hello
i have some problem..
actually i make a userscreen using php and problem is that i have check the username is already exists aur not...
i used the query
like this...
[code=php]
$con = mysql_connect(" localhost","roo t");
if(!$con)
{
die('Could not connect:'.mysql _error());
}
mysql_select_db ("demo",$con );
$obj1=mysql_que ry("select count(u_Usernam e) as test from user where u_Username='$_P OST[username]'");
echo ($obj1);
$sql="Insert into user(u_id, u_Fname, U_Lname, u_Email, u_Username, u_password, u_Cpassword) VALUES
(NULL, '$_POST[fname]', '$_POST[lname]', '$_POST[email]', '$_POST[username]', '$_POST[password]', '$_POST[repassword]');";
$objRecordSet = mysql_query($sq l);
$errorNo = mysql_errno();
if($errorNo == 0)
{
?>
<script type="text/javascript">
alert("Record Saved");
</script>
<?php
}
mysql_close($co n);
[/code]
this is my code...
i want the no of records in the $obj1;;;
but this coding return me the Resource id #3
so anyone can solve my problem....
actually i am totally new in php....
so plz help...
thanks
i have some problem..
actually i make a userscreen using php and problem is that i have check the username is already exists aur not...
i used the query
like this...
[code=php]
$con = mysql_connect(" localhost","roo t");
if(!$con)
{
die('Could not connect:'.mysql _error());
}
mysql_select_db ("demo",$con );
$obj1=mysql_que ry("select count(u_Usernam e) as test from user where u_Username='$_P OST[username]'");
echo ($obj1);
$sql="Insert into user(u_id, u_Fname, U_Lname, u_Email, u_Username, u_password, u_Cpassword) VALUES
(NULL, '$_POST[fname]', '$_POST[lname]', '$_POST[email]', '$_POST[username]', '$_POST[password]', '$_POST[repassword]');";
$objRecordSet = mysql_query($sq l);
$errorNo = mysql_errno();
if($errorNo == 0)
{
?>
<script type="text/javascript">
alert("Record Saved");
</script>
<?php
}
mysql_close($co n);
[/code]
this is my code...
i want the no of records in the $obj1;;;
but this coding return me the Resource id #3
so anyone can solve my problem....
actually i am totally new in php....
so plz help...
thanks
Comment