Duchaine Posted October 24, 2020 Share Posted October 24, 2020 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) Quote Link to comment https://forums.phpfreaks.com/topic/311637-connection-to-db-from-web-page/ Share on other sites More sharing options...
requinix Posted October 25, 2020 Share Posted October 25, 2020 Quote Link to comment https://forums.phpfreaks.com/topic/311637-connection-to-db-from-web-page/#findComment-1582066 Share on other sites More sharing options...
phppup Posted November 4, 2020 Share Posted November 4, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/311637-connection-to-db-from-web-page/#findComment-1582226 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.