-1

I'm using the following code to determine if a file is present in the directory pdf_Order_pdf/ which will display a working link or just and anchor link if file not present, I am a complete novice with php (as you can see) but do have a very limited understanding.

<?php
if(file_exists('pdf_Order_pdf/'.$row_Recordset1["our_ref"]'.pdf')) 
    echo 'pdf_Order_pdf/'.$row_Recordset1["our_ref"]'.pdf'; 
else 
    echo '#';
?>

the code above is in between the following html:

<a href="****code above ****">File</a>

I get the following error

Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\SwiftPHP\resultsSupplier.php on line 230

Why does this happen?

fuxia
  • 62,923
  • 6
  • 54
  • 62
wiggy1977
  • 33
  • 8

2 Answers2

3

You forgot the . operator after $row_Recordset1["our_ref"]

if(file_exists('pdf_Order_pdf/'.$row_Recordset1["our_ref"].'.pdf')) 
----------------------------------------------------------^
Andreas Wong
  • 59,630
  • 19
  • 106
  • 123
2
if(file_exists('pdf_Order_pdf/'.$row_Recordset1["our_ref"].'.pdf')) 
                                                          ^dot here
heyanshukla
  • 701
  • 8
  • 17