[thelist] PHP and MySQL Multiple Query/Array

David McCreath mccreath at kadmium.net
Mon Jan 20 19:40:01 CST 2003

> I'm trying to get information from two
> tables on the same database

Hi, Razzak --

(I see that Rudy beat me with the join, but the PHP syntax for using the
results is below. You just put your variables into the print string.)

Is there a reason you can't user a join instead of two SQL statements?

select articles.author, users.pic
	from articles inner join users
		on articles.author = users.author
			where articles.submitdt = $id

Then just print the values back in your HTML:

print "<div align=\"center\"><img src=\"../images/profilepics/$pic\"
alt=\"$author\" width=\"88\" height=\"76\" border=\"0\"></div>";


More information about the thelist mailing list