Jump to content

Need a lil help


grappy

Recommended Posts

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/lewke/domains/lukegibson.co.uk/public_html/imagegallery/loginscript.php on line 23thats the obvious error, and i cant make it work, i had this error before but i was able to fix it, and now i cant fix it again lol

<?phpif ( ( isset($_REQUEST['username']) && isset($_REQUEST['password'])) ){$un = $_REQUEST['username'];$pass = $_REQUEST['password'];$p = md5($pass);//connects to database$con = mysql_connect("localhost","lewke_acc","");if (!$con) {  die('Could not connect: ' . mysql_error());}//selects databasemysql_select_db("lewke_image", $con);//sends the query to mysql$query = "SELECT * FROM accounts WHERE acc_un ='$un'";$result = ($query);$row = (mysql_fetch_array($result));if ($row['acc_pw'] == $p){header ( 'Location: gallery.php?un=$un' ); }elseheader ( 'Location: login.php?id=2' );}elseheader ( 'Location: login.php?id=2' );?>

any help with the problem would be great...since im still learning php

Link to comment
Share on other sites

As the reference on mysql_fetch_array() says, it's first argument must come from a resourse generated with mysql_query() and I don't see mysql_query in use. I only see brackets around $result above with no function. Try to replace

$result = ($query);$row = (mysql_fetch_array($result));

with

$result = mysql_query($query);$row = (mysql_fetch_array($result));

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...