Hi,
this run ok in php.............but how I do in fw
$resulta1 = mysqli_query($conexion, " SELECT * FROM $tabla_db2 WHERE subcta = $cue ");
$consulta1 = mysqli_fetch_array($resulta1);
$claveve = $consulta1['clave'];
$nombre = $consulta1['subnom'];
$cuentaoriginal = $consulta1['cta'];
$tipomoneda = $consulta1['sumon'];
a simple select con where.
Thank you.
in php I do this way, but how in fw SOLUCIONADO
-
- Posts: 392
- Joined: Wed Jul 31, 2013 1:14 pm
- Location: Maldonado - Uruguay
- Contact:
in php I do this way, but how in fw SOLUCIONADO
Last edited by D.Fernandez on Sun Nov 29, 2020 4:30 pm, edited 1 time in total.
Dario Fernandez
FWH, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay
FWH, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 392
- Joined: Wed Jul 31, 2013 1:14 pm
- Location: Maldonado - Uruguay
- Contact:
Re: in php I do this way, but how in fw
Antonio, muchas gracias.
Pero lo quiero hacer en un programa de escritorio.
Es una aplicacion vieja, que quiero ir pasando a MySql.
Saludos.
Pero lo quiero hacer en un programa de escritorio.
Es una aplicacion vieja, que quiero ir pasando a MySql.
Saludos.
Dario Fernandez
FWH, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay
FWH, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay
-
- Posts: 392
- Joined: Wed Jul 31, 2013 1:14 pm
- Location: Maldonado - Uruguay
- Contact:
Re: in php I do this way, but how in fw
Antonio, I can't do a SELECT whith the clausula WHERE.
I don't see any axample.
Example: Insert
FWCONNECT oCon HOST 'localhost' USER 'root' PASSWORD '' DB dbases
csql := oCon:InsertSQL( ctabla ,"nomlargo,idusu,pasar, claveliq",;
{ 'hola' , 'holla2', '30745298', '123456789' } )
ocon:Execute(csql)
Esto funciona bien.
Pero un SELECT con clausula WHERE no logro hacerlo.
Gracias, Saludos.
I don't see any axample.
Example: Insert
FWCONNECT oCon HOST 'localhost' USER 'root' PASSWORD '' DB dbases
csql := oCon:InsertSQL( ctabla ,"nomlargo,idusu,pasar, claveliq",;
{ 'hola' , 'holla2', '30745298', '123456789' } )
ocon:Execute(csql)
Esto funciona bien.
Pero un SELECT con clausula WHERE no logro hacerlo.
Gracias, Saludos.
Dario Fernandez
FWH, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay
FWH, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay
- Marc Venken
- Posts: 727
- Joined: Tue Jun 14, 2016 7:51 am
Re: in php I do this way, but how in fw
Maybe this part of code can help you...
Code: Select all
#include "FiveWin.ch"
#include "richedit.ch"
#include "ord.ch"
#include "xbrowse.ch"
#include "Mail.ch"
REQUEST DBFCDX
#define WID 600
#define HGT 350
#define MY_GREEN nRGB( 145, 214, 124)
FUNCTION Main
local cTable, oBrw, oList, aData
local oDlg, oBar, oFont
local cErrorLogFileName:= "MyLog.log"
Public cServer := "your data"
Public cDataBase := "your data"
Public cUser := "your data"
Public cPassWord := "your data"
PUBLIC oCn, oRs, setup_user:="", setup_naam:="", setup_version:="", setup_level:="", sys_admin:=.F., cPath:="", cLocal:="", cOnline:=""
PUBLIC oCn_kab, oRs_kab
PUBLIC system_version:="20052018", sys_ploegsplit:=0
PUBLIC aPloegen:= {} ,aBtn:= {} ,aBtn2:= {}, aToegang:= {}, aPloegTypes:= {}
Public aUserEdit:= {}
SetPostErrorAction( { |cErrorLogFileName, oError| MyErrorAction( cErrorLogFileName, oError ) } )
RDDSetDefault( "DBFCDX" )
set( 4, "mm/dd/yyyy" )
set( 5, 1930 )
SET DATE BRITISH
XbrNumFormat( 'E', .t. )
//set deleted on
SetHandleCount( 100 )
setkey( VK_F12,{|| xbrowser(oBrw[4]) } )
FWCONNECT oCn HOST cServer USER cUser PASSWORD cPassword DATABASE cDatabase
if oCn == nil
? "Failed to connect to Maveco"
return nil
endif
getploegen() // this gets some data
oRs := oCn:RowSet( "SELECT * FROM parameters" )
system_version = oRs:versie
if lGetPassword(.t.)
oCn:close()
oCn_kab:close()
SET 3DLOOK ON
DEFINE BRUSH oBrush STYLE TILED // FiveWin new predefined Brushes
DEFINE WINDOW oWnd TITLE "LEDEN - ADMINISTRATIE" MENU BuildMenu() BRUSH oBrush
/// Rest code
function getploegen()
oRs := oCn:RowSet( "select * from ploegen where `actief` = ?", { .T. } )
oRs:MoveFirst()
aPloegen := ArrTranspose( oRs:GetRows() )[ 2 ]
aPloegTypes := ArrTranspose( oRs:GetRows() )[ 14 ]
ASize( aBtn, len(aPloegen))
ASize( aBtn2, len(aPloegen))
oRs:close()
return NIL
/*
Some samples :
oRs_Match := oCn_kab:RowSet( "SELECT * FROM tbl_matchen where `poule` = ? " , { "3B" } )
oRsInvent := oCn:RowSet( "SELECT * FROM inventaris" )
oRsMatch := oCn:RowSet( "select * from matchen where `bond` = ?", { oRs:bond } )
oCn:Insert( "changes", "veld, doorwie, naam, voornaam,oldploeg,newploeg,datum", { "Ploeg", setup_naam,oBrw:naam:value, oBrw:voornaam:value, oBrw:p2018:value, cPloeg, date() } )
oCn:Insert( "errors", "datum,uur,user,error,errorlog", { date(),time(), setup_naam, oError:dEscription,cErrText } )
*/
static function BrwDelselect(oBrw)
if msgyesno("Wenst U deze regels te wissen ?")
if !Empty( oBrw:aDeleted )
a := {}
AEval( oBrw:aDeleted, { |x| If( Empty( x[ 1 ] ), nil, AAdd( a, x[ 1 ] ) ) } )
// Array of IDs (primary key) to delete
if !Empty( a )
cSql := "DELETE FROM leden WHERE ID IN " + oCn:ValToSQL( a )
oCn:Execute( cSql )
if oCn:nError != 0
BREAK
endif
endif
endif
endif
return nil
///// This will get some Data from online database and change it.
FWCONNECT oCn HOST cServer USER cUser PASSWORD cPassword DATABASE cDatabase
if oCn == nil
? "Failed to connect"
return nil
endif
oRs := oCn:RowSet( "SELECT * FROM leden" )
oRs:sort:= 'BOND'
oRs:MoveFirst()
do while ! oRs:Eof() // reset bondflag voor controle
oRs:bondlid = .f.
oRs:save()
oRs:MoveNext()
enddo
oRs:MoveFirst()
// check local database with online database.
// controleer bond teveel aan spelers
bond->(dbgotop())
nTel = 0
nPass = 0
do while ! bond->(eof())
cData = alltrim(bond->bondnum)
oRs := oCn:RowSet( "select * FROM leden where bond = ? ", { cData } )
if oRs:BOND = cData
oRs:BONDLID = .T.
oRs:aansluit = bond->aansluit_B
if !empty(bond->ontslag)
oRs:bonderror = "Ontslag: "+dtoc(bond->ontdat)
else
oRs:bonderror = ""
endif
nTel++
else
oRs:Append()
oRs:BOND = alltrim(bond->bondnum)
oRs:NAAM = alltrim(bond->naam_B)
oRs:VOORNAAM = alltrim(bond->VOORN_B)
oRs:ADRES = alltrim(bond->adres_B)
oRs:ADRES = alltrim(bond->adres_B)
oRs:POST = alltrim(bond->post_B)
oRs:GEMEENTE = alltrim(bond->plaats_B)
oRs:BONDERROR = alltrim(bond->ontslag)
oRs:BONDLID = .T.
oRs:geboorte = bond->geboorte_B
oRs:aansluit = bond->aansluit_B
oRs:ploeg2018 = "NIEUW LID"
endif
oRs:Save()
bond->(dbskip())
enddo
msginfo("Bondcontrole verwerkt")
oCn:close()
// select bond
// bond->(dbgotop())
// showbond()
close all
return nil
Marc Venken
Using: FWH 20.08 with Harbour
Using: FWH 20.08 with Harbour
-
- Posts: 392
- Joined: Wed Jul 31, 2013 1:14 pm
- Location: Maldonado - Uruguay
- Contact:
Re: in php I do this way, but how in fwSOLUCIONADO
Excelente Marc.
Tomado de tus ejemplos, lo soluciné. Gracias.
Así quedó.
FWCONNECT oCon HOST 'localhost' USER 'root' PASSWORD '' DB dbases
oRs := oCon:RowSet( "select * from usuario where `idusu` = &1", { cUsuario } )
? oRs:FieldGet(4) >>>>Este dato quería.
Gracias.
Tomado de tus ejemplos, lo soluciné. Gracias.
Así quedó.
FWCONNECT oCon HOST 'localhost' USER 'root' PASSWORD '' DB dbases
oRs := oCon:RowSet( "select * from usuario where `idusu` = &1", { cUsuario } )
? oRs:FieldGet(4) >>>>Este dato quería.
Gracias.
Dario Fernandez
FWH, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay
FWH, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay