Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help with 1054 error please


BA172

Recommended Posts

Hi, I'm new to the forum and to using OS Commerce. I'm hoping to resolve the issues I have and run OSC for my business, but I'm not a programmer so I'm having a little trouble. To be fair I can program html and dabble in java enough to do simple things, I've run several small websites over the years but never used php, sql, xml or anything until very recently. I follow directions well though, heh...

 

I installed OSC a couple of days ago and have been adding, editing and setting things up for the site trying to see if it will work for me. I still have a fresh install, no templates and only a couple of small contribs. When trying to edit "Orders Status" under "Localization" in the admin panel anything I try to change, whether it be making a new status or editing an existing one I get this error:

 

1054 - Unknown column 'public_flag' in 'field list'

insert into orders_status (orders_status_name, public_flag, downloads_flag, orders_status_id, language_id) values ('Shipped', '0', '0', '4', '1')

[TEP STOP]

 

Now is this telling me to edit the file "orders_status.php"? I'm just trying to figure out the problem and a solution, but I have zero PHP background outside of following detailed directions to make changes.

 

Any help is greatly appreciated, I'm sure I'll be back a few more times to bug ya if I can get this figured out. :lol:

Link to comment
Share on other sites

public_flag, downloads_flag do not exist on default osC, check your mods

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

I have only added:

 

http://addons.oscommerce.com/info/4859

 

http://addons.oscommerce.com/info/6170

 

I started to add:

 

http://addons.oscommerce.com/info/2821

 

But when it seemed to get complicated I stopped and undid everything I did.

 

Does that help any? I only have myself and my friend with admin rights, but we both work on the site together so I know there's nothing else done that I'm not aware of. I'd appreciate any help, please! :unsure:

Link to comment
Share on other sites

I have only added:

 

http://addons.oscommerce.com/info/4859

 

http://addons.oscommerce.com/info/6170

 

I started to add:

 

http://addons.oscommerce.com/info/2821

 

But when it seemed to get complicated I stopped and undid everything I did.

 

Does that help any? I only have myself and my friend with admin rights, but we both work on the site together so I know there's nothing else done that I'm not aware of. I'd appreciate any help, please! :unsure:

 

If you was updating latest version why not replace the files minus config ones and you will be ok, unless its a modified site layout wise?

Link to comment
Share on other sites

If you was updating latest version why not replace the files minus config ones and you will be ok, unless its a modified site layout wise?

It's still the original layout, I have only installed those 2 contribs. I wasn't updating, it is a fresh install. Can anyone even tell me what the error means to perhaps help me get started in the right direction? My entire decision to go with OSC was because it seemed to be stable, but problems like this make me worry - I don't know PHP, I'm trying to learn, but if problems like this arise after I launch my store how do I get help? :(

Link to comment
Share on other sites

It's still the original layout, I have only installed those 2 contribs. I wasn't updating, it is a fresh install.

 

well, if you were making changes, you were updating. :)

 

My entire decision to go with OSC was because it seemed to be stable, but problems like this make me worry

 

osc is pretty stable. the problems are occurring when you start making changes. if you don't follow the directions exactly, then you can run into a little trouble - like you're seeing now. backups are always good, as they allow you to start over without beating your head against the wall too much.

 

as far as your original question goes,

 

1054 - Unknown column 'public_flag' in 'field list'

insert into orders_status (orders_status_name, public_flag, downloads_flag, orders_status_id, language_id) values ('Shipped', '0', '0', '4', '1')

 

take a look at your orders_status table. this sql statement is saying to insert a new record into the table and set the 'public_flag' column to a value... in this case '0'. the message 'unknown column' simply means that the column named 'public_flag' does not exist in the table. this is a standard column name and should be in the table.

 

most likely, this error is happening due to your product not found contribution, since the other two don't look like they'd mess with the tables much. did your install instructions say to rename or remove this column name? if so, then this error is probably the result of some extra reference to the column that wasn't removed as part of the instructions.

 

whenever changes are made to the tables, it's important to make sure each and every reference to the 'old way' is updated. this can be made more confusing if you install a contribution that makes new use of a table, and then install another contribution which changes the table. the second contribution just doesn't know all the other references that are not part of 'standard osc.'

Link to comment
Share on other sites

well, if you were making changes, you were updating. :)

My mistake, I thought you meant I was updating an older version of OSC. ;)

 

take a look at your orders_status table. this sql statement is saying to insert a new record into the table and set the 'public_flag' column to a value... in this case '0'. the message 'unknown column' simply means that the column named 'public_flag' does not exist in the table. this is a standard column name and should be in the table.

