Re: Check out system for Shopping Cart

From: Date: Thu, 21 May 2009 13:17:23 +0000
Subject: Re: Check out system for Shopping Cart
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-292864@lists.php.net to get a copy of this message
On Thu, May 21, 2009 at 7:32 AM, Vernon St.Croix <vstcroix@hotmail.com>wrote: > *Warning*: mysqli_query() expects parameter 1 to be mysqli, object given > in *C:\wamp\www\draft\checkout.php* on line *26* > > ***for the script > > <?php > > include("mysql.class.php"); > > include ("header.php"); > > > > //include ("functions.php"); > > $user = 1; > $total = 178.93; > > include ("mysql_connect.php"); > > //Turn off autocommit > > //mysql_autocommit($con, FALSE); > > //Add orders to the order table > > $sql = "INSERT INTO orders (user_id, total) VALUES ($user, $total)"; > > $r = mysqli_query($con, $sql);* The warning message is saying that it's expecting the first parameter you passed in mysqli_query() to be a mysqli link identifier, i.e., that the variable $con used in the line above be your connection to the database. Somewhere before this function call, you need to set $con: $con = *mysqli_connect* ($host, $username, $passwd, $dbname); -- Lex

« previous php.general (#292864) next »