Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

num_rows error

Status
Not open for further replies.

ja01

Technical User
Dec 14, 2005
48
US
I submit the following code in php. I get an error message for $num = mysql_num_rows($result);
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

<?php

//connect to server and select database
$conn = mysql_connect("localhost", "test1_admin", "admin") or die(mysql_error());
mysql_select_db("test1_database1",$conn) or die(mysql_error());

$display_block = "<h1><p>test Nu Pledge Lines</p></h1>
<p><h2>Updated July 31, 2006</h2></p>";


$query = "SELECT * from lines ORDER BY 'Year'";
$result=mysql_query($query);

$num = mysql_num_rows($result);

 
you should have copied and pasted from my last post. the singlequotes should be backticks.

backtick: `
singlequote: '

big difference for a small angle

Code:
 $query = "SELECT * from lines ORDER BY `Year`";
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top