Re: Is this code right?

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re: Is this code right?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-175047@lists.php.net to get a copy of this message
Radwan Aladdin wrote:
Hi all.. I made this code for the login.php page.. it will compare A value from the users machine (Serial) and with a value inside the database (In that users' row).. so after logging it will check if also this value is the same and then echo something..is the following code is right for that? : <?php $link = mysql_connect("localhost", "Database username", "Database password) or die("Could not connect: " . mysql_error()); mysql_select_db("Table name", $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $Serial = $_GET['Serial']; $query = "SELECT Serial, Password from accounts where UserName='$UserName'"; $result = mysql_query($query) or die("Query errort: " . mysql_error()); $row = mysql_fetch_row($result) or die("User Not found: " . mysql_error()); $Serial = htmlspecialchars($row[0]); mysql_select_db is for selecting the database and NOT the table, the SELECT statement must be something like this: "select SOMETHING from TABLE where WHERE_CLAUSE"


« previous php.general (#175047) next »