![]() |
need MYSQL help here
whats wrong with this command?
Insert into bBadult_config (id, name, value) VALUES ( ('1', 'EMAIL', 'change@me'), ('2', 'BLOGNAME', '.$config['blogname'].'), ('3', 'TEMPLATE', 'default'), ('4', 'DB_TEMPLATES', 'false'), ('5', 'DEFAULT_MODIFIER', 'simple'), ('6', 'DEFAULT_STATUS', 'live'), ('7', 'PING','false'), ('8', 'COMMENT_MODERATION','none'), ('9', 'NOTIFY','false'), ('12', 'META_DESCRIPTION', 'Some words about this blog'), ('13', 'META_KEYWORDS','work,life,play,web design'), ('15', 'EMAIL','[email protected]'), ('10', 'BLOG_DESCRIPTION', '.$config['blogdescription'].'), ('14', 'LAST_MODIFIED', UNIX_TIMESTAMP()); Its telling me: 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 ' 'EMAIL', 'change@me'), ('2', 'BLOGNAME', '.$config['blogname'] |
I believe you are missing a closing ) at the end.
|
Instead of:
('2', 'BLOGNAME', '.$config['blogname'].'), Try: ('2', 'BLOGNAME', '".$config['blogname']."'), |
nope and nope....
|
You have an extra ( after values. Multi row inserts have brackets around each row, not around all rows.
Also, every one of those $config[blogname]'s need to be encapsulated in additional quotes unless $config[blogname] is guaranteed to be a number of some variety. HTH. HAND. :thumbsup BTW - you *can* use subscripted arrays within quotes in PHP, thusly: $result = mysql_query("Insert into bBadult_config (id, name, value) VALUES (1, 'EMAIL', 'change@me'), (2, 'BLOGNAME', '$config[blogname]'), (3, 'TEMPLATE', 'default'), (4, 'DB_TEMPLATES', 'false'), (5, 'DEFAULT_MODIFIER', 'simple'), (6, 'DEFAULT_STATUS', 'live'), (7, 'PING','false'), (8, 'COMMENT_MODERATION','none'), (9, 'NOTIFY','false'), (12, 'META_DESCRIPTION', 'Some words about this blog'), (13, 'META_KEYWORDS','work,life,play,web design'), (15, 'EMAIL','[email protected]'), (10, 'BLOG_DESCRIPTION', '$config[blogdescription]'), (14, 'LAST_MODIFIED', UNIX_TIMESTAMP())"); |
I also hope that you're filtering and mysql_real_escape_string()ing any data that might be user-input, so's to take care of storing data with quotes and stripping out possible exploit code. :thumbsup
|
Hello,
use ('2', 'BLOGNAME', $config['blogname']), instead of ('2', 'BLOGNAME', '.$config['blogname'].'), Same applies to this: ('10', 'BLOG_DESCRIPTION', '.$config['blogdescription'].'), |
And, like it was stated, you will need an extra closing )
|
Quote:
|
Quote:
Code:
insert into TARGET_TABLE |
thanks. I just cant seem to figure out this issue. I have a blog installed on my main domain http://www.digitalconfessional.net
but when i try to install another one on the subdomain http://adult.digitalconfessional.net it wont work. Even if i tell it to use the same database and table prefix. makes no sense |
All times are GMT -7. The time now is 07:12 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123