Jump to content

MySQL array (w/join) variables


desoto0311

Recommended Posts

I've got two tables laid out as such:

table 1: "articles"

L id

L catid

L title

L author

L desc

 

table 2: "files"

L id

L articleid

L filename

 

I've got the SQL statement:

$sql = "SELECT * FROM articles, files WHERE files.articleid = articles.id";

 

and a while statement to create my variables. (for later placement into a smarty template)

 

while ($a_row = sqlFetchArray($res)) {

$records[$c]["id"] = $a_row["id"];

// note: this repeats for all variables.

}

 

The problem is, when referencing said variables in the $records array, it seems I can only output those from the first table (articles). Those from the second table aren't seen at all.

 

Am I missing something?

-------------------------------

MySQL: v.5.0

PHP: v.5.2.5

 

Thanks,

-D

 

Link to comment
https://forums.phpfreaks.com/topic/152525-mysql-array-wjoin-variables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.