PHP - Why Does My Php Miss A Value From My Db ?
I am trying to find the order values between 2 dates: $date1 and $date2. My code appears to work BUT, for some reason it always leaves out one of the values from my MySQL DB table. I have checked in the table that the Time value of the order being left out is indeed within the date range and yup it sure it, but for some crazy reason it is either not being picked up by the sql statement or the PHP statement or something - I just don't get it > there must be a stupid error somewhere
Many Many Thanks for your help - Vincej Code: [Select] /* Create Query*/ <?php $query_sales_shipping_tax = "SELECT order_id, user_id, order_tax, order_shipping_tax, cdate FROM jos_vm_orders ORDER BY cdate DESC"; $sales_shipping_tax = mysql_query($query_sales_shipping_tax, $teashop) or die(mysql_error()); $row_sales_shipping_tax = mysql_fetch_assoc($sales_shipping_tax); ?> /*Create dates for start and end of range */ <?php $date1 = strtotime("09/30/2010"); $date2 = strtotime("10/05/2010"); ?> <br /> /*Create While statement Create Conditions & Echo results*/ <?php while ($row_sales_shipping_tax = mysql_fetch_assoc($sales_shipping_tax)){ if ($row_sales_shipping_tax['cdate'] >$date1 && $row_sales_shipping_tax['cdate'] <$date2){?> <tr> <td><?php echo $row_sales_shipping_tax['order_id']; ?></td> <td><?php echo $row_sales_shipping_tax['user_id']; ?></td> <td><?php echo strftime("%m/%d/%Y/%H/%M/%S", $row_sales_shipping_tax['cdate']); ?></td> <td><?php echo $row_sales_shipping_tax['order_tax']; ?></td> <td><?php echo $row_sales_shipping_tax['order_shipping_tax']; ?></td> </tr> <?php } Similar TutorialsCode: [Select] <?php $username = $_POST['username']; $password = $_POST['password']; $userid = $_POST['userid']; $api = $_POST['api']; mysql_connect('x', 'x', 'x'); mysql_select_db ("evepay"); $query="insert into users (id, username, password, userid, api) values ('NULL', '".$username."', '".$password."', '".$userid.'", '".$api."')"; mysql_query($query) or die ('Error updating database'); echo "You are now signed up with: " .$username. ; ?> When the script runs it brings back "Parse error: syntax error, unexpected '"' in signup.php" any ideas as to what I missed? Hey Guys,
I'm doing some coding and I've managed to snip something off....
This is the original code
<form method="post" action="{$systemsslurl}cart.php?a=add&domain=register"> <table class="table table-striped table-framed"> <thead> <tr> <th></th> <th>{$LANG.domainname}</th> <th class="textcenter">{$LANG.domainstatus}</th> <th class="textcenter">{$LANG.domainmoreinfo}</th> </tr> </thead> <tbody> {foreach from=$availabilityresults key=num item=result} <tr> <td class="textcenter">{if $result.status eq "available"}<input type="checkbox" name="domains[]" value="{$result.domain}" {if $num eq "0" && $available}checked {/if}/><input type="hidden" name="domainsregperiod[{$result.domain}]" value="{$result.period}" />{else}X{/if}</td> <td>{$result.domain}</td> <td class="textcenter {if $result.status eq "available"}domcheckersuccess{else}domcheckererror{/if}">{if $result.status eq "available"}{$LANG.domainavailable}{else}{$LANG.domainunavailable}{/if}</td> <td class="textcenter">{if $result.status eq "unavailable"}<a href="http://{$result.domain}" target="_blank">WWW</a> <a href="#" onclick="popupWindow('whois.php?domain={$result.domain}','whois',650,420);return false">WHOIS</a>{else}<select name="domainsregperiod[{$result.domain}]">{foreach key=period item=regoption from=$result.regoptions}<option value="{$period}">{$period} {$LANG.orderyears} @ {$regoption.register}</option>{/foreach}</select>{/if}</td> </tr> {/foreach} </table> <p align="center"><input type="submit" value="{$LANG.ordernowbutton} »" class="btn btn-danger" /></p> </form>and I've changed it to: <form method="post" action="{$systemsslurl}cart.php?a=add&domain=register"> {foreach from=$availabilityresults key=num item=result} {if $result.status eq "available"} <div style="width: 400px; color: #339933; font-size:14px;"><img src="/templates/dj/yes.jpg" style="float:left" />{$tld}<br />Available</div> <div style="width: 100px;" >{$name}<p style="color: #339933;">{$tld}</p></div> <div style="width: 200px;" ><select name="domainsregperiod[{$result.domain}]">{foreach key=period item=regoption from=$result.regoptions}<option value="{$period}">{$period} {$LANG.orderyears} @ {$regoption.register}</option>{/foreach}</select> <input type="submit" value="{$LANG.ordernowbutton} »" class="btn btn-danger" /></div> {/if} {if $result.status eq "unavailable"} <div style="width: 400px; color: #cc0000; font-size:14px;"><img src="/templates/dj/no.jpg" style="float:left" />{$tld}<br />Taken</div> <div style="width: 100px;" >{$domain}<p style="color: #cc0000;">{$tld}</p></div> <div style="width: 200px;" ><a href="http://{$result.domain}" target="_blank">WWW</a> <a href="#" onclick="popupWindow('whois.php?domain={$result.domain}','whois',650,420);return false">WHOIS</a></div> {/if} {/foreach}</form>The original code works fine and add to my cart, the new "updated" version fails... What have I done wrong? |