Jump to content

Archived

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

chico1st

join rename

Recommended Posts

Okay i had a post yesterday but i figured out what the problem is therefore i have a new question, i had
commands like $news_id = $row['[b]news.[/b]newsID']; whereas i needed $news_id = $row['newsID'];

however this raises the issue that when i try to bring up the name of the news file i end up reading the name of the date.
i want to say $name = $row[[b]'news.[/b]name']; but i have to say $name = $row['name']; which brings up the date's name

how can i force my code to accept $name = $row[[b]'news.[/b]name'];

here is the code:

$query = "SELECT news.newsID, news.pictureID, [b]news.name[/b], news.abstract, [b]date.name[/b] " .
  "FROM news, date WHERE news.dateID = date.dateID";


  $result = mysql_query($query, $dbConn);

 
  //print 2 most recent news articles
  for( $i = 0; $i <2; $i++){
$output .= "\n<tr><td>";
$row = mysql_fetch_assoc($result);
$news_id = $row['newsID'];

i dont want to rename the elements of my table if it can be avoided
$name = $row['name'];
$abstract = $row['abstract'];
$image_id = $row['pictureID'];

Share this post


Link to post
Share on other sites
You'll have to alias that column name.

Share this post


Link to post
Share on other sites

×

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.