Skip navigation links

MySQL Forums :: PHP :: Need help connecting MySQL with PHP


Advanced Search

Need help connecting MySQL with PHP
Posted by: Michal McCaskle ()
Date: February 25, 2013 05:24PM

I am teaching myself PHP & MySQL from two different books:
PHP & MySQL in easy steps and PHP/MySQL for Dummies.

I've learned most of the SQL commands but for some reason I can't get a connection or response when I try to link the html files to the database.

I have Abyss Web Server setup on my computer to develop my sites before publishing.

In Easy Steps says to create two files:

connect_db.php in the htdocs parent folder:

<?php
$dbc = mysqli_connect
( 'localhost' , 'mike' , 'easysteps' , 'site_db' )
OR die
( mysqli_connect_error() ) ;
mysqli_set_charset( $dbc , 'utf8' ) ;

&

require.php in the htdocs folder

<?php
require ( '../connect_db.php' ) ;

if( mysqli_ping( $dbc ) )
{ echo 'MySQL Server '.mysqli_get_server_info( $dbc ).' on '.mysqli_get_host_info( $dbc ) ; }

Now when I open it in my browser the page is empty. And nothing shows up....
There should be a line saying connection succesful but its not there.

And when I try PHP/MySQL for Dummies' SQL test i get the same blank page.

Any help would be greatly appreciated!!!!!

Options: ReplyQuote


Subject Written By Posted
Need help connecting MySQL with PHP Michal McCaskle 02/25/2013 05:24PM
Re: Need help connecting MySQL with PHP Barry Galbraith 02/25/2013 05:52PM
Re: Need help connecting MySQL with PHP Michal McCaskle 02/25/2013 06:23PM
Re: Need help connecting MySQL with PHP Barry Galbraith 02/25/2013 09:01PM
Re: Need help connecting MySQL with PHP Michal McCaskle 02/26/2013 12:21AM
Re: Need help connecting MySQL with PHP Barry Galbraith 02/26/2013 02:57PM
Re: Need help connecting MySQL with PHP Peter Brawley 02/26/2013 12:34AM
Re: Need help connecting MySQL with PHP Barry Galbraith 02/26/2013 03:00PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.