Join db Tables in CRUD application (in update)

okay, so… [quote]What I’m trying to do is populate links that only pertain to the user that is logged in[/quote]

so your first query, you need to add a WHERE condition that filters out the ids of the reports that don’t belong to the logged in user

change this –

SELECT id FROM Reports ORDER BY timedate DESC

to this –

SELECT id FROM Reports WHERE "name or email" = $userid ORDER BY timedate DESC

please note i don’t do php so i just guessed at $userid

and of course “name or email” is whichever column the user’s id is stored in

I’m a little confused on how to this is going to work, it’s not changing anything on my page. How would this join the tables? isn’t that what I need to do, so it only shows the submitted reports of the user that is logged in?

On a different note, I’ve given up on trying to connect tables for now. I’m having another issue with the above query. I now have

if(!isset($id)){
        $x = mysql_query("SELECT id FROM Reports  ORDER BY name ASC") or die(mysql_error());
	while($row = mysql_fetch_array($x)){
		$id = $row['id'];
	}
}

I can’t seem to make order alphabetically, am I doing something wrong?

never mind…I figured it out just now

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.