Vermontecher
Programmer
Hello,
I am new to PHP and I am trying to do something that I could do in ASP with my eyes closed, but PHP is so much different. Here are the two things I thought would be simple...
1.) I want to display data from the database according to a start and end date. In ASP I would use the following code...
Where "[Activate]=True AND [StartDate]< #" & CDate(Date) & "# AND [EndDate]> #" & CDate(Date) & "#"
Can someone tell me what I would use in PHP please, it would be greatly appreciated.
2.) The next item seemed to be a lot simpler, but I can't seem to get it. I want to display something according to a field in a database. Here is the code I now have...
<?php if ($x_field1 != 0) { ?>
0
<?php } ?>
<?php if ($x_field1 != 1) { ?>
1
<?php } ?>
<?php if ($x_field1 != 2) { ?>
2
<?php } ?>
<?php if ($x_field1 != 3) { ?>
3
<?php } ?>
The value of field1 in the database is set to 2, but when I view the page what is displayed is 0 1 3 and no 2. I would have thought that if the value of field1 were 2 it would disregard the 0 1 3 and display the 2, but that is not the case. If I could get some direction on this I would be forever grateful.
Thanks
VermontTecher
I am new to PHP and I am trying to do something that I could do in ASP with my eyes closed, but PHP is so much different. Here are the two things I thought would be simple...
1.) I want to display data from the database according to a start and end date. In ASP I would use the following code...
Where "[Activate]=True AND [StartDate]< #" & CDate(Date) & "# AND [EndDate]> #" & CDate(Date) & "#"
Can someone tell me what I would use in PHP please, it would be greatly appreciated.
2.) The next item seemed to be a lot simpler, but I can't seem to get it. I want to display something according to a field in a database. Here is the code I now have...
<?php if ($x_field1 != 0) { ?>
0
<?php } ?>
<?php if ($x_field1 != 1) { ?>
1
<?php } ?>
<?php if ($x_field1 != 2) { ?>
2
<?php } ?>
<?php if ($x_field1 != 3) { ?>
3
<?php } ?>
The value of field1 in the database is set to 2, but when I view the page what is displayed is 0 1 3 and no 2. I would have thought that if the value of field1 were 2 it would disregard the 0 1 3 and display the 2, but that is not the case. If I could get some direction on this I would be forever grateful.
Thanks
VermontTecher