Jump to content

Connection to DB from web page


Recommended Posts


Cannot put this together... what link do I use for my website to bring up the contents?

The database is good, all the stuff is there.  


I did this... https://www.cloudways.com/blog/connect-mysql-with-php/#createfolder



function OpenCon()


$dbhost = "localhost";

$dbuser = "root";

$dbpass = "1234";

$db = "example";




/* Setup MySQL Access */

$DBhost = "localhost";
$DBuser = "duchaine_admin";
$DBpass = "(mypw)'";
$DBname = "duchaine_";
mysql_connect($DBhost, $DBuser, $DBpass) or die ("Cannot connect to database server");
mysql_select_db($DBname) or die ("Cannot select site database");

?>(not uploaded, wanted to ask first - HTML page with above php inside?)





// db bits here

// site details
$site_name  = "American Family Recipe Database!";             // site name/title
$site_url   = "www.americanfamilyrecipedatabase.com";    // site url. Lowercase. Including the www. Remove any ending forward slash '/'. i.e. 'mysitename.com'.
$site_admin = "duchaine1932@gmail.com";        // email address used for the contact page

// other bits
$default_header = "Over 22,000 free recipes online now!";  // used a default title text when one is not set
$logo_slogan    = "Over 22,000 free recipes online now!";  // shown beneath the main logo



Leo Duchaine

(php wannabe)


Link to comment
Share on other sites

  • 2 weeks later...

You need to RUN the script.

This is done by calling it.

If your DOMAIN NAME is:. mydomain

And the file in the root folder is xyz.php

Then, open a browser and type in the address bar: mydomain/xyz.php


Another tip: You can remove the: include_once("db_connect.php") and replace it with the actual connection information DIRECTLY in the script.

This is NOT an optional method to use, but a good troubleshooting technique to determine whether a connection problem is due to the scripting code or the connection code.

Once everything is working, you can expand and confidentially use the include_once("db_connect.php") format.

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 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.