Jump to content


Photo

PERL TO PHP


  • Please log in to reply
No replies to this topic

#1 xcguyxc

xcguyxc
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 17 April 2006 - 08:25 PM

Hey guys! I just need some minor help converting what i was doing in PERL to PHP.

***NOTE: The perl was setup as a db read not a MS SQL i have already taken care of this. We

just Upgraded.

THE UNION ALL PART AND THE DATAHASH ARE WERE I AM LOST!!!!


***** PERL CODE ****
#!/perl/bin/perl.exe

use Win32::ODBC;
print "Content-type:text/html\n\n";

read(STDIN, $line, $ENV{'CONTENT_LENGTH'});

$anyorder="no";
$anyship="no";

@values = split(/&/, $line);
foreach $i (@values) {
($name, $value) = split(/=/, $i);
$value =~ tr/+/ /;
$value  =~ tr/[a-z]/[A-Z]/;

$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
  }
print "<html><head><title>Database</title></head>";
print "<body>\n";
print "<h2>These are the results</h2>\n";

$DSN="AccountMate";
if (!($db=new Win32::ODBC($DSN))) {
print "ERROR CONNECTING";
 }
$po=$FORM{'P.O.'};

$db->Sql("SELECT * FROM dbo.soship where dbo.soship.ccustno = '" . $FORM{'P.O.'} . "' UNION 

ALL SELECT * FROM Soshiph where ccustno = '" . $FORM{'P.O.'} . "'");

while ($db->FetchRow()){
my(%data) = $db->DataHash();

$ship=$data{'dship'};
$pon=$data{'cshipno'};

if (($ship > 2005) && ($pon > 1000074112)){
 
print "<b>Customer No. = </b> $data{ccustno}<br>
<b>Sales Order # =</b> $data{'csono'}<br>
<b>Purchase Order # =</b> $data{'cpono'}<br>
<b>Company = </b> $data{'cscompany'}<br>
<b>Zip = </b> $data{'cszip'}<br>
<b>Ship Date =</b> $data{'dship'}<p>";}

if ($data{'csono'}=~m/\d/)
{$anyorder="yes";}

if ($data{'dship'}=~m/\d/)
{$anyship="yes";}

}

if ($anyorder eq "yes")
{
print"<p><font color='#0000FF'>Please check your PO's </font></p>";
}
else
{print "<p><font color='#FF0000'>If you dont see your PO please check back in 24 

hours.</font></p>";}

if ($anyship eq "yes")
{
print"<p><font color='#FF0000'>Your order has  shipped</font></p>";
}
else
{print "<p><font color='#FF0000'>Your order has not yet shipped</font></p>";}

$db->Close();
print "</body></html>\n";






I need to try to get it to work the same as the perl would on UNION ALL and the PRINT

DATA....




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users