• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Is my database not connected? Why?

Explorer ,
Jun 21, 2016 Jun 21, 2016

Copy link to clipboard

Copied

Hello everyone! OK this is my first attempt at connecting a database to my website. I found some really good info on how to do this through how-to videos via YouTube.

Ok lets get to business. I'm still early in the process but I do have a database set-up and the simple PHP pages are good (still early though). Now, I need to try and confirm that the database and page(s) are linked - or connected so anyone that fills an account will be going right to the database. Well, here's the problem: When I insert this PHP script into the "sign up" page it give me this (right below here: Sorry pic.jpg

Take note that I made a script to purposely shows that quote with this script...it was suggested:

pic2.jpg

Ok, when the PHP file above (i.e. trying to connect to the database, I assume) pops-up on login/create account page, above is what I see...when I remove that specific PHP from the Login page, it looks fine. So please, if anybody has an idea on what may be causing this please share your thoughts. I suspect it's because the database is not in connection yet.

PS Here are a couple pictures from "The phpMyAdmin" operation I've been working on and is also not allowing me to

access the "Privilages" operation because it doesn't exist as an option along the top. Hence, I can't find out how to access my "User overview" User, Host, Password,

Global privilages, Grant, etc.

"The phpMyAdmin" in the video lesson:

snap1.jpg

"The phpMyAdmin" in which I'm working with now. There's no "Privilages" in it.

database2.jpg

TOPICS
Database access

Views

816

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 25, 2016 Jun 25, 2016

Copy link to clipboard

Copied

Your question is on PHP, but you are now in a ColdFusion forum. Go to a PHP forum or check this PHP documentation or this PHP tutorial out.

In any case, here is a suggestion:

<?php

$connect_error = "blah blah blah";

$isMySQLConnected = mysql_connect('localhost', 'root', '');

if (!$isMySQLConnected) {

    die($connect_error);

}

etc.

mysql_close($isMySQLConnected);

?>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 20, 2016 Jul 20, 2016

Copy link to clipboard

Copied

LATEST

Thanks for updates - or lack thereof. Here's the latest I have that seems to be connecting fine so far; along with the statement if it doesn't connect (NOTE- all italics represent what's below):

<?php

mysql_connect('a', 'b', 'c');

mysql_select_db('d');

$connect_error = 'Sorry, we\'re experiencing connection problems. Please come back and try again later.';

?>

a represents your personal "host name" which can be a long number like "17.9.56.6:82497" or simply be "localhost."

b represents the username or "root" which could simply be "root" or another name like "bill" or steph."

c represent a password like "treelawn69!" and can simply be blank '' if your database does not have a password.

d represents the title of your select database you chose to use.

This is where I am so far in my database connecting and will be working on this when I get home tomorrow. If anyone feels I am wrong with any of this please fill me in.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation