Go to Post I have no desire to watch a battle of who sucks less. - Cory [more]
Home
Go Back   Chief Delphi > Technical > IT / Communications > Website Design/Showcase
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 23-05-2004, 16:41
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
MySQL/PHP Query question

I've decided to create a comment script for a beginning project. Right now, I'm working on the registering part of the script. My problem is checking to see if the username already exists within the database. Here's the code I'm using right now:

PHP Code:
<?
$user 
$_POST['username'];
$pass $_POST['password'];
$check $_POST['passcheck'];
$conn mysql_connect(/* connect to mysql */);
if(!
$conn){
 echo(
"Unable to connect to MySQL: "mysql_error());
 exit;
}
$db mysql_select_db(/* try to connect to database */);
if(!
$db){
 echo(
"Unable to select database: "mysql_error());
 exit;
}
 
/* ::: LOOK BELOW ::: */
$result mysql_query("SELECT * FROM information WHERE user = '"$user ."'");
if(
$result != ""){
 echo(
"Username already exists in database.  Please choose a different username to continue.");
 exit;
}
/* ^^^^  LOOK ABOVE ^^^^ */
?>
I can connect to MySQL and the database just fine.
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question of the Week [05-02-04]: The Very Merry Month of May EddieMcD Rumor Mill 10 05-05-2004 14:02
MIM's question of the day on programming. Gene F Programming 3 24-02-2004 16:32
A question about control system options computhief263 Control System 7 04-02-2004 14:46
MySQL query question Jack Website Design/Showcase 9 02-02-2003 00:11


All times are GMT -5. The time now is 15:28.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi