CodeIgniter Forums

Full Version: Query returns nothing.... [SOLVED]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I have a query to get a row from a table,
to extract a row with a field = "Accessories - Mouse"

$this->db->select("*, as merchant, ".$this->table.".id as id, as category");
$this->db->join("merchant", " = ".$this->table.".merchant_id");
$this->db->join("category", " = ".$this->table.".category_id");

$query = $this->db->get($this->table);

Which converts to this, as tested in phpmyadmin:
SELECT * , AS merchant, AS id, AS category
JOIN `merchant` ON = merchant_category.merchant_id
JOIN `category` ON = merchant_category.category_id
WHERE merchant_category.display = 'Accessories - Mouse'

CI returns nothing:
echo "search results:".$query->num_rows();

but, phpmyadmin returns a row, which should be the correct result:

Quote:Showing rows 0 - 0 (1 total, Query took 0.0008 sec)

45, Accessories Mouse, Accessories - Mouse, 4, 17, 96, 4, newegg, NewEgg....

What is going on here? It's driving me insane Confused

El Forum

[eluser]Michael Wales[/eluser]
Be sure ActiveRecord is piecing your query together properly:

El Forum

Cheers, Michael.. that helped! turned out to be different!