lundi 17 novembre 2014

php mysql get id from table 1 to match with table 2


Vote count:

0




i am new to php, i have a idea of what i want to do but i am not sure how i can execute them


i have 2 table in mysql table 1 contains: ID|Name|AboutMe|Specialisation



Example:
101|Andrew|handsome|drawing
102|Jane|pretty|drawing
103|Daniel|cute|swimming

table 2 contains
ID|Link|Title
101|//image1.jpg|Drawing in the dark
102|//image2.jpg|Drawing in me
103|//image3.jpg|Fish swimming


I want to display some images that are link to a Specialisation only once my website run.


A flow of what i have 1)



// get all the ID with drawing as specialisation // will return 2 rows
select ID FROM table1 WHERE Specialisation = "Drawing";
id = ID


2) from each row that matches, take the ID to get the link from table 2 like so



// get row of the links from the userid
Select * FROM userdatafiles WHERE ID = id
store the links into a variable and send to my jquery to display.


So basically get the id of each row that matches drawing, and take the id to find the same id from table 2 and get the link, and send it out to jquery as a result.


As there are many rows that i have to send out and i need to use arrays & loops, i'm not sure how i can do that. Can someone guide me along to what i'm doing? Thanks!





asked 2 mins ago







php mysql get id from table 1 to match with table 2

Aucun commentaire:

Enregistrer un commentaire