Jump to content

[SOLVED] MYSQL num_row error


darkfreaks

Recommended Posts

ii get error: mysql_num_rows not valid on line so n so:

 

<?php 

$getCatStores = mysql_query("SELECT DISTINCT a.ownerid, u.store_name FROM probid_users u, probid_auctions a WHERE 

	".$subcatquery."

	a.listin!='auction' AND a.active='1' AND a.closed='0' AND a.deleted!='1' AND a.ownerid=u.id AND 

	u.active='1' AND u.store_active='1' AND u.aboutpage_type='2'");



	$isCatStores = mysql_num_rows($getCatStores);



	if ($isSubcats>0 || $isCatStores>0) {?>

Link to comment
Share on other sites

There is a problem with your query then, try catching the error:

 

<?php

$getCatStores = mysql_query("SELECT DISTINCT a.ownerid, u.store_name FROM probid_users u, probid_auctions a WHERE ".$subcatquery." a.listin!='auction' AND a.active='1' AND a.closed='0' AND a.deleted!='1' AND a.ownerid=u.id AND u.active='1' AND u.store_active='1' AND u.aboutpage_type='2'")or die(mysql_error());

?>

Link to comment
Share on other sites

<?php

$subcatquery="a.category IN (".$all_subcats.") OR a.addlcategory IN (".$all_subcats.") AND ";

$getCatStores = mysql_query("SELECT DISTINCT a.ownerid, u.store_name FROM probid_users u, probid_auctions a WHERE ".$subcatquery." a.listin!='auction' AND a.active='1' AND a.closed='0' AND a.deleted!='1' AND a.ownerid=u.id AND u.active='1' AND u.store_active='1' AND u.aboutpage_type='2'")or die(mysql_error());

?>

 

 

 

 

Link to comment
Share on other sites

i told you to echo your query for us to see it as a whole

 

but your query should look like this

 

SELECT DISTINCT a.ownerid, u.store_name FROM probid_users u, probid_auctions a 
	WHERE ".$subcatquery."     <--- should look like  where a.category IN ('1','2',etc) OR a.addlcategory IN ('test','test',etc) AND
       a.listin!='auction'
    AND a.active='1' 
	AND a.closed='0' 
	AND a.deleted!='1' 
	AND a.ownerid=u.id 
	AND  u.active='1' 
	AND u.store_active='1' 
	AND u.aboutpage_type='2'");

Link to comment
Share on other sites

<?php

if ($catname!="") {

while (list($cat_array_id, $cat_array_details)=each($cat_array)) {

	list($cat_array_name, $userid) = $cat_array_details;

	$strResult = strpos($cat_array_name,$catname);

	if (trim($strResult)=="0") $cat_id[$catcnt++] = $cat_array_id;
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.