rahulvicky00 Posted November 21, 2011 Share Posted November 21, 2011 Hi Mates, I am very new to PHP so this forums too. i have stored a URL in database as VARCHAR, now i want to retrieve that URL in src attribute..is it possible in php to retrieve that URL in src so i can get the latest URL running with the tag? if yes then how to get that. Quote Link to comment Share on other sites More sharing options...
freelance84 Posted November 21, 2011 Share Posted November 21, 2011 http://www.w3schools.com/php/php_mysql_select.asp Quote Link to comment Share on other sites More sharing options...
rahulvicky00 Posted November 21, 2011 Author Share Posted November 21, 2011 http://www.w3schools.com/php/php_mysql_select.asp Thanks for your reply... but the problem is still.. i am clearing my scenario here. i have uploaded a video in my sites in a specified folder and stored the URL in database. now i want to retrieve that particular URL to my video player with the help of "video tag". it requires "src attribute" in that i want to retrieve the URL so every time when the new video have been uploaded that video will run in the video player.. please send some suggestions... Quote Link to comment Share on other sites More sharing options...
Adam Posted November 21, 2011 Share Posted November 21, 2011 freelance84 provided you with a tutorial that explains how to retrieve MySQL data using PHP. After reading it carefully for a good understanding, you should be able to adapt the examples there to fit what you need to do. If you get stuck, show us the code you have so far and we'll go from there. Quote Link to comment Share on other sites More sharing options...
freaker87 Posted November 21, 2011 Share Posted November 21, 2011 put that into the variable like... $surl = $row['yourfieldname']; then src="$surl"; I think it'll work Quote Link to comment Share on other sites More sharing options...
rahulvicky00 Posted November 21, 2011 Author Share Posted November 21, 2011 freelance84 provided you with a tutorial that explains how to retrieve MySQL data using PHP. After reading it carefully for a good understanding, you should be able to adapt the examples there to fit what you need to do. If you get stuck, show us the code you have so far and we'll go from there. Thanks for your reply... My code is looks like: <html> <head> <script type="text/javascript" src="/jwplayer/jwplayer.js"> </script> </head> <body> <?php $link = mysql_connect("localhost", "dbname", "password"); if(!$link) { die("Connection Lost" . mysql_error()); } mysql_select_db ("635177_vik", $link); $data = mysql_query('SELECT * FROM vik ORDER BY id DESC LIMIT 1'); $info = mysql_fetch_array($data); echo "<video class="jwplayer" src=".$info['path']." width="252" height="250"></video>"; mysql_close($link); ?> </body> </html> it showing an error :: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /srv/disk3/635177/www/indiavsaustralia.in/vup/acha/flash.php on line 16 Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted November 21, 2011 Share Posted November 21, 2011 There may be other issues, but the thing that jumps out at me is the use of double quotes inside of a double quoted string: <?php //... echo "<video class="jwplayer" src=".$info['path']." width="252" height="250"></video>"; //... ?> You need to escape the quotes, switch to a single quoted string, or use single quotes for your attributes. For example: <?php //... echo '<video class="jwplayer" src=' . $info['path'] . ' width="252" height="250"></video>'; //... ?> Quote Link to comment 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.