Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

item ID remove auto increment


mateo107

Recommended Posts

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

      <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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...