Re: [PHP] ASP to PHP
> But has anybody had any experience of translating the asp code over? I've gone the other way and translated some PHP to ASP, which felt pretty dirty. Are you dealing with simple includes and small bits of logic? That's all that I had (also fairly static sites) and I found the process quite simple. Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
Richard Davey wrote: unset($type); $type = $_GET['action']; (Please note - you don't HAVE to "unset" each variable, but if you are working in a Register Globals ON environment, it's a good safety measure). I've seen a few people recommending this type of thing. Please explain how this is any safer than just setting $type to $_GET['action']. As far as I can tell it makes absolutely no difference. Basically you unset the variable and then assign something to it. If you weren't to unset it first it would still have the same effect. Seems like nothing more than a waste of cycles to me. Or am I missing something weird about how PHP works? -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
To everyone, especially Richard, Thanks a lot for the help. I have accomplished everything I needed to do with your help, and I have never used PHP before. Thanks again! alistair -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
On Wednesday 10 March 2004 18:54, Raditha Dissanayake wrote: > Hi. > There is an ADO simulator for PHP (i think it's called ADODB PHP but i > can't remember the link). There is also a asp to php converter called > (can you guess? ) asp2php. http://php.weblogs.com/ And Pear::DB must work too :P http://pear.php.net/package/DB http://www.onlamp.com/pub/a/php/2001/11/29/peardb.html -- roche -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
Sorry, was the query! Richard Davey wrote: Hello Alistair, Wednesday, March 10, 2004, 11:26:53 PM, you wrote: AH> I get this error: mysql_num_rows(): supplied argument is not a valid AH> MySQL result resource Then your database connection failed OR the SQL query did. Check those steps over before anything else. Maybe post that part of your code so we can see? AH> Question: Where you have the //do stuff comment, I assume this is where AH> my HTML code will go. But can I put it between the open brackets? I.E: AH> { AH> html code AH> } Yes like so: { ?> html here Just like in ASP :) unset($type); $type = $_GET['type']; $link = mysql_connect('localhost', 'user', 'password'); if (!$link) { echo "Couldn't make a connection!"; exit; } $db = mysql_select_db("sealhouse", $link); if (!$db) { echo "Couldn't select database!"; exit; } $sql= "SELECT * FROM table WHERE type=$type ORDER BY style"; $result = mysql_query($sql); $total_records = mysql_num_rows($result); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
Richard Davey wrote: Hello Alistair, Wednesday, March 10, 2004, 11:26:53 PM, you wrote: AH> I get this error: mysql_num_rows(): supplied argument is not a valid AH> MySQL result resource Then your database connection failed OR the SQL query did. Check those steps over before anything else. Maybe post that part of your code so we can see? AH> Question: Where you have the //do stuff comment, I assume this is where AH> my HTML code will go. But can I put it between the open brackets? I.E: AH> { AH> html code AH> } Yes like so: { ?> html here Just like in ASP :) unset($type); $type = $_GET['type']; $link = mysql_connect('localhost', 'user', 'password'); if (!$link) { echo "Couldn't make a connection!"; exit; } $db = mysql_select_db("sealhouse", $link); if (!$db) { echo "Couldn't select database!"; exit; } $sql= "SELECT * FROM table WHERE type=$type ORDER BY style"; $result = mysql_query($sql); $total_records = mysql_num_rows($result); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
Hi. There is an ADO simulator for PHP (i think it's called ADODB PHP but i can't remember the link). There is also a asp to php converter called (can you guess? ) asp2php. Alistair Hayward wrote: Hi , What is the equavilant in PHP to creating a recordset in ASP using a query? This is what I do in PHP: .. dim Type Type = CStr(Request.QueryString("action")) (getting parameter from URL) Dim cnn ' ADO connection Dim rst ' ADO recordset Dim strDBPath ' path to my Access database (*.mdb) file strDBPath = Server.MapPath("/_database/database.mdb") Set cnn = Server.CreateObject("ADODB.Connection") cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";" Set rst = cnn.Execute("SELECT * FROM table WHERE Type ='" & type & "' order by style") .. I can then call any field and display it in the html by using : <%=rst.fields("whatever").value%> .. I can also create a loop: <%Do While Not rstSimple.EOF%> do something <% rstSimple.MoveNext Loop %> Please can someone show me how to do the same thing in PHP? Alistair -- Raditha Dissanayake. --- http://www.radinks.com/upload/ Drag and Drop Upload thousands of files and folders in a single transfer. (HTTP or FTP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
Richard Davey wrote: A few ways to do this: $total_records = mysql_num_rows($result); for ($i=0; $i < $total_records; $i++) { $data = mysql_fetch_assoc($result); print_r($data); } $data will now be an array holding the first set of information. The print_r line just displays it so you can see it easily. Instead of a FOR loop you could do a "while" loop checking to see the end of the $result set, i.e.: while ($row = mysql_fetch_array($result, MYSQL_NUM)) { // do stuff print_r($row); } AH> <%=rst.fields("whatever").value%> I get this error: mysql_num_rows(): supplied argument is not a valid MySQL result resource Question: Where you have the //do stuff comment, I assume this is where my HTML code will go. But can I put it between the open brackets? I.E: { html code } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
Richard: Thank you so much! Richard Davey wrote: Hello Alistair, Wednesday, March 10, 2004, 10:26:03 PM, you wrote: AH> dim Type AH> Type = CStr(Request.QueryString("action")) (getting parameter from URL) unset($type); $type = $_GET['action']; (Please note - you don't HAVE to "unset" each variable, but if you are working in a Register Globals ON environment, it's a good safety measure). AH> strDBPath = Server.MapPath("/_database/database.mdb") MySQL doesn't work the same way as MDB files (thank goodness), so you need to create a connection to the MySQL database: $link = mysql_connect('localhost', 'username', 'password'); AH> Set cnn = Server.CreateObject("ADODB.Connection") AH> cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";" mysql_select_db('database_name', $link); AH> Set rst = cnn.Execute("SELECT * FROM table WHERE Type ='" & type & "' AH> order by style") $sql= "SELECT * FROM table WHERE type='$type' ORDER BY style"; $result = mysql_query($sql); You now have the entire "record set" in $result. To obtain the first row of data, do this: AH> <%Do While Not rstSimple.EOF%> AH> do something AH> <% AH> rstSimple.MoveNext AH> Loop A few ways to do this: $total_records = mysql_num_rows($result); for ($i=0; $i < $total_records; $i++) { $data = mysql_fetch_assoc($result); print_r($data); } $data will now be an array holding the first set of information. The print_r line just displays it so you can see it easily. Instead of a FOR loop you could do a "while" loop checking to see the end of the $result set, i.e.: while ($row = mysql_fetch_array($result, MYSQL_NUM)) { // do stuff print_r($row); } AH> <%=rst.fields("whatever").value%> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
Hello Alistair, Wednesday, March 10, 2004, 10:26:03 PM, you wrote: AH> dim Type AH> Type = CStr(Request.QueryString("action")) (getting parameter from URL) unset($type); $type = $_GET['action']; (Please note - you don't HAVE to "unset" each variable, but if you are working in a Register Globals ON environment, it's a good safety measure). AH> strDBPath = Server.MapPath("/_database/database.mdb") MySQL doesn't work the same way as MDB files (thank goodness), so you need to create a connection to the MySQL database: $link = mysql_connect('localhost', 'username', 'password'); AH> Set cnn = Server.CreateObject("ADODB.Connection") AH> cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";" mysql_select_db('database_name', $link); AH> Set rst = cnn.Execute("SELECT * FROM table WHERE Type ='" & type & "' AH> order by style") $sql= "SELECT * FROM table WHERE type='$type' ORDER BY style"; $result = mysql_query($sql); You now have the entire "record set" in $result. To obtain the first row of data, do this: AH> <%Do While Not rstSimple.EOF%> AH> do something AH> <% AH> rstSimple.MoveNext AH> Loop A few ways to do this: $total_records = mysql_num_rows($result); for ($i=0; $i < $total_records; $i++) { $data = mysql_fetch_assoc($result); print_r($data); } $data will now be an array holding the first set of information. The print_r line just displays it so you can see it easily. Instead of a FOR loop you could do a "while" loop checking to see the end of the $result set, i.e.: while ($row = mysql_fetch_array($result, MYSQL_NUM)) { // do stuff print_r($row); } AH> <%=rst.fields("whatever").value%> -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ASP to PHP
I used it for a site I did. The code wasn't doing anything too funky. Just simple accesses to adodb and also simple form manipulation - worked like a treat. Although, the database stuff, it converts it the standard PHP functions, but I had some classes for that, so I still had to manually go through and change the code -Original Message- From: Chuck PUP Payne [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 9:38 PM To: [EMAIL PROTECTED] Subject: [PHP] ASP to PHP I got a strange request from a client. He wants to be able to take his ASP pages and move them over to PHP so that he can run them on apache on his linux server. I saw a tool yesterday ASP2PHP, but I am wanting to know does it work, how much is lost, is it easy to use? Is there another way to change ASP file to PHP with out a lot of re-writes? Chuck Payne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ASP to PHP
Just try it on. I heard some good reviews about it. And, if the site is not too complex, try estimating the time it would take you to re-create the functionality and compare it to the time you think you would take for debugging. I once had to do this and have choosen rewriting the code ourselves. Sincerely, Maxim Maletsky Founder, Chief Developer www.PHPBeginner.com // where PHP Begins -Original Message- From: .ben [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 2:00 PM To: PHP Subject: RE: [PHP] ASP to PHP I am in the process of porting an ASP site to PHP and am really chuffed with how easy it is so far. I am slightly worried that doing a straight conversion may not be the best idea, but I plan to go through the site again when i'm done, and optimise for PHP where possible. .b > -Original Message- > From: Cal Evans [mailto:[EMAIL PROTECTED]] > Sent: 23 April 2002 12:53 > To: Chuck PUP Payne; [EMAIL PROTECTED] > Subject: RE: [PHP] ASP to PHP > > > Having moved a moderately sized website last year from ASP to PHP I > can say from experience that if you can re-write it, the move will go > smoother and you will have fewer lines of code. I ended up with about > 1/2 as many lines of code to maintain after the port was done. > =C= > > * > * Cal Evans > * Journeyman Programmer > * Techno-Mage > * http://www.calevans.com > * > > > -Original Message- > From: Chuck PUP Payne [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 23, 2002 6:38 AM > To: [EMAIL PROTECTED] > Subject: [PHP] ASP to PHP > > > I got a strange request from a client. He wants to be able to take his > ASP pages and move them over to PHP so that he can run them on apache > on his linux server. I saw a tool yesterday ASP2PHP, but I am wanting > to know does it work, how much is lost, is it easy to use? Is there > another way to change > ASP file to PHP with out a lot of re-writes? > > Chuck Payne > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ASP to PHP
I am in the process of porting an ASP site to PHP and am really chuffed with how easy it is so far. I am slightly worried that doing a straight conversion may not be the best idea, but I plan to go through the site again when i'm done, and optimise for PHP where possible. .b > -Original Message- > From: Cal Evans [mailto:[EMAIL PROTECTED]] > Sent: 23 April 2002 12:53 > To: Chuck PUP Payne; [EMAIL PROTECTED] > Subject: RE: [PHP] ASP to PHP > > > Having moved a moderately sized website last year from ASP to PHP > I can say > from experience that if you can re-write it, the move will go smoother and > you will have fewer lines of code. I ended up with about 1/2 as many lines > of code to maintain after the port was done. > =C= > > * > * Cal Evans > * Journeyman Programmer > * Techno-Mage > * http://www.calevans.com > * > > > -Original Message- > From: Chuck PUP Payne [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 23, 2002 6:38 AM > To: [EMAIL PROTECTED] > Subject: [PHP] ASP to PHP > > > I got a strange request from a client. He wants to be able to take his ASP > pages and move them over to PHP so that he can run them on apache on his > linux server. I saw a tool yesterday ASP2PHP, but I am wanting to > know does > it work, how much is lost, is it easy to use? Is there another > way to change > ASP file to PHP with out a lot of re-writes? > > Chuck Payne > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ASP to PHP
Having moved a moderately sized website last year from ASP to PHP I can say from experience that if you can re-write it, the move will go smoother and you will have fewer lines of code. I ended up with about 1/2 as many lines of code to maintain after the port was done. =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Chuck PUP Payne [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 6:38 AM To: [EMAIL PROTECTED] Subject: [PHP] ASP to PHP I got a strange request from a client. He wants to be able to take his ASP pages and move them over to PHP so that he can run them on apache on his linux server. I saw a tool yesterday ASP2PHP, but I am wanting to know does it work, how much is lost, is it easy to use? Is there another way to change ASP file to PHP with out a lot of re-writes? Chuck Payne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP ...
This really depends how complicated your ASP system is. Presumably, your current system has many components that make it work correctly with the server and MS Access. The hardest part will be getting PHP to function as expected in that environment. The actual code is easy to translate, but you'll probably end up rewriting everything from scratch to take advantage of PHP's strengths. Just don't forget your semicolons! PHP can link up well with MS Access, but there aren't a lot of example scripts out there to work with. Little things can drive you nuts -- like trying to find the unique id of your last db insert. >I have been asked to convert an ASP/MS Access system to PHP. I would be >interested in hearing the thoughts of anyone with exp. of this. Thanks. > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Jim Musil - Multimedia Programmer Nettmedia - 212-629-0004 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] asp to php
RedHat 7.1 (Linux) has a package that converts from ASP to PHP pages. I didn't use it, so I don't know if it is useful neither if it is available for Windows. Kind regards, Willie _ Seja avisado de novas mensagens do Hotmail e use o comunique-se com seus amigos com o MSN Messenger em http://messenger.msn.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] asp to php
on 7/26/01 9:52 AM, kaab kaoutar at [EMAIL PROTECTED] wrote: > > Does anyone of u has alreday tried successfully converting asp file to php > file ? > Is it worth doing so or restarting from scratch? > Thanks i've only tried this once, but i'd do it again. you will definitely have to edit the code it produces, but you'll find patterns and you can search and replace some. it's a great way to get some of your typing done if nothing else. -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] ASP to PHP
Try asp2php: http://asp2php.naken.cc/home.php Michael Simcich AccessTools -Original Message- From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 17, 2001 8:48 AM To: PHP Mailing List Subject: [PHP] ASP to PHP Is there such thing as program that will convert ASP code to PHP code? I have built some nice libraries with ASP and am interested in converting those over to PHP, rather than rewriting them! Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]