Page 1 of 1

any good eyes

Posted: Thu Nov 30, 2006 1:57 pm
by dbdvd7
Can anyone see why I just get a blank page when this loads?

Code: Select all

require('./include/config.inc');

db_connect();

if ($_SERVER['REQUEST_METHOOD'] == "POST") {

$product_name = $_POST['product_name'];
$Small = $_POST['Small'] ;
$Medium = $_POST['Medium']; 
$Large = $_POST['Large'];
$XLarge = $_POST['XLarge'];
}

mysql_connect("MYSQLHOST", "MYSQLUSER", "MYSQLPASS") ;
mysql_select_db("MYSQLDB") or die(mysql_error());


$sql="INSERT INTO CartItems (product_name, Small, Medium, Large, XLarge) VALUES
('$product_name','$Small','$Medium','$Large', '$XLarge',NOW()) WHERE (uid='$uid' AND pwd='$pwd')";
$result=mysql_query($sql) or die("insert fails");

 if (isset($result)) {
 
 echo "Items Added Successfully";
 
 
 } else {
 
 echo "Error. Contact Admin";
 
 }

Re: any good eyes

Posted: Thu Nov 30, 2006 1:59 pm
by Luke
Run this and see what happens...

Code: Select all

require('./include/config.inc');

db_connect();

if ($_SERVER['REQUEST_METHOOD'] == "POST") {

$product_name = $_POST['product_name'];
$Small = $_POST['Small'] ;
$Medium = $_POST['Medium']; 
$Large = $_POST['Large'];
$XLarge = $_POST['XLarge'];
}

mysql_connect("MYSQLHOST", "MYSQLUSER", "MYSQLPASS") ;
mysql_select_db("MYSQLDB") or die(mysql_error() . 'THERE WAS AN ERROR SELECTING YOUR DATABASE');


$sql="INSERT INTO CartItems (product_name, Small, Medium, Large, XLarge) VALUES
('$product_name','$Small','$Medium','$Large', '$XLarge',NOW()) WHERE (uid='$uid' AND pwd='$pwd')";
$result=mysql_query($sql) or die("insert fails");

 if (isset($result)) {
 
 echo "Items Added Successfully";
 
 
 } else {
 
 echo "Error. Contact Admin";
 
 }

Posted: Thu Nov 30, 2006 2:05 pm
by dbdvd7
what the?
now it brought up an error on line 57 which is the

Code: Select all

if (isset($result)) {
Parse error: syntax error, unexpected '{' in /home/penguinp/public_html/extramediumapparel/membermu/addcart.php on line 57

Posted: Thu Nov 30, 2006 3:04 pm
by RobertGonzalez
Try this...

Code: Select all

<?php
require './include/config.inc';

db_connect();

if ($_SERVER['REQUEST_METHOOD'] == "POST") {
  $product_name = $_POST['product_name'];
  $Small = $_POST['Small'] ;
  $Medium = $_POST['Medium'];
  $Large = $_POST['Large'];
  $XLarge = $_POST['XLarge'];
}

mysql_connect("MYSQLHOST", "MYSQLUSER", "MYSQLPASS") or die(mysql_error());
mysql_select_db("MYSQLDB") or die(mysql_error());

$sql = "INSERT INTO CartItems (product_name, Small, Medium, Large, XLarge) 
        VALUES ('$product_name','$Small','$Medium','$Large', '$XLarge', NOW()) WHERE (uid='$uid' AND pwd='$pwd')";
if (!mysql_query($sql) || !mysql_affected_rows()) {
  die("insert fails: " . mysql_error());
}
?>

Posted: Thu Nov 30, 2006 3:04 pm
by volka
Then we need the first 57 lines of code.

Posted: Thu Nov 30, 2006 3:23 pm
by dbdvd7
that helped, i got it working now.