Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

What is the difference?


lildog

Recommended Posts

Could someone please tell me what the difference is between these two lines? Why does one work on one store and one on another?

 

Which is osCommerce correct?

 

tep_db_query("update " . TABLE_CONTRIB_TRACKER . " set contr_last_modified = now(), status =  '" . $HTTP_POST_VARS['status'] . "',contrib_name =  '" . $HTTP_POST_VARS['contrib_name_new'] . "', contrib_link =  '" . $HTTP_POST_VARS['contrib_link_new'] . "', config_comments = '" . $HTTP_POST_VARS['config_comments'] . "', last_update = '" . $HTTP_POST_VARS['last_update'] . "', note_created = '" . $HTTP_POST_VARS['note_created'] . "',contrib_vers= '" . $HTTP_POST_VARS['contrib_vers'] . "'  where contr_id = '" . $HTTP_POST_VARS['contr_id'] . "'");

  

tep_db_query("update " . TABLE_CONTRIB_TRACKER . " set contr_last_modified = now(), status = '" . $status . "',contrib_name = '" . $contrib_name_new . "', contrib_link = '" . $contrib_link_new . "', config_comments = '" . $config_comments . "', last_update = '" . $last_update . "', contrib_vers= '" . $contrib_vers . "' where contr_id = '" . $HTTP_POST_VARS['contr_id'] . "'");

Link to comment
Share on other sites

One difference is they don't have the same number of fields. But main difference is where the data is being loaded from. One loads right from the POST entries while the other uses local varialbes, which are probably pbtained from the POST entries.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 2 weeks later...

Jack,

Thank you for your reply. the extra field in the first query is not needed. Shouldn't both variations work about the same? One just creates variables via OSC code and the other doesn't. This does not nessessarily need to apply to the two queries I posted, just in general. I am trying to grasp the subtle differences in code for future reference, in case I need to move my shop to another server, or my server changes, etc. Also it will help me write code that is more compatible all around.

 

Thank you,

lildog

Link to comment
Share on other sites

They will work te same. However, using the version with variables is more versatile. If you come back a month from now and need to change the code so that one of the variables is checked for validity, you would have a larger job to do. It is generally better to do that upfront. Of course, if you are absolutely sure you won't need that, it keeps code size down by skipping the variables.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

They will work te same. However, using the version with variables is more versatile. If you come back a month from now and need to change the code so that one of the variables is checked for validity, you would have a larger job to do. It is generally better to do that upfront. Of course, if you are absolutely sure you won't need that, it keeps code size down by skipping the variables.

 

Jack

 

Thanks Jack I appreciate your guidance. It sounds like it will be worth a bit more work and use variables, because I always WANT to be absolutely sure but I honestly never am. There seems to alsways be room for improvement.

 

Have a great day,

lildog

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...