Jump to content

query issues?


ahsesino

Recommended Posts

Hello guys;

I posted this thread a couple of days ago in the PHP code section thinking there was something wrong with my php code. So I realized it was in the wrong section, the issue has to be in mysql query. The code is below; when I run the query on "myphpadmin" my result is empty and on the page I want this query to apear the result is a capital S. If someone could help me out I would really appreciate it.

 

<?php 
  $query = ("SELECT nick, avatar_img, person FROM latest_post, profile WHERE latest_post.person = profile.nick AND profile.nick = profile.avatar_img WHERE profile.avatar_img='$avatar_img'");
   echo $query[$avatar_img];
  
?>

Link to comment
Share on other sites

Thanks for your reply AyKay47;

 

What Im trying to do is display the current poster avatar next to his post. For that I need to connect to DB and select from two tables three

rows.

 

The reason I have to do it this way is because when someone post something new it the new post gets stored in the latest_post table and the avatars are located in the profile table.

 

Tables

---------

1.latest_post

2.profile

 

I need to select "nick","avatar_img" from table "profile" and select "person" FROM table "latest_post" from there I need to make latest_post.person = profile.nick AND make profile.nick = profile.avatar_img to display avatar in box.

 

The reason i use $query is to echo the result.

 

I hope my explanation makes sense.

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.