RE: [PHP-WIN] Code Conversion ASP --> PHP Example
| From: | Thoenen, Peter Mr. EPS | Date: | Wed, 14 Aug 2002 01:09:04 +0000 |
| Subject: | RE: [PHP-WIN] Code Conversion ASP --> PHP Example | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-15243@lists.php.net to get a copy of this message | ||
I know all of ZERO ASP but think I infer what you are trying to do from that
code snippet. What you want is:
#Do not need an ODBC conenction first off
$connect=mysql_pconnect('localhost', 'user', 'password');
mysql_select_db('database', $connect);
# Do the SQL query
$resource=mysql_query('SELECT * FROM categories');
# Step through each row returned
while($row=mysql_fetch_array($queryexe)){
extract($row);
echo "$categoryid, $catdescription, $catimage<br/>";
}
Hope this helps,
-Peter
##################################
Peter Thoenen - Systems Programmer
Commercial Communications
Camp Bondsteel, Kosovo
##################################
> -----Original Message-----
> From: David R [mailto:3xzy-i3ct@spamex.com]
> Sent: Wednesday, August 14, 2002 12:36 AM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Code Conversion ASP --> PHP Example
>
>
> I am in the early stages of learning PHP as an alternative to
> ASP. I am
> using MySQL and need a beginning nudge. If anyone has the
> time, could you
> please convert the following basic code block into pure
> PHP/MySQL minus all
> the MS bits? It's a very simple example I know but the
> principles would
> help me to understand some things that are not sinking in
> right now. Thank
> you!
>
> <%
>
> strConnection = "driver={MySQL ODBC 3.51
> Driver};server=localhost;user=username;"
> strConnection = strConnection & "pwd=demo;database=mysql450"
>
> Set objConn = Server.CreateObject("ADODB.Connection")
> objConn.Open strConnection
>
> strSQL = "SELECT * FROM categories"
>
> Set objRS = objConn.Execute(strSQL)
>
> Do While Not objRS.EOF
> Response.Write objRS("categoryid") & ", "
> Response.Write objRS("catdescription") & ", "
> Response.Write objRS("catimage") & "<br>"
> objRS.MoveNext
> Loop
>
> objRS.Close
> Set objRS = Nothing
> objConn.Close
> Set objConn = Nothing
>
> %>
>
> David
>
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
begin 600 winmail.dat
M>)\^(CD7
0:0"9ƒw«\à
M>óc_ò‘~·b'$`````!$0>0!@(```Y0``````#H$(@<`
M&```$E032Y-:6-R;W-O9G0@36%I;"Y.;W1E#$(06P.```T@<(X
MP)`0P"0$@@,#@`-('".$.`W,8@$!"8!"$````R
M-D0Y.#X-41$.#<X0S0U.49&,44Q,CE!0T%#-C!#,0!.!P$$@$,@``%)%
M.B!;4$A0+5=)3ET@0V]D92!#;VYV97)S:6]N($%34"`M+3X@4$A0($5X86UP
M;&4/0\!#8$`(``"(0.0!@",#0,P``,"5D!````@$Q$
M`!$0`4$-$1D5",#D0"($```````.*&[$7E$!JANP@*RI6P@`
M14U3341"+D1,3``````````&U7Z(*IF$<V;R"J"_$6@P``!"3TY$4U1%
M14PR`"]O/4]21T%.25I!5$E/3B]O=3U41D8@0D].1%-4145,+V-N/5)E8VEP
M:65N=',O8VX]5&AE;VYE4`N```````$/#%Z&QP/I%N#_P?AL13-@!*<S
M_YL?L/1!LZ8@G_<0,.4``$&"3L``````N````````$/#%Z&QP/I%N#_P
M?AL13-@!*<S_YL?L/1!LZ8@G_<0,.4`$&49P!````FV8"%W8>,19_Q
MX2FLK&#!,@``%)%.B!;4$A0+5=)3ET@0V]D92!#;VYV97)S:6]N($%34"M
M+3X@4$A0($5X86UP;&4`P#>/Z]O`#"""&````#```````1@`
M`!2A0)VH!!X`8((8````,``````!&```%2%`!``!``
M#DN,+N""&````#```````1@```&A0``````,H((8
M````,``````!&````&%``````"P#@@@!@````P``````$8
M````X4``````+2""&````#```````1@```.A0``````,
M!8((8`````,``````!&```!"%```````P&@@@!@````P``
M````$8```$84``````#>""&````#```````1@```8A0`
M````!X"(((8`````,``````!&```#:%`!```0````````>
M`F""&````#```````1@```WA0`0``$```````'@*@`@@
M!@`````P``````$8```.(4`$``!````````(!"1!```+P8
M"L&"?"@3%I&=<MYYJX#H<F-P9S$R->(RT-T97@%00$#??_"H`"
MI/D!Q,"@_S%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'@!"$$````J
M```/#(P,#(P.#$S,C(S-34Q+C8T-C8P+G%M86EL0'!B,2YP86ER+F-O;3X
M``#/T_Y0$.0#0H]$N+T/"0,\3\)!`'@Q0$``(```5$A%
M3TY%4`#!I`````!X,$!``"``%1(14].15`P90`````#"8`
M`````,-@``````P"$/____\"4<0`#D``!C/553.V$](#MP/4]2
M1T%.25I!5$E/3CML/4)/3D135$5%3#(M,#(P.#$T,#$P.3T6BTT-3DS,0`
M``"?D_0`%8```````W*=R,!"$!JTN0@*R_A@@$````````+T\]
M3U)'04Y)6D%424].+T]5/51&1B!"3TY$4U1%14PO0TX]4D5#25!)14Y44R]#
M3CU42$5/3D50```'@#X/P$``8``4&5T97(@5&AO96YE;B@37(N("!%
M4%,'@X0$``(``5$A%3TY%4"?L_0`%8```````W*=R,!"
M$!JTN0@*R_A@@$````````+T\]3U)'04Y)6D%424].+T]5/51&1B!"3TY$
M4U1%14PO0TX]4D5#25!)14Y44R]#3CU42$5/3D50```'@#Z/P$``8```
M4&5T97(@5&AO96YE;B@37(N("!%4%,'@Y0$```(``5$A%3TY%4!`
M`<PE*W1+B]#P@%`@P#19&B5#P@$>#T0``4`!213H@```!X
M'0X!```+@`%M02%M5TE.72!#;V1E($-O;G9E<G-I;VX@05-0("TM/B!0
M2%@17AA;7!L90`!X-1!``10``#Q!-S,S1D8Y0C%&0C!&-#0Q0C-!
M-C(P.49&-S$P,S!%-3`Q,#8U.#0V0&)O;F1S=&5E;#(N87)E=7(N87)M>2YM
M:6P^`````L*0!``"PC`$``#80)ZTPYP,!QC!@`P0$```
M``#!$00`!X"!!``90``$E+3D]704Q,3T9:15)/05-00E545$A)
M3DM)24Y&15)72$%464]505)%5%)924Y'5$]$3T923TU42$%40T]$15-.25!0
M15172$%464]55T%.5$E3.B-$3TY/5$Y%141!3D]$0D,`````@%_$``!%
M```/$$W,S-&1CE",49",$8T-#%",T$V,CY1D8W,3S,$4U,#$P-C4X-#9
@8F]N9'-T965L,BYA<F5U<BYA<FUY+FUI;#X`````8I,=
`
end