We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Help with conditional logic

vonfranzken
vonfranzken asked
on
Medium Priority
375 Views
Last Modified: 2012-05-11
I only want to show the selected table row if the auction endDate is greater then the current date and not show it if the auction is either over; meaning less then current date; the way I did it is not working

<?php
// Show IF Conditional region1
if (@$row_rssearchResults['endDate'] > "date(\'Y-m-j\')") {
?>
                <tr>
                  <td>Place Bid </td>
                  <td><form id="form1" name="form1" method="post" action="place-bid.php?id=<?php echo $row_rssearchResults['auctionID']; ?>">
                    <input name="Submit" type="image" value="Place Bid" src="images/placebid.gif" />
                  </form></td>
                </tr>
                <?php }
// endif Conditional region1
?>
Comment
Watch Question

CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Most Valuable Expert 2011
Author of the Year 2014
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Most Valuable Expert 2011
Author of the Year 2014

Commented:
It's often a good idea to use data visualization techniques to see what your programming is doing to the data.  Example:
http://www.laprbass.com/RAY_temp_vonfranzken.php

Outputs:
string(15) "date(\'Y-m-j\')"
string(10) "2011-04-19"
string(25) "2011-04-19T06:41:47-05:00"

HTH, ~Ray
<?php // RAY_temp_vonfranzken.php
error_reporting(E_ALL);
date_default_timezone_set('America/Chicago');
echo "<pre>";

// SHOW THE ORIGINAL DATA STRING
$str = "date(\'Y-m-j\')";
var_dump($str);

// TRY THE FUNCTION RESULT WITH THE STRANGE ESCAPE CHARACTERS INTACT
// $str = date(\'Y-m-j\'); // COMMENTED OUT - CREATES A PARSE ERROR
// var_dump($str);

// SHOW THE DATE STRING
$str = date('Y-m-j');
var_dump($str);

// SHOW THE ISO8601 DATETIME STRING
$str = date('c');
var_dump($str);

Open in new window

Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.