Guest Posted December 1, 2004 Posted December 1, 2004 Hi, I have just downloaded this contribution, but it isn't rendering the html correctly, spitting out php onto the screen I've followed the basic instructions, but there aren't really many, other than put it where you like, and run it Seems to be giving up from around line 31 - 34 (talking specialmain.php). I don't know why exactly, but presume there's something as simple as a syntax error? Or has anyone else had similar problems, can anyone recommend something better - I'm just looking for a way to be able to apply a discount to a whole category. Thanks Quote
Guest Posted December 2, 2004 Posted December 2, 2004 Ok, does this help? anyone? as i say - it seems to be getting to around line 31 - 34 <!----------------------- Actual code for Specials Admin starts here -------------------------> <? if (!$categoryinput){ $categoryinput = "no"; } ?> I tried putting an extra '}' at the start of the section of code above, but I'm completely at a loss. It just prints out the PHP from there on. Here's the rest of the code anyway, actually DB details blanked out of course: <?php require('includes/application_top.php'); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title><?php echo TITLE;?>::Specials Admin</title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table> </td> <!-- body_text //--> <td> <!----------------------- Actual code for Specials Admin starts here -------------------------> <? if (!$categoryinput){ $categoryinput = "no"; } ?> <form action="specialmain.php" method="get"><select name="categories"> <? /////////////////////////////////////////////////////////////// // Change the settings below to match your server and database /////////////////////////////////////////////////////////////// $dbcnx = mysql_connect("xxxxxx", "xxxxxx", "xxxxxx"); mysql_select_db("xxxxxxxxx"); /////////////////////////////////////////////////////////////// $result = mysql_query("SELECT * FROM categories, categories_description where categories.categories_id=categories_description.categories_id"); while ( $row = mysql_fetch_array($result) ) { print (" <option value=\"" . $row["categories_id"] . "\">" . $row["categories_name"] . ""); } ?></select> <input type="hidden" name="categoryinput" value="yes"> <input type="submit" value="submit"> </form> <? if ($categoryinput == "yes") { print ("<table><tr><td><b>Product Title</b></td><td><b>Product Price</b></td><td><b>Special Price</b></td><td><b>Full Price</b></td></tr>"); $result2 = mysql_query("SELECT * FROM products_description, products_to_categories, products where products_description.products_id=products_to_categories.products_id and products.products_id=products_to_categories.products_id and products_to_categories.categories_id = $categories"); while ( $row = mysql_fetch_array($result2) ) { $number = $row["products_id"]; print("<tr><td>" . $row["products_name"] . "</td><td>" . $row["products_price"] . "</td><td>"); $result3 = mysql_query("SELECT * FROM specials where products_id=$number"); $num_rows = mysql_num_rows($result3); if ($num_rows == "0") { $specialprice = "none"; } else { while ( $row2 = mysql_fetch_array($result3) ) { $specialprice = $row2["specials_new_products_price"]; } } print("<form action=\"specialmain.php\" method=\"get\"><input name=\"specialprice\" type=\"text\" value=\"$specialprice\"><input type=\"hidden\" name=\"productid\" value=\"" . $row["products_id"] . "\"><input type=\"hidden\" name=\"inputupdate\" value=\"yes\"><input type=\"submit\" value=\"Update\"></td><td align=\"center\"><input type=\"checkbox\" name=\"fullprice\" value=\"yes\"></form></td></tr>"); } } print ("</table>"); ?> <? if ($fullprice == "yes") mysql_query("DELETE FROM specials WHERE products_id=$productid"); else if($inputupdate == "yes"){ $alreadyspecial = ""; $alreadyspecial = mysql_query ("SELECT * FROM specials WHERE products_id=$productid"); $specialproduct= mysql_fetch_array($alreadyspecial); if ($specialproduct["specials_id"]){ print ("Database updated. Status:".$specialproduct["status"]); mysql_query ("UPDATE specials SET specials_new_products_price='$specialprice' where products_id=$productid"); } else{ print("New product added to specials table"); $today = date("Y-m-d H:i:s"); mysql_query ("INSERT INTO specials VALUES ('','$productid','$specialprice','$today','','','','1');"); } } ?> <!------------------------ Code for Specials Admin ends here ---------------------------> </td> </tr> </table> <!-- body_text_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> </body> </html> Quote
mujina Posted December 3, 2004 Posted December 3, 2004 Hi Nick! I also have a problem with this contribution. Here's the message error displayed : Notice: Undefined variable: categoryinput in c:\program files\easyphp1-7\www\catalog\admin\specialallcategory.php on line 10 Do you have this error? Quote OSC2.2
mujina Posted December 3, 2004 Posted December 3, 2004 (edited) Hi Nick! I also have a problem with this contribution. Here's the message error displayed : Notice: Undefined variable: categoryinput in c:\program files\easyphp1-7\www\catalog\admin\specialallcategory.php on line 10 Do you have this error? <{POST_SNAPBACK}> Sorry! Do not pay attention to my post! I remove this contribution... too much darkness for me! Good luck! Sorry not to be able to help you! :blush: Edited December 3, 2004 by mujina Quote OSC2.2
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.