Alex1646 Posted March 12, 2011 Share Posted March 12, 2011 OMFG! I have no idea what is going on! <?php if (isset($user_log)) { //************************************************************************************************************************************************ $user = $_SESSION['user']; $query = " SELECT title, sum, story_id FROM draft WHERE user='$user' "; $select = mysql_query($query); while($rows = mysql_fetch_assoc($select)); { $titledb = $rows['title']; $sumdb = $rows['sum']; $id_db = $rows['story_id']; echo "$titledb"; } } //************************************************************************************************************************************************* ?> I have no idea whats going on I have tried: 1. Using mysql_num_rows I get a number (1) 2.Trying to use the mysql_fetch_assoc outside of the while loop. The values are getting echo'ed out, but when I put the code in the while loop and the $rows=mysql_fetch_assoc in the while peramiters, nothing happening. I have also tried putting other code in the while loop and it works. Its just the mysql values. also I tried using or die(mysql_errror()), It dies but no mysql error Link to comment https://forums.phpfreaks.com/topic/230397-i-have-no-idea-what-is-going-on-php-not-working/ Share on other sites More sharing options...
Pikachu2000 Posted March 12, 2011 Share Posted March 12, 2011 Is the code you posted code that works, or code that does not work? Link to comment https://forums.phpfreaks.com/topic/230397-i-have-no-idea-what-is-going-on-php-not-working/#findComment-1186510 Share on other sites More sharing options...
Alex1646 Posted March 12, 2011 Author Share Posted March 12, 2011 The code that does not. I cant get it to work. Link to comment https://forums.phpfreaks.com/topic/230397-i-have-no-idea-what-is-going-on-php-not-working/#findComment-1186512 Share on other sites More sharing options...
PFMaBiSmAd Posted March 12, 2011 Share Posted March 12, 2011 You have got a semi-colon on the end of the while();, thereby ending the while() statement on that line. Link to comment https://forums.phpfreaks.com/topic/230397-i-have-no-idea-what-is-going-on-php-not-working/#findComment-1186513 Share on other sites More sharing options...
Alex1646 Posted March 12, 2011 Author Share Posted March 12, 2011 OMG. Really??? I spent like a hour debugging that code, and it was something as mundane as a semicolon. Well, at least I will never be making that mistake again. Thanks for everyone who read this post, and thanks even more to everyone who helped me! Link to comment https://forums.phpfreaks.com/topic/230397-i-have-no-idea-what-is-going-on-php-not-working/#findComment-1186516 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.