Derleek Posted May 22, 2008 Share Posted May 22, 2008 So, i've been trying to fix this error for over an hour. i don't know why i am getting the error "Table 'thethrgu_moto.fans' doesn't exist" here is the code that is problematic, i'm guessing it has something to do with the table create. $query = 'CREATE TABLE fans( '. 'screenName VARCHAR(20) NOT NULL, '. 'email VARCHAR(50) NOT NULL, '. 'realName VARCHAR(30) NOT NULL, '. 'password VARCHAR (30) NOT NULL, '; $result = mysql_query($query); if(!result) { echo "database error:". mysql_error(); } $sql = "SELECT COUNT(*) FROM fans WHERE screenName = '$_POST[newid]'"; $result = mysql_query($sql); if (!$result) { echo "FUCKING ERROR: " . mysql_error(); } i'm just confused because it works with apache friends on my localhost, but when i took it live through blueHost i get this hang up very frustrated, if any one can tell me whats going on here it'd be great. here is the site www.the3guys.com/signup.php Link to comment https://forums.phpfreaks.com/topic/106701-solved-frustrated/ Share on other sites More sharing options...
jonsjava Posted May 22, 2008 Share Posted May 22, 2008 did you give the user access to create tables on the db? (the user you setup to handle the db) Link to comment https://forums.phpfreaks.com/topic/106701-solved-frustrated/#findComment-546972 Share on other sites More sharing options...
realjumper Posted May 22, 2008 Share Posted May 22, 2008 show us your connect (to database) string please Link to comment https://forums.phpfreaks.com/topic/106701-solved-frustrated/#findComment-546974 Share on other sites More sharing options...
sasa Posted May 22, 2008 Share Posted May 22, 2008 run $result = mysql_query('SHOW GRANTS FOR CURRENT_USER'); $row = mysql_fetch_row($result); echo $row[0]; to see your grants Link to comment https://forums.phpfreaks.com/topic/106701-solved-frustrated/#findComment-547070 Share on other sites More sharing options...
Derleek Posted May 22, 2008 Author Share Posted May 22, 2008 i do have the permissions set up correctly. here is my database connect string: <?php // db.php $dbhost = "localhost"; $dbuser = "thethrgu_derek"; $dbpass = "goodhabit"; function dbConnect($db="") { global $dbhost, $dbuser, $dbpass; $dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass) or die("The site database appears to be down."); if ($db!="" and !@mysql_select_db($db)) die("The site database is unavailable."); return $dbcnx; } ?> Link to comment https://forums.phpfreaks.com/topic/106701-solved-frustrated/#findComment-547341 Share on other sites More sharing options...
PFMaBiSmAd Posted May 22, 2008 Share Posted May 22, 2008 The following line is missing the $ in front of result - if(!result) I found this by getting php to tell what it found that was wrong with the code. When learning php, developing php code, or debugging php code, turn on full php error reporting to get php to help you. If this works on your development system it is because the table already exists in the database and the code does not care that the CREATE TABLE query fails. The create table query appears to be incomplete and it is missing a closing ")". Link to comment https://forums.phpfreaks.com/topic/106701-solved-frustrated/#findComment-547360 Share on other sites More sharing options...
Derleek Posted May 22, 2008 Author Share Posted May 22, 2008 how do i turn on full error reporting? and thanks PFM Link to comment https://forums.phpfreaks.com/topic/106701-solved-frustrated/#findComment-547417 Share on other sites More sharing options...
bilis_money Posted May 22, 2008 Share Posted May 22, 2008 // Turn on all error reporting error_reporting(1); http://www.php.net/manual/en/function.error-reporting.php Link to comment https://forums.phpfreaks.com/topic/106701-solved-frustrated/#findComment-547422 Share on other sites More sharing options...
PFMaBiSmAd Posted May 22, 2008 Share Posted May 22, 2008 Setting error_reporting to 1 will only display fatal runtime errors and if display_errors are off, won't show anything anyway. Link to comment https://forums.phpfreaks.com/topic/106701-solved-frustrated/#findComment-547425 Share on other sites More sharing options...
bilis_money Posted May 22, 2008 Share Posted May 22, 2008 Here you go. ini_set('display_errors', '1'); Link to comment https://forums.phpfreaks.com/topic/106701-solved-frustrated/#findComment-547432 Share on other sites More sharing options...
Derleek Posted May 22, 2008 Author Share Posted May 22, 2008 thanks, you guys rock =) Link to comment https://forums.phpfreaks.com/topic/106701-solved-frustrated/#findComment-547437 Share on other sites More sharing options...
bilis_money Posted May 22, 2008 Share Posted May 22, 2008 Derleek please press the 'solve' button, if you think this case is solve. your welcome. Link to comment https://forums.phpfreaks.com/topic/106701-solved-frustrated/#findComment-547441 Share on other sites More sharing options...
PFMaBiSmAd Posted May 22, 2008 Share Posted May 22, 2008 The error in the posted code was a Notice about an undefined constant. To be useful to the people who come to a forum like this for help, error reporting should be set to at least E_ALL. Link to comment https://forums.phpfreaks.com/topic/106701-solved-frustrated/#findComment-547475 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.