Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP to PHP

Posted on 2011-09-23
6
Medium Priority
?
470 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
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
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…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

715 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