MDizzleFresh Posted March 7, 2010 Share Posted March 7, 2010 Hello everyone. I am in need of help. Below are parts of my script for my registration code. All I am getting is a mysql_error, and nothing is showing up after that. The URL to the site is www.mafiasyndicate.co.cc if you would like to register, and see what I am talking about. Below are parts of the code, that I think may have cause the error: Date, to show the start date of the users account $today = date("F j, Y, g:i a"); Part where I changed the ereg to preg if (preg_match('[^A-Za-z]', $reg_username)) { $message="Your username can only contain letters."; }elseif (!preg_match('[^A-Za-z]', $reg_username)) { MySQL Stuff mysql_query("INSERT INTO `users` ( `id` , `username` , `password` , `money` , `regged` ,`startdate` ,`email` , `location` , `homecity` ,`ip` , `r_ip`, `referal`) VALUES ('', '$reg_username', '$reg_password', '500', '$time', '$today', '$email', '$location', '$location', '$ip', '$ip', '$referal2')") or die(mysql_error); Those are the different parts, that I think may have caused the error. Please help me anyone, if you can. Quote Link to comment Share on other sites More sharing options...
LeadingWebDev Posted March 7, 2010 Share Posted March 7, 2010 if (preg_match('/[^A-Za-z]/', '', $reg_username)) { $message="Your username can only contain letters."; }elseif (!preg_match('/[^A-Za-z]/', '', $reg_username)) { Quote Link to comment Share on other sites More sharing options...
MDizzleFresh Posted March 7, 2010 Author Share Posted March 7, 2010 Thanks, i think it fixed it somewhat. When I put that in, it gave me this though: Warning: strlen() expects parameter 1 to be string, array given in /~/www/mafiasyndicate.co.cc/register.php on line 57 Quote Link to comment Share on other sites More sharing options...
LeadingWebDev Posted March 7, 2010 Share Posted March 7, 2010 oops, my bad) didnt pay attention that is preg_match, thought preg_replace ) if (preg_match('/[^A-Za-z]/', $reg_username)) { $message="Your username can only contain letters."; }elseif (!preg_match('/[^A-Za-z]/', $reg_username)) { Quote Link to comment Share on other sites More sharing options...
MDizzleFresh Posted March 7, 2010 Author Share Posted March 7, 2010 Pasted that, and it went back to the mysql_error Quote Link to comment Share on other sites More sharing options...
Mchl Posted March 7, 2010 Share Posted March 7, 2010 Change die(mysql_error); to die(mysql_error()); this will display actual MySQL error message in the future. Quote Link to comment Share on other sites More sharing options...
LeadingWebDev Posted March 7, 2010 Share Posted March 7, 2010 echo variables you pass to mysql Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.