Jump to content

Recommended Posts

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.

 

 

Link to comment
https://forums.phpfreaks.com/topic/251538-retriving-url-from-database/
Share on other sites

 

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...

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.

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

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>';

//...
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.