Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Technical Support » Other » PHP issue
Re: PHP issue [message #439497 is a reply to message #438943] Sun, 14 November 2010 12:40 Go to previous messageGo to previous message
cnc95fan is currently offline  cnc95fan
Messages: 1261
Registered: July 2007
Karma:
General (1 Star)
if($_POST['user'] != "" && $_POST['pwd'] != "")
{
$con = mysql_connect("localhost","root","1234");
mysql_select_db("test");
$regnum = rand(100000,999999);
$sqlone = mysql_query("SELECT * FROM users");
$sqlfetch = mysql_fetch_array($sqlone);
while($sqlone['id'] == $regnum)
{
	$regnum = rand(100000,9999999);
}
$regtitle = mysql_query("INSERT INTO titles (id) VALUES ('".$regnum."')");
$reguser = mysql_query("INSERT INTO users (id,login,password) VALUES ('".$regnum."','".$_POST['user']."','".$_POST['pwd']."')");
if($reguser) 
{
	header("Location: index.php");
	exit;
}
else 
{
echo "SQL QUERY NOT COMPLETED.";	
}	
mysql_close($con);
}
else 
{
	header("Location: register.php?login=failed&cause=".urlencode('Insert all values please'));
	exit;
	}

This one has puzzled me. I have messed about commenting out parts to see where the problem is but I cannot find it.
I'm aware that the while loop is probably not the best way to go about doing something like that but this is just a small project I'm doing to learn PHP.. Any ideas?
Edit: It goes to the else "SQL QUERY NOT COMPLETED"

[Updated on: Sun, 14 November 2010 14:21]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GameSpy
Next Topic: Generals... AGAIN
Goto Forum:
  


Current Time: Tue Nov 26 11:05:08 MST 2024

Total time taken to generate the page: 0.01351 seconds