FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


[RESOLVED] RETARDED ERROR!





Aelita
heres a good one for ya. Tell me why this code:
Code:
<?php
$dbhost = 'localhost';
$dbuser = 'bob';//Looks like this   usernamr_USERNAME type exactly how it shows in cpanel
$dbpasswd = 'notrealpass';
$dbname = 'aelita_Lyoko';//your_DATABSE (create in cpanel first)
//This file connects to your database and crestes the necessary
$connect = sprintf("%s, %s, %s", $dbhost, $dbuser, $dbpasswd);
if (connect != TRUE)
{
   echo "some dumb issue";
   die(mysql_error());
}
$link = @mysql_pconnect($connect);
$cdb = sprintf("'%s', '%s'", $dbname, $link);
mysql_select_db($cdb);
//I just pulled this from making the table using phpadmin that why its looks so funny
$sql = mysql_query('CREATE TABLE `clicks` ('
        . ' `id` TINYINT NOT NULL AUTO_INCREMENT, '
        . ' `url` TEXT NOT NULL, '
        . ' `number` VARCHAR(25) NOT NULL, '
        . ' `type` TEXT NOT NULL,'
        . ' PRIMARY KEY (`id`)'
        . ' )'
        . ' TYPE = myisam');
if ($sql == TRUE)
{
   echo "TABLE ADDED";
   echo "<meta http-equiv=\"refresh\" content=\"5;URL=nowwhat\">";

}
else
{
   echo "There has been a problem";
}
mysql_close($link);
?>


gives this error...

Code:

Warning: mysql_select_db(): Access denied for user: 'aelita@localhost' (Using password: NO) in /home/aelita/public_html/mysql_install_clicks.php on line 15

Warning: mysql_select_db(): A link to the server could not be established in /home/aelita/public_html/mysql_install_clicks.php on line 15

Warning: mysql_query(): Access denied for user: 'aelita@localhost' (Using password: NO) in /home/aelita/public_html/mysql_install_clicks.php on line 24

Warning: mysql_query(): A link to the server could not be established in /home/aelita/public_html/mysql_install_clicks.php on line 24
There has been a problem
Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/aelita/public_html/mysql_install_clicks.php on line 35


AND THATS THE USERNAME I INPUT! ->BOB BECAUSE THE REAL ONE WASNT WORKING, AND BOB STILL PRODUCES THAT ERROR DOEN"T EVEN SAY ANTHING ABOUT BOB NOT BEING USERNAE IN ERROR STILL SAYS aelita@localhost...
Aelita
I must just get super hard solve the error for a test question. nobody ever answers...

But I always figure it out.

Corrected code:
Code:
<?php
$dbhost = 'localhost';
$dbuser = 'My_username';//Looks like this   usernamr_USERNAME type exactly how it shows in cpanel
$dbpasswd = 'My password';//Like this  password
$dbname = 'My Database';//your_DATABSE (create in cpanel first)
//This file connects to your database and crestes the necessary
$link = @mysql_pconnect("$dbhost", "$dbuser", "$dbpasswd");
if ($link != TRUE)
{
   echo "Cannot connect to database";
   die(mysql_error());
}

mysql_select_db($dbname, $link);
//I just pulled this from making the table using phpadmin that why its looks so funny
$sql = mysql_query('CREATE TABLE `clicks` ('
        . ' `id` TINYINT NOT NULL AUTO_INCREMENT, '
        . ' `url` TEXT NOT NULL, '
        . ' `number` VARCHAR(25) NOT NULL, '
        . ' `type` TEXT NOT NULL,'
        . ' PRIMARY KEY (`id`)'
        . ' )'
        . ' TYPE = myisam');
if ($sql == TRUE)
{
   echo "TABLE ADDED";
   echo "<meta http-equiv=\"refresh\" content=\"5;URL=nowwhat\">";

}
else
{
   echo "There has been a problem";
}
mysql_close($link);
?>


You can close topic now. Should move some of this to a new forum called solved issues so people can see some wierd mistakes and errors

I just reread over the reason why. It wasn't actually that difficult. I was just way over coding the variables and you cant make a variable like this..

$cdb = "$blah, $blah2, $blah3";
it was basically teling me to go screw myself..
orno
lol ok, good job Smile

P.S whoever closed this, next time change the topic to also include [RESOLVED]
Related topics
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.