Dynadot โ€” .com Transfer

Number Of Rows In MySQL

Spaceship Spaceship
Watch

buddybuddha

Established Member
Impact
2
Alright, I have no experience with MySQL, but if someone could guide me with tis one thing I need te do, that would be sweet.

I have a database named buddybud_nugget with a user of the same name. Inside, there is a table plog_blogs with a given number of rows. How can I use PHP to determine the number of rows in the table and then use that number as a a variable?

15 NP$ to whoever can tell me to my satisfaction.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
PHP:
<?php
//Do all connect stuff up here

//Do sqlquery and get variable num
$sqlquery = mysql_query("SELECT * FROM blah");
$num = mysql_num_rows($sqlquery);

print "There is $num rows in blah";
?>

There yah go
 
0
•••
But what code do I need to use for the connections. Ive barely even seen code for a mysql query.
 
0
•••
Here
PHP:
<?php
/* Set mysql variables */
$db_host = "localhost"; //Leave localhost
$db_user = "inod"; //DB username
$db_name = "inod"; //DB Name
$db_pass = "pass"; //DB User password

$connect = mysql_connect("$db_host","$db_user","$db_pass") or die(mysql_error());
$select_db = mysql_select_db("$db_name");

//Do sqlquery and get variable num
$sqlquery = mysql_query("SELECT * FROM field_name");
$num = mysql_num_rows($sqlquery);

print "There is $num rows in blah"; 

?>

There..
 
0
•••
15 NP$ your way!
 
0
•••
Received.. Thanks dude.. If you need any more help just pm me.. I would love to give you any kind of assistance you may need.

iNod
 
0
•••
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
Appraise.net
Domain Recover
DomainEasy โ€” Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back