Dear PHP Helpers,

I have an array created by an mysql select statement.

I have the code to display the "rows" from the select

Everything works fine except that only n-1 rows from
the array will display.

For example if the array contains four rows only three
will display. If the array contains one row, nothing
displays on the screen.

I understand that a WHILE loop will count down to zero
and then since it becomes false will quit, but how do
I get the last (or first) row to print?

Here is the code:







$db = mysql_connect("localhost" , "phpuser" ,


// display individual record

if ($user_name) {

        $result = mysql_query("SELECT * FROM svt_members
WHERE user_name='$user_name'",$db);

        $myrow = mysql_fetch_array($result);
  while ($myrow = mysql_fetch_array($result)) {

        printf("Full Name: <b><font color=\"green\"
size=\"5\">%s %s %s %s\n<br></b></font>",
$myrow["salutation"], $myrow["first_name"],
$myrow["mid_name"], $myrow["user_name"]);

        printf("Credentials and Degrees: <b><font
color=\"blue\" size=\3\">%s</font></b>   Job Title:
<b><font color=\"blue\"
<b><font color=\"blue\"
size=\3\">%s<br></font></b>Address: <b><font
color=\"blue\" size=\3\">%s %s<br></font></b>City:
<b><font color=\"blue\" size=\3\">%s</font></b>  
State/Provence: <b><font color=\"blue\"
size=\3\">%s<br></font></b>Country: <b><font
color=\"blue\" size=\3\">%s</font></b>   Postal Code:
<b><font color=\"blue\"
size=\3\">%s<br></font></b>Voice: <b><font
color=\"blue\" size=\3\">%s</font></b>   Fax: <b><font
color=\"blue\" size=\3\">%s<br></font></b>E-mail:
<b><font color=\"blue\" size=\3\">%s\n<P></b></font>",
$myrow["cert_deg"], $myrow["job_title"],
$myrow["institution"], $myrow["address_1"],
$myrow["address_2"], $myrow["geo_loc"],
$myrow["state"], $myrow["country"], $myrow["zip"],
$myrow["phone"], $myrow["fax"], $myrow["e_mail"]);


<form method="post" action="<?php echo $PHP_SELF ?>">

Enter Last Name To Search:  <input type="Text"

<input type="Submit" name="submit" value="Click To




Thank you very much for your help.

Best regards,

Bob Stone

Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to