The PHP code connects fine as you can see here: http://www.ccspecialorders.com/test/
Also when I set up an ODBC it connects fine as well.
connect code in PHP code is this:
Code: Select all
$db_host = 'instance28600.db.xeround.com:18692';
$db_user = 'admin';
$db_pwd = 'admintest';
$database = 'testdb';
$table = 'testdbtable';
if (!mysql_connect($db_host, $db_user, $db_pwd))
die("Can't connect to database");
if (!mysql_select_db($database))
die("Can't select database");
// sending query
$result = mysql_query("SELECT * FROM {$table}");
if (!$result) {
die("Query to show fields from table failed");
}
What am I doing wrong?
Code: Select all
/*
* HMG - Harbour Win32 GUI library
* Copyright 2002-2008 Roberto Lopez <mail.box.hmg@gmail.com>
* http://sites.google.com/site/hmgweb/
*/
#include "hmg.ch"
# include "minigui.ch"
Function Main()
set century on
set date ital
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 200 ;
HEIGHT 200 ;
MAIN;
TITLE 'Button Test'
DEFINE MAIN MENU
POPUP 'Test'
ITEM 'Disable button' ACTION Form_1.Button_1.Enabled := .f.
ITEM 'Enable button' ACTION Form_1.Button_1.Enabled := .t.
END POPUP
END MENU
@ 30,70 BUTTON Button_1 PICTURE "button.bmp" WIDTH 50 HEIGHT 50 ACTION connect2db('instance28600.db.xeround.com:18692','admin','admintest','testdb')
@ 100,70 textbox t1 value date() date
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return
FUNCTION connect2db(host,user,password,dbname)
dbo := tmysqlserver():new(AllTrim(host),AllTrim(user),AllTrim(password))
IF dbo:NetErr()
msginfo(dbo:ERROR())
RETURN nil
ENDIF
dbo:selectdb(dbname)
IF dbo:NetErr()
msginfo(dbo:ERROR())
RETURN nil
ENDIF
//msginfo("Successfully Connected to the MySQL Server")
RETURN nil