I restored my orders_status.php from an original, unmodified version from my original install before any changes were made at all and I still get the same error. What you're telling me is sort of what I expected that message to mean, I'm still learning PHP at W3 schools so hopefully what you say will make more sense in a day or so - but shouldn't I not be having this problem with a fresh, uncorrupted version of this file?

 

most likely, this error is happening due to your product not found contribution, since the other two don't look like they'd mess with the tables much. did your install instructions say to rename or remove this column name? if so, then this error is probably the result of some extra reference to the column that wasn't removed as part of the instructions.

The product not found contrib instructions (minus specific details):

 

INDEX OF DOCUMENTED STEPS:

STEP#1 - add defines to .../Catalog/Includes/language/"your language here"/product_info.php

STEP#2 - edit lines in .../Catalog/product_info.php

STEP#3 - Optional updates for MySQL 5, (necessary if you have mysql 5 installed)

STEP#4 - edit .../Catalog/Includes/Seo_cache.php (necessary if you have cName pName mod installed)

 

I only did steps 1 & part of 2 before stopping and undoing this, even so, neither of these affected my orders_status.php file.

 

My other 2 contribs were pretty simple, CSS editor and "about us" page. I've checked and rechecked my steps and nothing I've done has involved me changing the orders_status page. Does anyone know the architecture of OSC enough to maybe speculate about another file that would impact the orders_status page? Otherwise I'm really stumped... I can post my code for this page if it would help anyone, but it should be a fresh page as I reinstalled from the .zip I downloaded OSC in originally...

 

I really appreciate your time helping me, please keep the suggestions coming. :)

Link to comment
Share on other sites

I really appreciate your time helping me, please keep the suggestions coming. :)

 

once again, check your orders_status table. use phpmyadmin to do this. you're looking for a column named 'public_flag'. if it's not there, you will need to add it in, or restore the table from your backup. (you did make a backup, right? :) )

 

if you've only made changes to your code and not your database then i can't explain why you're getting this error, other than possibly the table is corrupt or something. either way, the failure of the sql statement is due to the missing column name. put it back and things should be better.

Link to comment
Share on other sites

once again, check your orders_status table. use phpmyadmin to do this. you're looking for a column named 'public_flag'. if it's not there, you will need to add it in, or restore the table from your backup. (you did make a backup, right? :) )

As I said in my last post I restored from the original install .zip file and still have the same result. I haven't screwed anything up badly enough (yet) to need to reinstall or reload from a full backup.

On a side note, is there a problem using Dreamweaver to edit these files or do I have to use phpmyadmin? I've been using DW so far without issue, but your statement does have me a little concerned. :huh:

I know I can't use a normal text editor as it will insert other characters or markers or something, but DW has worked well so far.

 

if you've only made changes to your code and not your database then i can't explain why you're getting this error, other than possibly the table is corrupt or something. either way, the failure of the sql statement is due to the missing column name. put it back and things should be better.

