Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need __FILE__ and __LINE__ passed to tep_db_error


swatgear

Recommended Posts

Posted

I don't know about you guys but I find it completely rediculous that the tep_db_error function does not display the __FILE__ and __LINE__ the error occurs on.

 

oscommerce is so confusing I spent about 3 hours yesterday and still couldn't get it to pass the constants correctly.

 

Does anyone have a working solution to this?

 

Without the __FILE__ and __LINE__ of the error it's near impossible to debug this thing.

 

 

Thanks,

Chris.

Posted

tep_db_error displays the error that is returned my MySQL.

 

MySQL does not return the File and Line because it is not given a File and Line.

 

If you want, you can post the error that tep_db_error is giving you, and I'll tell you what is causing it (or try to at least.)

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

The thing is I've modified (and need to modify) the database to suit my needs.

 

One such modification is that of adding two more image fields to the database and modifying the original as well.

 

Now that I've done this I have to go through and modify all the sql statements that request products_image to products_image_sml. This is not a surprise to me. The problem is that the calls are very hard to track down because it doesn't show you where they are coming from.

 

The way things SHOULD have been done (because honestly I can't imagine anyone being able to work with this otherwise) is to modify the tep_db_query function to include the __FILE__ and __LINE__ constants each time it is called.

 

For example the original function definition is:

 

function tep_db_query($query, $link = 'db_link')

 

And I think it should be:

 

function tep_db_query($query, $link = 'db_link', $curFile, $curLine)

 

Normally the function is used like this:

 

tep_db_query($sql_statement);

 

When it would instead be used like this:

 

tep_db_query($sql_statement,__FILE__,__LINE__);

 

One thing I'm confused about is the part in the original function declaration that says "$link = 'db_link'". I come from an ASP background and as far as I know vbscript does not support that sort of argument definition.

 

Why would they put that as an argument instead of just defining a local variable to the function?

 

What I mean is why do they do this:

 

function tep_db_query($query, $link = 'db_link')

 

Instead of this:

 

function tep_db_query($query)

{

$link = 'db_link';

 

?

 

 

Thanks,

Chris.

 

p.s. Hopefully I made sense. ;)

Posted

just a suggestion how i solved it without using additional table fields:

the "regular" image is auto-resized to 200x180. the big image is placed into a subdirectory called images_big... the popup image code parses out the filepath and uses image_big/filename instead of filename...

simple solution :)

Posted

You are right. That is a good solution.

 

Another thing I was thinking about was creating a new table that contained records regarding media for a certain product. Each item would have a code, and url. For example:

 

1 = small image

2 = large image

3 = huge image

4 = 360 degree quicktime image

5 = etc.

 

 

Thanks for your suggestion.

Archived

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

×
×
  • Create New...