Page 1 of 1

[SOLVED] While

Posted: Sun Jul 18, 2004 11:23 pm
by AlbinoJellyfish
Not sure if this is classified databases, but here goes.

Code: Select all

<?php
$uname = "0";
$db = mysql_connect("localhost","username","password"); 
mysql_select_db("sevengfx_com_-_hosted" , $db) or die("Couldn't open $db: ".mysql_error()); 
$sql = "SELECT * FROM support_users";
$result=mysql_query($sql); 
while ($row = mysql_fetch_array($result)){ 
if ($username == $row['username']{
while ($uname != "1"){
echo '<font color="red">That username is already taken.  Please create a new one.</font>';
$_SESSION['used'] = "1";
include 'form.php';
$uname = "1";
		} else {
	} 
}
?>
Im checking to see if there is a username already registered that is the same as the user put in. I want it so that once it finds that it is taken, it will stop. When I use this code i get

Code: Select all

Parse error: parse error in /var/www/html/formmail1.php on line 46
Line 46 is:

Code: Select all

<?php
while ($uname != "1"){
?>

Posted: Sun Jul 18, 2004 11:26 pm
by turbo2ltr
Whenever you get an error, always look at the previouis line of code. You are missing a ) at the end of

Code: Select all

if ($username == $row['username']{

Posted: Sun Jul 18, 2004 11:29 pm
by AlbinoJellyfish
thank you, it always seems like my problems end up a typo. ergg, im not bad at php, just php grammar.