louis_coetzee Posted May 4, 2009 Share Posted May 4, 2009 <?php session_start(); $username = $_SESSION['username']; $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $dbname = 'database'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); ////////////////details//////////////////// $result = mysql_query("SELECT * FROM details where username = '$username'"); while ($row = mysql_fetch_array($result)) { $dataload_username = $row['username']; $dataload_email = $row['email']; $dataload_firstname = $row['firstname']; $dataload_lastname = $row['lastname']; } mysql_close($conn); ////////////////////////////////////////// ////////////////user_log///////////////// $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); $result2 = mysql_query("SELECT * FROM js_profile_log where username = '$username'"); while ($row2 = mysql_fetch_array($result2)) { $dataload_last_login = $row2['last_login']; $dataload_login_counter = $row2['login_counter']; } ///////////////////////////////////////// ?> I get this: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\website\data_load.php on line 25 Link to comment https://forums.phpfreaks.com/topic/156777-weird-mysqlphp-problem-please-help/ Share on other sites More sharing options...
revraz Posted May 4, 2009 Share Posted May 4, 2009 Means your query is failing. Add mysql_error() after them to find out why. Link to comment https://forums.phpfreaks.com/topic/156777-weird-mysqlphp-problem-please-help/#findComment-825634 Share on other sites More sharing options...
Ken2k7 Posted May 4, 2009 Share Posted May 4, 2009 Change $result2 = mysql_query("SELECT * FROM js_profile_log where username = '$username'"); To $result2 = mysql_query("SELECT * FROM js_profile_log where username = '$username'") OR die(mysql_error()); Post any errors. Link to comment https://forums.phpfreaks.com/topic/156777-weird-mysqlphp-problem-please-help/#findComment-825663 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.