Jump to content

Lassie

Members
  • Posts

    390
  • Joined

  • Last visited

Everything posted by Lassie

  1. Can anybody give me a starter for 10 on this. I need to integrate a paypal form with hidden values into my shopping cart. The form needs an aggregate value named 'amount' This value is held in a session variable on my checkout page $SESSION ['total_price'] How do I transfer the value of total price to the form field? the form code is <form action="https://www.paypal.com/uk/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="xxxx.com"> <input type="hidden" name="item_name" value="xxxxx"> <input type="hidden" name="currency_code" value="GBP"> <nput type="hidden" name="amount" value="0.00"> <input type="image" src="http://www.paypal.com/en_GB/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"> </form>
  2. I will apply that. Thanks
  3. I am having trouble establishing what is wrong with an insert query within a function used to update oder details within a simple cart application. Can any one suggest how I can debug this or see my error. The first query updates successfully and the variables are all present. The code is: function insert_order($order_details) {   // extract order_details out as variables   extract($order_details);       // set shipping address same as address   if(!$ship_name&&!$ship_address&&!$ship_city&&!$ship_state&&!$ship_zip&&!$ship_country)   {     $ship_name = $name;     $ship_address = $address;     $ship_city = $city;     $ship_state = $state;     $ship_zip = $zip;     $ship_country = $country;   }     include("misc.inc");     $connection = mysql_connect($host,$user,$password)          or die ("$connection:".mysql_error($connection));   $db = mysql_select_db($database,$connection)                or die ("$db:".mysql_error($connection));       $query = "insert into customer values             ('', '$name','$address','$city','$state','$zip','$country')";     $result = mysql_query($query);     if (!$result)     return false;     $customer_id = mysql_insert_id();   echo "$customer_id";     /* Insert Customer Order details */   $order_date = date('Y-m-d');       $query = "INSERT INTO order (total,customer_id,order_date,ship_name,ship_address,ship_city,ship_state,ship_zip, ship_country,order_status) VALUES (".$_SESSION['total_price'].",'$customer_id','$order_date','$ship_name','$ship_address','$ship_city', '$ship_state','$ship_zip','$ship_country','PARTIAL')"; $result = mysql_query($query); if (!$result) return false;     /* Retrieve Order No */   $query = "select order_number from order where                               total > ".$_SESSION['total_price']."-.001 and               total < ".$_SESSION['total_price']."+.001 and               order_date = '$order_date' and               ship_name = '$ship_name' and               ship_address = '$ship_address' and               ship_city = '$ship_city' and               ship_state = '$ship_state' and               ship_zip = '$ship_zip' and               ship_country = '$ship_country'and   order_status = 'PARTIAL'";   $result = mysql_query($query);     $num_ord = mysql_num_rows($result);     if ($num_ord>0)     {     $result = mysql_fetch_row($result);     $order_number = $result;     }   else   return false;       // insert each book   foreach($_SESSION['cart'] as $product_id => $quantity)   {     $detail = get_book_details($product_id);         $query = "INSERT INTO order_contents (product_id, quantity,price) VALUES               ($product_id,$quantity,".$detail['price'].")";     $result = mysql_query($query);       if(!$result)           return false;   }   return $order_number; } The table structure is   Field  Type  Attributes  Null  Default  Extra  Action order_number  int(6)   No    auto_increment  Change Drop Primary Index Unique Fulltext customer_id  int(5)   No  0    Change Drop Primary Index Unique Fulltext total  float(6,2)   No  0.00    Change Drop Primary Index Unique Fulltext order_date  date   No  0000-00-00    Change Drop Primary Index Unique Fulltext ship_name  varchar(50)   No      Change Drop Primary Index Unique Fulltext ship_address  varchar(50)   No      Change Drop Primary Index Unique Fulltext ship_city  varchar(50)   No      Change Drop Primary Index Unique Fulltext ship_state  varchar(30)   No      Change Drop Primary Index Unique Fulltext ship_zip  varchar(10)   No      Change Drop Primary Index Unique Fulltext ship_country  varchar(30)   No      Change Drop Primary Index Unique Fulltext order_status  varchar(10)   No      Change Drop Primary Index Unique Fulltext With selected: Check All  /  Uncheck All    With selected:  Change Drop Primary Index Unique Fulltext
  4. I have just upgraded mysql from 4.0 to 4.1 I now get the following when trying to connect. Client does not support authentication protocol requested by server;consider upgrading mysql client... Can anyone trow light on this please. My connect coding is <?php # Script - mysql_connect.php // This file contains the database access information. // This file also establishes a connection to MySQL and selects the database. // This file also defines the escape_data() function. // Set the database access information as constants. DEFINE ('DB_USER', 'Mike'); DEFINE ('DB_PASSWORD', 'hawkesley'); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'Reg_user'); // Make the connection. $dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() ); // Select the database. @mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() ); // Create a function for escaping the data. function escape_data ($data) { // Address Magic Quotes. if (ini_get('magic_quotes_gpc')) { $data = stripslashes($data); } // Check for mysql_real_escape_string() support. if (function_exists('mysql_real_escape_string')) { global $dbc; // Need the connection. $data = mysql_real_escape_string (trim($data), $dbc); } else { $data = mysql_escape_string (trim($data)); } // Return the escaped value. return $data; } // End of function. ?>
  5. I have just upgraded from mysql 4.0 to 4.1 and now get the following error message: Could not connect to MySQL: Client does not support authentication protocol requested by server; consider upgrading MySQL client: Can anyone shed light on this please.
  6. Thanks. I will do that.
  7. I am trying to use phpmyAdmin to interface with the Mysql database. Does any one have experience of getting this to work?
×
×
  • 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.