Current location: Hot Scripts Forums » Programming Languages » PHP » display different


display different

Reply
  #1 (permalink)  
Old 11-24-04, 03:11 AM
franches franches is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Question display different

hi,
really need anybody's help. i put some alert in this code to check if is being read.this code displays the the alert "hi" then "3" then "IN" then "1985" then the next alert is blank then the next alert is "NONE" then it will alert again "1991" then blank then "NONE" then "1971" then blank then "NONE". I think the only problem i've got is <? if ( $WrkHrsNew['Date'] == $DateLogtemp ) which i don't know why. and also the date being displayed "1985,1991 and 1971" are wrong. in my database my date are "2004-11-21,2004-11-22 and 2004-11-23". i really don't know why is this happening. hope someone is patient enough to help me. i've got nowhere to go.
PHP Code:

<script language="javascript">

//some other functions
function getWrkHrsNew(tempDateLog2)
{
    alert  ("hi");

   <? $newWrkHrsRec=mysql_connect("localhost","root");
       
mysql_select_db("TEST",$newWrkHrsRec); ?>
    <? $SQLString="SELECT StatusTable.ActDate AS Date, StatusTable.RegHrs AS Regular, StatusTable.OTHrs AS Overtime FROM StatusTable INNER JOIN StaffTable ON StatusTable.PIN = StaffTable.PIN WHERE (StaffTable.PinProfile = 'C1771') AND (PrjCode <> '9000P901' and PrjCode <> '9000P902' and PrjCode <> '9000P903' and PrjCode <> '9000P904' and PrjCode <> '9000P905' and PrjCode <> '9000P909')";
       
$WrkHrsNew_query=mysql_query($SQLString,$newWrkHrsRec);
       
$WrkHrsNew2=mysql_num_rows($WrkHrsNew_query);  ?>

       alert (<? echo $WrkHrsNew2 ?>);
  
  if ($WrkHrsNew2 != 0 )
       { ?>
        alert ("IN");
        <? while( $WrkHrsNew=mysql_fetch_array($WrkHrsNew_query))
          {
              
?>
            alert (<? echo $WrkHrsNew['ActDate']?>);
             alert (<? echo $DateLogtemp  ?>);

          <?  if ( $WrkHrsNew['ActDate']  ==  $DateLogtemp )
              {  
?>
               alert ("NO MATCH!");
         <?  }
              else
              {  
?>
               alert ("NONE");
          <?  }
          }
        } 
?>
</script>
<script language="vbscript">
//some other vb codes

Sub OkOutput() 
tempDateLog = NewDataForm.LogYear.value &"-"& NewDataForm.LogMonth.value &"-"& NewDataForm.LogDay.value 
NewDataForm.DateLog.value = tempDateLog 
tempDateLog2 = tempDateLog 
NewDataForm.DateLogtemp.value = tempDateLog2 
getWrkHrsNew(tempDateLog2) 
End Sub 
 </script>
<body>
<form>
//selectboxes LogYear,LogMonth,LogDay,DateLogTemp
</form>
</body>
Reply With Quote
  #2 (permalink)  
Old 11-24-04, 04:04 AM
franches franches is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
i want to make some correction about the alert being displayed in my "alert (<? echo $WrkHrsNew['ActDate']?>);" in my database date "2004-11-21" the alert is 1972 and "2004-11-22" the alert is 1971 and "2004-11-23" the alert is "1970". I've noticed 2004-11-21 is treated as 2004 subtracted by 11 then subtracted by 21 is equal to 1972 then same with other dates. it should be alert ("<? echo $WrkHrsNew['ActDate']?>"); so that it will display the date in my database. Does this mean in my code <? if ( $WrkHrsNew['ActDate'] contains same date format from my database? or do i have to change it from
PHP Code:

<?  if ( $WrkHrsNew['ActDate']  ==  $DateLogtemp )  ?>

to 
if ("<? echo $WrkHrsNew['Date']?>"
and also the alert (<? echo $DateLogtemp ?>); displays nothing on it. I don't why it displays or alerts nothing on it? Hope you understand what's my problem
Reply With Quote
  #3 (permalink)  
Old 11-25-04, 08:41 AM
franches franches is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
thanks guys. i've already done it.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
display (radio)form along with selected values. al22 ASP 1 10-14-04 03:11 PM
Php Form + mysql + display data sent needed TheRaider Script Requests 3 10-07-04 01:30 AM
Image display based on URL rjwebgraphix PHP 5 09-09-04 08:02 AM
count vowels and display backwards crsdba New Members & Introductions 0 02-12-04 08:35 PM
If date is less than today do not display jimthepict ASP 5 10-19-03 10:43 PM


All times are GMT -5. The time now is 05:16 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.