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
https://forums.phpfreaks.com/topic/254230-query-issues/
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
https://forums.phpfreaks.com/topic/254230-query-issues/#findComment-1303502
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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