Jump to content


join rename

  • Please log in to reply
1 reply to this topic

#1 chico1st

  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts

Posted 19 August 2006 - 02:06 AM

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['news.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['news.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['news.name'];

here is the code:

$query = "SELECT news.newsID, news.pictureID, news.name, news.abstract, date.name " .
  "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'];

#2 fenway

  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 19 August 2006 - 12:37 PM

You'll have to alias that column name.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users