Hydrian Posted September 5, 2012 Share Posted September 5, 2012 I get Resource id #10 when i load my page Full Script <?php session_start(); include 'config.php'; mysql_select_db("my_db"); $result = mysql_query(" SELECT * FROM `categorys`, SELECT * FROM `topics` "); ?> <?php include 'header.php'; ?> <div id="nar"> </div> <div id="content"> <?php print $result; ?> </div> <div id="nar"> </div> <?php include 'footer.php'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/268009-php-application/ Share on other sites More sharing options...
MMDE Posted September 5, 2012 Share Posted September 5, 2012 You must use a function to handle the result of the mysql_query. Read the manual: http://www.php.net/manual/en/ref.mysql.php you typically use mysql_fetch_* or mysql_result. You may want to use mysqli_* instead of mysql_* Quote Link to comment https://forums.phpfreaks.com/topic/268009-php-application/#findComment-1375379 Share on other sites More sharing options...
Hydrian Posted September 5, 2012 Author Share Posted September 5, 2012 what so suchas mysql_fetch(); ? Quote Link to comment https://forums.phpfreaks.com/topic/268009-php-application/#findComment-1375382 Share on other sites More sharing options...
MMDE Posted September 5, 2012 Share Posted September 5, 2012 what so suchas mysql_fetch(); ? See the link, it's the PHP manual for mysql functions. It says what the functions are and how to use them. Quote Link to comment https://forums.phpfreaks.com/topic/268009-php-application/#findComment-1375383 Share on other sites More sharing options...
Hydrian Posted September 5, 2012 Author Share Posted September 5, 2012 I get mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource. when i load the page <?php session_start(); include 'config.php'; mysql_select_db("my_db"); $result = mysql_query("SELECT * FROM `categorys`, SELECT * FROM `topics` "); while ($row = mysql_fetch_assoc($result)) { echo $row["cat_name"]; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/268009-php-application/#findComment-1375384 Share on other sites More sharing options...
Christian F. Posted September 5, 2012 Share Posted September 5, 2012 At this point I think you really should reconsider your choice of hobby. Either that or you need to start paying attention to stuff and actually try to learn, instead of just writing random stuff and expecting things to work without having to put forth the effort to understand why things work as they do. Quote Link to comment https://forums.phpfreaks.com/topic/268009-php-application/#findComment-1375389 Share on other sites More sharing options...
Hydrian Posted September 5, 2012 Author Share Posted September 5, 2012 Im working on the login stuff I get an unexpected '=' on line 9 <?php session_start(); include_once('connect.php'); if (isset($_POST['username'])) { $username = $_POST['username']; $password = $_POST['password']; $sql = " SELECT * FROM members WHERE username='".$username."'" AND password='".$password." LIMIT 1'; $res = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($res) == 1) { $row = mysql_fetch_assoc($res); $_SESSION['uid'] = $row['id']; $_SESSION['username'] = $row['username']; header ("Location: index.php"); exit(); } else { echo "Invalid login information. Please return to previous page."; exit(); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/268009-php-application/#findComment-1375392 Share on other sites More sharing options...
darkfreaks Posted September 5, 2012 Share Posted September 5, 2012 check your $sql value you left off a double quote at the end i am pretty sure why you are getting that error. Quote Link to comment https://forums.phpfreaks.com/topic/268009-php-application/#findComment-1375394 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.