Jump to content

[SOLVED] PHP not recognizing MySQL?


Treval

Recommended Posts

 

Ok guys what are the steps I have to do in order to setup MySQL with PHP?

 

I read on here that you guys set values in php.ini and I don't think I did that.

I got Apache running too and I'm on Wnidows XP Pro.

I probably have to add lines to httpd.conf concerning MySQL?

 

Which could explain why all my PHP scripts that try to connect to MySQL are displaying a blank page..

I don't know the reason yet.

I used default codes from google to connect.

 

Here's one:

 

<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');

$dbname = 'petstore';
mysql_select_db($dbname);
?> 

 

Any help is greatly appreciated.

 

Treval

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/41606-solved-php-not-recognizing-mysql/
Share on other sites

Yes please read the Sticky titled Call to undefined function mysql_connect() in the PHP Help forum or the PHP Installation forum.

 

Also it is recommended to set error_reporting to E_ALL in the php.ini whilst you are learning/developing your scripts. Before you change it make sure that display_errors is set to On in the php.ini too. That way if any errors crop up it will show you errors as to why rather than getting an unhelpful blank page.

 

Also any changes you make to the php.ini make sure you save it and restart Apache.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.