hi..
i m getting parse error ......
can anyone help me how can i remove it...........
Parse error: parse error in c:\apache\htdocs\newhr\attendnce.php on line 21

<?php
     mysql_connect("localhost","root","root");
     mysql_select_db("master");
     $dates = array();
     $employee = array();
     $attendance_record = array();
     $getdates = "select * from mar10 order by Date" or die(mysql_error());
     $dates_resultset = mysql_query($getdates);
     while ($dates_data = mysql_fetch_assoc($dates_resultset))
     {
     $dates[] = $dates_data['Date'];
     }
    $get_employee = "select * from emp_company"or die(mysql_error());
    $employee_resultset = mysql_query($get_employee);
    while ($employee_data = mysql_fetch_assoc($employee_resultset))
    {
   $get_attendance = "select * from at0310 where ecode=".$employee_data['ecode']." and atdate in (".implode(",",$dates).") order by atdate" or die(mysql_error());
   $employee[$employee_data['ecode']] = $employee_data['ename'];
   $attendance_resultset = mysql_query($get_attendance);
   // Now we build the data into a mutlidimensional array() of format $attendance_record[$empcode][$date]['attendance']
    while ($attendance_data = mysql_fetch_assoc($attendance_resultset) or die(mysql_error());
    {

       // FOR SCENARIO 1
   //$attendance_record[$employee_data['ecode']][$attendance_data['atdate']]['attendance'] = "P";

      // FOR SCENARIO 2
     if ($attendance_data['IO'] != "")
     {
     $attendance_record[$employee_data['ecode']][$attendance_data['atdate']]['attendance'] = "P";
     }
     else
      {
     $attendance_record[$employee_data['ecode']][$attendance_data['atdate']]['attendance'] = "A";
     }
       }
       }
      $tabledata = "";
      $tabledata .= "Empcode Name \t";
      foreach ($dates as $key => $value) {
      $tabledata .= $value." \t";
       }
       $tabledata .= "\r\n";
      foreach ( $employee as $emp_key => $emp_value )
      {
       $tabledata .= $emp_key."/".$emp_value;
       foreach ( $dates as $dates_key => $dates_value )
       {
       $tabledata .= "\t";
       if ( isset($attendance_record[$emp_key][$dates_value]['attendance']) ) {
       $tabledata .= $attendance_record[$emp_key][$dates_value]['attendance'];
       } else {
       $tabledata .= "A";
       }
       }
      $tabledata .= "\r\n";
       }
      $file_resource = fopen("att.txt","w+");
      fwrite($file_resource,$tabledata);
      mysql_close();
       ?>

hi..
i m getting parse error ......
can anyone help me how can i remove it...........
Parse error: parse error in c:\apache\htdocs\newhr\attendnce.php on line 21

<?php
     mysql_connect("localhost","root","root");
     mysql_select_db("master");
     $dates = array();
     $employee = array();
     $attendance_record = array();
     $getdates = "select * from mar10 order by Date" or die(mysql_error());
     $dates_resultset = mysql_query($getdates);
     while ($dates_data = mysql_fetch_assoc($dates_resultset))
     {
     $dates[] = $dates_data['Date'];
     }
    $get_employee = "select * from emp_company"or die(mysql_error());
    $employee_resultset = mysql_query($get_employee);
    while ($employee_data = mysql_fetch_assoc($employee_resultset))
    {
   $get_attendance = "select * from at0310 where ecode=".$employee_data['ecode']." and atdate in (".implode(",",$dates).") order by atdate" or die(mysql_error());
   $employee[$employee_data['ecode']] = $employee_data['ename'];
   $attendance_resultset = mysql_query($get_attendance);
   // Now we build the data into a mutlidimensional array() of format $attendance_record[$empcode][$date]['attendance']
    while ($attendance_data = mysql_fetch_assoc($attendance_resultset) or die(mysql_error());
    {

       // FOR SCENARIO 1
   //$attendance_record[$employee_data['ecode']][$attendance_data['atdate']]['attendance'] = "P";

      // FOR SCENARIO 2
     if ($attendance_data['IO'] != "")
     {
     $attendance_record[$employee_data['ecode']][$attendance_data['atdate']]['attendance'] = "P";
     }
     else
      {
     $attendance_record[$employee_data['ecode']][$attendance_data['atdate']]['attendance'] = "A";
     }
       }
       }
      $tabledata = "";
      $tabledata .= "Empcode Name \t";
      foreach ($dates as $key => $value) {
      $tabledata .= $value." \t";
       }
       $tabledata .= "\r\n";
      foreach ( $employee as $emp_key => $emp_value )
      {
       $tabledata .= $emp_key."/".$emp_value;
       foreach ( $dates as $dates_key => $dates_value )
       {
       $tabledata .= "\t";
       if ( isset($attendance_record[$emp_key][$dates_value]['attendance']) ) {
       $tabledata .= $attendance_record[$emp_key][$dates_value]['attendance'];
       } else {
       $tabledata .= "A";
       }
       }
      $tabledata .= "\r\n";
       }
      $file_resource = fopen("att.txt","w+");
      fwrite($file_resource,$tabledata);
      mysql_close();
       ?>

I've never tried to insert an "or die()" statement in a loop header. That is probably the issue.

Now that I look at it again, you need an another ")" at the end of line 21. If you are still having issues, I would seriously remove that die statement.

i have removed die statement and also put )......but still not work...........
now i got thes warning msgs..
Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\newhr\danihelp.php on line 20

Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\newhr\danihelp.php on line 20

Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\newhr\danihelp.php on line 20

i have removed die statement and also put )......but still not work...........
now i got thes warning msgs..
Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\newhr\danihelp.php on line 20

Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\newhr\danihelp.php on line 20

Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\newhr\danihelp.php on line 20

Chances are this error is going to be your sql statement. You probably should confirm that it is a valid sql statment by outputting it right after you construct it in the code and then running it directly in your database management system. This will tell you if you have any errors in your query.

i think the problem is in this query....when i execute it on MYSQL.it just show the table structure...........according to you is this query is correct or not?if any modifications are required then do reply me.........
$get_attendance = "select * from at0310 where ecode=".$employee_data." and atdate in (".implode(",",$dates).") order by atdate" or

i think the problem is in this query....when i execute it on MYSQL.it just show the table structure...........according to you is this query is correct or not?if any modifications are required then do reply me.........
$get_attendance = "select * from at0310 where ecode=".$employee_data." and atdate in (".implode(",",$dates).") order by atdate" or

I would try to throw in some single quotes:

$get_attendance = "select * from at0310 where ecode='".$employee_data['ecode']."' and atdate in ('".implode("', '",$dates)."') order by atdate";

And let me stress again, using an or die after assigning a string to a variable like this query in your code is excessive and may be giving unexpected results.

hey you solve my prob......................but the code written inside while loop is not executing......... can you help me......... only P print into text file..
$tabledata .= "p";

thanx if you will help me about this ..........

hey you solve my prob......................but the code written inside while loop is not executing......... can you help me......... only P print into text file..
$tabledata .= "p";

thanx if you will help me about this ..........

you missed this while loop close bracket ')'. put this.

while ($attendance_data = mysql_fetch_assoc($attendance_resultset))

Parse error: parse error in C:\wamp\www\hello.php on line 8
i got this error

Parse error: parse error in C:\wamp\www\hello.php on line 8
this the error plz help me how can i remove it?

Parse error: parse error in C:\wamp\www\hello.php on line 8
this the error plz help me how can i remove it?rply now n this is my code

<html>
<head>
<center><font face="comic sanse-ms" color="red"><u>Learning PHP.....</u></center>
<?php
print("Hello world<br>");
print"hello world";
$a="jasmeet";
print("hello".$a "<br>");
?>
</head>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.