Lisa23 Posted July 13, 2011 Share Posted July 13, 2011 hi i have the above function but what i am trying to do is replace the above the name of the file with the one that will be queried from the database but i keep getting sintax error. want to to put where it says filr name example (file1.mp4) with the ( <?php echo $filename?>) but i keep getting sintax error PHP Code: echo "<td><a href='#' onClick=\"jwplayer().load({'file': 'file1.mp4', 'hd.file': 'file2.mp4'})\"> </td>"; this how my all code looks like is a simple query four fields frm the database and the issue is make the names into file row into onclick link but i get the sintax error which i think i need to close and ope teh php tags somewhere in order to put the ( <?php echo $filename?>) because i have it inside teh while loop help please? this how it whole looks <html> <head> </head> <body> <?php $q=$_GET["q"]; $con = mysql_connect('localhost', 'root', ''); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("droptest", $con); $FirstName=$_GET['FirstName']; $sql="SELECT * FROM user WHERE id = '".$q."'"; $result = mysql_query($sql); echo "<table border='1'> <tr> <th>Firstname</th> <th>Lastname</th> <th>Age</th> <th>Hometown</th> <th>Job</th> <th>secondvideo</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['LastName'] . ''. $row['Job'] . "</td>"; echo "<td>" . $row['Age'] . "</td>"; echo "<td>" . $row['Hometown'] . ''. $row['Job'] . "</td>"; echo "<td>" . $row['Job'] . "</td>"; echo "<td><a href='#' onClick="jwplayer().load({'file': '<?php echo $FirstName?>', 'hd.file': 'videos/film.mp4'})"> </td>"; echo "<td>" . $row['arr'] . "</td>"; echo "<td>" . $arr . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/241855-how-can-i-replace-name-of-the-file-with-php-echo/ Share on other sites More sharing options...
jcbones Posted July 13, 2011 Share Posted July 13, 2011 You need to escape the double quotes, since it is a double quoted string: echo "<td><a href='#' onClick=\"jwplayer().load({'file': '$FirstName', 'hd.file': 'videos/film.mp4'})\"> </td>"; Quote Link to comment https://forums.phpfreaks.com/topic/241855-how-can-i-replace-name-of-the-file-with-php-echo/#findComment-1242041 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.