Jump to content

Code problem from Windows Server to Linux


vexer007

Recommended Posts

Hi all,

 

I have the code below which worked fine when I was using it on my windows server.  However I had a few problem with the windows server then I had to switch to a Linux based server.  Once the switch was completed I started having problems with a number of my codes which worked fine previously.  I have managed to solve quiet a few of them with the exeption of this one which I cant figure out and was hoping you could help.

 

QUERY

<?php
if(!isset($HTTP_COOKIE_VARS['cart_id'])) {
     $cart_id = md5(uniqid(rand()));
     setcookie("cart_id", $cart_id, time() + 14400);
} else {
     $cart_id = $HTTP_COOKIE_VARS['cart_id'];
}

?>

<?php require_once('Connections/Connection.php');
?>

<?php
mysql_select_db($database_Connection) or die ("cannot connect to database ".mysql_error());
$sessionid = "$cart_id" ;

$sql = "
SELECT
        Sum(products.product_price * ylabelcart.quantity) AS total, ylabelcart.`session`
FROM
        products
        INNER JOIN
                    ylabelcart
                    ON
                    products.product_id = ylabelcart.product_id
GROUP BY
         ylabelcart.`session`
HAVING
        ylabelcart.`session`='$sessionid'";
        echo $sql;
$result=mysql_query($sql)
or die ("Query Error: " . mysql_error());
$row=mysql_fetch_assoc($result);
$amount = "" . number_format ( floatval($row['total']), 2, ".", ",");
?>

<?php
mysql_select_db($database_Connection, $Connection);



$sql  = "
SELECT products.product_name, products.product_price, products.image, products.product_id, ylabelcart.quantity, products.id
FROM ylabelcart
INNER JOIN
  products
  ON
    products.product_id = ylabelcart.product_id
WHERE
   ylabelcart.`session`='$sessionid'";
   echo $sql;
$result = mysql_query($sql) or die (mysql_error());
//$validation =

?>

THE THE WHILE LOOP

while ($row=mysql_fetch_assoc($result)):
echo "<br/>" . $row['product_name'];
etc

The page is just blank even though I checked the DB and the records are there.  I've also tried outputting the query which also seems fine.

 

Any help is appreciated.  Thank You.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.