Fix this error Please :(

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Fix this error Please :(

    Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/damm/public_html/cost.php on line 9

    Code:
    <?php
    $con = mysql_connect("localhost","username","password");
    if (!$con)
    {
     die('error');
    }
    $sql = mysql_query("SELECT SUM(`at`) FROM `User`");
    $r = mysql_fetch_array($sql);
    $total=$r[0];
    echo $total;
    ?>
    please guys do something

    #2
    Originally posted by RDXZ View Post
    Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/damm/public_html/cost.php on line 9

    Code:
    <?php
    $con = mysql_connect("localhost","username","password");
    if (!$con)
    {
     die('error');
    }
    $sql = mysql_query("SELECT SUM(`at`) FROM `User`");
    $r = mysql_fetch_array($sql);
    $total=$r[0];
    echo $total;
    ?>
    please guys do something
    are you trying to prove yourself a noob? :D
    put ds b4 the the sql query

    PHP Code:
    mysql_select_db("DATABASE_NAME"); 
    btw, the php errors lets you know where to correct,
    Warning:
    PHP Code:
    mysql_fetch_array() 
    expects parameter 1 to be resource, boolean given in
    Means $sql is returing
    PHP Code:
    FALSE 
    Last edited by softwarefreak; 11.07.12, 12:04.
    I need some facebook likes, can you please help me
    http://facebook.com/softwarefreakin
    I noticed social media is really powerful
    Well DONE is better than well SAID

    Comment

    Working...
    X