mysql error code not execute

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

    mysql error code not execute

    hey frnds its my frnds.php code in this

    when i want to show my frnds.php?act=list

    its not excute chk out last code where is wrong in this..

    PHP Code:

    case "list":
    print "<div class='catSides'>Your Buddy list : <br/></div>";
    $getfrlist=$db->select("SELECT * FROM b_budy WHERE r_id='$user->userid' AND pendg='0'");
    if($getfrlist)
    {
    foreach($getfrlist as $frlist)
    {
    $frid=$frlist->u_id;
    $frridname=getusernamebyid($frid);
    $frinavatar=getuseravatarbyid($frid); 
    print "<img src='".$config->url."/avatar/$frinavatar' alt='avatar'/> <a href=''".$config->url."/profile.php?uid=$frid''>$frridname</a><hr>";  
    }
    }

    break;

    default:
    forward("index.php");
    }    
    ?>
    <?php include "footer.php"?>

    error in this line

    $getfrlist=$db->select("SELECT * FROM b_budy WHERE r_id='$user->userid' AND pendg='0'");

    bcoz of this list not show some mistek in this i cant figure out so help me

    #2
    im no expert in sql by a long shot, i have been trying to create a new mysqli project lately to learn the language.

    but i noticed a little object oriented code in there. and thought shouldnt it be
    $db->query("SELECT * FROM b_budy WHERE r_id='$user->userid' AND pendg='0'");
    not
    $db->select("SELECT * FROM b_budy WHERE r_id='$user->userid' AND pendg='0'");

    so your asking for a query. i did some checking on google but couldnt find anything to support
    ->select

    if this isnt the problem or a problem. sorry.
    <?php
    include ('Ghost');
    if ($Post == true) {
    echo '

    sigpic
    alt='coding-talk.com!!' />';
    echo 'Sharing Is Caring!';
    } else {
    echo '

    alt='the username GHOST has been comprimised!' />';
    echo 'OMG SOMEBODY HELP ME!!';
    }
    ?>

    Comment


      #3
      thanks for your reply ghost but that not effect any thing in code ..my problem still same

      Comment


        #4
        This will only return result
        If $user->userid is not null
        If pendg is 0

        Check your inserted records using phpmyadmin

        Comment


          #5
          see this data inserted in table

          Click image for larger version

Name:	1.png
Views:	1
Size:	23.3 KB
ID:	110717

          Click image for larger version

Name:	2.png
Views:	1
Size:	8.2 KB
ID:	110718

          Comment


            #6
            add an or die() call to end of your query so it looks something like:

            $getfrlist = $db->query('YOUR QUERY CALL HERE') or die($db->error);
            or
            $getfrlist = $db->select('YOUR QUERY CALL HERE') or die($db->error);
            as you have it.

            it should then display an error to you when the query fails/has syntax error and alerts you to the problem.

            try both versions even. you never know
            <?php
            include ('Ghost');
            if ($Post == true) {
            echo '

            sigpic
            alt='coding-talk.com!!' />';
            echo 'Sharing Is Caring!';
            } else {
            echo '

            alt='the username GHOST has been comprimised!' />';
            echo 'OMG SOMEBODY HELP ME!!';
            }
            ?>

            Comment


              #7
              problem is solved

              Comment

              Working...
              X