RE: [PHP-DB] asp to php

From: Date: Tue, 09 Oct 2001 23:44:19 +0000
Subject: RE: [PHP-DB] asp to php
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-13168@lists.php.net to get a copy of this message
A less confusing example IMHO is as follows: <?php $sql = "SELECT count(*) AS total FROM sys_parameter_tbl"; $result = mysql_query($sql); $row = mysql_fetch_array($result); echo $row["total"]; ?> David Balatero db@reactiongaming.com -----Original Message----- From: Jason G. [mailto:blair@nb.net] Sent: Tuesday, October 09, 2001 4:07 PM To: harpreet@crispincorp.com; 'Christopher J. Graham'; php-db@lists.php.net Subject: RE: [PHP-DB] asp to php $sqlstr="SELECT count(*) AS total from sys_parameter_tbl"; //note the AS $result=mysql_query($sqlstr); $aResult = mysql_fetch_array($result, MYSQL_NUM); echo($aResult[0]); -Jason Garber IonZoft.com At 03:10 PM 10/9/2001 -0400, Harpreet wrote: >I used the asp2php program to convert my page but ti doesnt seem to mak >sense to me. Like the query works fine but now i would like to print the >value on the screen. > >My code is as follows: > >$sqlstr="SELECT count(*) total from sys_parameter_tbl"; >$result=mysql_query($sqlstr); >print total; > >how can i print total?? > >help is appreciated. >regards, >Harpreet Kaur >Software Developer >Crispin Corporations Inc. > > > >-----Original Message----- >From: Christopher J. Graham [mailto:cjgraham@tachegroup.com] >Sent: Tuesday, October 09, 2001 2:39 PM >To: harpreet@crispincorp.com; php-db@lists.php.net >Subject: Re: [PHP-DB] asp to php > > >FYI: Have you seen this page? > >http://asp2php.naken.cc/ > > >on 10/09/2001 2:39 PM, Harpreet at harpreet@crispincorp.com wrote: > > > I have an asp page and am trying to convert my asp code to php. > > > > my asp code is as follows: > > <% ' Check for message alerts for Traffic Area > > sqlstr = "SELECT COUNT(*) TOTAL FROM MSG_OPERATOR_TBL WHERE PRIORITY >= > > 1000 AND READ_FLAG = 'N' AND TYPE = 'TR'" > > if Session("ObjectRecordset").State = 1 then > > Session("ObjectRecordset").Close > > Session("ObjectRecordset").Open sqlstr, Session("ObjectConnection") > > total1 = Session("ObjectRecordset")("TOTAL") > > Session("ObjectRecordset").Close > > %> > > The php code so far is: > > > > <?php > > // Check for message alerts for Traffic Area > > $StrConnectionUser=mysql_connect("ip address","$USER"); > > mysql_select_db(databasename, $StrConnectionUser); > > $sqlstr="SELECT COUNT(*) TOTAL FROM MSG_OPERATOR_TBL WHERE PRIORITY >= >1000 > > AND READ_FLAG = 'N' AND TYPE = 'TR'"; > > $result=mysql_query($sqlstr); > > ?> > > > > How do i get the value of TOTAL from the above query. > > > > Please help, > > Regards, > > Harpreet Kaur > > Software Developer > > Crispin Corporations Inc. > > > > > > >------------------------------------------------------------------------ >Christopher Graham >cjgraham@tachegroup.com > >PGP Fingerprint: F765 CCB5 B9CF 1285 7E3E 8CB0 0B1B 8454 9D66 D411 > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net >For additional commands, e-mail: php-db-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#13168) next »