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

Pages not connecting to MySQL database

Guest
May 28, 2011 May 28, 2011

I programmed some web pages on my Mac OS X (10.5.8) using Dreamweaver CS4 and MAMP.  Now I've uploaded them to a host (FatCow) and transferred my MySQL database to the same host, but I can't get them to connect, so the body of the page shows up, but things like #story_head# show up like that instead of being replaced with information from the database.

The host has a MySQL code generator from which I got this PHP string (Python and Perl are the other generator choices) and put it in my root folder in a file called "connect.php":

<?php 
$link = mysql_connect('burwelltribunecom.fatcowmysql.com', 'megan', 'password'); 
if (!$link) { 
    die('Could not connect: ' . mysql_error()); 
} 
echo 'Connected successfully'; 
mysql_select_db(burwelltribune); 
?> 

"connect.php" works when I open it separately, but the .cfm pages still aren't connecting to it.

Host support says it's a coding issue on my end, so my question is where should I put that PHP string or do I need different code to connect to the database in the .cfm pages?

Here's one of the pages: http://burwelltrib.com/TRIBUNESITE/tribuneindex.cfm

This is the code I used to connect to the database when it was on my local computer, and that's still what's in there:

<!---Datasource--->

<CFSET DataSource="burwelltribune">

<CFQUERY name="DisplayNewsStories" datasource="#DataSource#">

     SELECT *

     FROM stories

</CFQUERY>

        <CFQUERY name="DisplaySportsStory" datasource="#DataSource#">

     SELECT *

     FROM stories

</CFQUERY>

        <CFQUERY name="DisplayWeather" datasource="#DataSource#">

     SELECT *

     FROM weatherreport

</CFQUERY>

Thanks!

TOPICS
Database access
538
Translate
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 ,
May 28, 2011 May 28, 2011

Your virtual server or directory isn't configured to serve CF applications. This doesn't have anything to do with MySQL. You can verify this by creating a very simple CF page like this:

<html>

<head>

<title>This page probably won't work</title>

</head>

<body>

Today's date: <cfoutput>#dateFormat(now())#</cfoutput>

</body>

</html>

Beyond that, once you get CF running properly, you'll need to configure the datasource just like you did on your own computer. CF doesn't use connection strings like PHP does.

Dave Watts, CTO, Fig Leaf Software

http://www.figleaf.com/

http://training.figleaf.com/

Dave Watts, Eidolon LLC
Translate
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
LEGEND ,
May 29, 2011 May 29, 2011
LATEST
Your virtual server or directory isn't configured to serve CF applications. This doesn't have anything to do with MySQL. You can verify this by creating a very simple CF page like this:

And FatCow make no claims to provide CF hosting...

--

Adam

Translate
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