Re: mysql_num_rows()
| From: | Andre Polykanine | Date: | Tue, 22 Feb 2011 12:24:25 +0000 |
| Subject: | Re: mysql_num_rows() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-311510@lists.php.net to get a copy of this message | ||
Hello Gary,
Please wrap $i in braces in your variable variable:
if ( isset($_POST["county{$i}"] ) ) {
echo "You have chosen ". $_POST["county{$i}"]." <br/>";
--
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion
------------ Original message ------------
From: Gary <gpaul@paulgdesigns.com>
To: php-general@lists.php.net
Date created: , 7:40:48 AM
Subject: [PHP] mysql_num_rows()
Can someone tell me why this is not working? I do not get an error message,
the results are called and echo'd to screen, the count does not work, I get
a 0 for a result...
$result = mysql_query("SELECT * FROM
counties WHERE name =
'checked'") or
die(mysql_error());
if ( isset($_POST['submit']) ) {
for($i=1; $i<=$_POST['counties']; $i++) {
if ( isset($_POST["county$i"] ) ) {
echo "You have chosen ". $_POST["county$i"]." <br/>";
}
}
}
$county_total=mysql_num_rows($result);
while($row = mysql_fetch_array($result))
{$i++;
echo $row['name'];
}
$county_total=mysql_num_rows($result);
echo "$county_total";
echo 'You Have ' . "$county_total" . ' Counties ';
?>
--
Gary
__________ Information from ESET Smart Security, version of virus signature database 5894 (20110221)
__________
The message was checked by ESET Smart Security.
http://www.eset.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php