note 109709 added to function.mysql-fetch-row
| From: | apoorvgaur dot srcm at gmail dot com | Date: | Mon, 13 Aug 2012 12:23:25 +0000 |
| Subject: | note 109709 added to function.mysql-fetch-row | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190048@lists.php.net to get a copy of this message | ||
<title>Registration</title>
</head>
<body>
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("oas", $con);
$id = $_POST['reg_id'];
$dob = $_POST['day'].$_POST['month'].$_POST['year'];
$name = $_POST['reg_fname'].$_POST['reg_lname'];
$sql1 = mysql_query("SELECT* FROM it WHERE regid LIKE 'IT%'");
$a = mysql_fetch_array($row[]);
$sql2 = mysql_query("SELECT regid FROM hr WHERE regid LIKE 'HR_%'");
$b = mysql_fetch_row($sql2);
$sql3 = mysql_query("SELECT regid FROM marketing WHERE regid LIKE 'M_%'");
$c = mysql_fetch_row($sql3);
if($id==$a)
{
$sql="INSERT INTO IT (regid, name, contactno, dob, address, emailid, password)
VALUES
('$_POST[reg_id]','$name','$_POST[reg_cntct]','$dob','$_POST[reg_add]','$_POST[reg_email_id]','$_POST[reg_pwd]')";
echo $sql;
}
else if($id==$b)
{$sql="INSERT INTO HR (regid, name, contactno, dob, address, emailid, password)
VALUES
('$_POST[reg_id]','$name','$_POST[reg_cntct]','$dob','$_POST[reg_add]','$_POST[reg_email_id]','$_POST[reg_pwd]')";
echo $sql;
}
else if($id==$c)
{$sql="INSERT INTO marketing (regid, name, contactno, dob, address, emailid, password)
VALUES
('$_POST[reg_id]','$name','$_POST[reg_cntct]','$dob','$_POST[reg_add]','$_POST[reg_email_id]','$_POST[reg_pwd]')";
echo $sql;
}
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "THANK YOU FOR REGISTRATION";
mysql_close($con);
?>
</body>
</html>
i want to differenciate the users on the basis of their reg_id at the time of registration into
three tables namely IT HR and MARKETING......this is an office automation syatem project.
Kindly help me out. Youe suggestions are really valuable.
----
Server IP: 69.147.83.197
Probable Submitter: 122.177.239.242
----
Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-row.php
Edit -- https://master.php.net/note/edit/109709
Del: integrated -- https://master.php.net/note/delete/109709/integrated
Del: useless -- https://master.php.net/note/delete/109709/useless
Del: bad code -- https://master.php.net/note/delete/109709/bad+code
Del: spam -- https://master.php.net/note/delete/109709/spam
Del: non-english -- https://master.php.net/note/delete/109709/non-english
Del: in docs -- https://master.php.net/note/delete/109709/in+docs
Del: other reasons-- https://master.php.net/note/delete/109709
Reject -- https://master.php.net/note/reject/109709
Search -- https://master.php.net/manage/user-notes.php