crEA-tEch
04-22-2004, 05:14 PM
I have a query and im getting errors with it...
$query="SELECT b.*, c.* FROM tod_company_information c INNER JOIN tod_bookings_archive b ON c.company_id = b.company_id $filter_string WHERE b.date_fitted < DATE_SUB(now(),INTERVAL 1 YEAR)ORDER BY b.date_in ASC";
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/eeeepcom/public_html/tt/main.php on line 23
any ideas :S
Thanks in advance
crE
Rahde
04-22-2004, 05:22 PM
what's $filter_string?
you might want to do a echo mysql_error();
it'll help you pinpoint the problem
crEA-tEch
04-22-2004, 05:33 PM
I have echoed it but it just echos exactly what it says there..
i got rid of the filter string - it was something that was tehre when i cut it from some of my old coding..
still doesnt work :S
crE
Rahde
04-22-2004, 08:20 PM
this might seem a bit silly but
1) did you make a connection to the db?
2) did you do a mysql_query() or just made the query string?
stephenvs
04-23-2004, 12:12 AM
sample1
$textsql="SELECT * FROM news_details,news_mast WHERE news_mast.item_no = news_details.item_no AND news_details.row_no ='$rwn'";
sample2
SELECT DISTINCT SUBGROUP,ITEM_NO FROM news_mast where NGROUP='".$SubCateSearch."'";
$resultmain=mysql_query($textsql) or die("Invalid ".mysql_error());
$num_of_rows = mysql_num_rows($resultmain)or die ("Data not found from news details");
$row=mysql_fetch_row($resultmain);
This are the parameters
'".$SubCateSearch."'";
'$rwn'
just try...
Burhan
04-23-2004, 08:51 AM
You have to call mysql_query() and pass the result of that operating to mysql_num_rows(). You don't pass mysql_num_rows() a query.
$query = "SELECT * FROM mytable";
echo mysql_num_rows($query); //wrong, will produce your warning
echo mysql_num_rows(mysql_query($query)); //correct.
This is all assuming that there aren't any errors in your query itself.
crEA-tEch
04-24-2004, 02:25 PM
i never had a connection to the db :rolleyes:
sorted now!
Rahde
04-24-2004, 03:58 PM
Originally posted by crEA-tEch
i never had a connection to the db :rolleyes:
sorted now!
don't worry, happens to all of us :)