vexer007 Posted March 7, 2007 Share Posted March 7, 2007 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. Link to comment https://forums.phpfreaks.com/topic/41628-code-problem-from-windows-server-to-linux/ Share on other sites More sharing options...
pocobueno1388 Posted March 7, 2007 Share Posted March 7, 2007 Try this: while ($row=mysql_fetch_assoc($result)){ echo "<br/>" . $row['product_name']; //everything else in your while loop } Link to comment https://forums.phpfreaks.com/topic/41628-code-problem-from-windows-server-to-linux/#findComment-201695 Share on other sites More sharing options...
vexer007 Posted March 7, 2007 Author Share Posted March 7, 2007 Thanks pocobueno for that. I just tried that but still the same problem it just omitt the while loop and dostn even give any error. any other suggestion? Thanks again. Link to comment https://forums.phpfreaks.com/topic/41628-code-problem-from-windows-server-to-linux/#findComment-201748 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.