Jump to content


Photo

not connecting to mysql server!!


  • Please log in to reply
9 replies to this topic

#1 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 15 August 2006 - 07:11 AM

$dbhost = 'localhost'; 
$dbusername = ''; 
$dbpasswd = ''; 
$database_name = ''; 
 
$connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd")  
    or die ("Couldn't connect to server."); 
$db = mysql_select_db("$database_name", $connection) 
    or die("Couldn't select database."); 
?>
im using phpmyadmin.
i can't seem to connect to the server.
im not typing anything wrong i can't figure it out!
pleeze help!

#2 HeyRay2

HeyRay2
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts

Posted 15 August 2006 - 07:28 AM

Change your die() calls to print out the MySQL error you are receiving:

<?php

$connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd")  
    or die ("Couldn't connect to server: ".mysql_error()); 
$db = mysql_select_db("$database_name", $connection) 
    or die("Couldn't select database: ".mysql_error());

?>

Post back with the error you receive... ;)

#3 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 15 August 2006 - 07:47 AM

what does that do?

#4 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 15 August 2006 - 07:51 AM

ohh
it still doesn't work thanks for the help tho. :'(
but tommarow im gonna get a hosting package for my site!
thanks for the help!
[move]""""""""""""pieisgood"""""""""""""[/move]


#5 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 15 August 2006 - 11:11 AM

Have you installed PHP locally on your computer? If you have installed PHP5 and you're on Windows you'll need to enable the php_mysql.dll function. If you have PHP4 then it should work. Also if you are not on Windows you'll need to recompile PHP with the --with-mysql command option.

Could you post more information about your PHP setup.

#6 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 15 August 2006 - 05:07 PM

ok im on a mac i can't download php5

im using a site that uses phpmyadmin
it won't let me connect to database

right now im trying to connect to the database
through dreamweaver.
can any one help?

#7 tdnxxx444

tdnxxx444
  • Members
  • Pip
  • Newbie
  • 3 posts

Posted 15 August 2006 - 05:14 PM

Looks like you're not connect as any user with any password to any database.  Have you set up these three things on your mysql server?

#8 whare

whare
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 15 August 2006 - 05:14 PM

carnt help you with dreamweaver

But with your connection problems try checking the server address coz some servers dont use localhost I no mine dont mine is [serverurl.com] just check that one that may be your problem

Hope its some help :)

#9 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 15 August 2006 - 05:20 PM

Looks like you're not connect as any user with any password to any database.  Have you set up these three things on your mysql server?


yes i have i set up a database for users

#10 anthonydamasco

anthonydamasco
  • Members
  • PipPipPip
  • Advanced Member
  • 92 posts

Posted 15 August 2006 - 08:48 PM

<php

error_reporting(E_ALL);
ini_set('display_errors','on');

    $conn = mysql_connect("localhost" ,"username", "password");
    $db = mysql_select_db("database") or die("Unable to select database");

?>
make sure mysql will allow users to connect from the domain the php is on.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users