Jump to content

Illegal double - AARGH!


slibob

Recommended Posts

Hi

 

Can anyone help me?  I have the following page:

 

==================

 

<?php

 

include 'lib/config.php';

include 'lib/opendb.php';

 

$display_block = "";

$display_block2 = "";

$empty=0;

 

$sess_id = session_id();

 

$get_cart = "SELECT * FROM shoppertrack WHERE session_id = $sess_id";

 

$get_cart_res = mysql_query($get_cart) or die(mysql_error());

 

if(mysql_num_rows($get_cart_res) < 1)

{

$display_block2 = "<h1>You have no items in your cart. Please <a href=\"index.php\">continue to shop</a>!</p>";

 

} else {

 

while($cart=mysql_fetch_array($get_cart_res))

{

 

$item_ref_cart = $cart['item_ref'];

 

$get_details = "SELECT item_title, item_desc, item_price FROM badges WHERE item_ref = $item_ref_cart";

 

$get_details_res = mysql_query($get_details) or die(mysql_error());

 

while($details=mysql_fetch_array($get_details_res))

{

 

$total_line = ($details[item_price])*($cart[item_qty]);

$display_block.= "<tr><td>$item_ref_cart</td><td>$details[item_title]</td><td>$details[item_desc]</td><td>$details[item_price]</td><td>$cart[item_qty]</td><td>$total_line</td><td><a href=\"removeitem.php?id=$item_ref_cart\">x</a></td></tr>";

}

 

}

}

 

?>

<html>

<head>

<title>Test</title>

</head>

<body>

<table align=center width=90%>

<tr><th>Ref</th><th>Title</th><th>Description</th><th>Price</th><th>Qty</th><th>Total</th><th></th></tr>

 

<? print $display_block2; ?>

<? print $display_block; ?>

 

</table>

</body>

</html>

 

==================

 

... called showcart.php - if you go to www.badgeshop.net, 'buy' something, then click basket - you will see (or atleast I think you will) the message: Illegal double '9e5702' value found during parsing

 

Can anyone help me fix it?  The site is not a real shop, its some uni work I'm doing and I'm stuck :(

 

Thanks

 

Simon

Link to comment
https://forums.phpfreaks.com/topic/41414-illegal-double-aargh/
Share on other sites

<?php
$get_details = "SELECT item_title, item_desc, item_price FROM badges WHERE item_ref = $item_ref_cart";
echo $get_details;
?>

 

Do the above.

 

I would guess that your $item_ref_cart has a comma in it. This would make your sql:

 

SELECT item_title, item_desc, item_price FROM badges WHERE item_ref = 1234,5678

 

which means something in SQL. Try quotes or escaping the variable

 

monk.e.boy

Link to comment
https://forums.phpfreaks.com/topic/41414-illegal-double-aargh/#findComment-200624
Share on other sites

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.