e4games Posted January 18, 2010 Share Posted January 18, 2010 I can't find a error with this code...can you guys help me? <?phpmysql_connect("Host Name", "username", "pass") or die(mysql_error()); mysql_select_db("DB name") or die(mysql_error()); $query=mysql_query ("SELECT * FROM users");echo "<tr><td colspan='2' bgcolor='darkyellow'>.::. Users .::.</td><tr/><tr><td colspan='2'>";while "($row = mysql_query ($query) ) ";{echo "<tr><td> {$row['ID']}";echo "</td></tr>";echo "<tr><td> {$row['username']}";echo "</td></tr>";}echo "</table>"";?> The code is supposed to output a users ID and name inside of a table...but a white screen just happens D: Link to comment Share on other sites More sharing options...
jeffman Posted January 18, 2010 Share Posted January 18, 2010 PHP is trying to understand this part as PHP, and it doesn't work: <tr><td colspan='2'>When you interpolate array elements inside double quotation marks, they should be wrapped in braces, like this:echo "<tr><td> {$row['ID']}";All PHP statements must end with a semicolon ( ; ). If the semicolon is inside quotation marks, it is part of the string and does not terminate the statement.This will never work:while "($row = mysql_query ($query) );"No offense, but this is pretty basic stuff. PLEASE do some homework. We are here to help you, not teach you stuff you can learn in chapter 1 of any basic tutorial or book. Link to comment Share on other sites More sharing options...
e4games Posted January 18, 2010 Author Share Posted January 18, 2010 I changed the code at the top...and it still gets the same error D: I also tried it with the semicolons only after the lines with the curly braces it them, but it still gets the same errorAnd it says no where that you need to put curly braces around PHP with HTML with it, especially not at the beginning of anything Link to comment Share on other sites More sharing options...
jeffman Posted January 18, 2010 Share Posted January 18, 2010 Post your revised code. No one can guess what it looks like now. it says no where that you need to put curly braces around PHP with HTML with itThat is not what I was discussing. If you don't understand, please say you don't understand. There is no need to get defensive.And what is this "nowhere" you're talking about? This site is great for HTML, but it barely scratches the surface of PHP. Use it as a starting point, but don't imagine everything you need to know about PHP can be found in the tutorials here. Link to comment Share on other sites More sharing options...
e4games Posted January 18, 2010 Author Share Posted January 18, 2010 my revised code is on the first post...I editted it..like I said in my post. Link to comment Share on other sites More sharing options...
jeffman Posted January 18, 2010 Share Posted January 18, 2010 my revised code is on the first post...I editted it..like I said in my post.Sorry. I thought you meant something different by "at the top." It is not customary on this board to post revised code into earlier entries.Remove the quotation marks and the semicolon from this line:while "($row = mysql_query ($query) ) ";I deliberately didn't tell you everything that was wrong with it because I hoped you wanted to be part of this process and might look at it closely yourself. Link to comment Share on other sites More sharing options...
Ingolme Posted January 18, 2010 Share Posted January 18, 2010 You still have useless quotation marks around your while() condition. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 18, 2010 Share Posted January 18, 2010 You also have too many here:echo "</table>"";If you're seeing a blank page, that means you have error messages disabled on your server. It would be a good idea to enable error messages while you're developing. Link to comment Share on other sites More sharing options...
e4games Posted January 18, 2010 Author Share Posted January 18, 2010 Thanks, it works know Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.