Sikander Posted February 16, 2004 Posted February 16, 2004 I know, I know, it's a noob question, but I'm kinda stuck here. I know, this must be an idiot question about PHP, but I'm kinda stuck here and I have no idea on how to get out of this. I got this include contribution, c-price, and I'm tryin to make it work with more atributes to modify. I tried this: <?php include('includes/application_top.php'); // category drop down $sql3 = mysql_query("SELECT categories_id, categories_name FROM categories_description ORDER BY categories_name"); ?> <?php if ($action == "category") { echo "<form name=\"update\" method=\"post\" action=\"".$_SERVER["PHP_SELF"]."?action=update_prices\">"; echo "<table>"; echo "<tr><th>ID</th><th>Code</th><th>Product</th><th>Price</th><th>Weight</th><th>Unit</th></tr><tr>"; $result = mysql_query("SELECT * FROM products, products_description, products_to_categories WHERE products_to_categories.categories_id = $option AND products_to_categories.products_id = products.products_id AND products.products_id = products_description.products_id"); if ($row = mysql_fetch_array($result)) { do { echo "<td>".$row["products_id"]."</td>\n"; echo "<td align=\"center\">".$row["products_model"]."</td>\n"; echo "<td>".$row["products_name"]."</td>\n"; echo "<td align=\"center\"><input type=\"text\" name=\"product_new_price[".$row['products_id']."]\" value={$row['products_price']}></td>\n"; echo "<td><input type=\"text\" name=\"product_new_weight[".$row['products_id']."]\" value={$row['products_weight']}></td>\n"; echo "</tr>\n"; } while($row = mysql_fetch_array($result)); } echo "</table>\n"; echo "<br><input type=\"submit\" value=\"Update Prices\">"; echo "</form>"; } ?> <?php if ($action == "update_prices") { foreach($HTTP_POST_VARS['product_new_price'] as $id => $new_price) { mysql_query("UPDATE products SET products_price=$new_price WHERE products_id=$id"); } } if ($action == "update_prices") { foreach($HTTP_POST_VARS['product_new_weight'] as $id => $new_weight) { mysql_query("UPDATE products SET products_weight=$new_weight WHERE products_id=$id"); } $random = date("U"); echo "<p><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\"><b>Success</b></font></p>"; echo "<p><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\">Click <a href=\"$PHP_SELF?$random\">here to go back</a>.</font></p>"; exit; } ?> <html> <head> <title>Product Quick Add</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- th { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; background-color: #eeeeee} table { border: #666666; border-style: dashed; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px} td { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; padding-top: 3px; padding-bottom: 3px; padding-left: 5px} td.left { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; padding-top: 3px; padding-bottom: 3px; padding-left: 5px; text-align: right; padding-right: 16px} --> </style> </head> <body bgcolor="#FFFFFF"> <table> <tr> <th>Choose a categorie to change the price</td> </tr> <tr> <td> <?php if(mysql_num_rows($sql3)) { while($row = mysql_fetch_row($sql3)) { print("<a href=\"".$_SERVER["PHP_SELF"]."?action=category&option={$row[0]}\">$row[1]</a><br>"); } } ?> </td> </tr> </table> </form> </body> </html> I have no idea of why, but I do the modification, and the atribute stay the same. it's not updating the modifications. I have no idea of what's wrong here, pleeease help. and sorry for being such a noob. :unsure: and sorry for the english. not good in english I am (Yoda-like speakin... ??... sorry...).
Sikander Posted February 16, 2004 Author Posted February 16, 2004 By the way, if you guys know a contribution to change all the products properties faster like this one I'm tryin to make (that's what I hope, at least), please tell me of it.
Sikander Posted February 16, 2004 Author Posted February 16, 2004 Someone help me here, please! send some cheers at least eh? :/
drakonan Posted February 16, 2004 Posted February 16, 2004 If you want to update your inventory fast easypop is great. What exactly is c-price? - - - - Sometimes, ignorance is bliss.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.