Xiphoid8 Posted November 19, 2003 Share Posted November 19, 2003 I\'m trying to include two databases (one that contains member info and another that holds file info) in my index.php to show the last five members to register and the most recently uploaded files. I have each of my database connection strings in separate files and I\'ve included them in the file I\'m working on. I\'m receiving the following error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource I thought at first it was because I had the same variable names in my database connection files, so I changed those and I\'m still this error. Here\'s more of my code if that helps: $result = mysql_query("SELECT * FROM users ORDER BY user_date_registered DESC LIMIT 0, 5"); if (mysql_num_rows($result)) { print "<table>"; print "<tr><td colspan=2><h4>Newest Members</h4></td></tr>"; while ($qry = mysql_fetch_array($result)) { print "<tr><td>$qry[user_id]</td><td>$qry[user_name]</td>"; print "</tr>"; } print "</table>"; } $result2 = mysql_query("SELECT * FROM games ORDER BY game_date_uploaded DESC LIMIT 0, 5"); if (mysql_num_rows($result2)) { print "<BR><BR><CENTER><table border=1 cellspacing=0 bordercolor=#000000 bgcolor=#323741>n</CENTER>"; print "<tr><td colspan=2><h4>Newest Games</h4></td></tr>"; while ($qry2 = mysql_fetch_array($result2)) { print "<tr><td>$qry2[game_id]</td><td>$qry2[game_name]</td>"; print "</tr>"; } print "</table>"; } Thanks in advance for any help. Hopefully there is a way to do this. Link to comment https://forums.phpfreaks.com/topic/1396-including-two-databases-in-one-file-conflicts/ Share on other sites More sharing options...
triphis Posted November 20, 2003 Share Posted November 20, 2003 Hmm, have you tried having the mysql_num_rows outside the \"if\" statement? $check1 = mysql_num_rows($result2); if($check1){ you get the picture } Link to comment https://forums.phpfreaks.com/topic/1396-including-two-databases-in-one-file-conflicts/#findComment-4642 Share on other sites More sharing options...
PHPcadet Posted November 20, 2003 Share Posted November 20, 2003 I thought mysql_num_rows returns a number. Shouldn\'t the if statement be like this?: [php:1:ef30ccf0ab]<?php $check1 = mysql_num_rows($result2); if($check1 == 0){ } ?>[/php:1:ef30ccf0ab] Link to comment https://forums.phpfreaks.com/topic/1396-including-two-databases-in-one-file-conflicts/#findComment-4647 Share on other sites More sharing options...
Xiphoid8 Posted November 20, 2003 Author Share Posted November 20, 2003 Thanks for the replies. I tried both of those methods, but I still receive the error. Link to comment https://forums.phpfreaks.com/topic/1396-including-two-databases-in-one-file-conflicts/#findComment-4655 Share on other sites More sharing options...
Xiphoid8 Posted November 20, 2003 Author Share Posted November 20, 2003 For reference for anyone who searches this thread... here\'s how I fixed it: $result2 = mysql_query("SELECT * FROM files.games ORDER BY game_date_uploaded DESC LIMIT 0, 5"); All I had to do was specify the database and table, where as before I was just naming the table. Link to comment https://forums.phpfreaks.com/topic/1396-including-two-databases-in-one-file-conflicts/#findComment-4659 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.