Re: mysql_num_rows()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Daniel Molina Wegener" <dmw@xxxxxxxx> wrote in message 
news:201102220747.11805@xxxxxxxxxxx
> On Tuesday 22 February 2011,
> "Gary" <gpaul@xxxxxxxxxxxxxxxx> 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...
>
>  Are you sure that the table is called `counties` and not `countries`?
>
>  :)
>
>>
>>
>>
>> $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 ';
>>
>> ?>
>
> Best regards,
> -- 
> Daniel Molina Wegener <dmw [at] coder [dot] cl>
> System Programmer & Web Developer
> Phone: +56 (2) 979-0277 | Blog: http://coder.cl/


Daniel

Thank you for your reply, yes the database is named counties, working and 
returning results.

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





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux