Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Execute Sql command


Recommended Posts

Sorry. I know, I feel shame!!

 

I really want this contrib. from what everyone has been saying. It's Brilliant!

 

Problem is I'm dead in the water before I even get out the gate.

 

I downloaded CAP .V1.4 I put in all the files. and afterward I will be able to

change the php files. But I am stuck on

 

3. Execute Sql command:

ALTER TABLE `products` ADD `customer_id` INT( 11 ) NOT NULL AFTER `manufacturers_id` ;

 

I don't know how to execute an SQL command I actually think I have been to the place in my SQL where

I carry this out. BUT I don't know what to do when I get there.

 

 

Can someone please point me in the right direction, or explain step by step how to do this?

 

Thank you so much!!

 

Nancy :D

Link to comment
Share on other sites

When I first started out in oscommerce, this was one of my biggest probs - no-one acutally told you how to do the SQL statement!!!

 

It is done through an admin tool provided by your host. In my case, I went to my admin area of my hosting information (not of oscommerce), and found a section labelled 'MySQL'. Clicking on this leads to an admin tool called 'phpMyAdmin'.

 

Everyone is different, but you should have access to something like this.

 

In phpMyAdmin, there is a heading 'MySQL', click on the subheading 'Databases'. This leads to a list of all the databases you have running - I only have one, labelled 'mydomain_com_-_oscommerce'. Yours is probably labelled something similar, it was set up way back when you first ran the set up to setup oscommerce.

 

Clicking on the database name leads to a list of all the tables in the database. To run an SQL, there is a tab at the top labelled 'SQL', click on this.

 

You should be presented with a screen with a big area for entering text, and an option to 'locate the text file'. How you run the SQL file depends on how it was presented to you. Some of the contributions have files labelled 'contribtionSQL' or the like, others just give you the command. If there is a file to run, upload it as you would an image (choose 'browse', etc etc). If you have just the command (like the one you have, ALTER TABLE `products` ADD `customer_id` INT( 11 ) NOT NULL AFTER `manufacturers_id` ;, simply cut and paste the command into the large text box and hit 'go'. Afterwards, you should see some text (hopefully) saying that the SQL has been run successfully.

 

Hope this helps you out - as I said at the beginning, this is all based on my particular scenerio, it's likely to be slightly different for you, but the fundamentals are the same. If you don't know how to access your hosting admin, contact your host or search around their website.

 

~Barbara~

Edited by bobsi18
Link to comment
Share on other sites

When I first started out in oscommerce, this was one of my biggest probs - no-one acutally told you how to do the SQL statement!!!

 

It is done through an admin tool provided by your host. In my case, I went to my admin area of my hosting information (not of oscommerce), and found a section labelled 'MySQL'. Clicking on this leads to an admin tool called 'phpMyAdmin'.

 

Everyone is different, but you should have access to something like this.

 

In phpMyAdmin, there is a heading 'MySQL', click on the subheading 'Databases'. This leads to a list of all the databases you have running - I only have one, labelled 'mydomain_com_-_oscommerce'. Yours is probably labelled something similar, it was set up way back when you first ran the set up to setup oscommerce.

 

Clicking on the database name leads to a list of all the tables in the database. To run an SQL, there is a tab at the top labelled 'SQL', click on this.

 

You should be presented with a screen with a big area for entering text, and an option to 'locate the text file'. How you run the SQL file depends on how it was presented to you. Some of the contributions have files labelled 'contribtionSQL' or the like, others just give you the command. If there is a file to run, upload it as you would an image (choose 'browse', etc etc). If you have just the command (like the one you have, ALTER TABLE `products` ADD `customer_id` INT( 11 ) NOT NULL AFTER `manufacturers_id` ;, simply cut and paste the command into the large text box and hit 'go'. Afterwards, you should see some text (hopefully) saying that the SQL has been run successfully.

 

Hope this helps you out - as I said at the beginning, this is all based on my particular scenerio, it's likely to be slightly different for you, but the fundamentals are the same. If you don't know how to access your hosting admin, contact your host or search around their website.

 

~Barbara~

 

 

Thank you so much Barbara, you couldn't have explained it more clearly. It worked perfectly!!!!

now to finnish off the install:D

 

Thanx again!

Nancy:D

Link to comment
Share on other sites

When I first started out in oscommerce, this was one of my biggest probs - no-one acutally told you how to do the SQL statement!!!

 

It is done through an admin tool provided by your host. In my case, I went to my admin area of my hosting information (not of oscommerce), and found a section labelled 'MySQL'. Clicking on this leads to an admin tool called 'phpMyAdmin'.

 

Everyone is different, but you should have access to something like this.

 

In phpMyAdmin, there is a heading 'MySQL', click on the subheading 'Databases'. This leads to a list of all the databases you have running - I only have one, labelled 'mydomain_com_-_oscommerce'. Yours is probably labelled something similar, it was set up way back when you first ran the set up to setup oscommerce.

 

Clicking on the database name leads to a list of all the tables in the database. To run an SQL, there is a tab at the top labelled 'SQL', click on this.

 

You should be presented with a screen with a big area for entering text, and an option to 'locate the text file'. How you run the SQL file depends on how it was presented to you. Some of the contributions have files labelled 'contribtionSQL' or the like, others just give you the command. If there is a file to run, upload it as you would an image (choose 'browse', etc etc). If you have just the command (like the one you have, ALTER TABLE `products` ADD `customer_id` INT( 11 ) NOT NULL AFTER `manufacturers_id` ;, simply cut and paste the command into the large text box and hit 'go'. Afterwards, you should see some text (hopefully) saying that the SQL has been run successfully.

 

Hope this helps you out - as I said at the beginning, this is all based on my particular scenerio, it's likely to be slightly different for you, but the fundamentals are the same. If you don't know how to access your hosting admin, contact your host or search around their website.

 

~Barbara~

I would like to say thank you for this too Barbara. I was new to php, OSc & databases. I am slowly learning the first two, but the database queries I have had great difficulty searching for easy to understand tutorials.

 

Can I just check I have understood properly. When in the database, just click on SQL tab. Do not select any file from the left column first? I am trying to do the all products with pics. It says:

 

1) Run the required sql statement using the allprods.sql.

 

Do I locate this file when in the SQL area & press go? The file says this:

 

insert into configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) values ('880', 'All Products Image Width', 'ALLPROD_IMAGE_WIDTH', '100', 'The pixel width of heading images', '4', '5', '2003-07-31 19:35:01', '2003-07-24 17:45:15', NULL, NULL);
insert into configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) values ('881', 'All Products Image Height', 'ALLPROD_IMAGE_HEIGHT', '80', 'The pixel height of heading images', '4', '6', '2003-07-31 19:34:01', '2003-07-24 17:45:15', NULL, NULL);
INSERT INTO configuration_group (configuration_group_id, configuration_group_title, configuration_group_description, sort_order, visible) VALUES ('29', 'All Products', 'All Product Options', '29', '1');

INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, use_function) VALUES ('','All Products: ON/OFF', 'ALL_PRODUCTS', 'false', 'All Products <br>(true=on false=off)', '29', '1', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), NULL);
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, use_function) VALUES ('','All Products: filename', 'ALL_PRODUCTS_FILENAME', 'allprods.php', 'All Products filename Default=allprods.php', '29', '2', '', now(), NULL);
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, use_function) VALUES ('','All Products: Display Mode', 'ALL_PRODUCTS_DISPLAY_MODE', 'true', 'Display in standard table format <br>(true=on false=off)', '29', '3', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), NULL);

UPDATE configuration SET sort_order = '1' WHERE configuration_title = 'Heading Image Width';
UPDATE configuration SET sort_order = '2' WHERE configuration_title = 'Heading Image Height';
UPDATE configuration SET sort_order = '3' WHERE configuration_title = 'Subcategory Image Width';
UPDATE configuration SET sort_order = '4' WHERE configuration_title = 'Subcategory Image Height';
UPDATE configuration SET sort_order = '5' WHERE configuration_title = 'Small Image Width';
UPDATE configuration SET sort_order = '6' WHERE configuration_title = 'Small Image Height';
UPDATE configuration SET sort_order = '7' WHERE configuration_title = 'Medium Image Width';
UPDATE configuration SET sort_order = '8' WHERE configuration_title = 'Medium Image Height';
UPDATE configuration SET sort_order = '9' WHERE configuration_title = 'Large Image Width';
UPDATE configuration SET sort_order = '10' WHERE configuration_title = 'Large Image Height';
UPDATE configuration SET sort_order = '11' WHERE configuration_title = 'All Products Image Width';
UPDATE configuration SET sort_order = '12' WHERE configuration_title = 'All Products Image Height';
UPDATE configuration SET sort_order = '13' WHERE configuration_title = 'Calculate Image Size';
UPDATE configuration SET sort_order = '14' WHERE configuration_title = 'Image Required';

 

I get confused when looking at this as I'm not sure if it is treated as a whole, or to be done seperately? On the left column I can see a file called configuration, but reading your notes I do not have to go into this first to run the allprods.sql.

:huh:

Thank you

Julie

Edited by warrenerjm
Link to comment
Share on other sites

Yep, you had it right - you do not need to go into the 'files' on the left hand side - these are the different tables that make up the database. Ultimately, the SQL is going into one (or more) of these tables and modifying it slightly (eg, with the code you quoted,

insert into configuration (configuration_id, configu...

it is going into the 'configuration' table and inserting some stuff). I *think* it is possible to go and do this all yourself, manually, but is a lot harder (and takes a lot more time).

 

So, no, you don't need to click on one of the 'files' on the left hand side, just go to the top and click on the 'sql' tab.

 

As for the SQL statement - it looks like what you have is a couple of comands all together - but that's fine, just cut and paste and put them all in the SQL query box (of locate the SQL file) and hit go - it will figure out what needs to be done.

 

9 times out of 10 the code will work fine and you'll get a screen saying that the SQL query was executed successfully. If you do get an error, it is probably because of an error in the SQL query, or it had trouble locating something in one of your tables - post back to the specific contribution forum for help.

 

Incidently, this is why people always say BACKUP BACKUP BACKUP, particularily before you run a SQL query. If you backup (just using the 'backup' feature in your tools section of oscommerce), and something goes wrong, you can just run your backed-up file, and everything will be ok...

 

Hope this helps you out!

 

~Barbara~

Edited by bobsi18
Link to comment
Share on other sites

Incidently, this is why people always say BACKUP BACKUP BACKUP, particularily before you run a SQL query. If you backup (just using the 'backup' feature in your tools section of oscommerce), and something goes wrong, you can just run your backed-up file, and everything will be ok...

 

Hope this helps you out!

 

~Barbara~

It did Barbara. :thumbsup: Thank you. I have now done my first sql query :D successfully :D :D

 

I have a tool in my control panel which says backup database. I do this & it saves it to where I say on my computer. Fine, but I wouldn't know how to run my back up file? At least I have it.

 

Julie

Link to comment
Share on other sites

It did Barbara. :thumbsup: Thank you. I have now done my first sql query :D successfully :D :D

 

I have a tool in my control panel which says backup database. I do this & it saves it to where I say on my computer. Fine, but I wouldn't know how to run my back up file? At least I have it.

 

Julie

Fantastic - always exciting when it works!!! As to the backup - it really depends on our admin as to how you would restore a backup if you needed to. There's probably a 'restore backup' option around where you backup somewhere. If you can't find it, the oscommerce has the same function under 'tools', 'backup'..

:) :) :)

~Barbara~

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...