Hi i have a simple database query that fetch the data from the database i want to make one of the row like first name into a jwplayer link so when click on first name linked plays the video this my php code <?php $q=$_GET["q"]; $con = mysql_connect('localhost', 'root', ''); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("droptest", $con); $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> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td> " . $row['FirstName'] . "</td>"; echo "<td>" . $row['LastName'] . "</td>"; echo "<td>" . $row['Age'] . "</td>"; echo "<td>" . $row['Hometown'] . "</td>"; echo "<td>" . $row['Job'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> PHP: this the jwplayer link <a href="#" onClick="jwplayer().load('videos/film.mp4')"><a/> Code (markup): i tried like this echo "<td> "<a href="#" onClick="jwplayer().load(' . $row['FirstName'] .')"><a/>"</td>"; Code (markup): but get error
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\xampp\htdocs\4film\4film\droptest\getuser1.php on line 30 this line echo "<td>" <a href='#' onClick='jwplayer().load(' . $row['FirstName'] .')'><a/> "</td>"; Code (markup): this without the link works fine but i want the link echo "<td> " . $row['FirstName'] . "</td>"; Code (markup):
You, have it all quoted wrong... Try This: echo "<td><a href=\"#\" onClick=\"jwplayer().load('" . $row['FirstName'] . "')\"><a/></td>"; Code (markup):
it removes the error but unfortunaly doesnt retrieve the row first name just comes blank like that it removes the error but it doesnt retrieve the row just shows the row blank echo "<td><a href='#' onClick='jwplayer().load('" . $row['FirstName'] ."')'><a/></td>"; Code (markup):
Did you use my Code Above? Of course it comes out blank, you put nothing in the a URL: Try this: echo "<td><a href=\"#\" onClick=\"jwplayer().load('" . $row['FirstName'] . "')\">" . $row['FirstName'] . "<a/></td>"; Code (markup):
the jwplayer is usually called tru the onclick like this <a href="#" onClick="jwplayer().load({'file': '[B]video1_SD.mp4[/B]', 'hd.file': '[B]video2.mp4[/B]'})"> Code (markup): so i tried video1_SD replaced with . $row['FirstName'] . instead to put the file name directly it will come from the database thats why i tried the pick up the first row just to test it so how can i replace video1 and video2 with . $row['FirstName'] . and . $row['FirstName'] . <a href="#" onClick="jwplayer().load({'file': 'video1_SD.mp4', 'hd.file': '[B]video2.mp4'})"> Code (markup):