mateo107 Posted June 30, 2003 Posted June 30, 2003 I was in MySQL Control Center, in my database, and I need to make a change. I need to change the "Products" table, so that the ID number is NOT auto-increment. (I need these numbers to match what we use in our retail store). But when I change the table I get this message: "ERROR 1064: You have an error in your SQL syntax near 'FIRST, CHANGE `products_quantity` `products_quantity` int(4) NOT NULL DEFAULT '0' at line 1" SECONDLY: could someone send me the code that i'll need so that I can enter a product id when you enter the product information (because currently, it isn't displayed on that first page) THANKS!
Daemonj Posted June 30, 2003 Posted June 30, 2003 Use PHPMyAdmin, it is a lot easier to modify table fields and their data. For the second item, that is going to take some modification. You will need to add the product_id field so you can enter the appropriate information and then use that information instead of the mysql insert id. "Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein
mateo107 Posted June 30, 2003 Author Posted June 30, 2003 my PHPAdmin for the web wasn't working.... is there a command line version i can use? I'm using a Windows XP Machine, with Apache, and MySQL. Its a local machine, so I could just use dos commands if necessary. or anyone else have any ideas? thanks
Daemonj Posted June 30, 2003 Posted June 30, 2003 The command that you want to use is: ALTER TABLE `products` CHANGE `products_id` `products_id` INT(4) NOT NULL DEFAULT '0' you could issue that statement from the mysql client command line if you cannot use PHPMyAdmin. You could also take a look at SQLyog to use in place of PHPMyAdmin. "Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein
mateo107 Posted June 30, 2003 Author Posted June 30, 2003 this modification will alter the products id so that it does not auto-increment?
Daemonj Posted June 30, 2003 Posted June 30, 2003 this modification will alter the products id so that it does not auto-increment? Yes. If you wish to keep everything at the default settings (other than the auto increment) change the int(4) to int(11). ;) "Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein
mateo107 Posted June 30, 2003 Author Posted June 30, 2003 thank you okay- does anyone have any ideas for source code on the product entering screen so that I can enter my own product id?
mdfst13 Posted June 30, 2003 Posted June 30, 2003 <tr><?php echo tep_draw_form('new_product', FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '') . '&action=new_product_preview', 'post', 'enctype="multipart/form-data"'); ?> <td><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php echo TEXT_PRODUCTS_STATUS; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('products_status', '1', $in_status) . ' ' . TEXT_PRODUCT_AVAILABLE . ' ' . tep_draw_radio_field('products_status', '0', $out_status) . ' ' . TEXT_PRODUCT_NOT_AVAILABLE; ?></td> </tr> in categories.php becomes <tr><?php echo tep_draw_form('new_product', FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '') . '&action=new_product_preview', 'post', 'enctype="multipart/form-data"'); ?> <td><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main">Product ID: </td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_id', $pInfo->products_id); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_STATUS; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('products_status', '1', $in_status) . ' ' . TEXT_PRODUCT_AVAILABLE . ' ' . tep_draw_radio_field('products_status', '0', $out_status) . ' ' . TEXT_PRODUCT_NOT_AVAILABLE; ?></td> </tr> Properly speaking, you should define a constant (e.g. TEXT_PRODUCT_ID) to hold Product ID: in the appropriate languages file, but you can get by without it if you are only going to use one language. You may also need to make other changes, but this should get you started. Hth, Matt I love deadlines. I like the whooshing sound they make as they fly by. ---Douglas Adams
mateo107 Posted June 30, 2003 Author Posted June 30, 2003 thank you everyone who has helped me this far... perhaps this would make a neat contribution? just a thought... I'm very close to making this a very nice reality. Here's my problem now... I can get to my MYSQL.EXE and then i use that to connect to the database.... and i get this prompt: "mysql>" and i don't know what to do. I thought with a previous version of MYSQL that i had a MYSQLADMN tool that i could use so as to put in the above selection, but i was having some serious issues and install PHPDEV (all in one Windows MYSQL/PHP/APACHE install) and now I don't seem to have that.... any ideas how to get this [stupid] database to conform? (Resistance is futile mr database!) thanks a bunch
mateo107 Posted July 3, 2003 Author Posted July 3, 2003 any other ideas anyone? i'm still stuck? thanks
Guest Posted July 3, 2003 Posted July 3, 2003 This: ALTER TABLE `products` CHANGE `products_id` `products_id` INT(4) NOT NULL DEFAULT '0'; statement? You should be able to enter it as listed at the mysql> prompt after typing use catalog; -- replace catalog with the name of your database. Good luck, Matt
mateo107 Posted July 3, 2003 Author Posted July 3, 2003 thanks... but ARGGG.. here's what I get back: mysql> ALTER TABLE 'products' CHANGE 'products_id' 'products_id' INT(4) NOT NULL DEFAULT '0'; ERROR 1064: You have an error in your SQL syntax near ''products' CHANGE 'produc ts_id' 'products_id' INT(4) NOT NULL DEFAULT '0'' at line 1 mysql> somethings funky,,,, any other ideas fellas?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.