davidknag Posted January 22, 2011 Share Posted January 22, 2011 i get Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\AtomicPool\s.php on line 93 Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\AtomicPool\s.php on line 95 when i use this code: <?php $dbhost = 'xxxx'; $dbname = 'xxxx'; $dbuser = 'xxx'; $dbpass = 'xxxxxx'; $connect = mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); if (isset($_GET['cat'])){ $cat = $_GET['cat']; $get_cat = mysql_query("SELECT * FROM categories WHERE Short Name = '$cat'"); $get_cat_rows = mysql_num_rows($get_cat); --This is Row 93 if ($get_cat_rows=1){ while ($fetch = mysql_fetch_assoc($get_cat)){ --This is Row 95 $categoryyyy = $fetch['Name']; $categ = "".$categoryyyy." Games"; } } } else echo "Looks like someone has been playing with the URL bar..."; ?> Quote Link to comment https://forums.phpfreaks.com/topic/225349-error-with-mysql-integration/ Share on other sites More sharing options...
Maq Posted January 22, 2011 Share Posted January 22, 2011 Your query is most likely failing, please change this line to: $get_cat = mysql_query("SELECT * FROM categories WHERE Short Name = '$cat'") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/225349-error-with-mysql-integration/#findComment-1163755 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.