Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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/
Copy link to clipboard
Copied
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