- To: php-general@lists.php.net, php-db@lists.php.net
- Subject: 'while' not picking up on first DB record
- From: Roger Spears <roger@bgnet.bgsu.edu>
- Date: Wed, 17 Sep 2003 10:17:24 -0400
- Delivered-to: mailing list php-db@lists.php.net
- Delivered-to: ezmlm-scan-php-db@lists.php.net
- Delivered-to: ezmlm-php-db@lists.php.net
- User-agent: Mozilla/5.0 (Macintosh; U; PPC; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01
Hello,
Can anyone from the lists please tell me why this bit of code is not
picking up on the first record in the database? If the 'id' I'm looking
for is '1' it doesn't populate the _SESSION variables. Any 'id' greater
then '1' will populate the _SESSION variables.
$q = "SELECT * FROM employee";
$r = mysql_query($q);
$row = mysql_fetch_array($r);
while ($row = mysql_fetch_array($r))
{
if ($employee == $row["id"])
{
$_SESSION['dear'] = $row["last_name"];
$_SESSION['to_email'] = $row["email"];
}
}
Thanks,
Roger
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[PHP Home]
[PHP Users]
[Postgresql Discussion]
[Kernel Newbies]
[Plagiarism Notes]
[Postgresql]
[Yosemite News]