Can't Connect to Database via PHP

3 replies [Last post]
PandaWarrior1014
Offline
Last seen: 5 years 47 weeks ago
Joined: 2013-04-06

(trying to connect via tcp://127.0.0.1:3306) in C:...\database.php on line 10"

I'm following along with the PhP Programming videos and I've tried re installing Drupal Dev Desktop to accomplish exactly what's being done in the videos but I keep hitting this brick wall. I tried looking online for some help but perhaps I missed a step? My url and database are set up the same way as in the videos:

// Replace with the username and password you used for PhpMyAdmin.
$server = 'localhost';
$username = 'drupaluser';
$password = '';
$database = 'my_database';

So what's wrong?
* 6:03 - How to connect to a MySQL database with PHP

lukejoliat
Offline
Last seen: 2 years 2 days ago
Joined: 2015-11-03
did you ever figure this out?

did you ever figure this out? I am having the same problem

webnytraining3
Offline
Last seen: 3 years 9 weeks ago
Joined: 2015-08-12
also running into this problem

I'm encountering the same issue. I'm new to PHP and googled around and still haven't resolved this issue.

Chris Shattuck
Offline
Last seen: 5 weeks 3 days ago
Joined: 2009-08-16
Hey folks, If you run into

Hey folks,

If you run into this problem, it's possible that the version of PHP you're using has deprecated the mysql functions. Here's what one user said solved their problem:

"After looking through my php error log, I discovered the issue. Apparently the version of PHP I am using no longer accepts the mysql_connect function, but instead uses mysqli extension. Once I replaced all the relevant functions, I was able to connect to my database, no problem! Thanks for the quick response, regardless."

I hope that helps!
Chris

Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:


Loading...
Contact us

Below are the supported keyboard shortcuts for our video player.

space
Start / stop video
shift
Go to next video
shift
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
1...9
Jump to a percentage (2 is 20%, for example)
f
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
$29
1 month
$156
6 months
10% off
$276
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
user
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.