What does this mean: Object Id #2
Posted: Sat May 02, 2009 3:47 am
Hey Guys,
I am having trouble, I am working on an assignment is basically an online store that sells CDs. Now I am trying to add items to the Cart but getting is weird error "Object Id #2", see below for the code and yes I know its very messy code at the moment but im just testing with it.
Im echoing all the variables to the screen to see what they are and this is the output:
Table: 'cart' cd_id: '2' CD Name: Object id #2 ItemQty: 'Object id #3' TotalQty: '2' Price: 'Object id #4' Current Total: 'Object id #5' TOTAL:'2'
Please let me know if you need more information.
I am having trouble, I am working on an assignment is basically an online store that sells CDs. Now I am trying to add items to the Cart but getting is weird error "Object Id #2", see below for the code and yes I know its very messy code at the moment but im just testing with it.
Code: Select all
<?php
$DBConnect=@mysqli_connect("localhost", "username", "password", "database")
Or die("<p>Unable to connect to the database server.</p>" . "<p>Error code " . mysqli_connect_errno($DBConnect) . ":" . mysqli_connect_error($DBConnect)) . "</p>";
$TableName="cart";
$CdId = "$_GET[cdid]";
$CdNamestring = "SELECT cd_name FROM CDs WHERE cd_id='$CdId'";
$CdName = mysqli_query($DBConnect, $CdNamestring);
$ItemQtystring = "SELECT item_qty FROM cart WHERE cd_id='$CdId'";
$ItemQty = mysqli_query($DBConnect, $ItemQtystring);
$TotalQty = $ItemQty + 1;
$Pricestring = "SELECT cd_price FROM CDs WHERE cd_id='$CdId'";
$Price = mysqli_query($DBConnect, $Pricestring);
$CurrentTotalPricestring = "SELECT total_price FROM cart WHERE cd_id='$CdId'";
$CurrentTotalPrice = mysqli_query($DBConnect, $CurrentTotalPricestring);
$TotalPrice = $Price + $CurrentTotalPrice;
echo "Table: '$TableName' cd_id: '$CdId' CD Name: $CdName ItemQty: '$ItemQty' TotalQty: '$TotalQty' Price: '$Price' Current Total: '$CurrentTotalPrice' TOTAL:'$TotalPrice'";
$SQLstring = "INSERT INTO $TableName VALUES ('','','$CdName','$TotalQty','$TotalPrice')";
$QueryResult=mysqli_query($DBConnect, $SQLstring)
Or die("<p>Unable to execute the query.</p>" . "<p>Error code " . mysqli_connect_errno($DBConnect) . ":" . mysqli_connect_error($DBConnect)) . "</p>" .
'<a href="admin.html">Return to Delete.php page</a>';
echo "<p>Successfully Added to Cart</p>";
echo '<a href="main.php">Return CD Selection</a>';
mysqli_close($DBConnect);
?>
Table: 'cart' cd_id: '2' CD Name: Object id #2 ItemQty: 'Object id #3' TotalQty: '2' Price: 'Object id #4' Current Total: 'Object id #5' TOTAL:'2'
Please let me know if you need more information.