I have just installed Apache2.2.3 , php5.2 and mysql 5.
My question is: How do i setup, or need to do to get php5.2 to connect to mysql5.
I am an absolute beginner and really would like to get started in learning so need to get these sorted
I have just installed Apache2.2.3 , php5.2 and mysql 5.
My question is: How do i setup, or need to do to get php5.2 to connect to mysql5.
I am an absolute beginner and really would like to get started in learning so need to get these sorted
Is the apache working?
Are you able to parse PHP pages?
Is your MySQL Running?
Yes php5.2 and apache2.2.3 are working fine ,it just i’m learning from a book and when i tried to load this test example in to verify mysql was working all i got was a blank web page
Mysql Connection TestFirst I would refer you to http://phphelp.com/forums/posting.php for info on posting code… It just makes it so much easier to read posts.
Next, you probably want to look at your connection line
[php]
$connection = mysql_connect ( “localhost”, “root”, “”)
[/php]
If this WERE correct that means you would be connecting as the ROOT user with NO PASSWORD… VERY BAD INDEED!!!
I hope that is not the case.
the syntax for the mysql_connect should be (in it’s very basic form)
[php]
$connection = mysql_connect ( “Server”, “Username”, “Password”)
[/php]
Where :
Server is the name of the server you are connecting to. This may be in many forms. If it’s on the machine that you are running PHP from then you can use localhost or you can use a FQDN with port.
Username is the name of the mysql user authorized to connect to the database and that has been previously set up (NOT your login to the system) within the mysql server…
Password is the password supplied to the mysql Username (from above). Not your system password.
Hi there , yes this time i did get something but it was this error :
Fatal error: Call to undefined function mysql_connect() in C:Program FilesApache Software FoundationApache2.2htdocsmysql.php on line 4
can anyone help me here lol
Please post your code EXACTLY as it was is in your mysql.php. I have tried to duplicate the error and cannot. My error (because I used phony credentials) also gave an error on line 7 not 4.
An undefined function leads me to believe that there is a problem in the configuration. The undefined function is usually a result of it not being found. In this case PHP cannot find the function mysql_connect.
On Windows, you will probably have to copy libMySQL.dll from MySQL’s bin folder to a folder in the library path, like C:Windows or such. Then, you will need to enable the php_mysql.dll extension in php.ini.
This should all be documented in the manual under the MySQL extension.