Solved

ASP to PHP

Posted on 2011-09-23
6
459 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
What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

 
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

628 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