Re: mysql_num_rows()
| From: | Gary | Date: | Tue, 22 Feb 2011 13:28:06 +0000 |
| Subject: | Re: mysql_num_rows() | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-311514@lists.php.net to get a copy of this message | ||
Thanks for your reply
"Deva" <devendra.in@gmail.com> wrote in message
news:AANLkTimvyCQsi5nejD1LXxAqBQsB+q_oNhOC7OmGJ3Dz@mail.gmail.com...
>I tried your script locally. Its working for me.
>
> On Tue, Feb 22, 2011 at 11:10 AM, Gary <gpaul@paulgdesigns.com> wrote:
>
>> 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
Thanks for your reply.
I'm curious, how did you try it locally without a database?
I am still getting either a 0 or a 1 for a result.
Gary
__________ Information from ESET Smart Security, version of virus signature database 5895 (20110222)
__________
The message was checked by ESET Smart Security.
http://www.eset.com