Solved

ASP to PHP

Posted on 2011-09-23
6
447 Views
Last Modified: 2012-06-27
Hello,

I have attached a code sample of ASP (Active Server Pages) . CUrrently Iam switching from ASP to PHP and I need to learn and understand PHP- Can someone please post the correct code for PHP here please.

Ocrana
0
Comment
Question by:Ocrana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 34

Expert Comment

by:Beverley Portlock
ID: 36585423
There is no code attached to the question.

0
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 36585437
Attach OR paste your code
0
 

Author Comment

by:Ocrana
ID: 36585965
Sorry, seems seomething went wrong. Here ist the code.
for i = 0 to 8
			nQty = CInt(Split(Request.Form("plimus_prod"), ",")(i))  'Wenn die Anzahl größer als 0 ist

			if nQty > 0 then
				if n = 0 then
					strQuery = strQuery & "contractId=" & trim(Split(Request.Form("plimus_code"), ",")(i)) & "&numberOfPromotionContract=TOTAL_PROD"
					strQty = strQty & "&quantity=" & CInt(Split(Request.Form("plimus_prod"), ",")(i))
				else
					strQuery = strQuery & "&promoteContractId" & n - 1 & "=" & trim(Split(Request.Form("plimus_code"), ",")(i)) & "&promoteContractFlag" & n - 1 & "=Y&addPromoteContract" & n - 1 & "=Y"
					strQty = strQty & "&promoteQuantity" & n - 1 & "=" & CInt(Split(Request.Form("plimus_prod"), ",")(i))
				end if

				n = n + 1
			end if
		next
		
		strQuery = Replace(strQuery, "TOTAL_PROD", n) & strQty

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Expert Comment

by:sonawanekiran
ID: 36586074
What is n? Check what is n and try below code

<?php
$strQuery = "";
$strQty =""
for ($i=0; $i<8; $i++)
  {
     $plimus_prod =  explode(",", $_REQUEST['plimus_prod']);
     $nQty = (int)$plimus_prod[i];
  
    if($nQty > 0)
    {
       $plimus_code =  explode(",", $_REQUEST['plimus_code']);
       if($n == 0)
       {
         $strQuery = $strQuery + "contractId=" + trim($plimus_code[i]) + "&numberOfPromotionContract=TOTAL_PROD";
         $strQty = $strQty + "&quantity=" + $nQty;


       }
       else
       {
         $strQuery = $strQuery + "&promoteContractId" + $n - 1 + "=" + trim($plimus_code[i]) + "&promoteContractFlag" + $n - 1 + "=Y&addPromoteContract"    + $n - 1 + "=Y";
   $strQty = $strQty & "&promoteQuantity" + $n - 1 + "=" + $nQty;
       }
       $n = $n +1;
    }

  }
?>

Open in new window

0
 
LVL 17

Accepted Solution

by:
sonawanekiran earned 500 total points
ID: 36586128
OR Try this...

Below is link to convert asp script to PHP. (You need register first)
http://www.design215.com/toolbox/translator/index.php


for ($i=0; $i<=8; $i++) {
			$nQty = CInt(explode( ",@$_POST["plimus_prod"])($i));  //Wenn die Anzahl größer als 0 ist
 
			if ($nQty > 0) {
				if ($n == 0) {
					$strQuery = $strQuery."contractId=".trim(explode( ",@$_POST["plimus_code"])($i)).".numberOfPromotionContract=TOTAL_PROD";
					$strQty = $strQty."&quantity=".CInt(explode( ",@$_POST["plimus_prod"])($i));
				} else {
					$strQuery = $strQuery."&promoteContractId".$n - 1."=".trim(explode( ",@$_POST["plimus_code"])($i)).".promoteContractFlag".$n - 1."=Y.addPromoteContract".$n - 1."=Y";
					$strQty = $strQty."&promoteQuantity".$n - 1."=".CInt(explode( ",@$_POST["plimus_prod"])($i));
				}
 
				$n = $n + 1;
			}
		}
		
		$strQuery = str_replace( "TOTAL_PROD", $n,$strQuery).$strQty;

Open in new window

0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 36590761
If you're a competent programmer in ASP it will be easy to pick up PHP.  Get this book - it will get you set on the right path.
http://www.sitepoint.com/books/phpmysql4/
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question