seeking guidance to alias correctly
Moderator: General Moderators
seeking guidance to alias correctly
since no one cared to read, but only to attack becasue i don't space PHP in their style on a db question, i've decided that db questions are not to be asked here since ppl attack instead fo reading and then veer as far from topic as possible.
Last edited by m3rajk on Sun Apr 11, 2004 6:20 pm, edited 2 times in total.
- Ixplodestuff8
- Forum Commoner
- Posts: 60
- Joined: Mon Feb 09, 2004 8:17 pm
- Location: Queens, New York
The code itself isn't confusing, but it looks very jumbled up and hard to read, instead of
try
For me it's alot more readable, while the first example seems fine to you, it only seems fine to you since you made it and understand what is going on, but for another person who isn't familiar with the code it isn't as easy to understand what it's doing.
Code: Select all
<?php
if(isset($_POST['month'])&&($_POST['month']!='')&&(isset($_POST['day']))&&($_POST['day']!='')
&&(isset($_POST['year']))&&($_POST['year']!='')){ # there is a month, day & year
$date1="{$_POST['year']}-{$_POST['month']}-{$_POST['day']} 00:00:00"; # get day start
$date2="{$_POST['year']}-{$_POST['month']}-{$_POST['day']} 23:59:59"; # get day end
$sql.=" and appdate>'$date1' and appdate<'$date2'"; } # add the date restriction
?>Code: Select all
<?php
# there is a month, day & year
if(isset($_POST['month'])&&($_POST['month']!='')&&(isset($_POST['day']))&&($_POST['day']!='')&&(isset($_POST['year']))&&($_POST['year']!='')){
# get day start
$date1="{$_POST['year']}-{$_POST['month']}-{$_POST['day']} 00:00:00";
# get day end
$date2="{$_POST['year']}-{$_POST['month']}-{$_POST['day']} 23:59:59";
# add the date restriction
$sql.=" and appdate>'$date1' and appdate<'$date2'";
}
?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
m3rajk - debugging your code is a nightmare and I know I've pointed out the same things that Steveo31 and Ixplodestuff8 have a number of times now (so you should be aware of exactly what Steveo31 was trying to say). Please, you have to help us help you by making your code not only clear to yourself but clear to those that would like to try and help you - requiring them to spend ages reformatting your code so that it makes sense isn't going to inspire anyone to help.
I know this sounds harsh but your intense dislike of whitespace and insistence on putting multiple statements on one line makes your code very difficult to read and is going to make maintaining your code a horrible soul destroying experience.
Mac
I know this sounds harsh but your intense dislike of whitespace and insistence on putting multiple statements on one line makes your code very difficult to read and is going to make maintaining your code a horrible soul destroying experience.
Mac
What was the question? Cant judge from the code I see sofar (I'm abit late, i know). I do see something that might be of interest tho:
Code: Select all
// your
if(isset($_POST['month'])&&($_POST['month']!='')&&(isset($_POST['day']))&&($_POST['day']!='')&&(isset($_POST['year']))&&($_POST['year']!='')){
// spaced (I note abit to many odd ()'s?)
if(
isset($_POST['month']) && ($_POST['month'] !='') &&
(isset($_POST['day'])) && ($_POST['day'] !='') &&
(isset($_POST['year'])) && ($_POST['year'] !='')
) {
// clean(er)
if(!empty($_POST['month']) && !empty($_POST['day']) && !empty($_POST['year'])) {