OSCOMMERCE SUPPORT CALL 702-453-3332

 

Help - Search - Members - Calendar
Full Version: 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 'where pr
osCommerce Community Support Forums > osCommerce Online Merchant v2.x > General Support
jicedel
Hi,
When I want to change the price for a certain group I have the following

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 'where products_attributes_id = '31'' at line 1

update products_attributes se where products_attributes_id = '31'


Anybody an idea how to correct it ?
geoffreywalton
The code you are using is invalid.

Try following the sql link in my sig block.

There need to be a set element in the sql code.
jicedel
hI
i JUST MADE THE FOLLOWING

Solution:

Line 67 in catalog/includes/classes/split_page_results.php must be changed from:

$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;

to:

$this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page;

Line 38 in catalog/admin/includes/classes/split_page_results.php must be changed from:

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

to:

$sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page;

BUT ALWAYS SAME ERROR

???

Thanks
geoffreywalton
Does the first post refer to some code you are running via phpmyadmin and an sql window or a page on your shop?

If so the command should be in the form

update products_attributes set fied_a = 93 where products_attributes_id = '31'

Don't understand your second post, does it refer to the first?

(I might be having one of my blind moments so if anyone can help me out here.....)
Coopco
QUOTE (geoffreywalton @ Jan 11 2008, 01:09 AM) *
Does the first post refer to some code you are running via phpmyadmin and an sql window or a page on your shop?

If so the command should be in the form

update products_attributes set fied_a = 93 where products_attributes_id = '31'

Don't understand your second post, does it refer to the first?

(I might be having one of my blind moments so if anyone can help me out here.....)

It is, apparently, a solution to the first post.
jicedel
Hi again,
in fact it's a solution regarding the first post.
I found it on the forum

The first post refer to a web page from my web site.
In the admin section when I want to update an product attibute for a group, I receive the popup window, I change the price for the specified group and when I do save, I receive the error 1064,......

ID31 is the id of this product atribute but do the same with all atibutes.

Thanks
Jan Zonjee
QUOTE (jicedel @ Jan 9 2008, 11:16 PM) *
When I want to change the price for a certain group I have the following

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 'where products_attributes_id = '31'' at line 1

update products_attributes se where products_attributes_id = '31'

A. You are posting in the wrong forum. SPPC has it's own support thread.
B. This is a page that comes with SPPC, so no need to do make any manual changes. The query that gives is an error is triggered by line 45 in that file (admin/attributes_groups.php):
CODE
                tep_db_perform(TABLE_PRODUCTS_ATTRIBUTES_GROUPS, $sql_data_array, 'update', "products_attributes_id = '" . (int)$_POST['attribute_id'] . "' and customers_group_id = '" . (int)$customer_group_id . "'");
            } // end elseif ($data_array['in_db'] == '1')

The function tep_db_perform is in your admin/includes/functions/database.php which file is not changed by SPPC:
CODE
  function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {
    reset($data);
    if ($action == 'insert') {
      $query = 'insert into ' . $table . ' (';
      while (list($columns, ) = each($data)) {
        $query .= $columns . ', ';
      }
      $query = substr($query, 0, -2) . ') values (';
      reset($data);
      while (list(, $value) = each($data)) {
        switch ((string)$value) {
          case 'now()':
            $query .= 'now(), ';
            break;
          case 'null':
            $query .= 'null, ';
            break;
          default:
            $query .= '\'' . tep_db_input($value) . '\', ';
            break;
        }
      }
      $query = substr($query, 0, -2) . ')';
    } elseif ($action == 'update') {
      $query = 'update ' . $table . ' set ';
      while (list($columns, $value) = each($data)) {
        switch ((string)$value) {
          case 'now()':
            $query .= $columns . ' = now(), ';
            break;
          case 'null':
            $query .= $columns .= ' = null, ';
            break;
          default:
            $query .= $columns . ' = \'' . tep_db_input($value) . '\', ';
            break;
        }
      }
      $query = substr($query, 0, -2) . ' where ' . $parameters;
    }

    return tep_db_query($query, $link);
  }

And now the error is that ' set ' becomes ' se' and the rest after it is mostly gone?

My question: how on earth do you manage to f***k this up? mad.gif
jicedel
Hi Jan,

sorry to disturb you again,

I checked my files

admin/attributes_groups.php
and
admin/includes/functions/database.php

but I have the same that you write.

I'm very sorry but I don't understand
Thanks
jicedel
Case closed

the following was missing

INSERT INTO `customers_groups` VALUES('0','Retail','1','0','','','');

Thanks
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.