Page 1 of 1

Insert query error

Posted: Tue Apr 14, 2009 12:13 pm
by thisbl00d
Sometimes i feel like breaking my PC coz of these errors :banghead:
error:
Could not insert data into users table
 
DEBUG MODE

Code: Select all

 
INSERT INTO phpbb_users (user_id, username, user_regdate, user_password, user_email, user_interests, user_viewemail, user_allowhtml, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_dateformat, user_level, user_allow_pm, user_active, user_actkey) VALUES (8, 'researcher', 1239730941, '81dc9bdb52d04dc20036dbd8313ed055', 'p@p.com', ","0","1, 1, 0, 1, 1, 'D M d, Y g:i a', 0, 1, 1, ")
 
 
THe query i'm trying to execute

Code: Select all

$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_interests, user_viewemail, user_allowhtml, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_dateformat, user_level, user_allow_pm, user_active, user_actkey)
                VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $interests) . "','" . "'$viewemail'" . "','" . "'$allowhtml, $allowviewonline, $notifyreply, $notifypm, $popup_pm, '" . str_replace("\'", " '' ", $user_dateformat) . "', 0, 1, ";
TABLE STRUCTURE

Code: Select all

CREATE TABLE phpbb_users (
  user_id mediumint(8) NOT NULL,
  user_active tinyint(1) DEFAULT '1',
  username varchar(25) NOT NULL,
  user_password varchar(32) NOT NULL,
  user_session_time int(11) NOT NULL DEFAULT '0',
  user_session_page smallint(5) NOT NULL DEFAULT '0',
  user_lastvisit int(11) NOT NULL DEFAULT '0',
  user_regdate int(11) NOT NULL DEFAULT '0',
  user_level tinyint(4) DEFAULT '0',
  user_posts mediumint(8) UNSIGNED NOT NULL DEFAULT '0',
  user_dateformat varchar(14) NOT NULL DEFAULT 'd M Y H:i',
  user_new_privmsg smallint(5) UNSIGNED NOT NULL DEFAULT '0',
  user_unread_privmsg smallint(5) UNSIGNED NOT NULL DEFAULT '0',
  user_last_privmsg int(11) NOT NULL DEFAULT '0',
  user_login_tries smallint(5) UNSIGNED NOT NULL DEFAULT '0',
  user_last_login_try int(11) NOT NULL DEFAULT '0',
  user_emailtime int(11) DEFAULT NULL,
  user_viewemail tinyint(1) DEFAULT NULL,
  user_allowhtml tinyint(1) DEFAULT '1',
  user_allow_pm tinyint(1) NOT NULL DEFAULT '1',
  user_allow_viewonline tinyint(1) NOT NULL DEFAULT '1',
  user_notify tinyint(1) NOT NULL DEFAULT '1',
  user_notify_pm tinyint(1) NOT NULL DEFAULT '0',
  user_popup_pm tinyint(1) NOT NULL DEFAULT '0',
  user_rank int(11) DEFAULT '0',
  user_email varchar(255) DEFAULT NULL,
  user_interests varchar(255) DEFAULT NULL,
  user_actkey varchar(32) DEFAULT NULL,
  user_newpasswd varchar(32) DEFAULT NULL,
  PRIMARY KEY (user_id),
  KEY user_session_time (user_session_time)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
P.S what i dont understand is the double quotes that is displayed in the DEBUG mode where have they come from :(

Re: Insert query error

Posted: Tue Apr 14, 2009 11:11 pm
by thisbl00d

Code: Select all

str_replace("\'", "''", $new_password)
there is a backslash & a singlequote in the first argument of str_replace.
the backslash is not shown by this forums code viewer.

Re: Insert query error

Posted: Tue Apr 14, 2009 11:44 pm
by thisbl00d
Yes, this code snippet is taken from phpbb 2.0.22... im trying to modify it

Re: Insert query error

Posted: Tue Apr 14, 2009 11:52 pm
by thisbl00d
:banghead: :banghead: :banghead: :crazy: :crazy: :crazy: :crazy: :crazy:

thnx for ur time ... but ive lost it.

y cant i upload files here

Code: Select all

http://rapidshare.com/files/221493568/u ... r.php.html
download the above file and go to line 423. after the get current date comment.