Re: MySql Close problem

From: Date: Mon, 21 Jun 2004 21:09:56 +0000
Subject: Re: MySql Close problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-188780@lists.php.net to get a copy of this message
you should tell WHAT problem you have. does it throw an error? doesn't it work as expected ... ? whats the matter? thomas On Sun, 20 Jun 2004 13:47:03 -0700 erik@gjertsen.as (Erik Gjertsen) wrote: > I have problem with mysql_close > I dont understand why. > Are ther someone that have any proposal? > > Thank for any help > Erik Gjertsen > > Here is the code > > > $query = "SELECT usrid FROM users WHERE username"; > $result = @mysql_query ($query); //Run the query > if (mysql_num_rows($result) == 0) { // Make the query > $query = "INSERT INTO users (username, name, email, password, registration_date) VALUES > ('$username', '$name', '$email', '$password', NOW() > )"; > $result = @mysql_query ($query); > if ($result) { // IF it ran OK > > // Send an email, if desired > echo '<p><b>You have been registered!</b></P>'; > include("./footer.inc"); > exit(); > } else { // If it did not ron OK. > $message = '<p>You cout not be registered due to a system error. We apologize > for any inconvenience</p>'; > } > } else { > $message = '<p>That username is alredy taken.</p>'; > } > mysql_close(); > > > } else { > $message = '<p>Please try again.</p>'; > } > } // End of the main submit conditional. > > // Print the error message if ther is one > if (isset($message)) { > echo '<font color="red">', $message, '</font>'; > )

« previous php.general (#188780) next »