Jump to content

Recommended Posts

Hi,

 

I am trying to join 2 tables and select the info I want but it doesnt seem to work.. can somebody please advise on my code :

 

 $result = @mysql_query("SELECT * FROM profile,vrequest WHERE profile.id=vrequest.by, profile.type = Student AND vrequest.status= Accepted AND vrequest.to=$vID"); 

 

What i want is actually output the information from profile table where it meets the condition that type of students, status and 'to' value as given... all other tables are storing the ID only and the full info is in profile table..

 

Tried this as well but not working too.

$result = @mysql_query("SELECT * FROM profile,vrequest WHERE profile.type = 'Student' AND vrequest.status= 'Accepted' AND vrequest.to='$vID'");

 

Please advise

Link to comment
https://forums.phpfreaks.com/topic/149762-info-not-displayed/
Share on other sites

vrequest structure

  rid int(10)  No  auto_increment             

  by varchar(5) latin1_swedish_ci  No               

  to varchar(5) latin1_swedish_ci  No                       

  status varchar(5) latin1_swedish_ci  No               

  type varchar(5) latin1_swedish_ci  No               

 

profile

  mid int(5)  No  auto_increment             

  id varchar(5) latin1_swedish_ci  No               

  pro longtext latin1_swedish_ci  No               

  resume mediumtext latin1_swedish_ci  No               

  type varchar(100) latin1_swedish_ci  No               

  date timestamp  ON UPDATE CURRENT_TIMESTAMP No CURRENT_TIMESTAMP               

  info varchar(200) latin1_swedish_ci  No                           

  status varchar(20) latin1_swedish_ci  No Active

 

 

* Type and status for both tables are having different info.. only the vrequest to and by column value which used to store ID needs to refer back to profile table id to get the other information.

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/149762-info-not-displayed/#findComment-786433
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.