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. Link to comment https://forums.phpfreaks.com/topic/194453-mafia-game-registration-code/ 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)) { Link to comment https://forums.phpfreaks.com/topic/194453-mafia-game-registration-code/#findComment-1022769 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 Link to comment https://forums.phpfreaks.com/topic/194453-mafia-game-registration-code/#findComment-1022771 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)) { Link to comment https://forums.phpfreaks.com/topic/194453-mafia-game-registration-code/#findComment-1022773 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 Link to comment https://forums.phpfreaks.com/topic/194453-mafia-game-registration-code/#findComment-1022775 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. Link to comment https://forums.phpfreaks.com/topic/194453-mafia-game-registration-code/#findComment-1022776 Share on other sites More sharing options...
LeadingWebDev Posted March 7, 2010 Share Posted March 7, 2010 echo variables you pass to mysql Link to comment https://forums.phpfreaks.com/topic/194453-mafia-game-registration-code/#findComment-1022777 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.