 |
| PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the PHP Databases 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
|
|
|
|

January 23rd, 2005, 07:08 PM
|
|
Authorized User
|
|
Join Date: Jan 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 26th, 2005, 09:27 PM
|
|
Registered User
|
|
Join Date: Jan 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi guys,
I have the same problem in a Windows XP environment. I am using MySQL4.1 and PHP5. Other postings have said to take extensions and uncomment extensions in the php.ini. I have done that without success. People have also said to go back to the PHP4 but I still have the same problem with that MySQL_Connect() function.
Any help on this would be appreciated and if possible could you give me basic step by step instructions? Id there is no way around it then could you tell me the last two versions of both PHP and MySQL that worked properly together using the MySQL functions.
Regards
Johnny
|
|

February 26th, 2005, 11:06 AM
|
|
Authorized User
|
|
Join Date: Jan 2005
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
mysql on my system works alone but can not connect to php, i use php4 and mysql 4.1 on apache 1.33 all on win xp pro,please help me too.
|
|

March 8th, 2005, 01:17 PM
|
|
Registered User
|
|
Join Date: Mar 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i'm currently trying to set up php4.3.10 on xp pro alongside IIS and mysql4.1. i don't have the answers for you, but i have found that phpinfo() says the mysql library in php is only at 3.23.49 - whereas it should at least match the version of mysql
there's something here that looks like it's worth following up, although i haven't got my head around it yet:
http://lists.mysql.com/mysql/179529
|
|

March 8th, 2005, 01:31 PM
|
|
Registered User
|
|
Join Date: Mar 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
just followed up the link i posted previously, and it has sorted me out. essentially it involves going into mysql via the Command Prompt and making some changes - i didn't exactly understand the what i was doing, but this did work:
1. In Command Prompt type:
mysql -u root -p
2. enter password when requested
3. type the following where user is your username (probably 'root') and password is your password:
SET PASSWORD FOR user@localhost = OLD_PASSWORD('password');
it should say something like 'Query ok, 0 rows affected (0.01 sec)'
then when i went back into phpmyadmin bingo it found mysql ok
|
|

March 8th, 2005, 01:42 PM
|
|
Registered User
|
|
Join Date: Mar 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
forgot to mention - i also explicitly added TCP port 3306 as an exception to my firewall (ie. the port that i set mysql to listen on)
Control Panels / Windows Firewall / Exceptions / Add Port
|
|

April 16th, 2005, 03:28 PM
|
|
Registered User
|
|
Join Date: Apr 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks, I did set up my password by using :
"set password for root@loacalhost=password('your_password');
log out "\q", and then log back with:
mysql -u root -p,
prompts for password! 'yourpassword'
and then I get the wellcome monitor screen.
then I make sure I place the same password in my PHP script, at hte
mysql_connect () function.
and I now get : Can't create database 'wiley'. Database exists.
My hole next week will be dvoted to this message NOW..
|
|
 |