0

how do i pull data from my database table and put that data into a readonly textinput in a form for a user to see.

<input readonly type="text" name="em1" id="em1"/>

for this specific field i want to pull the data from a column called wmyt000 in the row of the currently logged in user using a $username variable with session that i created to get the current logged in users username in a table called cash_flow_plan

im using mysql and php

i havnt attempted to try anything yet. i was looking into mysql_fetch_array but that wants to display all of the users information for their row.

1
  • Try adding a WHERE clause to your query. Commented Aug 13, 2012 at 13:39

1 Answer 1

1

i havnt attempted to try anything yet.

ya. well, if you had, you'd know that you can do more with it than you think.

if you write a query limiting your results, then you're going to get what you want.

$query = "SELECT wmyt000 FROM cash_flow_plan WHERE username = '$username'"

$row = mysql_fetch_row($query);

print_r($row); // now you can see the structure of your array. access it accordingly.
Sign up to request clarification or add additional context in comments.

3 Comments

sometimes i can be a little afraid of php thank you for your answer
so wait, now how do i tell the readonly input field to give me that value?
updated my answer so you can see how to print the array out and see the exact structure of the result.... at this point, start googling, i just did. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.