Jump to content

User List Error


e4games
 Share

Recommended Posts

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:

Edited by e4games
Link to comment
Share on other sites

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.

Edited by Deirdre's Dad
Link to comment
Share on other sites

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

Edited by e4games
Link to comment
Share on other sites

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 it
That 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. Edited by Deirdre's Dad
Link to comment
Share on other sites

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. Edited by Deirdre's Dad
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
 Share

×
×
  • Create New...