Welcome Guest, Not a member yet? Register   Sign In
DB Selection error
#1

[eluser]Unknown[/eluser]
Hi

Is it wrong to write this query in codeigniter in this way ? Smile if yes how shall I do it ?
by the way the query is right i test it in phpmyadmin

Code:
$query = $this->db->query("SELECT 'products'.'ID', 'products'.'title', 'products'.'cID', 'p_pic'.'image', 'categories'.'title'
FROM 'p_pic'
LEFT JOIN 'shop'.'products' ON 'p_pic'.'pID' = 'products'.'ID'
LEFT JOIN 'shop'.'categories' ON 'products'.'cID' = 'categories'.'ID'
WHERE ('p_pic'.'front' =1)
        ");
    
         return $query->result();
the error I get :

Quote:A Database Error Occurred
Error Number: 1064

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 '.'ID', 'products'.'title', 'products'.'cID', 'p_pic'.'image', 'categories'.'titl' at line 1

SELECT 'products'.'ID', 'products'.'title', 'products'.'cID', 'p_pic'.'image', 'categories'.'title' FROM 'p_pic' LEFT JOIN 'shop'.'products' ON 'p_pic'.'pID' = 'products'.'ID' LEFT JOIN 'shop'.'categories' ON 'products'.'cID' = 'categories'.'ID' WHERE ('p_pic'.'front' =1)

Filename: C:\xampp\htdocs\project\system\database\DB_driver.php

Line Number: 330


Messages In This Thread
DB Selection error - by El Forum - 02-07-2011, 04:18 AM
DB Selection error - by El Forum - 02-11-2011, 04:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB