FarhanKhalaf Posted May 19, 2009 Share Posted May 19, 2009 Surprisingly I'm getting an error that I wasn't getting before, and I'm not sure what changed... I am getting : Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/retai13/public_html/secret/Nordstrom.php on line 90 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/retai13/public_html/secret/Nordstrom.php on line 92 referring to $shoppercount <?php $shopperid = mysql_query("SELECT UserID FROM users WHERE Username = '$username'"); $getshopperid = mysql_fetch_array($shopperid); $getshopperid = $getshopperid['UserID']; $shoppercount = mysql_query("SELECT * FROM nordstromlisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM saksfifthavenuelisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM gnclisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM guesslisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM urbanoutfitterslisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM americaneaglelisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM footlockerlisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM bananarepubliclisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM neimanmarcuslisting WHERE ShopperID = '$getshopperid'"); $test123 = mysql_num_rows($shoppercount); if (mysql_num_rows($shoppercount) > 2) { echo "You are currently at the maximum (3) amount of listings you can create in a five day span."; } else { Quote Link to comment https://forums.phpfreaks.com/topic/158702-invalid-arguements/ Share on other sites More sharing options...
Masna Posted May 19, 2009 Share Posted May 19, 2009 Try... <?php $shopperid = mysql_query("SELECT UserID FROM users WHERE Username = '$username'"); $getshopperid = mysql_fetch_array($shopperid); $getshopperid = $getshopperid['UserID']; $shoppercount = mysql_query("SELECT * FROM nordstromlisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM saksfifthavenuelisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM gnclisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM guesslisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM urbanoutfitterslisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM americaneaglelisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM footlockerlisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM bananarepubliclisting WHERE ShopperID = '$getshopperid' UNION ALL SELECT * FROM neimanmarcuslisting WHERE ShopperID = '$getshopperid'") or die(mysql_error()); $test123 = mysql_num_rows($shoppercount); if (mysql_num_rows($shoppercount) > 2) { echo "You are currently at the maximum (3) amount of listings you can create in a five day span."; } else { ...and post back here what error is printed. Quote Link to comment https://forums.phpfreaks.com/topic/158702-invalid-arguements/#findComment-836971 Share on other sites More sharing options...
FarhanKhalaf Posted May 19, 2009 Author Share Posted May 19, 2009 Columns are not matching (fixed it). If I want to achieve the UNION ALL feature with tables that have different columns, what can I use? Quote Link to comment https://forums.phpfreaks.com/topic/158702-invalid-arguements/#findComment-836974 Share on other sites More sharing options...
Daniel0 Posted May 19, 2009 Share Posted May 19, 2009 Well, you obviously cannot do that. From the looks of your query it looks like your schema could do with some normalization though. http://en.wikipedia.org/wiki/Database_normalization Quote Link to comment https://forums.phpfreaks.com/topic/158702-invalid-arguements/#findComment-836982 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.