I have a problem where no matter what value I pass into my php function below, the same row keeps being returned and its not the row I requested. Has anyone seen anything like this before because I am very confused?
Its such simple MYSQL thats why I don’t understand it.
public function getSend($order_id)
{
$query = $this->dbs->query("SELECT order_id FROM SEND` WHERE order_id ='" . (int)$order_id . "'");
return $order_id."<br/>db:".$query->row['order_id'];
}
If I pass in 173 , my output is 173 db: 171 it just keeps returning 171 no matter what i put in there
Thats my test code to ensure that what I’m passing in is referring to the same row that I’m getting out the actual code is to return some different data but for now I just need to make sure I have the right row returning.
Hey that’s it!
It was the backtick but that’s just odd because I didn’t put it there, I am using opencart you see, I was just copying their syntax, I wouldn’t have used it myself either
the backtick is mysql’s mechanism to delimit problematic table/column names – those which either contain special characters (like a space) or are themselves a reserved word (like ORDER)
SEND does not appear to be a reserved word (although it might easily be, right?) so you don’t really need the backticks