PHP help =) *solved*

Questions about programming languages and debugging
Post Reply
User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

PHP help =) *solved*

Post by ayu »

I'm very new to PHP and i just started using MySQL with it a few days ago.

I'm making a login page for my site and i am having some problems with 2 things in it atm.

First of all this part of the code

Code: Select all

$database = mysql_select_db("$db");
$sql = "SELECT * FROM authadmin";
$result = mysql_query("$sql");

while($row = mysql_fetch_row($result))

if($_POST['user'] == $row[0] && $_POST['pass'] == $row[1])
This is just a small part, i want to get the first row in my database in the table authadmin (there is only one row anyway) that has the username and password. But i am getting this error (note that the "while" was just placed there for experimental purposes)

Code: Select all

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\Program\wamp\www\documentcat\adm\login.php on line 12

and i have one other small problem, i have an error that is shown when the login/pass fields are empty on the page, but i don't want it to be shown when first entering the page, any ideas?



Thanks in advance


PS: This post was fucking awful to make thanks to the PHP-NUKE tag filter.



EDIT: solved it, i was way off ^^

Code: Select all

$sql = mysql_query("SELECT * FROM authadmin WHERE user='".$username."'");
"The best place to hide a tree, is in a forest"

Post Reply