Jump to content

I have an problem with a query!


co.ador

Recommended Posts

The error is coming from this line  21   

LEFT OUTER JOIN dkb

          ON ( cart.id = dkb.id and dkb.id = $is ) line 21

 

Error:

#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 'FROM cart LEFT OUTER JOIN dkb ON (cart.id = dkb.i' at line 21 

 

The error below is being generated by the Run SQL query/queries.

 

    
    $is= isset($_GET['is'])?(int) $_GET['is']:null;
    $ic= isset($_GET['is'])?(int) $_GET['is']:null;
    $result = mysql_query("SELECT
       cart.id    AS cart_id,
       cart.qty   AS qty,
       dkb.id     As dkb_id,
       dkb.price  AS price1,
       dkb.name   As name1,
       cdkb.id    As cdkb_id,
       cdkb.price AS price2,
       dkb.name   As name2,       
       dbl.id     As dbl_id
       
    FROM
        cart
    
        LEFT OUTER JOIN dkb
           ON ( cart.id = dkb.id and dkb.id = $is )
    
        LEFT OUTER JOIN dbl
            ON ( dbl.id = dkb.id )
    
        LEFT OUTER JOIN cdkb
           on ( cart.id = cdkb.id and cdkb.id = $ic )
    
    WHERE cart.id = '" . GetCartId() . "'ORDER BY dkb.name AND cdkb.name ASC" );
<?php 
    $totalCost=0;
    while($row = mysql_fetch_array($result))
    {  
    // Increment the total cost of all items
    $totalCost += ($row["qty"] * $row["price1"]);?>
    
    <select name="<?php echo $row["dkb_id"]; ?>" onChange="UpdateQty(this)">
    
    <?php echo $row["name1"]; ?></p></div>

 

 

Link to comment
https://forums.phpfreaks.com/topic/192336-i-have-an-problem-with-a-query/
Share on other sites

The error is coming from this line  21   

LEFT OUTER JOIN dkb

          ON ( cart.id = dkb.id and dkb.id = $is ) line 21

 

Error:

#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 'FROM cart LEFT OUTER JOIN dkb ON (cart.id = dkb.i' at line 21 

 

 

 

Runs fine through phpmyadmin?

That's the error below and not that's what phpmyadmin is throwing back...

#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 'FROM cart LEFT OUTER JOIN dkb ON (cart.id = dkb.i' at line 21 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.