rallokkcaz Posted August 15, 2006 Share Posted August 15, 2006 [code]$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."); ?> [/code]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! Quote Link to comment https://forums.phpfreaks.com/topic/17591-not-connecting-to-mysql-server/ Share on other sites More sharing options...
HeyRay2 Posted August 15, 2006 Share Posted August 15, 2006 Change your [b]die()[/b] calls to print out the MySQL error you are receiving:[code]<?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());?>[/code]Post back with the error you receive... ;) Quote Link to comment https://forums.phpfreaks.com/topic/17591-not-connecting-to-mysql-server/#findComment-74952 Share on other sites More sharing options...
rallokkcaz Posted August 15, 2006 Author Share Posted August 15, 2006 what does that do? Quote Link to comment https://forums.phpfreaks.com/topic/17591-not-connecting-to-mysql-server/#findComment-74955 Share on other sites More sharing options...
rallokkcaz Posted August 15, 2006 Author Share Posted August 15, 2006 ohhit 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] Quote Link to comment https://forums.phpfreaks.com/topic/17591-not-connecting-to-mysql-server/#findComment-74957 Share on other sites More sharing options...
wildteen88 Posted August 15, 2006 Share Posted August 15, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/17591-not-connecting-to-mysql-server/#findComment-75025 Share on other sites More sharing options...
rallokkcaz Posted August 15, 2006 Author Share Posted August 15, 2006 ok im on a mac i can't download php5im using a site that uses phpmyadmin it won't let me connect to databaseright now im trying to connect to the database through dreamweaver. can any one help? Quote Link to comment https://forums.phpfreaks.com/topic/17591-not-connecting-to-mysql-server/#findComment-75222 Share on other sites More sharing options...
tdnxxx444 Posted August 15, 2006 Share Posted August 15, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/17591-not-connecting-to-mysql-server/#findComment-75227 Share on other sites More sharing options...
whare Posted August 15, 2006 Share Posted August 15, 2006 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 problemHope its some help :) Quote Link to comment https://forums.phpfreaks.com/topic/17591-not-connecting-to-mysql-server/#findComment-75228 Share on other sites More sharing options...
rallokkcaz Posted August 15, 2006 Author Share Posted August 15, 2006 [quote author=tdnxxx444 link=topic=104306.msg416307#msg416307 date=1155662046]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?[/quote]yes i have i set up a database for users Quote Link to comment https://forums.phpfreaks.com/topic/17591-not-connecting-to-mysql-server/#findComment-75230 Share on other sites More sharing options...
anthonydamasco Posted August 15, 2006 Share Posted August 15, 2006 [code=php:0]<phperror_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");?>[/code]make sure mysql will allow users to connect from the domain the php is on. Quote Link to comment https://forums.phpfreaks.com/topic/17591-not-connecting-to-mysql-server/#findComment-75324 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.