I hate to seem dense or stupid but I've opened this file up and gone over it time and time again and even with the small bit of PHP I'm learning (I've been reading W3 schools for 2 days now) I still don't understand where or what this missing column name is. It's a missing variable, right? Is it the declaration of the variable or a missing call to one?

Seeing as how this is a brand new, unedited, freshly restored file (orders_status.php) is it possible that the problem is from another file? I'm still trying to figure out the architecture of OSC so I'm not even sure which files call to orders_status or what files orders_status calls to...

 

I am sincerely not trying to be helpless here, but I searched this all over here and google and I got no 1054 error that matched mine, and the other 1054 errors I found didn't help me make sense of my problem. Is it possible for someone to post a line of code to check around for this in the orders_status file? Perhaps compare my orders_status file to theirs? Mine is 273 lines long with the last command on line 272...

 

Anything to help would be great, and thanks again.

Link to comment
Share on other sites

Do a search through your entire osCommerce code-base for the phrases "public_flag" and "downloads_flag". These phrases do not appear in the standard osCommerce v2.2 code-base, so something was changed somewhere. Lines 28 and 37 of admin/orders_status.php look like good places to check as well. They should look like:

$sql_data_array = array('orders_status_name' => tep_db_prepare_input($orders_status_name_array[$language_id]));

and

$insert_sql_data = array('orders_status_id' => $orders_status_id, 'language_id' => $language_id);

respectively.

 

I've never really used Dreamweaver to edit PHP code, so can't say much about its effectiveness. If you want a good raw-code editor, get Notepad++. It's free and it handles PHP well.

 

phpMyAdmin is not a PHP editor, it's a web-based utility (written in PHP) for administering MySQL databases.

 

If you don't know how to directly access, view and modify your MySQL database -- using either a tool like phpMyAdmin or the via command-line -- you aren't going to have much success installing mods of any complexity. Learning only PHP isn't going to be enough; spending time learning how to use and interact with MySQL is necessary too.

Link to comment
Share on other sites

Well, it would seem that "public_flag" and "downloads_flag" do in fact exist in oscommerce-2.2rc2a. I checked the oscommerce-2.2rc2a\catalog\install\oscommerce.sql file, and the orders_status table has both those columns. oscommerce-2.2rc2a\catalog\admin\orders_status.php expects those columns to be there (see lines 28-30).

 

I installed a fresh copy of oscommerce-2.2rc2a and inserted a new order status in the system. Everything seemed to work fine. That would seem to indicate that you are using oscommerce-2.2rc2a PHP code with a MySQL database created from some other version of osCommerce, or that you have multiple osCommerce MySQL databases running, and your PHP code is using the wrong one.

 

Installing and running phpMyAdmin would still help you track this problem down.

Link to comment
Share on other sites

/bump

 

i'm not talking about looking in your .php files, but in your database. the 'public_flag' is a column name found in the default osc database schema. so i'm sure it's being used and is even supposed to be used. my question is whether or not you find it in your database table.

 

dreamweaver allows you to edit html and/or php files...but it won't show you what is in the database. for that, you need phpmyadmin or an equivalent, as logiczero said. you will have to use your host's control panel and look at your mysql *database*.

Link to comment
Share on other sites

Well, it would seem that "public_flag" and "downloads_flag" do in fact exist in oscommerce-2.2rc2a. I checked the oscommerce-2.2rc2a\catalog\install\oscommerce.sql file, and the orders_status table has both those columns. oscommerce-2.2rc2a\catalog\admin\orders_status.php expects those columns to be there (see lines 28-30).

 

I installed a fresh copy of oscommerce-2.2rc2a and inserted a new order status in the system. Everything seemed to work fine. That would seem to indicate that you are using oscommerce-2.2rc2a PHP code with a MySQL database created from some other version of osCommerce, or that you have multiple osCommerce MySQL databases running, and your PHP code is using the wrong one.

 

Installing and running phpMyAdmin would still help you track this problem down.

I have phpmyadmin installed at my host, I figured out something this morning which had been puzzling me for some time - my host moved my website to a new sql server last week but didn't actually migrate the DB over. It's complicated to explain so I'll just say that the shop was still working because it was still housed on the old sql server - but with their moving my domain the phpmyadmin pointed to a new DB that was blank. I couldn't understand what I was doing wrong because everytime I logged into phpmyadmin it showed zero tables.

Anyway, now that it's fixed and I can see the tables it makes it a little easier for me to comprehend what folks are telling me and what I'm reading about editing things in the DB directly.

You raise a very important question here that never crossed my mind. When I first setup the DB I also turned on OSC at my host (they offer it as a free, default E-commerce solution there) but I could never get it to agree with what I was trying to do so I scrapped their version and installed from a downloaded .zip file and it seemed to fix my problems until this one. Is there a place in phpmyadmin to check which version the DB is tied to? Because it seems that it could be possible that DB was established by my host for what may have been an older version of OSC and that might be my issue. I tried looking in phpmyadmin for a version somewhere, but no luck thus far - I'm still looking as I type this.

Thanks so much this far, you made me realize that this may possibly be my issue and I never would have thought of it otherwise.

 

i'm not talking about looking in your .php files, but in your database. the 'public_flag' is a column name found in the default osc database schema. so i'm sure it's being used and is even supposed to be used. my question is whether or not you find it in your database table.

Is schema a generic term for the entire table set? I ask because I've seen that term used but I am not familiar with it and I haven't found a file named "schema" anywhere.

Thanks to you guys helping point me in the right direction I am learning more as I go and as I continue to read everything on here I can find. I got a book in today on OSC and I have been taking the "classes" at W3C on all these languages to try and get a better understanding.

I know that I can't get by on just php alone, the W3C website recommended I go back and learn everything from javascript on up through php, so I've been learning JS again so I can move on to XML, SQL and PHP.

I'm trying really hard to get a grasp, so thanks in the meantime for your patience.

 

If there is a place to check my DB version in phpmyadmin please let me know, at least then I can solve my issue of perhaps needing to backup my DB and reload everything. :blush:

Link to comment
Share on other sites

well, your host moving things around on you certainly explains things. :)

 

