[PHP-DB] Re: [PHP] Re: [PHP-DB] Easy MySQL question
At 10:10 AM -0500 1/12/01, Leonard T. Harris wrote: >What's wrong with > >$number=mysql_num_rows($result); >echo "The total number of rows is $number"; Primarily that mysql_num_rows() tells you how many rows are in the result set, which for the query in question, is 1. The *content* of that row is how many rows are in the table. > > >- Original Message - >From: Julie Meloni <[EMAIL PROTECTED]> >To: Paulson, Joseph V. "Jay" <[EMAIL PROTECTED]> >Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> >Sent: Thursday, January 11, 2001 11:17 AM >Subject: [PHP] Re: [PHP-DB] Easy MySQL question > > >> Paulson, Joseph V. \"Jay\" wrote: >> >> > Hello everyone-- >> > I've got a easy question that I can't seem to answer for myself. I'm >> > running a query in MySQL and want to know how many entries are in a >table >> > and then echo that out onto a page. I thought this would be easy but I >> > don't know why it's not working. Anyway, here's what I am doing: >> > >> > (open db connection) >> > >> > $query = "SELECT count(*) FROM Movie"; >> > $result = mysql_query($sql, $dbLink); >> > $myrow = mysql_result($result); >> > echo $myrow; >> > >> > > $myrow = mysql_result($result,0,"count(*)"); -- Paul DuBois, [EMAIL PROTECTED] -- 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]
[PHP-DB] Re: [PHP] Re: [PHP-DB] Easy MySQL question
What's wrong with $number=mysql_num_rows($result); echo "The total number of rows is $number"; - Original Message - From: Julie Meloni <[EMAIL PROTECTED]> To: Paulson, Joseph V. "Jay" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, January 11, 2001 11:17 AM Subject: [PHP] Re: [PHP-DB] Easy MySQL question > Paulson, Joseph V. \"Jay\" wrote: > > > Hello everyone-- > > I've got a easy question that I can't seem to answer for myself. I'm > > running a query in MySQL and want to know how many entries are in a table > > and then echo that out onto a page. I thought this would be easy but I > > don't know why it's not working. Anyway, here's what I am doing: > > > > (open db connection) > > > > $query = "SELECT count(*) FROM Movie"; > > $result = mysql_query($sql, $dbLink); > > $myrow = mysql_result($result); > > echo $myrow; > > > > $myrow = mysql_result($result,0,"count(*)"); > > > > -- > ++ > | Julie Meloni ([EMAIL PROTECTED]) | > | Tech. Director, i2i Interactive (www.i2ii.com) | > || > | "PHP Essentials" & "PHP Fast & Easy" | > |http://www.thickbook.com/ | > ++ > > > -- > PHP General 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] > > -- 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]
Re: [PHP-DB] Easy MySQL question
Julie Meloni wrote: > simon wrote: > > > Julie Meloni wrote: > > > > > >> Paulson, Joseph V. \"Jay\" wrote: > >> > >> > >>> Hello everyone-- > >>> I've got a easy question that I can't seem to answer for myself. I'm > >>> running a query in MySQL and want to know how many entries are in a table > >>> and then echo that out onto a page. I thought this would be easy but I > >>> don't know why it's not working. Anyway, here's what I am doing: > >>> > >>> (open db connection) > >>> > >>> $query = "SELECT count(*) FROM Movie"; > >>> $result = mysql_query($sql, $dbLink); > >>> $myrow = mysql_result($result); > >>> echo $myrow; > >>> > >> > >> $myrow = mysql_result($result,0,"count(*)"); > >> > > > > > > Shouldn't this be $query also? > > > > $query = "SELECT count(*) FROM Movie"; > > $result = mysql_query($sql, $dbLink); > > $myrow = mysql_result($result); > > echo $myrow; > > > > Yes; I wasn't paying attention to that, just the use of the > mysql_result() function. > > -- > ++ > | Julie Meloni ([EMAIL PROTECTED]) | > | Tech. Director, i2i Interactive (www.i2ii.com) | > || > | "PHP Essentials" & "PHP Fast & Easy" | > | http://www.thickbook.com/ | > ++ > > -- > 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] Sorry, I didn't see that I was replying to your reply. I thought you were the original sender. Perhaps you could help me with my Q above??? I'm pulling my hair out here! -- Simon Pospisil Mail: [EMAIL PROTECTED] Web EngineerWeb: http://www.fastsearch.com/ Fast Web Media Ltd. Phone: +44 (0) 161 835 3444 Suite 1202, Sunlight House Quay Street Fax: +44 (0) 161 835 3488 Manchester, England M3 3JZ Try FAST Search: http://www.alltheweb.com
Re: [PHP-DB] Easy MySQL question
simon wrote: > Julie Meloni wrote: > > >> Paulson, Joseph V. \"Jay\" wrote: >> >> >>> Hello everyone-- >>> I've got a easy question that I can't seem to answer for myself. I'm >>> running a query in MySQL and want to know how many entries are in a table >>> and then echo that out onto a page. I thought this would be easy but I >>> don't know why it's not working. Anyway, here's what I am doing: >>> >>> (open db connection) >>> >>> $query = "SELECT count(*) FROM Movie"; >>> $result = mysql_query($sql, $dbLink); >>> $myrow = mysql_result($result); >>> echo $myrow; >>> >> >> $myrow = mysql_result($result,0,"count(*)"); >> > > > Shouldn't this be $query also? > > $query = "SELECT count(*) FROM Movie"; > $result = mysql_query($sql, $dbLink); > $myrow = mysql_result($result); > echo $myrow; > Yes; I wasn't paying attention to that, just the use of the mysql_result() function. -- ++ | Julie Meloni ([EMAIL PROTECTED]) | | Tech. Director, i2i Interactive (www.i2ii.com) | || | "PHP Essentials" & "PHP Fast & Easy" | |http://www.thickbook.com/ | ++ -- 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]
Re: [PHP-DB] Easy MySQL question
Julie Meloni wrote: > Paulson, Joseph V. \"Jay\" wrote: > > > Hello everyone-- > > I've got a easy question that I can't seem to answer for myself. I'm > > running a query in MySQL and want to know how many entries are in a table > > and then echo that out onto a page. I thought this would be easy but I > > don't know why it's not working. Anyway, here's what I am doing: > > > > (open db connection) > > > > $query = "SELECT count(*) FROM Movie"; > > $result = mysql_query($sql, $dbLink); > > $myrow = mysql_result($result); > > echo $myrow; > > > > $myrow = mysql_result($result,0,"count(*)"); > > -- > ++ > | Julie Meloni ([EMAIL PROTECTED]) | > | Tech. Director, i2i Interactive (www.i2ii.com) | > || > | "PHP Essentials" & "PHP Fast & Easy" | > | http://www.thickbook.com/ | > ++ > > -- > 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] Shouldn't this be $query also? $query = "SELECT count(*) FROM Movie"; $result = mysql_query($sql, $dbLink); $myrow = mysql_result($result); echo $myrow; -- Simon Pospisil Mail: [EMAIL PROTECTED] Web EngineerWeb: http://www.fastsearch.com/ Fast Web Media Ltd. Phone: +44 (0) 161 835 3444 Suite 1202, Sunlight House Quay Street Fax: +44 (0) 161 835 3488 Manchester, England M3 3JZ Try FAST Search: http://www.alltheweb.com
Re: [PHP-DB] Easy MySQL question
Paulson, Joseph V. \"Jay\" wrote: > Hello everyone-- > I've got a easy question that I can't seem to answer for myself. I'm > running a query in MySQL and want to know how many entries are in a table > and then echo that out onto a page. I thought this would be easy but I > don't know why it's not working. Anyway, here's what I am doing: > > (open db connection) > > $query = "SELECT count(*) FROM Movie"; > $result = mysql_query($sql, $dbLink); > $myrow = mysql_result($result); > echo $myrow; > $myrow = mysql_result($result,0,"count(*)"); -- ++ | Julie Meloni ([EMAIL PROTECTED]) | | Tech. Director, i2i Interactive (www.i2ii.com) | || | "PHP Essentials" & "PHP Fast & Easy" | |http://www.thickbook.com/ | ++ -- 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]
[PHP-DB] Easy MySQL question
Hello everyone-- I've got a easy question that I can't seem to answer for myself. I'm running a query in MySQL and want to know how many entries are in a table and then echo that out onto a page. I thought this would be easy but I don't know why it's not working. Anyway, here's what I am doing: (open db connection) $query = "SELECT count(*) FROM Movie"; $result = mysql_query($sql, $dbLink); $myrow = mysql_result($result); echo $myrow; (close db connection) I know this is wrong but I don't know how to get the results to echo out to the page. Thanks, Jay -- 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]