Jump to content

My query is resulting in error....why ?


jd2007

Recommended Posts

select $this->id, $this->title, $this->thumbnail from $this->table order by 'select $this->past from $this->table2'

 

the above is my query....what's wrong ? this is the error:

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from flash order by 'select past from awards'' at line 1

Link to comment
Share on other sites

i want to take three columns from a table, one of the column is related to another table.

 

column title, id, thumb is in table 1,

column id, past, title is in table 2,

 

i want title, id, thumb from table 1 ordered by past in table 2.

Link to comment
Share on other sites

its valid

 

 

function latestSubmissionAwards($ext="")
{
	if ($ext=="")
	{
     $this->que="select $this->id, $this->title, $this->thumb from $this->table order by $this->past desc limit 5";
	 $this->res=mysql_query($this->que);
     $this->showSubm(); 
    }
    else
    {
      $this->table2=$ext;
	  $this->que="select $this->id, $this->title, $this->thumbnail from $this->table order by 'select $this->past from $this->table2";
	  $this->res=mysql_query($this->que);
     $this->showSubm(); 	
	}
}

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.