maxudaskin Posted July 19, 2007 Share Posted July 19, 2007 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 https://forums.phpfreaks.com/topic/60707-mysql_query-error/ Share on other sites More sharing options...
vbnullchar Posted July 19, 2007 Share Posted July 19, 2007 if its a query error check your sql statement.. can you post the whole error message you're getting? Link to comment https://forums.phpfreaks.com/topic/60707-mysql_query-error/#findComment-302008 Share on other sites More sharing options...
maxudaskin Posted July 19, 2007 Author Share Posted July 19, 2007 Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/.grable/vurl/someurl.net/include/login.php on line 5 Link to comment https://forums.phpfreaks.com/topic/60707-mysql_query-error/#findComment-302010 Share on other sites More sharing options...
AndyB Posted July 19, 2007 Share Posted July 19, 2007 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 https://forums.phpfreaks.com/topic/60707-mysql_query-error/#findComment-302012 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.