|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
HI I'm getting a parse error when calling the following php script.
I am new to php and any help will be greatly appreciated. Thanks in advance <? $project_id_v = $_REQUEST['project_name']; $team_lead_v = $_REQUEST['team_lead']; $engineers_v = $_REQUEST['engineers']; $this_week_tasks_completed_v = $_REQUEST['this_week_tasks_completed']; $this_week_tasks_in_progress_v = $_REQUEST['this_week_tasks_in_progress']; $new_tasks_next_week_v = $_REQUEST['new_tasks_next_week']; $week_start_date_v = $_REQUEST['week_start_date']; $week_end_date_v = $_REQUEST['week_end_date']; ?> <?php /* Mapping Project name to project id based on the list selection*/ $db_connect = mysql_connect("localhost", "qateam", "qateam999") or die("Could not connect"); mysql_select_db("qa_team_status") or die("Could not select database"); /* Insert record */ $sqlstmt = "INSERT INTO weekly_project_status_t (project_id,team_lead,engineers,this_week_tasks_co mpleted,this_week_tasks_in_progress,new_tasks_next _week,week_start_date,week_end_date) values ('$project_id_v','$team_lead_v','$engineers_v','$t his_week_tasks_completed_v','$this_week_tasks_in_p rogress_v','$new_tasks_next_week_v', '$week_start_date_v','$week_end_date_v')"; /* Performing SQL query $result = mysql_query($sqlstmt) or die ("Insert Failed");*/ /* porting data into the excel sheet */ $result = mysql_query('select * from weekly_project_status_t', $db_connect); $count = mysql_num_fields($result); for ($i = 0; $i < $count; $i++){ $title1 .= mysql_field_name($result, $i)."\t"; } while($row = mysql_fetch_row($result)){ $line = ''; foreach($row as $value){ if(!isset($value) || $value == ""){ $value = "\t"; }else{ # important to escape any quotes to preserve them in the data. $value = str_replace('"', '""', $value); # needed to encapsulate data in quotes because some data might be multi line. # the good news is that numbers remain numbers in Excel even though quoted. $value = '"' . $value . '"' . "\t"; } $line .= $value; } $data .= trim($line)."\n"; } # this line is needed because returns embedded in the data have "\r" # and this looks like a "box character" in Excel $data = str_replace("\r", "", $data); # Nice to let someone know that the search came up empty. # Otherwise only the column name headers will be output to Excel. if ($data == "") { $data = "\nno matching records found\n"; } # This line will stream the file to the user rather than spray it across the screen <?php header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=excelfile.xls"); header("Pragma: no-cache"); header("Expires: 0"); print "$title1."\n".$data"; ?> /* echo $title1."\n".$data; */ /* Closing connection */ mysql_close($db_connect); ?> |
|
#2
|
||||
|
||||
|
Can you maybe single out which line is 63 so we don't have to read the whole file or count lines?
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > Parse error: parse error in /home/tcprj/tcprj/www/php/qa_team_1.php on line 63 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|