ok this is the first time ive ever tried to use SQL joins within PHP.
i have two tables "userdetails" and "plan"
i need just title, firstname and surname from the "userdetails" table and all* from the "plan" table.
This was the original SQL statment i came up with to get the right data from the "plan" table
$data = mysql_query("SELECT * FROM plan WHERE ref = '".$ref."' AND link ='Ref1' ");
This works fine to get the data from the "plan" table but i need the title, firstname and lastname from the "userdetails"
This is the join that ive come up with. It does NOT work as i would like it to.
$data = mysql_query("SELECT* FROM details, plan WHERE userdetails.oref = '".$ref."'AND plan.link ='Ref1' ");
When i echo the the data into a table in my while loop it echos the right title, firstname and surname but also echos all the other records from the "plan" table.
Can anyone help ??? im sure im prob going the wrong way about this so any advice would be great 🙂