GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   need MYSQL help here (https://gfy.com/showthread.php?t=480651)

wedouglas 06-14-2005 12:06 AM

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']

Varius 06-14-2005 12:07 AM

I believe you are missing a closing ) at the end.

jwerd 06-14-2005 12:08 AM

Instead of:
('2', 'BLOGNAME', '.$config['blogname'].'),
Try:
('2', 'BLOGNAME', '".$config['blogname']."'),

wedouglas 06-14-2005 12:12 AM

nope and nope....

rickholio 06-14-2005 12:16 AM

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())");

rickholio 06-14-2005 12:21 AM

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

Meorazhar 06-14-2005 12:22 AM

Hello,
use
('2', 'BLOGNAME', $config['blogname']),
instead of
('2', 'BLOGNAME', '.$config['blogname'].'),

Same applies to this:
('10', 'BLOG_DESCRIPTION', '.$config['blogdescription'].'),

Meorazhar 06-14-2005 12:26 AM

And, like it was stated, you will need an extra closing )

wedouglas 06-14-2005 12:27 AM

Quote:

Originally Posted by rickholio
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

Im just trying to create a fix for a problem im having. is there a quick way to copy data from one table to another?

rickholio 06-14-2005 12:29 AM

Quote:

Originally Posted by wedouglas
Im just trying to create a fix for a problem im having. is there a quick way to copy data from one table to another?

Code:

insert into TARGET_TABLE
  select column1, column2, column3, etc from SOURCE_TABLE
    where some_column=some_criteria;


wedouglas 06-14-2005 12:33 AM

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