Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: PHP Error..Help

  1. #1
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Error..Help

    I get this error when trying to run a script any help?
    I understand this is mysql internal error, but it shows it on my *.php
    Code:
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/runelead/public_html/crospace/functions.php on line 42
    
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/runelead/public_html/crospace/functions.php on line 50
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/runelead/public_html/crospace/functions.php:42) in /home/runelead/public_html/crospace/index.php on line 73

  • #2
    Regular Coder
    Join Date
    Mar 2005
    Location
    Brighton, UK
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Its because the SQL query you sent isnt valid, and so $result isnt a valid result set. When you run mysql_num_rows its throwing this error because it cant count how many rows there are in an invalid result set.

    Whats the SQL query?
    Last edited by Jak-S; 02-19-2006 at 10:15 PM.

  • #3
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    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); 
    then
    PHP Code:
        $sql="select * from banners where b_blk='N' and b_typ='H' and b_exp='N'";
        
    $res=mysql_query($sql);
        
    $dis=array();
        
    $dis_id=array();
        
    $num=mysql_num_rows($res);
        if(
    mysql_num_rows($res))    { 

  • #4
    Regular Coder
    Join Date
    Mar 2005
    Location
    Brighton, UK
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, i dont see anything wrong with the syntax, stick this line ater the lines with mysql_query(...) on, it will output the error that mysql sends back, should tell you whats wrong with the query:

    PHP Code:
    echo mysql_error(); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •