PHP 5 and inserting to a table, 2 don't work, 1 does work???
Posted: Tue Jul 25, 2006 11:43 am
feyd | Please use
This function is on the same page and does work correctly...
what gives on the first two? something simple? By the way, all three work under my test environment using PHP 4.3 and MySQL 4, but under the new PHP 5 and MySQL 5, the first two error out.
JOsh Jones
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
These first two functions do not work... I have PHP 5 and MySQL 5 running...Code: Select all
function insertOrder($ClientID,$Total)
//inserts a new order into the system with total and shipping information
{
$ShipMethod = "Standard Shipping";
$OrderStatus = "Order Started";
$result = mysql_query("Insert into orders values('', '".$ClientID."', '".$Total."', '".$ShipMethod."', NOW(),'".$OrderStatus."')");
if(!mysql_error()) return mysql_insert_id($this->conn);
else return "error";
}
function insertDetails($OrderID,$Cart)
//inserts the order details into the many-many relationship table
{
for ($i=0; $i<sizeof($Cart); $i++)
$result = mysql_query("INSERT INTO details(OrderID, ProductID, Quantity) values('".$OrderID."', '".$Cart[$i]['productid']."', '".$Cart[$i]['quantity']."')");
if(!mysql_error()) return $OrderID;
else return "error";
}This function is on the same page and does work correctly...
Code: Select all
function insertMailingList($email)
//insert into the mailing list
{
$result = mysql_query("Insert into mailinglist values('".$email."')");
if(!mysql_error()) return $email;
else return "error";
}JOsh Jones
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]