note 30396 deleted from ref.odbc by sniper

From: Date: Tue, 04 Nov 2003 00:38:12 +0000
Subject: note 30396 deleted from ref.odbc by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59763@lists.php.net to get a copy of this message
Note Submitter: LaLista (lalista.fly.to) ---- FOR ASP-COMERS -------------- You can use the ADODB interface instead. It's the same code than ASP, but it's written in PHP: <HTML> <HEAD> <TITLE>ADODB Test in PHP</TITLE> </HEAD> <BODY> <?php $Connection = new COM("ADODB.Connection"); $RecordSet = new COM("ADODB.RecordSet"); $Connection -> Open("Provider=SQLOLEDB; DBQ=MyServer; UID=MyUser; PWD=MyPassword"); $RecordSet = $Connection -> Execute("SELECT * FROM MyTable"); while(!$RecordSet -> EOF) { echo "\"" . $RecordSet -> Fields(0) . "\""; echo "costs $" . $RecordSet -> Fields(1) . "< BR>"; $RecordSet -> MoveNext() #Don't forget this } $Connection -> Close(); $Connection -> Release(); $RecordSet -> Release(); $Connection = null; $RecordSet = null; ?> </BODY> </HTML> Supposing this is the table: Article(0) Price(1) Wine 19.95 CD-RW 1.49 CD-R 0.49 Pen 0.45 This will be the output: <HTML> <HEAD> <TITLE>ADODB Test in PHP</TITLE> </HEAD> <BODY> "Wine" costs $19.95< BR> "CD-RW" costs $1.49< BR> "CD-R" costs $0.49< BR> "Pen" costs $0.45< BR> </BODY> </HTML>

« previous php.notes (#59763) next »