Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP to PHP

Posted on 2011-09-23
6
Medium Priority
?
481 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
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
Industry Leaders: 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 2000 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 111

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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

824 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