PDA

View Full Version : <cfquery> correct cfm <> mysql phpMyAdmin ? I use goDaddy.com hosting (php/cfml/mysql


lse123
03-07-2009, 08:23 PM
<cfquery datasource="cf123" password="1234CF123" username="cfdbK" name="getData" >
SELECT * FROM CustomersTable
</cfquery>

is it correct if CustomersTable is a table in phpMyAdmin ? I am using www.goDaddy.com hosting (php/cfml/mysql), well ?

Gjslick
03-08-2009, 08:28 AM
That would be correct if the table is in fact named CustomersTable, and you have the correct datasource name. Did you set up the datasource by the way?

lse123
03-08-2009, 10:40 AM
<cfquery > needs any other parameter ?

phpMyAdmin may be used with PHP or CFML , Correct ?

Cfm database DSN must be setup or is the same as username ?

Gjslick
03-08-2009, 07:14 PM
Actually <cfquery> only needs the name and datasource attributes. Your datasource (DSN) must be set up though. I don't know how to do that on GoDaddy (as I don't use GoDaddy), but I'm assuming it's in the GoDaddy control panel somewhere. You're just going to have to look around for it.

Note that a datasource (DSN) is not the same as just your mysql database's name. A datasource encompasses all of the information that is needed to connect and log into that mysql database. In the regular ColdFusion administrator (which I'm sure you don't have access to on GoDaddy), a datasource is set up with the database name, database type, server (usually: localhost), and the username and password that you want to log into that database with. There has to be something just like that in GoDaddy's control panel.

This would allow you to run queries just like this, if you named the datasource "myDatasource":

<cfquery name="getData" datasource="myDatasource">
SELECT * FROM CustomersTable
</cfquery>
The username and password attributes in the <cfquery> tag are just to override the username and password that you set up with your datasource, so you shouldn't need them.

If you still can't figure it out though, I'd recommend emailing GoDaddy's support. They would be able to guide you better than I (as they obviously know their own system). Good luck though, and let me know if you figure it out.

lse123
03-08-2009, 09:49 PM
Please note with godaddy.com we use phpMyAdmin ...

The below is correct if CustomersTable is a cfml variable ?

<cfquery name="getData" datasource="myDatasource">
SELECT * FROM #CustomersTable#
</cfquery>

Gjslick
03-08-2009, 10:01 PM
No, CustomersTable has to exist in your database, and you would not use # signs.

Gjslick
03-08-2009, 10:02 PM
By the way, is there an admin in GoDaddy for ColdFusion specific settings, rather than just php settings?