PHP Classes

SQL in create_admin_account

Recommend this page to a friend!

      Simple User  >  All threads  >  SQL in create_admin_account  >  (Un) Subscribe thread alerts  
Subject:SQL in create_admin_account
Summary:Place of Id here is '' string, so I change it to null.
Messages:2
Author:Gediminas M.
Date:2012-02-29 22:38:58
Update:2012-03-01 01:28:59
 

  1. SQL in create_admin_account   Reply   Report abuse  
Picture of Gediminas M. Gediminas M. - 2012-02-29 22:38:58
First time creating admin account I got an error. Id is not INT.
$sql="insert into ".$this->prefix."users values ('','".mysql_real_escape_string(htmlentities($firstname,ENT_QUOTES))."','".mysql_real_escape_string(htmlentities($lastname,ENT_QUOTES))."','".mysql_real_escape_string($email)."','1',".mktime().")";

Place of Id here is '' string, so I change it to null.
After this it worked.

I dont know its my system, or its something else.

I run it on localhost with WAMP.

  2. Re: SQL in create_admin_account   Reply   Report abuse  
Picture of Bob Kennedy Bob Kennedy - 2012-03-01 01:28:59 - In reply to message 1 from Gediminas M.
Thanks for letting me know! I haven't seen that, but it certainly would be good practice to use null in an int field rather than an empty string! Good call, thanks. :)
I'll make the change eventually,
Bob