hi,
i'm beginner in php.
Please let me know why the select query is not working in the code below.
It is not giving me the error when there is more the one registration with the same userid. Iam stuck with this....
The code goes ;
<?php
include 'common.php';
include 'db.php';
if(!isset($_POST['register']))
{
header("Location=register.php");
}
else
{
dbconnect('rishaorg_members');
}
if($POST['newid']=='' or $POST['firstname']=='' or $POST['lastname']=='' or $POST['address']=='' or $POST['city']=='' or $POST['state']=='' or $POST['country']=='' or $POST['birthcity']=='' or $POST['birthstate']=='')
{
error('One more required fields were left blank. \n Please fill them in and try again.');
}
if ($POST['newemail']=='')
{
header("Location: email_error.html");
exit;
}
if (! ereg('[A-Za-z0-9-]+@[A-Za-z0-9-]+.[A-Za-z0-9-]+', $POST['newemail']))
{
header("Location: email_error.html");
exit;
}
$sql = "SELECT COUNT (*) FROM user WHERE userid = '$POST[newid]'";
$result = mysql_query($sql);
if(@mysql_result($result,0,0)>0)
{ error('A user alreday exists with your chosen Username. \n Please try another Username');
}
$newpass=substr(md5(time()),0,6);
$query = "INSERT INTO user (userid, password, firstname, lastname, gender, address, city, state, country, email, phone, birthdate, birthmonth, birthyear, hour, minute, seconds, birthplace, birthplace1, agee) VALUES ('$POST[newid]', PASSWORD('$newpass'), '$POST[firstname]', '$POST[lastname]', '$POST[gender]', '$POST[address]', '$POST[city]', '$POST[state]', '$POST[country]', '$POST[newemail]', '$POST[phone]', '$POST[birthdate]', '$POST[birthmonth]', '$POST[birthyear]', '$POST[birthhour]', '$POST[birthminute]', '$POST[birthsecond]', '$POST[birthcity]', '$POST[birthstate]', '$POST[agree]')";
mysql_query($query);
$message = " Congratulations !
Your personal account for the Rishi Jyotish Sanstha has been ceated !
We value your association with us.
To log in , proceed to the following address :
http://www.rishijyotishsanstha.org/index.php
Your personal login ID and password as follows :
userid : $_POST[newid]
password : $newpass
You can change your password at any time after you have logged in.
If you have any probleems feel free to contact us at :
http://www.rishijyotishsanstha.org/contactus.html
- Member's Administrator
|| Rishi Jyotish Sanstha ||
";
mail($_POST['newemail'],"Member's Password for Rishi Jyotish Sanstha",$message,"From:Member Admin <members@rishijyotishsanstha.org>");
header("Location:http://www.rishijyotishsanstha.org/successfullregistration.php")
?>[/COLOR]