i write the code for register but its not working
can u please check the code please
register.txt
please tell the solution for this
the data is not inserting in database(Mysql)
Thank you
Rakesh Nagekar
i write the code for register but its not working
can u please check the code please
register.txt
please tell the solution for this
the data is not inserting in database(Mysql)
Thank you
Rakesh Nagekar
<?
session_start();
include"../conn.php";
include"../functions.php";
if($_SERVER['REQUEST_METHOD']=='POST')
{
if(!empty($_GET['id']))
{ $ex=" and id <>".$_GET['id'];}
else $ex='';
$seq="select count(*) as cnt from register where fname='".$_POST['fname']."'".$ex;
$sres=mysql_query($seq);
$srow=mysql_fetch_assoc($sres);
if($srow['cnt']>0) {
$errmsg="User with this Username already existed.";
} else if(empty($_POST['id'])) {
$qur="INSERT INTO `register` (`Name` ,`email` ,`fname` ,`lname`,`password`,`phone`,`address`,`city`,`state`,`country` , `zip`)
VALUES ('".$_POST['name']."','".$_POST['emailid']."','".$_POST['fname']."','".$_POST['lname']."','".$_POST['password']."','".$_POST['phoneno']."', '".$_POST['address']."','".$_POST['city']."','".$_POST['state']."', '".$_POST['country']."','".$_POST['zip']."')";
$res= mysql_query($qur);
echo "<script language=javascript>window.location='register.php'</script>";
}
else {
$qur= "update `register` set `Name`='".$_POST['name']."', `email`='".$_POST['emailid']."', `fname`='".$_POST['fname']."', `lname`='".$_POST['lname']."', `password`='".$_POST['password']."', `phone`='".$_POST['phoneno']."',`address`='".$_POST['address']."', `city`='".$_POST['city']."', `state`='".$_POST['state']."', `country`='".$_POST['country']."', `zip`='".$_POST['zip']."' where id=".$_GET['id'];
mysql_query( $qur) ;
echo'<script language="javascript">window.location.href="index.php?msg=2";</script>';
}
}
if(!empty($_GET['id'] ))
{
$res = mysql_query ("select * from register where id=".$_GET['id']);
$row=mysql_fetch_array($res,MYSQL_BOTH);
$show=" Edit ";
}
else
$show =" Add ";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<link href="file:///C|/Documents and Settings/Administrator/Desktop/styles.css" rel="stylesheet" type="text/css">
<link href="../styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" height="525" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%"><table width="100%" height="10" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" height="1"><img src="../images/logo_01.jpg" width="257" height="106" /></td>
<td width="100" valign="top"><div align="right"><img src="../images/top-new_02.jpg" width="310" height="106" /></div></td>
<td width="100" rowspan="2" valign="top" align="left"><img src="../images/logo_03.jpg" width="219" height="149" /></td>
</tr>
<tr>
<td colspan="2"><table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td colspan="15" align="right" height="20" valign="top"><span class="th-brwn-13"> </span> </td>
</tr>
<tr>
<td align="center" width="2"><img src="../images/spacer.gif" alt="Spacer" height="1" width="2" /></td>
<td align="center" width="88"><table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td bgcolor="#e23a45"><img src="../images/r1.gif" height="20" width="3" /></td>
<td align="center" bgcolor="#e23a45"><a href="" class="mainlinks">Banjara Tribe</a></td>
<td align="right" bgcolor="#e23a45"><img src="../images/images/r2.gif" height="20" width="3" /></td>
</tr>
</tbody>
</table></td>
<td align="center" width="2"><img src="../images/spacer.gif" height="1" width="2" /></td>
<td align="center" width="67"><table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td bgcolor="#876ab7"><img src="../images/v1.gif" height="20" width="3" /></td>
<td align="center" bgcolor="#876ab7"><a href="" class="mainlinks">Leisure</a></td>
<td align="right" bgcolor="#876ab7"><img src="../images/v2.gif" height="20" width="3" /></td>
</tr>
</tbody>
</table></td>
<td align="center" width="2"><img src="../images/spacer.gif" height="1" width="2" /></td>
<td align="center" width="73"><table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td bgcolor="#f4a564"><img src="../images/b1.gif" height="20" width="3" /></td>
<td align="center" bgcolor="#f4a564"><a href="" class="mainlinks">Software</a></td>
<td align="right" bgcolor="#f4a564"><img src="../images/b2.gif" height="20" width="3" /></td>
</tr>
</tbody>
</table></td>
<td align="center" width="2"><img src="../images/spacer.gif" height="1" width="2" /></td>
<td align="center" width="72"><table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td bgcolor="#3594b8"><img src="../images/s1.gif" height="20" width="3" /></td>
<td align="center" bgcolor="#3594b8"><a href="http://banjarahills.com/shopping/index.asp" class="mainlinks">Shopping</a></td>
<td align="right" bgcolor="#3594b8"><img src="../images/s2.gif" height="20" width="3" /></td>
</tr>
</tbody>
</table></td>
<td align="center" width="2"><img src="../images/spacer.gif" height="1" width="2" /></td>
<td align="center" width="72"><table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td bgcolor="#aeac24"><img src="../images/i1.gif" height="20" width="3" /></td>
<td align="center" bgcolor="#aeac24"><a href="http://banjarahills.com/realestate/index.asp" class="mainlinks">Real Estate</a></td>
<td align="right" bgcolor="#aeac24"><img src="" height="20" width="3" /></td>
</tr>
</tbody>
</table></td>
<td align="center" width="2"><img src="" height="1" width="2" /></td>
<td align="center" width="82"><table border="0" cellpadding="0" cellspacing="0" width="105%">
<tbody>
<tr>
<td bgcolor="#2abcbe"><img src="" height="20" width="3" /></td>
<td align="center" bgcolor="#2abcbe"><a href="http://banjarahills.com/Lounge/index.asp" class="mainlinks">The Lounge</a></td>
<td align="right" bgcolor="#2abcbe"><img src="" height="20" width="3" /></td>
</tr>
</tbody>
</table></td>
<td align="center" width="2"><img src="" height="1" width="2" /></td>
<td align="center" width="90"><table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td bgcolor="#aa5a87"><img src="" height="20" width="3" /></td>
<td align="center" bgcolor="#aa5a87"><a href="http://banjarahills.com/Buzz/index.asp" class="mainlinks">Banjara Buzz!</a></td>
<td align="right" bgcolor="#aa5a87"><img src="" height="20" width="3" /></td>
</tr>
</tbody>
</table></td>
<td width="2"><img src="" height="1" width="2" /></td>
</tr>
</tbody>
</table></td>
</tr>
<tr>
<td bgcolor="#8dc3db"><? include("sublogin.php");?></td>
<td bgcolor="#8dc3db"><input name="srhevent" class="Inputform" id="srhevent" size="20" maxlength="30" onKeyPress="return chk_eventkey(event)" type="text" />
<input name="eventSubmit" class="Button" value="Search" onClick="return chk_event()" type="button" /></td>
<td bgcolor="#8dc3db"> </td>
</tr>
<tr>
<td height="1" colspan="2">
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
<tbody><tr>
<td valign="top">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="99%">
<tbody><tr>
<td height="25"><table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td colspan="2" bgcolor="#aa5a87"><img src="Register_files/spacer.gif" alt="spacer" height="1" width="1"></td>
</tr>
<tr>
<td bgcolor="#d6adc4" width="5"><input name="vvid" type="hidden">
</td>
<td bgcolor="#d6adc4" height="18"><strong><a href="http://www.banjarahills.com/index.asp" class="Normal">Home</a> <a href="http://www.banjarahills.com/Buzz/index.asp" class="Normal">Buzz</a> <a href="http://www.banjarahills.com/index.asp" class="Normal">Blogs</a> </strong>Registration </td>
</tr>
</tbody></table></td>
</tr>
<tr>
<td height="5"><img src="Register_files/spacer.gif" alt="Spacer" height="1" width="1"></td>
</tr>
<tr>
<td><table align="center" border="0" cellpadding="5" cellspacing="0" width="98%">
<tbody><tr>
<td bgcolor="#fefbff">
<form name="form1" method="post" action="" onSubmit="">
<table width="100%" border="0" align="left" cellpadding="1" cellspacing="0">
<tbody><tr>
<td bgcolor="#aa5a87"><table align="center" bgcolor="#f4fbff" border="0" cellpadding="3" cellspacing="0" width="100%">
Echo your insert query and tel me where the error was placed..
give me your table also...
Its not giving any error and not showing any thing in that
but not inserting the data in database.
Thank u
Rakesh Nagekar
Use die with mysql_query.
ie., $result = mysql_query($query) or die (mysql_error());
If your query fails, it will 'inform' you why it failed.
post your db table...
very very thanks nav
i got it
Thank u
Rakesh Nagekar
post your db table...
Thank u
I got that
Rakesh Nagekar
where was your error????????
Database name and variables name are changed due to mysql problem
Any how thanks once again
Rakesh Nagekar
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.