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 10 of 10
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    97
    Thanks
    10
    Thanked 0 Times in 0 Posts

    undefine function

    Im trying to do something with my profile.php and im getting

    Fatal error: Call to undefined function mysql_fech_assoc() in /home/youronli/public_html/profile.php on line 76
    basically, im trying to make a query that gets the id and then it checks the database to see if the active field is set to 1, and if it is it should display an online message if not should display an offline message

    here is my code
    PHP Code:

    <hr color='silver' width='100%'/>
    <?php

        $new 
    "SELECT * FROM `users` WHERE `id` = '".$_GET['id']."'";
        
    $new_res mysql_query($new) or die(mysql_error());
        
    $new_row mysql_fech_assoc($new_res);
        
        if(
    $new_row['active'] == 1) {
            echo 
    "<b> '".$new_row['name']."' is Scott is <font color=green>online.</font></b>";
        }
    ?>

  • #2
    New Coder
    Join Date
    Mar 2009
    Posts
    97
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Undefine function

    Im trying to do something with my profile.php and im getting

    Fatal error: Call to undefined function mysql_fech_assoc() in /home/youronli/public_html/profile.php on line 76
    basically, im trying to make a query that gets the id and then it checks the database to see if the active field is set to 1, and if it is it should display an online message if not should display an offline message

    here is my code

    PHP Code:
    <hr color='silver' width='100%'/>
    <?php

        $new 
    "SELECT * FROM `users` WHERE `id` = '".$_GET['id']."'";
        
    $new_res mysql_query($new) or die(mysql_error());
        
    $new_row mysql_fech_assoc($new_res);
        
        if(
    $new_row['active'] == 1) {
            echo 
    "<b> '".$new_row['name']."' is Scott is <font color=green>online.</font></b>";
        }
    ?>

  • #3
    New Coder
    Join Date
    Mar 2009
    Location
    Chicago, IL
    Posts
    69
    Thanks
    0
    Thanked 15 Times in 15 Posts
    It's mysql_fetch_assoc(), not mysql_fech_assoc().

  • Users who have thanked steelaz for this post:

    Kev0121 (03-22-2009)

  • #4
    New Coder
    Join Date
    Mar 2009
    Posts
    97
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Omg, how obvious. lmao thanks alot mate

  • #5
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,294
    Thanks
    4
    Thanked 203 Times in 200 Posts
    You missed the T in fetch

    PHP Code:
    $new_row mysql_fetch_assoc($new_res); 
    Dave .... HostMonster for all of your hosting needs

  • #6
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Kev0121 View Post
    Im trying to do something with my profile.php and im getting



    basically, im trying to make a query that gets the id and then it checks the database to see if the active field is set to 1, and if it is it should display an online message if not should display an offline message

    here is my code
    PHP Code:

    <hr color='silver' width='100%'/>
    <?php

        $new 
    "SELECT * FROM `users` WHERE `id` = '".$_GET['id']."'";
        
    $new_res mysql_query($new) or die(mysql_error());
        
    $new_row mysql_fech_assoc($new_res);
        
        if(
    $new_row['active'] == 1) {
            echo 
    "<b> '".$new_row['name']."' is Scott is <font color=green>online.</font></b>";
        }
    ?>
    you post in the wrong place, ask a moderator to move your post, don't post again, please.
    use mysql_result if you want to fetch a single field, don't use * in query in that case and check to have only one row in result.

    http://www.php.net/manual/en/function.mysql-result.php

    if you want to fetch multiple fields and/or rows use a while with mysql_fetch_assoc.

    best regards
    Last edited by oesxyl; 03-22-2009 at 08:43 PM.

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    While oesxyl actually posted the solution, this one is a little more specific for you're actual error:
    mysql_fech_assoc() doesn't exist, its a typo. You're missing the 't' in fetch.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #8
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Fou-Lu View Post
    While oesxyl actually posted the solution, this one is a little more specific for you're actual error:
    mysql_fech_assoc() doesn't exist, its a typo. You're missing the 't' in fetch.
    good catch, I didn't see the missing 't',

    best regards

  • #9
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Kev0121 View Post
    Omg, how obvious. lmao thanks alot mate
    that's why cross posting is not allow on cf:

    undefine function

    regards

  • #10
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Hmm, I thought it would let me choose how to merge these.
    Oh well, solution gained, even though the thread looks terrible now >.<
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

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