|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
mysql_num_rows(): supplied argument is not a valid MySQL result resource
Im trying to get several pieces of data from several different tables and print it out into one nice table to be displayed for the user and i get getting the above message.
The code is import_request_variables("gp","tt_"); $connection = mysql_connect($host,$user,$password) or die ("couldn't connect to server"); $db = mysql_select_db($database,$connection) or die ("Couldn't select database"); $query = "SELECT ana_name, ana_familyname, shortsize_size, shirtsize_size, kit_year FROM ana_tbl, shortsize_tbl, shirtsize_tbl, kit_tbl WHERE ana_name = '$tt_ana_name'"; $result = mysql_query($query) or die ("Could Not execute Query"); /* Display results in a table */ echo "<h1>Kit Details</h1>"; echo "<table cellspacing='15'>"; echo "<tr><td colspan='10'><hr></td></tr>"; $row = mysql_fetch_array($result); $num = mysql_num_rows($row); { $i = "0"; while ($i < $num); extract($row); echo "<tr>\n <td>$tt_ana_name</td>\n <td>$tt_ana_familyname</td>\n <td shortsize_size</td>\n <td shirtsize_size</td>\n <td kit_year</td>\n </tr>\n"; echo "<tr><td colspan='5'><hr></td></tr>\n"; ++$i; } echo "</table>\n"; ?> </body> </html> If anyone could help it would be much appreciated |
|
#2
|
||||
|
||||
|
Try this:
$row = mysql_fetch_array($result); $num = mysql_num_rows($result); mysql_num_rows() expects the result set, not an array... Refer to the PHP Manual: http://www.php.net/manual/en/functi...ql-num-rows.php |
|
#3
|
|||
|
|||
|
Have tried that and its not throwing an error message any more but it is now timing out.
Am i going from with the while loop? |
|
#4
|
||||
|
||||
|
wait, what while loop?
you seem to have missed an important line... I see curly braces, but no loop... Oh wait, there's the while line... this style of loop won't work in PHP try this: PHP Code:
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > mysql_num_rows(): supplied argument is not a valid MySQL result resource |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|