mysql error code not execute

Started on the old forum in March 2013 · view the original in the archive · old links redirect here

6 replies · 444 views · started 13 years ago · 1 min read

3 participants
12345xmen Developer · 239 posts #1

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..

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

Ghost Senior · 366 posts #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 ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
12345xmen Developer · 239 posts #3

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

shushant Developer · 207 posts #4

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

Check your inserted records using phpmyadmin

12345xmen Developer · 239 posts #5

see this data inserted in table

Attachments: 1.png 2.png
Ghost Senior · 366 posts #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 ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close