
SQL query to show all tool_tip_links related to pages_learn_more ids?
How to structure this query?
$SQL = "SELECT ptt.tool_tip_link FROM pages_tool_tip ptt JOIN pages_to_pages ptp ON ptp.tool_tip_id = ptt.tool_tip_id WHERE ptp.learn_more_id = 2"; $result = mysql_query($SQL); // or die(mysql_error()); while ($db_field = mysql_fetch_array($result)) { $reference_keys = $db_field['tool_tip_link']; } echo $reference_keys;
How to combine these queries to make them clean and efficient? Thanks for the help.
-------------------------------------- -------- UPDATE --- ----------------------- Using this code:
"SELECT ptt.tool_tip_link FROM pages_tool_tip ptt JOIN pages_to_pages ptp ON ptp.tool_tip_id = ptt.tool_tip_id JOIN pages_learn_more plm ON plm.id = ptp.learn_more_id WHERE plm.id = 2";
Gotta show me 3 tool_tip_links. However, it only returns the last field in the database, which is 4 → LINK 4

So, how do I get all the links, not just the latest? again..
-------------------------------------- -------- UPDATE --- -----------------------
When I exit mysql_num_rows, it correctly displays 3 for id # 2.
So, what code do I need to display all three lines? ONION ARRAY? I do not get it because it needs to be looped in my array . Can I just respond with $reference_keys or should I do something else?
I also tried foreach and returned an error. What am I doing wrong? please inform.
more db views → hope this helps to find a solution.


source share