mysql_fetch_array doesn't return all rows in a table.
I am completely new to MySQL and PHP so I hope I can explain what my problem is. A new site that I am working on has content that is fed from a database. Each webpage has to extract certain rows FROM the table WHERE the field in a column is a certain "county". I am working on the following script which does pretty much what it needs to except it doesn't display all the rows that are called. It seems to leave out at least one row. In phpMyAdmin all fields are set to NULL and type is set to TEXT. Someone in another forum said that the script was fetching one row and not doing anything with it then continuing to the while statement. Can someone confirm and better explain this. Thanks for having a look. Here is the script (not finished)...
<?php
$DBhost = "localhost";
$DBuser = "****";
$DBpass = "****";
$DBname = "homesubmit";
$table = "sellersinfo";
$caswell = "Caswell";
mysql_connect($DBhost, $DBuser, $DBpass) or die ("Unable to connect to database."
;
mysql_select_db("$DBname"
or die ("Unable to select database."
;
$ysql = "SELECT * FROM $table WHERE county = '$caswell'";
$yquery = mysql_query($ysql) or die ("Unable to query database."
;
$myresult = mysql_fetch_array($yquery);
while($myresult = mysql_fetch_array($yquery)) {
$myforsaleby = stripslashes ($myresult['forsaleby']);
$mycounty = stripslashes ($myresult['county']);
$mycity = stripslashes ($myresult['city']);
$mylotsize = stripslashes ($myresult['lotsize']);
$mysquarefeet = stripslashes ($myresult['squarefeet']);
$mybedrooms = stripslashes ($myresult['bedrooms']);
$mybaths = stripslashes ($myresult['baths']);
$myutilities = stripslashes ($myresult['utilities']);
$mycitytaxes = stripslashes ($myresult['citytaxes']);
$myprice = stripslashes ($myresult['price']);
$mycomments = stripslashes ($myresult['comments']);
echo "<td class=\"listingscontent\" colspan=\"2\" rowspan=\"1\"><a href=\"temp.html\"><img class=\"nobord\" src=\"myhome.jpg\" width=\"150\" height=\"100\" alt=\"home\">$myforsaleby, $mycounty, $mycity, $mylotsize, $mysquarefeet, $mybedrooms, $mybaths, $myutilities, $mycitytaxes, $myprice, $mycomments</a></td></tr>";
}
mysql_close();
?>
I am completely new to MySQL and PHP so I hope I can explain what my problem is. A new site that I am working on has content that is fed from a database. Each webpage has to extract certain rows FROM the table WHERE the field in a column is a certain "county". I am working on the following script which does pretty much what it needs to except it doesn't display all the rows that are called. It seems to leave out at least one row. In phpMyAdmin all fields are set to NULL and type is set to TEXT. Someone in another forum said that the script was fetching one row and not doing anything with it then continuing to the while statement. Can someone confirm and better explain this. Thanks for having a look. Here is the script (not finished)...
<?php
$DBhost = "localhost";
$DBuser = "****";
$DBpass = "****";
$DBname = "homesubmit";
$table = "sellersinfo";
$caswell = "Caswell";
mysql_connect($DBhost, $DBuser, $DBpass) or die ("Unable to connect to database."

mysql_select_db("$DBname"


$ysql = "SELECT * FROM $table WHERE county = '$caswell'";
$yquery = mysql_query($ysql) or die ("Unable to query database."

$myresult = mysql_fetch_array($yquery);
while($myresult = mysql_fetch_array($yquery)) {
$myforsaleby = stripslashes ($myresult['forsaleby']);
$mycounty = stripslashes ($myresult['county']);
$mycity = stripslashes ($myresult['city']);
$mylotsize = stripslashes ($myresult['lotsize']);
$mysquarefeet = stripslashes ($myresult['squarefeet']);
$mybedrooms = stripslashes ($myresult['bedrooms']);
$mybaths = stripslashes ($myresult['baths']);
$myutilities = stripslashes ($myresult['utilities']);
$mycitytaxes = stripslashes ($myresult['citytaxes']);
$myprice = stripslashes ($myresult['price']);
$mycomments = stripslashes ($myresult['comments']);
echo "<td class=\"listingscontent\" colspan=\"2\" rowspan=\"1\"><a href=\"temp.html\"><img class=\"nobord\" src=\"myhome.jpg\" width=\"150\" height=\"100\" alt=\"home\">$myforsaleby, $mycounty, $mycity, $mylotsize, $mysquarefeet, $mybedrooms, $mybaths, $myutilities, $mycitytaxes, $myprice, $mycomments</a></td></tr>";
}
mysql_close();
?>