NodeDad
NodeDad

Reputation: 1537

pull specific table row column data to output in html using php

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.

Upvotes: 0

Views: 1024

Answers (1)

Kristian
Kristian

Reputation: 21830

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.

Upvotes: 1

Related Questions