Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 23rd, 2005, 07:08 PM
Authorized User
 
Join Date: Jan 2005
Location: Siemianowice, , Poland.
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
Reply With Quote
  #2 (permalink)  
Old January 26th, 2005, 09:27 PM
Registered User
 
Join Date: Jan 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #3 (permalink)  
Old February 26th, 2005, 11:06 AM
Authorized User
 
Join Date: Jan 2005
Location: ipaja, lagos, Nigeria.
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to p2ptolu Send a message via Yahoo to p2ptolu
Default

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.

Reply With Quote
  #4 (permalink)  
Old March 8th, 2005, 01:17 PM
Registered User
 
Join Date: Mar 2005
Location: london, , United Kingdom.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #5 (permalink)  
Old March 8th, 2005, 01:31 PM
Registered User
 
Join Date: Mar 2005
Location: london, , United Kingdom.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #6 (permalink)  
Old March 8th, 2005, 01:42 PM
Registered User
 
Join Date: Mar 2005
Location: london, , United Kingdom.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #7 (permalink)  
Old April 16th, 2005, 03:28 PM
Registered User
 
Join Date: Apr 2005
Location: miami, fl, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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..
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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
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
mySQL doesn't work with php zarol Beginning PHP 3 January 25th, 2005 12:00 PM



All times are GMT -4. The time now is 05:15 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.