Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Version 2.2RC2a Help needed


Guest

Recommended Posts

Hi All

 

Please can anyone help!!

 

I have installed the HSBC XML API v2.2 module and all seems to have gone well.

 

When I try to do a purchase on my site I can the following error.

 

________________________________________________________________________________________________________________________________________________

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-a-shopp-26 like 'orders'' at line 1

 

SHOW TABLE STATUS from web38-a-shopp-26 like 'orders'

 

[TEP STOP]

_____________________________________________________________________________________________________________________________________________________

 

Iam running the latest version of OS ( v2.2 RC2a) and PHP version 4.4.9

Can anyone tell me if something has changed because I have had this working with an older version of OS ?

 

Can anyone Help !!

PLEASE

 

Many Thanks

Tony

Link to comment
Share on other sites

Hi All

 

Please can anyone help!!

 

I have installed the HSBC XML API v2.2 module and all seems to have gone well.

 

When I try to do a purchase on my site I can the following error.

 

________________________________________________________________________________________________________________________________________________

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-a-shopp-26 like 'orders'' at line 1

 

SHOW TABLE STATUS from web38-a-shopp-26 like 'orders'

 

[TEP STOP]

_____________________________________________________________________________________________________________________________________________________

 

Iam running the latest version of OS ( v2.2 RC2a) and PHP version 4.4.9

Can anyone tell me if something has changed because I have had this working with an older version of OS ?

 

Can anyone Help !!

PLEASE

 

Many Thanks

Tony

 

MySQL doesn't like the hyphens, open the payment file and change the query to ..

 

$query = "SHOW TABLE STATUS FROM `" . DB_DATABASE . "` LIKE '" . TABLE_ORDERS . "'";

 

It may also be written like ..

 

$result = tep_db_query("SHOW TABLE STATUS FROM `" . DB_DATABASE . "` LIKE '" . TABLE_ORDERS . "'");

Link to comment
Share on other sites

MySQL doesn't like the hyphens, open the payment file and change the query to ..

 

$query = "SHOW TABLE STATUS FROM `" . DB_DATABASE . "` LIKE '" . TABLE_ORDERS . "'";

 

It may also be written like ..

 

$result = tep_db_query("SHOW TABLE STATUS FROM `" . DB_DATABASE . "` LIKE '" . TABLE_ORDERS . "'");

 

 

Hi Robert

Thanks very much for your help

I am finding it difficult to find the line of code to change.

I can see what you mean and it looks good.

I will continue to search the HSBC_API.php file and let you know

 

Many thanks

 

Tony

Link to comment
Share on other sites

MySQL doesn't like the hyphens, open the payment file and change the query to ..

 

$query = "SHOW TABLE STATUS FROM `" . DB_DATABASE . "` LIKE '" . TABLE_ORDERS . "'";

 

It may also be written like ..

 

$result = tep_db_query("SHOW TABLE STATUS FROM `" . DB_DATABASE . "` LIKE '" . TABLE_ORDERS . "'");

 

Thanks Robert

I have managed to find the coding but it all looks good to me, would very much appreciate any comments you have ??

Below is the code that I think is causing me the problem.

_______________________________________________________________________________________________________________

// Calculate expected order id to use as order description (note can be inaccurate if a previous order has been deleted)

if ($use_more_accurate_order_id === true) {

// More Accurate way of getting expected order id but may not work for everyone - if not change setting at top of file

$last_order_id_query = tep_db_query("SHOW TABLE STATUS from " . DB_DATABASE . " like '" . TABLE_ORDERS . "'");

$last_order_id = tep_db_fetch_array($last_order_id_query);

$new_order_id = $last_order_id['Auto_increment'];

} else {

$last_order_query = "SELECT `orders_id` from `" . TABLE_ORDERS . "` ORDER BY `orders_id` DESC LIMIT 1";

$last_order = tep_db_fetch_array(tep_db_query($last_order_query));

$new_order_id = (int)$last_order['orders_id'] + 1;

}

$order_description = 'Order Number: ' . $new_order_id;

________________________________________________________________________________________________________________________

 

 

I have tried changing the "$use_more_accurate_order_id" to false but it is still the same !

 

Many Thanks

Tony

Link to comment
Share on other sites

Thanks Robert

I have managed to find the coding but it all looks good to me, would very much appreciate any comments you have ??

Below is the code that I think is causing me the problem.

_______________________________________________________________________________________________________________

// Calculate expected order id to use as order description (note can be inaccurate if a previous order has been deleted)

