Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 23rd, 2005, 07:05 PM
Authorized User
 
Join Date: Jan 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default mySQL doesn't work with php

I'm trying to learn using mySQL in PHP. The problem is I can't get connection with mySQL server. mySQL Server works, queries works, but not from php. For example such script:

<?php

$connection_id = mysql_connect("localhost","phpuser","phppass");

if(mysql_select_db("adresy",$connection_id))
    echo "Connection set.";
else die("Connection not set");

?>

show the "Connection not set" screen in browser.
The apache is 1.3.31, PHP 4.3.10.

Of course PHP works excelent without using mySQL.

Help, anyone knows what's the problem?

Yo
__________________
Yo
 
Old January 24th, 2005, 05:27 AM
Authorized User
 
Join Date: Jan 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
<?php

mysql_connect("localhost","username","password") or die ("Unable to connect to MySQL server."); 
$db = mysql_select_db("name_of_database") or die ("Unable to select requested database."); 
?>
 
Old January 24th, 2005, 09:41 AM
Authorized User
 
Join Date: Jan 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is only another way to do what I want and I have still the same answer. In this case, I see "Unable to connect to MySQL server".

Something is wrong with the config

Yo
 
Old January 25th, 2005, 12:00 PM
Authorized User
 
Join Date: Jul 2004
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rajuru Send a message via Yahoo to rajuru
Default

your mysql server may not working

please tell about ur OS. then tell how you configured mysql server.


Best Regard:
Md. Zakir Hossain (Raju)
www.rubd.net
www.xenex.rubd.net
www.forum.rubd.net





Similar Threads
Thread Thread Starter Forum Replies Last Post
begin php & mysql - chapter 12, user_form.php jon_stubber Beginning PHP 1 March 9th, 2006 10:57 AM
mySQL doesn't work with php zarol PHP Databases 6 April 16th, 2005 03:28 PM
php does not work help!!! p2ptolu PHP How-To 2 March 23rd, 2005 03:51 AM
mysql does not work p2ptolu PHP Databases 1 March 8th, 2005 12:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.