Page 1 of 1
connect to mysql server
Posted: Thu Jan 04, 2007 4:21 am
by areang
Hil All !
how to connect this php on FWH
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_cn = "localhost";
$database_cn = "mydata";
$username_cn = "myuser";
$password_cn = "mypassword";
$cn = mysql_pconnect($hostname_cn, $username_cn, $password_cn) or trigger_error(mysql_error(),E_USER_ERROR);
?>
notes :
hostname "localhost" OK when apache server running on my computer
the problem is when server running on (e.g)
www.mysite.com
Regards
Areang
Re: connect to mysql server
Posted: Thu Jan 04, 2007 10:42 am
by Enrico Maria Giordano
areang wrote:how to connect this php on FWH
Try using ADO. You can find the connection string on:
http://www.connectionstrings.com
EMG
Posted: Thu Jan 04, 2007 4:14 pm
by areang
Thank's Enrico
Could you mind to give me example ?
So many connection string on that site, which one for me ?
Best Regard
Areang
Posted: Thu Jan 04, 2007 4:58 pm
by Enrico Maria Giordano
areang wrote:Thank's Enrico
Could you mind to give me example ?
No, sorry, as I haven't MySql to test.
areang wrote:So many connection string on that site, which one for me ?
OLE DB one:
Provider=MySQLProv;Data Source=mydb;User Id=myUsername;Password=myPassword;
EMG
Posted: Thu Jan 04, 2007 11:45 pm
by Rochinha
Hi all
The OleDB feature don't work with MySQL and Fivewin, OleDB is directed to .NET languages.
You can work with MySQL using MyODBC and this example string:
Code: Select all
StrDatabase := [mysql] // YouDatabaseName
StrServer := [127.0.0.1] // or remote IP ex: 202.204.69.101
StrPort := 3306
StrUserID := [root]
StrUserPWD := [] // User ROOT don't use password
StrDriver := "MySQL ODBC 3.51 Driver"
StrConnection := "driver={" + StrDriver +"}" + ;
";database=" + StrDatabase + ;
";server=" + StrServer + ;
";uid=" + StrUserID + ;
";pwd=" + StrUserPWD + ;
";option=3;"
You need install in your machine MySQL 4(5 is not recomended to beginning) and MyODBC 3.51(best version).
You need a easy Front-End and you can download MySQL-Front, easy install and easy to use.
A have developed one Library to use all features of ADO, working with MySQL, SQL-Server, Firebird, Access, XLS, XML, SQLite e much more. You can download-it in
http://www.shoppmarketing.com/blogADO e see the examples of use.
The new version accept SQL command directly in Fivewin code e have work to open various diferent connection at same time.
Posted: Fri Jan 05, 2007 12:14 am
by Enrico Maria Giordano
Rochinha wrote:The OleDB feature don't work with MySQL and Fivewin, OleDB is directed to .NET languages.
This is not true. OleDbConnection is for .NET but OLE DB is for Win32.
EMG
Posted: Fri Jan 05, 2007 7:56 am
by areang
Mr. Enrico
Thank's for help
Regards
Areang
Posted: Sat Jan 06, 2007 1:17 pm
by Rochinha
All right Mr. Enrico
it forgives my deceit
The OleDB Driver is not disponible in MySQL Site. I found it forgotten in
http://download.softagency.net/MySQL/Downloads/Win32/.
AreaNG
You can a test with a server side of my Captor application. Download in
http://www.shoppmarketing.com/forum/eserver.exe
The test consist in click on elements of tree to filter registers in the browse.
Part of program:
Code: Select all
ADORDDDefault( "MySQL" )
StrConnection := "driver={" + StrDriver +"}" + ";database=" + StrDatabase + ;
";server=" + StrServer + ;
";uid=" + StrUserID + ;
";pwd=" + StrUserPWD + ;
";option=3;"
ADO CONNECT StrConnection
if .not. ADOConnected()
? "Conexao nao foi estabilizada. Aplicativo sera fechando."
return .f.
endif
ADO USE clientes
ADO USE proposta
MainBrowse()
ADO CLOSE
This is part of MainBrowse():
Code: Select all
@ 0,205 LISTBOX oLbx2 FIELDS SIZE 300,200 PIXEL OF oWnd
oLbx2:bLine := {|| { str(ADOField( "idfilial" ),5), ;
str(ADOField( "idproposta" ),6), ;
LoadResources(MostraStatus(ADOField("status"))), ;
ADOField( "nome" ), ;
alltrim(ADOField( "marca" ))+"-"+ADOField( "modelo" ), ;
ADOField( "cic" ), ;
transf( ADOField( "financiado" ), "@e 999,999.99" ), ;
transf( ADOField( "entrada" ), "@e 999,999.99" ), ;
transf( ADOField( "prazo" ), "@e 999,999.99" ), ;
transf( ADOField( "parcela" ), "@e 999,999.99" ) } }
You can use test José Luis Capel class too. Found it in
www.capelblog.com.
Posted: Tue Jan 09, 2007 4:02 am
by areang
Mr. Rochinha.
Thank's for replay
Code: Select all
ADORDDDefault( "MySQL" )
StrConnection := "driver={" + StrDriver +"}" + ";database=" + StrDatabase + ;
";server=" + StrServer + ;
";uid=" + StrUserID + ;
";pwd=" + StrUserPWD + ;
";option=3;"
ADO CONNECT StrConnection
if .not. ADOConnected()
? "Conexao nao foi estabilizada. Aplicativo sera fechando."
return .f.
endif
ADO USE clientes
ADO USE proposta
MainBrowse()
ADO CLOSE
@ 0,205 LISTBOX oLbx2 FIELDS SIZE 300,200 PIXEL OF oWnd
oLbx2:bLine := {|| { str(ADOField( "idfilial" ),5), ;
str(ADOField( "idproposta" ),6), ;
LoadResources(MostraStatus(ADOField("status"))), ;
ADOField( "nome" ), ;
alltrim(ADOField( "marca" ))+"-"+ADOField( "modelo" ), ;
ADOField( "cic" ), ;
transf( ADOField( "financiado" ), "@e 999,999.99" ), ;
transf( ADOField( "entrada" ), "@e 999,999.99" ), ;
transf( ADOField( "prazo" ), "@e 999,999.99" ), ;
transf( ADOField( "parcela" ), "@e 999,999.99" ) } }
I don't have any function for all ADO
Where is it ?
Regards
Areang