-
PHP Help
Hello,
I moved our website to godaddy.com (probably a mistake) but our old web guy quit. Anyway, now I cannot get the database part of the site to work. Here is the code that godaddy says is needed and after that is the code we have. Can anyone help me modify our code so it will work on godaddy? Thanks in advance for any help.
Art
godaddy suggests:
<?php
//Connect To Database
$hostname='hampsteadcos.db.4688542.hostedresource. com';
$username='hampsteadcos';
$password='your password';
$dbname='hampsteadcos';
$usertable='your_tablename';
$yourfield = 'your_field';
mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.');
mysql_select_db($dbname);
$query = 'SELECT * FROM $usertable';
$result = mysql_query($query);
if($result) {
while($row = mysql_fetch_array($result)){
$name = $row['$yourfield'];
echo 'Name: '.$name;
}
}
?>
Our code that needs to be changed to work on godaddy is:
<?php
#---------- Site-wide configuration
$GLOBALS[mysqlconnect] = "mysql://hampstead_sql:h4mpst34d*sql@localhost/hampstead_com_-_content";
$ROW_COLORS = array ("#ffffff","#eee3e3");
$GLOBALS[config_numnewthumbs] = 4;
$GLOBALS[config_cachethumb] = 1;
#---------- Portfolio Thumbs
$GLOBALS[config_max_width] = 149;
$GLOBALS[config_max_height] = 112;
$GLOBALS[config_syn_max_width] = 118;
$GLOBALS[config_syn_max_height] = 168;
$GLOBALS[config_items_per_page] = 20;
#---------- Start DB Connection
require_once('DB.php');
$db = DB::connect($GLOBALS[mysqlconnect]);
global $db;
if (DB::iserror($db)) { die($db->getMessage()); }
#---------- load prefs
#load_prefs();
#---------- Functions
function run_query ($sql) {
global $db;
if ($GLOBALS[debug]) {
print "sql: $sql<br>\n";
}
$q = $db->query($sql);
if (DB::iserror($q)) { die($q->getMessage()); }
return $q;
}
.....etc.....
-
Set Up a Discussion with an Assigned Rep ...
I have dozens of domains held, and many sites hosted, by Go Daddy for several years, and have an assigned rep with whom I discuss needs of this sort. They have done an excellent job in helping me to meet any needs that have arisen. And you would be hard pressed to find a more reasonably priced situation.
You really need to get access to such personalized assistance. You may find it difficult to wing on your own, and may not be able to get a precise solution that fits your needs from a forum such as this.
Good Luck.
Bill
-
Thanks for the replay Bill. Good to hear that godaddy is not the issue.
Not sure I understand your response though. Are you suggesting that tech support at godaddy should help me with this? I tried that some time ago and their reply was that they do not provide that kind of help.
I have seen all kinds of helpful responses on forums like this to questions similar to mine so I'm not sure why someone here could not help me.
-
I Appreciate the Response ...
Best of luck with your issues.
Bill
-
huh? Are you trying to be helpful or just jerking me around? Geez.
-
Hi, I touch php before, maybe you can check the configuration and the syntax of out print
________
Ford f-4eat transmission specifications
Last edited by sql; 03-06-2011 at 02:11 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|