Jump to content

Recommended Posts

I have some info i am trying to add to my database but it just keeps returning the following error: Error insert query failed.

I have tried writing this query many different ways but fet the same answer, any suggestions would be appreciated.

 

Thanks

 


$query = "INSERT INTO dashboard_component (dashboard_component_id, module_name, module_parameters, site_id, column_number, position) VALUES 

(13, 'text', 'Welcome', '((USERNAME))!\r\nDate: ((DATE))\r\nTime: ((TIME))', '$site_id', 0, 1)";

mysql_query($query) or die('Error, insert query failed');

 

 

Link to comment
https://forums.phpfreaks.com/topic/115820-solved-insert-query/
Share on other sites

ok, Thanks for that, another stupid mistake, i had a mismatch in column numbers all fixed now thanks, but now i have another problem

i need this part of the insert script  to have " " around it like so:

 


$query = "INSERT INTO dashboard_component (dashboard_component_id, module_name, module_parameters, site_id, column_number, position) VALUES 

(13, 'text', 'Welcome', '"((USERNAME))!\r\nDate: ((DATE))\r\nTime: ((TIME))"', '$site_id', 0, 1)";

mysql_query($query) or die('Error, insert query failed');

 

however when i write it like this it just gets binned and shows a blank page, when i take them out it works fine.  I need to add the "" so the info is formated for when it is read from the database table and then displays the username.

 

Does any body have any ideas or suggestions

Link to comment
https://forums.phpfreaks.com/topic/115820-solved-insert-query/#findComment-595459
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.