Beginner Question
Posted: Tue Oct 21, 2003 9:24 am
This may be stupid but I've never had to do it. So now that I do need it, I cannot figure it out.
I need to query the database for a particular record with WHERE. Then I need to take the particular fields (stated in the query) and turn them into constants to be used elsewhere in the page below.
Here is my code so far:
Now, as you can see I can only echo the field results. But I need them to be constants. I tried doing the basic "$username = echo ($row["username"])" but it did not work.
Any ideas?
I need to query the database for a particular record with WHERE. Then I need to take the particular fields (stated in the query) and turn them into constants to be used elsewhere in the page below.
Here is my code so far:
Code: Select all
<?php
$result = mysql_query("SELECT first_name, last_name, email_address, username, decrypted_password, dl, birth FROM users WHERE dl='16638868' AND birth='10-28-1978' ") or die (mysql_error());
if (!$result) {
print mysql_error()." ERROR - browse query failed.";
exit();
}
while ( $row = mysql_fetch_array($result) )
{
echo ($rowї"username"]);
echo $rowї"first_name"];
}
?>Any ideas?