as far as the version goes, when you're in phpmyadmin, go to the 'sql' tab so you can enter a raw sql query and type in the following:

select version();

 

then click on the [go] button. that'll always tell you the version of mysql. osc doesn't care which version it uses, 4 or 5 - so that's not an issue. this problem at least is because the code is looking for data that isn't there.

 

yes, 'schema' is a term that describes the tables, their relationships and even stored procedures (which osc doesn't make use of). it's not a single file you can look at, but rather the collection of all the tables.

Link to comment
Share on other sites

as far as the version goes, when you're in phpmyadmin, go to the 'sql' tab so you can enter a raw sql query and type in the following:

select version();

 

then click on the [go] button. that'll always tell you the version of mysql. osc doesn't care which version it uses, 4 or 5 - so that's not an issue. this problem at least is because the code is looking for data that isn't there.

I meant is there a way I can find out which version of OSC the DB set itself up for. My post above explains why there is a possibility that the DB was setup for an older version of OSC which might explain the discrepancies.

 

Let me ask you, if I backup my entire root directory (I did not use the /catalog folder), backup my DB, and then delete my existing DB and reinstall OSC from the ground up using the newest version, then restore my DB would that likely fix my problem? I can only assume that this is somehow my problem since I don't know enough to delete or add fields in the DB and I never edited or changed in any way the .php files in question...

 

Any other thoughts? ;)

 

Again I appreciate the help and feedback as it's really helping me sort out my issues.

Link to comment
Share on other sites

/bump

 

Can anyone answer my last question? I'm trying to figure out if there is a way to know which version of OSC my DB was setup for. It may be the cause/solution of my entire problem.

Link to comment
Share on other sites

I'm trying to figure out if there is a way to know which version of OSC my DB was setup for. It may be the cause/solution of my entire problem.

If your site is functioning at all, then there is a page that will tell what version of osCommerce *PHP* code you're using:

http://www.mywebsite.com/admin/server_info.php

This page has lots of other useful information as well.

 

If that page doesn't work, then look in catalog/includes/application_top.php. Somewhere near the top of the file (line 37 in 2.2rc2a) there is a line like this:

define('PROJECT_VERSION', 'osCommerce Online Merchant v2.2 RC2a');

According to the 2.2rc2a changelog, active download flag and a public status flag were added to the order status levels in v. 2.2rc2 (not 2a), so if your PHP code is earlier than that version, you're going to have problems.

 

It may be easier to simply reinstall osCommerce and point it to your new database server, rather than fight with trying to fix an older version of the database.

Link to comment
Share on other sites

You have installed RC2 but the data base is taken form oscommerce previous version.

 

When an upgrade was done YOu did not fire the needed sql queries.

 

Chek the update doc and fire those queries to add filed and tables that are missing.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

I apologize for my slow reply, I was evacuated trying to get away from hurricane Gustav and am only just getting internet access again.

 

What has apparently happened then is what I mentioned above, I created the database "accidentally" when I turned OSC on through my webhost (it's provided as a free service). When I ran into problems with their installation I erased the entire thing and installed new with a new download of OSC. I thought my DB was deleted and recreated with the new install but apparently it was not.

 

My questions is this - how can I rectify this since I haven't learned how to edit my DB in SQL or myphpadmin yet? Can I backup the database, backup my entire FTP site (folders, subfolders, files, etc) and then delete everything, reinstall a fresh version to a fresh DB and then restore my older DB and replace all my FTP files? I had been studying php, sql, xml, etc up until I had to evacuate last week and then I was without power or any other facilities for many days. I am only just getting back now and trying to play catchup - so any help on this would be VERY appreciated. :)

Link to comment
Share on other sites

Use PhpMyAdmin and manipulate DB.

 

Thats the fastest and not too complex if You are learning.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

Use PhpMyAdmin and manipulate DB.

 

Thats the fastest and not too complex if You are learning.

With all respect, I am trying to learn but I have no idea how to do what you are proposing. I wouldn't know where to go to do this, what to type, where to type it, etc - I mean no clue at all.

 

That's why I was asking if I could just do the backups and then reinstall from the ground up to fix my DB issues... As always, any help is greatly appreciated.

Link to comment
Share on other sites

  • 2 weeks later...

'public_flag' in 'field list'

 

Did You add this field.

 

Also chek the sql that were to fired when installing contrib or updating cart.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...