|
|||
Why my Query Not Working??
I have a script that when the user request for verification code, it will generate the verification code, store the verification code in the database and send the code to the user.
However, the code is not stored in the database. Can anybody check my script? My script is : <?php $title = "Process Request"; include ("header_footer_function.php"); header_start(); // Connect to database to store verification code mysql_connect("localhost", "root", "admin") or die(mysql_error()); mysql_select_db("project_db") or die(mysql_error()); // Function to generate random alphabets and numbers function generate_str ($length) { $characters = array('a','b','c','d','e','f','g','h','i','j','k', 'l','m','n','o','p','q','r','s','t','u','v','w','x ','y','z','0','1','2','3','4','5','6','7','8','9') ; $random_str = ""; for ($i = 0; $i < $length; $i++) { srand((double)microtime()*1000000); $random_chr = round(rand(0, count($characters)-1)); $random_str .= $characters[$random_chr]; } return ($random_str); } $code = generate_str(12); // Store code in database mysql_query("INSERT INTO code (code_string) VALUES ('$code')"); // Send e-mail $subject = "Verification Code Request"; $email = $_POST['email'] ; $name = $_POST['name']; $company = $_POST['company']; $message = "Name: $name\r\n"."Company: $company\r\n"."Verification Code: $code\r\n"; $headers = "From: xxxxx@xxx.com.my"; ini_set("SMTP","mail.xxx.com.my"); $sent = mail($email, $subject, $message, $headers) ; if($sent) {print "Please check your e-mail for verification code"; } else {print "We encountered an error sending your mail"; } footer(); ?> |
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Working at Home. | mx_duo | Job Vacancies | 4 | 19-05-2008 03:57 AM |
| getURL() not working in IE7 | ccool | Website Programming | 9 | 07-04-2007 06:10 AM |
| my 2CO a/c is not working.Help! | ronan | E-Commerce | 4 | 03-12-2004 05:10 PM |
| Sql query untuk A+B-C ... | nixx | Website Programming | 5 | 06-10-2004 04:51 PM |
| how to secured query string | vash | Website Programming | 3 | 28-04-2004 02:47 PM |
All times are GMT +8. The time now is 01:32 AM.
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.









Linear Mode

