MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 31st, 2004, 09:25 PM
yong1986 yong1986 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 2 yong1986 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy mysql_num_rows(): supplied argument is not a valid

hi, i'm getting problem on this:
i get this message when trying to access to the page:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/buayacafe.freelinuxhost.com/friends/functions.php on line 17

Warning: Cannot modify header information - headers already sent by (output started at /home/www/buayacafe.freelinuxhost.com/friends/functions.php:17) in /home/www/buayacafe.freelinuxhost.com/friends/index.php on line 51

this is the first few lines of the function.php
PHP Code:
<?
$conn_id
;
$sql_res;
$sql_res2;
$sql_query
function 
sql_connect(){
global 
$conn_id,$sql_host,$sql_user,$sql_pass,$sql_db;
$conn_id=mysql_connect($sql_host,$sql_user,$sql_pa  ss);
mysql_select_db($sql_db);
}
function 
sql_execute($sql_query,$wtr){
global 
$conn_id;
$sql_res=mysql_query($sql_query,$conn_id);
if(
$wtr=='get'){
if(
mysql_num_rows($sql_res)){
return 
mysql_fetch_object($sql_res);
}
else {
return 
'';
}
}
elseif(
$wtr=='num'){
return 
mysql_num_rows($sql_res);
}
elseif(
$wtr=='res'){
return 
$sql_res;
}
}
function 
sql_rows($id,$table){
global 
$conn_id;
$query="select $id from $table";
$result=mysql_query($query,$conn_id);
$number=mysql_num_rows($result);
return 
$number;
}
function 
sql_close(){
global 
$conn_id;
mysql_close($conn_id);
}

Can anyone figure out what's the problem? thanks.

Reply With Quote
  #2  
Old August 1st, 2004, 10:21 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
Generally this is the result of your query not exectuting properly.
Make sure $sql_query is set. Perhaps add an or die(mysql_error()) to your mysql_query line.

Reply With Quote
  #3  
Old August 2nd, 2004, 04:29 AM
yong1986 yong1986 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 2 yong1986 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yeah, thanks, it's solved now.
thanks a lot.

Reply With Quote
  #4  
Old September 19th, 2005, 12:03 PM
J3F J3F is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 17 J3F User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 20 m 46 sec
Reputation Power: 0
same issue

Any chance i could scope out your coding for function.php?

Last edited by J3F : September 19th, 2005 at 12:03 PM. Reason: I hate spelling errors

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > mysql_num_rows(): supplied argument is not a valid


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway