chopficaro Posted January 11, 2010 Share Posted January 11, 2010 if i run the following code as is, i see all the echos up to the /* operate normally. if i move the /* down two lines, so that it is in front of the query, the browser can see nothing. if i get rid of the /* and the */, still nothing, not even the fail message. i am running this on my server, i have created tables in this manner before without any trouble. i know my personal information is in there, i don't care, its just a practice site. in fact you can log in yourself and try it if u like. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Patrick Allard's Very Graphic Website</title> <link rel="stylesheet" type="text/css" href="main.css" /> </head> <body> <p> html working <?php define("DB_SERVER", "sql307.000space.com"); define("DB_USER", "space_4826174"); define("DB_PASS", "omgtkkyb"); define("DB_NAME", "space_4826174_loginsystem"); echo DB_SERVER; echo DB_USER; echo DB_PASS; echo DB_NAME; $con = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error()); mysql_select_db(DB_NAME, $con) or die(mysql_error()); $q="CREATE TABLE users ( username varchar(30) primary key, password varchar(32), userid varchar(32), userlevel tinyint(1) unsigned not null, email varchar(50), timestamp int(11) unsigned not null );"; echo $q /* $result = mysql_query($q, $con); //error is in the line above, if you move the star slash down two lines, the browser cannot see anything if(!$result) { echo "failure" . mysql_error(); } else { echo "table created"; } */ ?> </p></body></html> Quote Link to comment https://forums.phpfreaks.com/topic/188111-mysql_query-causes-all-html-from-browser-to-disapear/ Share on other sites More sharing options...
mikesta707 Posted January 11, 2010 Share Posted January 11, 2010 there appears to be a fatal error happening. Try turning error reporting on (put this at the TOP of the page) error_reporting(E_ALL); ini_set("display_errors", 1); but the problem is here echo $q there is no semi colon after that line. it should be echo $q; turning on error reporting will help find simple errors like that Quote Link to comment https://forums.phpfreaks.com/topic/188111-mysql_query-causes-all-html-from-browser-to-disapear/#findComment-993130 Share on other sites More sharing options...
chopficaro Posted January 11, 2010 Author Share Posted January 11, 2010 how embarrassing thank you for the debugging tip Quote Link to comment https://forums.phpfreaks.com/topic/188111-mysql_query-causes-all-html-from-browser-to-disapear/#findComment-993137 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.