Jump to content

Connection to DB from web page


Duchaine

Recommended Posts

Hi,

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

***********************

<?php

function OpenCon()

{

$dbhost = "localhost";

$dbuser = "root";

$dbpass = "1234";

$db = "example";

etc.,etc.

***********************

<?php

/* 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?)

 

(config)

<?php

error_reporting(0);

// db bits here
include_once("db_connect.php");

// 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

//DO NOT MODIFY THE LINE BELOW
include_once("function-library.php");

?>
Thanks!

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. Please don't revive it unless you have something important to add.

Join the conversation

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

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