Why is there an error?

Strange, I do

$db->Query(SELECT data FROM table_backup WHERE id=$id);
$row=$db->RowArray();
$data=unserialize($row['data']);
$db->AutoInsertUpdate("table",$data,$id);

Displays an error I don’t understand:

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 ‘Power PS2 ATX 1FAN (1000W) , 190*150*86mm, +5B=30A, +12B=90A, +3.3B=28A, 5VSB ‘ at line 1 (#1064)

after userialize $data contains:

Array
    (
        [0] => 23
        [id] => 23
        [1] => 90
        [cat_id] => 90
        [2] => 127
        [vendor_id] => 127
        [3] => pice
        [pice] => pice
        [4] =>   PS2 ATX 1FAN (1000W) , 190*150*86mm,  +5B=30A, +12B=90A, +3,3B=28A, 5VSB=4A,    105-150%,   90-260
        [name] =>   PS2 ATX 1FAN (1000W) , 190*150*86mm,  +5B=30A, +12B=90A, +3,3B=28A, 5VSB=4A,    105-150%,   90-260
        [5] => 
        [model] => 
        [6] => ISP1000
        [partnum] => ISP1000
        [7] => 
        [barcode] => 
        [8] => 
        [prim] => 
        [9] => 1310048629
        [data] => 1310048629
        [10] => 320.00
        [price] => 320.00
        [11] => 
        [shortstory] => 
        [12] => 
        [fullstory] => 
        [13] => 
        [photo] => 
        [14] => 1
        [statuswhs] => 1
        [15] => 0
        [status] => 0
        [16] => 0
        [payed] => 0
        [17] => 0
        [redactor_id] => 0
    )

I understand what this error is, but I don’t understand why it happens. Tell me please.


Answer 1

The issue has been resolved. The error was in the class working with a DB. Quotes were not taken into account when creating the query string.