Dear PHP Helpers,

I have an array created by an mysql select statement.

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

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:

<HTML>

<HEAD>

<TITLE></TITLE>

</HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF"
VLINK="#800080">

<?php

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

mysql_select_db("SVT",$db);

// 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\"
size=\3\">%s</font></b><br>Company/Institution:
<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"
name="user_name"><p>

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

</form>

</BODY>

</HTML>

Thank you very much for your help.

Best regards,

Bob Stone

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/?.refer=text

-- 
PHP Database Mailing List (http://www.php.net/)
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