Is this the best way?

From: Date: Fri, 14 Mar 2008 16:12:56 +0000
Subject: Is this the best way?
Groups: php.general 
Request: Send a blank email to php-general+get-271581@lists.php.net to get a copy of this message
Hi everyone, I am attempting to add a little error checking for a very simple login system. The info is stored in a MySQL database, and I am using mysqli to connect to it. I have it working with the solution provided below, but I am wondering if this is the right way to do it or if there is a better way? My thinking with this is if more then 1 record is returned from the database, then there is a issue... If only is returned then the username/password matched and I can safely show them the info... $rowcnt = mysqli_num_rows($loginResult); if($rowcnt !="1"){ echo "Auth failed"; die("Auth failed... Sorry"); }else{ while($row1 = mysqli_fetch_array($loginResult)) { $_SESSION['user'] = $row1['loginName']; $_SESSION['loggedin'] = "YES"; $table = $row1['tableName']; $adminLevel = $row1['adminLevel']; $authenticated = "TRUE"; echo "<BR>authentication complete"; } return Array($table, $authenticated, $adminLevel); -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com japruim@raoset.com

« previous php.general (#271581) next »