Jump to content

Recommended Posts

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

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.