Jump to content

MYSQL_QUERY ERROR


maxudaskin

Recommended Posts

What would be causing that error?

<?php
/* login.php */
require ('db.php');
function checklogin($username,$password){
$sql = mysql_query("SELECT pass FROM users WHERE pid='$username'");
   $result = mysql_query($sql,$con);
   if(!$result || (mysql_numrows($result) < 1)){
      return 1;
   }
   $password = stripslashes($password);
   if($password == $result){
      return 0;
   }
   else{
      return 2;
   }
}
function form(){
if(!isset($_POST["loginbutton"])){
?>
<style type="text/css">
<!--
.style2 {color: #FFFFFF}
-->
</style>
<form name="form1" method="post" action="">
<div align = center>
<table width="393" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="393" colspan="2">    </td>
  </tr>
  <tr>
    <td><div align="right">Pilot ID | OOM<span class="style2">.</span></div></td>
    <td><input name="user" type="text" id="user" size="16" maxlength="5"></td>
  </tr>
  <tr>
    <td><div align="right">Password<span class="style2">.</span></div></td>
    <td><input name="textfield2" type="password" size="16" maxlength="16"></td>
  </tr>
  <tr>
    <td colspan="2"><div align="center">
      <input name="remember" type="checkbox" id="remember" value="1">
     Remember Me </div></td>
  </tr>
    <tr>
    <td colspan="2"><div align="center">
      <input name="loginbutton" type="submit" id="loginbutton" value="Login">
    </div></td>
  </tr>
</table>
</div>
</form>
<?php
}}
if(isset($_POST["loginbutton"])){
if(!$_POST['user'] || !$_POST['pass']){
   die('Hey, I need you to fill out BOTH your Pilot ID and your Password.');
   }
if($_POST['rember']==1){
setcookie("user", $_SESSION['username'], time()+60*60*24*365);
setcookie("pass", $_SESSION['password'], time()+60*60*24*365);
}}
$passmd5 = md5($_POST["pass"]);
checklogin($_POST["user"],$passmd5);



form();
?>

<?php
/* db.php */
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$dbserver = "mysql.someurl.net";
$dbname = "db";
$dbuser = "dbadmin";
$dbpass = "admin";
$con = mysql_connect($dbserver, $dbuser, $dbpass) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($dbname,$con);
?>

Link to comment
Share on other sites

Wild guess. $con is unknown within the function.

 

Exactly what you were told when you had the same problem in http://www.phpfreaks.com/forums/index.php/topic,150201.msg647465.html#msg647465

 

Please DO NOT start new threads about the same problem.  If you feel the answers are nor correct, test them anyway, and then add a post explaining what you did and what you found.

 

Thread closed.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.