db_query INSERT issues...

So I'm trying to do a simple insert but for some reason I keep getting an error and all the fields in my array check out. Do I need to provide value pairs for every field?



When I try to run this simple code:



$shipment_load = array(
"shipping_id" => $record_unser[6]["shipping"],
"carrier" => $record_unser[6]["carrier"],
"tracking_number" => $record_unser[6]["tracking_number"],
"timestamp" => $srkey["timestamp"]+(60*60*24),
"comment" => ""
);
$shipment_load_id = db_query("INSERT into ?:shipments ?e", $shipment_load);




I get the following error:



[color=#000000][font=Courier]Database error:[/font][/color][color=#2C2B2B][font=Tahoma, Arial, Helvetica, sans-serif][size=3] Table 'cscart.cscart_' doesn't exist [/size][/font][/color]b[/b]

[color=#000000][font=Courier]Invalid query:[/font][/color][color=#2C2B2B][font=Tahoma, Arial, Helvetica, sans-serif][size=3] SHOW COLUMNS FROM cscart_[/size][/font][/color]



[color=#2C2B2B][font=Tahoma, Arial, Helvetica, sans-serif][size=3]I don't understand why the table to insert is disappearing during the course of the query. I can insert non-variable values that are appropriately typed and nothing seems to work. Is the format for this different in 2.2.5?[/size][/font][/color]

Never mind. The replacement regex that detect database operations is case sensitive - changing 'INSERT into' to 'INSERT INTO' resolved the problem.

How to insert date in date format instead of timestamp in database??

Can anyone tell me the insert query for that???

Thanks in adv!

How to insert date in date format instead of timestamp in database??

Can anyone tell me the insert query for that???

Thanks in adv!

Please provide us with more details about this request. What input data do you have? What table do you use?

MySQLnative date/time format is YYYY-MM-DD HH-MM-SS so you simply enter the data as a string or use any of the internal functions like NOW(). assuming the field is datetime.

I.e.

db_query("INSERT INTO ?:foo SET my_date=NOW(), id=123");
or
$now=date("Y-M-D H:i:s", TIME);
INSERT INTO ?:foo SET my_date=?s id=123", $now);

But note that much of cs-cart expects a UNIX timestamp for date/time operations versus a datetime type or a date string.

Suggest you look at the mySQL manual for Datetime.

Is there any way to find out the last inserted id in cs cart? It should have been a basic functionality.

Is there any way to find out the last inserted id in cs cart? It should have been a basic functionality.

This value is returned by the db_query function. E.g.

$product_id = db_query("INSERT INTO ?:products ?e", $_data);

Am using REPLACE Query. Will it work?? :confused: :confused: :confused:

Am using REPLACE Query. Will it work?? :confused: :confused: :confused:

Please try and inform us here :)

Replace should also retrun the current primary key value. Note that if this is a multiple field value that you might have to do additional parsing of the result to get to the value you want. But 'products' uses an integer(8) unsigned key so that would be what you would get from a REPLACE INTO ?:products.....

Am trying to install a new cs cart multivendor on a server with PHP version 7.0 and MySQL 5.7. Installation is stuck at Setup languages design/themes/responsive/styles/data. Have anyone else faced the same issue?