if ($use_more_accurate_order_id === true) {

// More Accurate way of getting expected order id but may not work for everyone - if not change setting at top of file

$last_order_id_query = tep_db_query("SHOW TABLE STATUS from " . DB_DATABASE . " like '" . TABLE_ORDERS . "'");

$last_order_id = tep_db_fetch_array($last_order_id_query);

$new_order_id = $last_order_id['Auto_increment'];

} else {

$last_order_query = "SELECT `orders_id` from `" . TABLE_ORDERS . "` ORDER BY `orders_id` DESC LIMIT 1";

$last_order = tep_db_fetch_array(tep_db_query($last_order_query));

$new_order_id = (int)$last_order['orders_id'] + 1;

}

$order_description = 'Order Number: ' . $new_order_id;

________________________________________________________________________________________________________________________

 

 

I have tried changing the "$use_more_accurate_order_id" to false but it is still the same !

 

Many Thanks

Tony

$last_order_id_query = tep_db_query("SHOW TABLE STATUS from `" . DB_DATABASE . "` like '" . TABLE_ORDERS . "'");

Link to comment
Share on other sites

$last_order_id_query = tep_db_query("SHOW TABLE STATUS from `" . DB_DATABASE . "` like '" . TABLE_ORDERS . "'");

 

Thanks For your very quick reply

 

I will try that soon and let you know

 

Tony

Link to comment
Share on other sites

Hi Robert

 

Just to let you know I have tried hyphens but it is still the same!!

 

Back to the drawing board.

 

any ideas welcome

 

Thanks for all our help

 

Tony

Link to comment
Share on other sites

Did this add-on successfully create a database named web38-a-shopp-26? If so, it's probably a valid name, hyphens and all. Does your particular server installation need something like an account name prepended to the database name (e.g., MyServerAccountName_web38-a-shopp-26)? If you're sharing a MySQL server, you often need something like that to distinguish you from the other users. You added the backticks ` around the database name, and it still didn't work? You have a table named orders?

 

Just for grins, try removing the from DATABASE clause and see what happens:

$last_order_id_query = tep_db_query("SHOW TABLE STATUS like '" . TABLE_ORDERS . "'");

Maybe try running that manually from phpMyAdmin's SQL tab. You could also try the original query (with the from DATABASE) there and see if it gives any more clues as to what it doesn't like:

SHOW TABLE STATUS from web38-a-shopp-26 like 'orders'
SHOW TABLE STATUS from MyServerAccountName_web38-a-shopp-26 like 'orders'
SHOW TABLE STATUS like 'orders'
SHOW TABLE STATUS

Link to comment
Share on other sites

As far as I can tell .. the original error ..

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-a-shopp-26 like 'orders'' at line 1

SHOW TABLE STATUS from web38-a-shopp-26 like 'orders'

 

should have been solved by adding the back ticks.

Link to comment
Share on other sites

Did this add-on successfully create a database named web38-a-shopp-26? If so, it's probably a valid name, hyphens and all. Does your particular server installation need something like an account name prepended to the database name (e.g., MyServerAccountName_web38-a-shopp-26)? If you're sharing a MySQL server, you often need something like that to distinguish you from the other users. You added the backticks ` around the database name, and it still didn't work? You have a table named orders?

 

Just for grins, try removing the from DATABASE clause and see what happens:

$last_order_id_query = tep_db_query("SHOW TABLE STATUS like '" . TABLE_ORDERS . "'");

Maybe try running that manually from phpMyAdmin's SQL tab. You could also try the original query (with the from DATABASE) there and see if it gives any more clues as to what it doesn't like:

SHOW TABLE STATUS from web38-a-shopp-26 like 'orders'
SHOW TABLE STATUS from MyServerAccountName_web38-a-shopp-26 like 'orders'
SHOW TABLE STATUS like 'orders'
SHOW TABLE STATUS

Hi Phil

Thanks for your input.

I do not have a shared database and yes it is there as web38-a-shopp-26 and contains a table 'orders'

I have just tried removing the form DATABASE clause but still the same error as above

I am working in the HSBC_API_PROCESS.php file , Do you think I could be in the wrong place altogether??

 

This was supposed to be a quick favour for someone Ha Ha.

 

Many Thanks for your help

 

Tony

Link to comment
Share on other sites

Hi Phil

I have just opened my database from phpMyAdmin's SQL tab and tried the following query

 

SHOW TABLE STATUS from web38-a-shopp-26 like 'orders'

SHOW TABLE STATUS like 'orders'

SHOW TABLE STATUS

 

And I get the same error

 

but if I just try..

SHOW TABLE STATUS

I then get a result

 

I then tried

SHOW TABLE STATUS like 'customers'

and I get the same error

 

If I type in...

SELECT * FROM `orders` WHERE 1

I get to see all the orders

 

 

Should that tell me something, I'am confused!!

 

Thanks Tony

Link to comment
Share on other sites

Hi Phil

I have just opened my database from phpMyAdmin's SQL tab and tried the following query

 

SHOW TABLE STATUS from web38-a-shopp-26 like 'orders'

SHOW TABLE STATUS like 'orders'

SHOW TABLE STATUS

 

And I get the same error

 

but if I just try..

SHOW TABLE STATUS

I then get a result

 

I then tried

SHOW TABLE STATUS like 'customers'

and I get the same error

 

If I type in...

SELECT * FROM `orders` WHERE 1

I get to see all the orders

 

 

Should that tell me something, I'am confused!!

 

Thanks Tony

 

You are still not testing with what I originally said which was ..

 

SHOW TABLE STATUS from `web38-a-shopp-26` like 'orders'

Link to comment
Share on other sites

You are still not testing with what I originally said which was ..

 

SHOW TABLE STATUS from `web38-a-shopp-26` like 'orders'

 

OK thanks Robert

 

typed in

 

SHOW TABLE STATUS from `web38-a-shopp-26` like 'orders'

 

and I get a result

 

so I have tried the following in my site.

 

$last_order_id_query = tep_db_query("SHOW TABLE STATUS from `" . DB_DATABASE . "` like '" . TABLE_ORDERS . "'");

 

but should it have been

 

$last_order_id_query = tep_db_query("SHOW TABLE STATUS from ` . DB_DATABASE . ` like '" . TABLE_ORDERS . "'");

 

I will try it.

 

Many Thanks

Tony

Link to comment
Share on other sites

typed in

 

SHOW TABLE STATUS from `web38-a-shopp-26` like 'orders'

 

and I get a result

Where did you run this? This is in phpMyAdmin? Which database were you in, if any?

 

so I have tried the following in my site.

 

$last_order_id_query = tep_db_query("SHOW TABLE STATUS from `" . DB_DATABASE . "` like '" . TABLE_ORDERS . "'");

 

but should it have been

 

$last_order_id_query = tep_db_query("SHOW TABLE STATUS from ` . DB_DATABASE . ` like '" . TABLE_ORDERS . "'");

What? No, DB_DATABASE should be defined as a string "web38-a-shopp-26". In order for PHP to substitute the string for it, it has to be outside the other strings (delimited by "). The dot operator "." says to concatenate strings together. The individual strings are SHOW TABLE STATUS from `, web38-a-shopp-26, ` like ', orders, and '. So, the first line was correct. If you use the second line, you should get a query SHOW TABLE STATUS from ` . DB_DATABASE . ` like 'orders', which I would not expect to work (because DB_DATABASE hasn't been substituted).

 

Just to confirm, you have a database named web38-a-shopp-26, not a table? Does it have a table named orders? I can go into phpMyAdmin and into one database, open the SQL tag, and run queries like show table status from `<one of my databases>` like '<table in that db>'; and it works fine. Notice that I put a semicolon at the end of the command -- you could try that:

]$last_order_id_query = tep_db_query("SHOW TABLE STATUS from ` . DB_DATABASE . ` like '" . TABLE_ORDERS . "';");

and see if it makes any difference.

Link to comment
Share on other sites

]$last_order_id_query = tep_db_query("SHOW TABLE STATUS from ` . DB_DATABASE . ` like '" . TABLE_ORDERS . "';");

 

Hi Phil

 

Just tried the above code and get the same error..

Would you be interested in taking a look into this problem for me?

 

Thanks for all your help

Tony

Link to comment
Share on other sites

Do NOT use that code! It is wrong! You must put the missing " (2 of them) back in, to get a proper PHP statement.

 

Now, if once the PHP code is fixed you still get an error, you need to go into phpMyAdmin and go to the SQL tab (probably within one of your databases), or if you have MySQL command line capability, and run the following command:

SHOW TABLE STATUS from `web38-a-shopp-26` like 'orders';

Does it list the characteristics of one table?

 

If not, do you actually have a database named web38-a-shopp-26? Do you need to add your account name or something to that name? Your hosting service can help you with that one. If there is no such database, that's your problem. Maybe you skipped its setup step? If there is such a database, is there a table named orders within it?

Link to comment
Share on other sites

Hi Phil

when I open MySQL I have a left margin that lists my database (web38-a-shopp-26(49))and under that it says "Select a database".

now I select the MySQL tab and enter the code that follows and I get a result showing that there are 12 orders in the order table (via Paypal)

SHOW TABLE STATUS from `web38-a-shopp-26` like 'orders';

But what code should I put into my payment_process file on my site??

Thanks

Tony

Link to comment
Share on other sites

[Rewinds to post 6]

 

$last_order_id_query = tep_db_query("SHOW TABLE STATUS from `" . DB_DATABASE . "` like '" . TABLE_ORDERS . "'");

Link to comment
Share on other sites

Hi All

OK I thing that works!!

I now get a message that says there is a problem with your card payment, Possibly something to do with the bank settings I will take a look.

 

Thank You both for all your help!

I must have been doing something wrong..

 

Tony

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...