Note that there are some explanatory texts on larger screens.

plurals
  1. POMysql inner join returning repeated results
    primarykey
    data
    text
    <p>Im trying to pull a character from a mysql database. The character table has 6 columns that link to a foreign item id from the item table, i need to link each item to get the item id, name, and foreign image id, then i need to link that foregin image id to my image table. and pull the image url. The code i coded below to do this is giving me duplicate image urls. Does anyone know whats wrong with it?</p> <p>This is my results. The image urls are repeating themselfs. I took project_users out to test it and the same thing happened its not being used now but will be used in the future.</p> <p>I made a sqlfiddle but it looks like its working correct here <a href="http://sqlfiddle.com/#!2/7896e/8" rel="nofollow">http://sqlfiddle.com/#!2/7896e/8</a></p> <pre><code> Array ( [name] =&gt; test1241 [0] =&gt; test1241 [gender] =&gt; [1] =&gt; [left_arm] =&gt; Images/Items/leftArm.png [2] =&gt; Images/Items/leftArm.png [legs] =&gt; Images/Items/legs.png [3] =&gt; Images/Items/legs.png [torso] =&gt; Images/Items/torso.png [4] =&gt; Images/Items/torso.png [head] =&gt; Images/Items/head.png [5] =&gt; Images/Items/head.png [hair] =&gt; Images/Items/hair.png [6] =&gt; Images/Items/hair.png [right_arm] =&gt; Images/Items/rightArm.png [7] =&gt; Images/Items/rightArm.png ) $sql = "SELECT pc.project_characters_name as name, pc.project_characters_gender as gender, pia1.project_images_url as left_arm, pia2.project_images_url as legs, pia3.project_images_url as torso, pia4.project_images_url as head, pia5.project_images_url as hair, pia6.project_images_url as right_arm FROM project_characters AS pc INNER JOIN project_users AS pu ON pc.fk_project_users_id = pu.project_users_id INNER JOIN project_items AS pi1 ON pc.project_characters_left_arm = pi1.project_items_id INNER JOIN project_items AS pi2 ON pc.project_characters_legs = pi2.project_items_id INNER JOIN project_items AS pi3 ON pc.project_characters_torso = pi3.project_items_id INNER JOIN project_items AS pi4 ON pc.project_characters_head = pi4.project_items_id INNER JOIN project_items AS pi5 ON pc.project_characters_hair = pi5.project_items_id INNER JOIN project_items AS pi6 ON pc.project_characters_right_arm = pi6.project_items_id INNER JOIN project_images AS pia1 ON pi1.fk_project_images_id = pia1.project_images_id INNER JOIN project_images AS pia2 ON pi2.fk_project_images_id = pia2.project_images_id INNER JOIN project_images AS pia3 ON pi3.fk_project_images_id = pia3.project_images_id INNER JOIN project_images AS pia4 ON pi4.fk_project_images_id = pia4.project_images_id INNER JOIN project_images AS pia5 ON pi5.fk_project_images_id = pia5.project_images_id INNER JOIN project_images AS pia6 ON pi6.fk_project_images_id = pia6.project_images_id WHERE pc.project_characters_name=:name LIMIT 1"; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload