Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Need simple line of Php / Mysql code

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

Alex.

Account Closed
Impact
5
[resolved] Need simple line of php / mysql code

hi,
i have litterally started learning php today, and im trying to compile a simple script.

i nèed a line of php code that returns the no. of rows in a table.

if i get this before 7:30pm (40 mins @ time of writing) i will donate the author 10np.

i know thats not a lot, but im not asking much.
 
Last edited:
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
From php website
http://us3.php.net/mysql_num_rows

Code:
<?php

$link = mysql_connect("localhost", "mysql_user", "mysql_password");
mysql_select_db("database", $link);

$result = mysql_query("SELECT * FROM table1", $link);
$num_rows = mysql_num_rows($result);

echo "$num_rows Rows\n";

?>
 
0
Close
Here you go sir.

PHP:
// You should have the following line.. 
$result = mysql_query($sql);

// This is the line you want to get the rows:
$rows = mysql_num_rows($result);

$rows will store how many rows the query has. Hence the rows stored in $result

Regards,
Richard.
 
0
Close
thanks.
thats all i need
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

A browser tab with a favicon next to the page title
Search members
You can now search for members by name, company, location and more. Open the search at the top of any page and choose Members. You will...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back