RE: [PHP] Is this code right?
| From: | Jeremy Davis | Date: | Mon, 19 Jan 2004 17:40:44 +0000 |
| Subject: | RE: [PHP] Is this code right? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-175054@lists.php.net to get a copy of this message | ||
<snip>
>$query = "SELECT Serial, Password from accounts where
UserName='$UserName'";
>$result = mysql_query($query) or die("Query errort: " . mysql_error());
>$row = mysql_fetch_row($result) or die("User Not found: " . mysql_error());
mysql_fetch_row only pulls data one cell at a time so you would need to call
$row[0] twice to get the two cells before calling the next row.
>$Serial = htmlspecialchars($row[0]);
>
>
mysql_select_db is for selecting the database and NOT the table, the
SELECT statement must be something like this: "select SOMETHING from
TABLE where WHERE_CLAUSE"