PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
so i have this code, and then after a line......the rest of it doesnt display. i dont recieve any errors or anything. Is it the while loop? its very frustrating and i cant figure out why.
Alphamonkey wrote:so i have this code, and then after a line......the rest of it doesnt display. i dont recieve any errors or anything. Is it the while loop? its very frustrating and i cant figure out why.
To see errors, you need to turn on PHP error reporting (for PHP errors) and use MySQL's mysql_error() function. Something like this:
You used the "short form" opening tag, which some web servers don't recognize. Always use <$php .
When your script is working properly, remove the error reporting lines for production use, because if an error occurs, it gives useful information to a hacker about your system.
Alphamonkey wrote:so i have this code, and then after a line......the rest of it doesnt display. i dont recieve any errors or anything. Is it the while loop? its very frustrating and i cant figure out why.
To see errors, you need to turn on PHP error reporting (for PHP errors) and use MySQL's mysql_error() function. Something like this:
You used the "short form" opening tag, which some web servers don't recognize. Always use <$php .
When your script is working properly, remove the error reporting lines for production use, because if an error occurs, it gives useful information to a hacker about your system.
but....whats very interesting is that if i PURPOSELY change the syntax of the sql query to throw an error.....it doesn't display the error BUT it does in the pages SOURCE file.
but....whats very interesting is that if i PURPOSELY change the syntax of the sql query to throw an error.....it doesn't display the error BUT it does in the pages SOURCE file.
Hmmm. That sounds like it isn't even getting to your query. What displays in the Source file? Code? Which part?
So, it just craps out after 2 rows? I don't see any reason for that, unless (remotely possible) there's a nonprinting character in your script between the end of the while loop and the </select>. You might backspace over everything between, then put in just a linefeed. How many rows should it have returned? Are there more than the 2 rows in the table?
I'm afraid I don't see what is causing it to halt execution. As onion2k said, you are misusing those <div /> and </div> tags, but I think the browser just ignores them. Still, you should remove them. <div> is an element that always needs a closing </div> tag, so <div /> is just invalid, and the lone </div> without a beginning <div> is meaningless. At the moment, I don't know what else to tell you.
Alphamonkey wrote:ok, ill ask elsewhere. the "<div />" is just for a line break. I've gotten in the habit of using it. I guess i should try and quit that habit
Definitely YES. A line break is <br />. Don't ever put invalid tags in your code, you might get by with it sometimes, but generally it will break your page.