Find Jobs
Hire Freelancers

Adding Conditional Where to PHP Code

$5-10 USD

In Progress
Posted about 14 years ago

$5-10 USD

Paid on delivery
I have some PHP code which works today. I am trying to add some more predicates to the WHERE clause.? The new ones do not work.? The code is below. ? I have highlighted the nonworking statements.? Entire test installation with mySQL installation is attached.? This PHP is TCPTerm1.php. Instructions to install are in the attached zip file. <?php $LocIpAddr=$_GET["LocIpAddr"]; $RmtIpAddr=$_GET["RmtIpAddr"]; If ($LocIpAddr == "") $LocIpAddr = "%"; If ($RmtIpAddr == "") $RmtIpAddr = "%"; $LocPortSingleFld=$_GET["LocPortSingleFld"]; $LocPortWhere = ""; If ($LocPortSingleFld == "") ? ? {? $LocPortWhere = ""; ? ? } Else ? ? { $LocPortWhere = "And TTLPORT=" . $LocPortSingleFld . "; ? ? ? ? echo $LocPortWhere; ? ? ? } $con = mysql_connect("localhost","root",""); if (!$con) { ? $ErrMsg = "{"; ? $ErrMsg = $ErrMsg . "ErrMsg: "; ? $ErrMsg = $ErrMsg . "'Houston we have a problem!!'"; ? $ErrMsg = $ErrMsg . "}"; ? echo $ErrMsg; ? exit(0); } $arr = array(); mysql_select_db('DBITS200'); $Query = "Select ? ? ? ? ? ? ? ? ? ? ? TTEDATE, ? ? ? TTETIME, ? ? ? TTLIP, ? ? ? TTLPORT, ? ? ? TTRIP, ? ? ? TTRPORT, ? ? ? TTINBYTES, ? ? ? TTOUTBYTES, ? ? ? TTTERMCODE, ? ? ? Case TTTERMCODE ? ? ? ? When 82 Then 'APP CLOS' ? ? ? ? When 83 then 'PSC CLOS' ? ? ? End as TTERMDCODE, ? ? ? Timestamp(TTEDATE,TTETIME) - Timestamp(TTSDATE,TTSTIME) as DURATION, ? ? ? TTRTT, ? ? ? TTRVA, ? ? ? TTXRT, ? ? ? TTDUPACKS ? ? ? From TBITS201 ? ? ? Where TTLIP Like '" . $LocIpAddr . "'? ? ? ? And TTRIP Like '" . $RmtIpAddr . "' ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ". $LocPortWhere ."; $ResultSet = mysql_query($Query); while($obj = mysql_fetch_object($ResultSet)) { ? $arr[] = $obj; } echo json_encode($arr); mysql_close($con); exit(0); ?>
Project ID: 3353469

About the project

1 proposal
Remote project
Active 14 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
1 freelancer is bidding on average $9 USD for this job
User Avatar
See private message.
$8.50 USD in 1 day
4.9 (264 reviews)
5.9
5.9

About the client

Flag of UNITED STATES
Carmel Valley, United States
5.0
345
Payment method verified
Member since Jul 1, 2002

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.