Getting data from a database...
I am trying to get data back out out of a database in the following way....
$sql = "SELECT * FROM tablename WHERE id='$id'";
$result = mysql_query($sql);
$something = mysql_result($result,"field-name-i-want");
But for some reason it only ever returns the first field in the table as opposed to the "field-name-i-want"
The "printf" thing works fine, but I want it in a variable!!
Okay I have it... but just so that if anyone else finds themselves in the same position then here it is...
$myrow = mysql_fetch_array($result);
$something = mysql_result("thing-i-want");
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)