Hey everyone, I'm currently learning php and MySQL from "Sams Teach Yourself PHP, Apache and MySQL in 24 hours". Now that's all well and good, but what I need some info on is converting data from a database table into a variable in PHP. Here's the example the book gives:
while ($newArray = mysql_fetch_array($result))
{
$id = $newArray['id'];
$testField = $newArray['testfield'];
echo "The ID is $id and the text is $testField<br>";
}
(the database table has two columns, id and testfield)
So this is great for turning table data into an array and displaying all the contents at once, but what if I wanna take ONE value of the testfield, say when the id = 3. How do I turn these individual little peices of data into their own variables, without making an array.
I made some guesses ( doesn't work too well with programming ), such as $id3 = $result['id=3'], but obviously that didn't work. Some help please?