PDA

View Full Version : MySQL query problem


Delphiprogrammi
01-03-2006, 05:41 PM
hi people,

I'm having a problem with a MySQL query.It's an "install" code for a product and i'm getting an error returned


$db->query_write("INSERT INTO " . TABLE_PREFIX . "setting(varname, grouptitle, value, defaultvalue, optioncode, displayorder, advanced, volatile,product) VALUES ('modpmtext', 'posting', 'Hi $username,\r\n\r\nThis message is to advise you that your $type titled "$threadinfo" has been $action.\r\n\r\nThe $type is located at this URL $url\r\n\r\nIf you have any questions, you can ask an administrator for assistance\r\n\r\nSincerely,\r\nThe $bbtitle staff.', 'Hi $username,\r\n\r\nThis message is to advise you that your $type titled "$threadinfo" has been $action by $modby.\r\n\r\nThe $type is located at this URL $url\r\n\r\nIf you have any questions, you can ask an administrator for assistance\r\n\r\nSincerely,\r\nThe $bbtitle staff.', 'textarea', 150, 0, 0, 'free', 'modautopm')


unexpected variable is the error returned ..

should i use $db->escape_string() ??

harmor19
01-03-2006, 06:01 PM
ytry dleting the quotes sround "$threadinfo" (both of them)

Delphiprogrammi
01-03-2006, 06:22 PM
hi,

getting this error ....


Parse Error:parse error,unexspected T_CONSTANT_ENCAPSED_STRING in /path to/plugin.php(1239):eval'd code on line 4


probably a " i forgot to close

Reaktor7
01-04-2006, 12:21 AM
$db->query_write("
INSERT INTO " . TABLE_PREFIX . "setting(varname, grouptitle, value, defaultvalue, optioncode, displayorder, advanced, volatile,product)
VALUES ('modpmtext', 'posting', 'Hi $username,\r\n\r\nThis message is to advise you that your $type titled \"$threadinfo\" has been $action.\r\n\r\nThe $type is located at this URL $url\r\n\r\nIf you have any questions, you can ask an administrator for assistance\r\n\r\nSincerely,\r\nThe $bbtitle staff.', 'Hi $username,\r\n\r\nThis message is to advise you that your $type titled \"$threadinfo\" has been $action by $modby.\r\n\r\nThe $type is located at this URL $url\r\n\r\nIf you have any questions, you can ask an administrator for assistance\r\n\r\nSincerely,\r\nThe $bbtitle staff.', 'textarea', 150, 0, 0, 'free', 'modautopm')");

Delphiprogrammi
01-04-2006, 06:34 PM
hi,

it isn't working correctly even with the "\" stuff those variables aren't parsed they don't show up all i see is "" an empty string

hi,

Here you can see what i mean.modpmtextitle should be "your $type $threadinfo has been $action" but it shows "" instead of the variables ?? this an old vb 3 hack i'm trying to port to 3.5.x product working fine except of those parsing trouble

problem solved just insert a "\" (no quotes offcource) before the text starting with $