Jump to content

Return array from query that has two tables?


commandopress

Recommended Posts

I want to take the following code and add a query from an additional table.

[code]
$findauth_id="SELECT article_id,category_id,article_title,article_sum,article_body,article_res,article_key FROM articles WHERE status='F';";

$result = mysql_query($findauth_id);
$x=0;
$num_rows=mysql_num_rows($result);
if ($num_rows>0)
       {
        while ($row= mysql_fetch_array($result, MYSQL_ASSOC))
         {
          $article[$x][id]=$row[article_id];
          $article[$x][categid]=$row[category_id];
          $article[$x][text]=strtolower($row[article_title])." ".strtolower($row[article_sum])." ".strtolower($row[article_body])." ".strtolower($row[article_res])." ".strtolower($row[article_key])." ".strtolower($row[pen_name]);
          $x++;
         }
       }
else {print "No articles to process"; exit;}
[/code]

I want to add 'penname' from the table 'pen_name' to the $result array then as in the while statement use .strtolower($row[pen_name]) as an additional $article[$x][text] variable......


I have tried everything I can find online to get this to work, but it just breaks the code. I need to pull the pen_name entry into the array so that I can look it up and match it to keywords in a later function.

Any help or direction on this would be great!

Rick
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.