diasansley Posted January 11, 2011 Share Posted January 11, 2011 I wanted to store a link in the db and display the same link on the front end which will take me to the site. i tried with href but i get some string error. Also i wanted to add a youtube embed tag to display it again on query to the db. in short is possible to store the url in the db and display the same url. thanks Link to comment https://forums.phpfreaks.com/topic/224074-display-link-in-href/ Share on other sites More sharing options...
dragon_sa Posted January 11, 2011 Share Posted January 11, 2011 you need to show us some code of what you are trying to do and what error did you get? Link to comment https://forums.phpfreaks.com/topic/224074-display-link-in-href/#findComment-1157845 Share on other sites More sharing options...
colleyboy Posted January 11, 2011 Share Posted January 11, 2011 Yes... In the database make sure you save it as VarChar and write the link in from youtube for example. In the PHP then write something like: <A HREF="$databasecell">$databasecell</A> That way it uses the link in the db as a link AND displays the link too. Simplees Link to comment https://forums.phpfreaks.com/topic/224074-display-link-in-href/#findComment-1157846 Share on other sites More sharing options...
diasansley Posted January 11, 2011 Author Share Posted January 11, 2011 while ($row = mysql_fetch_array($result)) { // Begin while $ts = $row["name"]; $ts1= $row["description"]; $ts2 = $row["link"]; $ts3 = $row["tag"]; echo '<div id="resultrow">'; echo '<div id="resultmedia">'; echo'</div>'; echo'<div id="resultdetails">'; echo'<div id="resulttitle">'; echo"$ts"; echo'</div>'; echo'<div id="resultdesc">'; echo "$ts1"; echo '</div>'; echo '<div id="resultlink">'; echo '<a href='$ts2'>'; echo "$ts2"; echo '</a>'; echo '</div>'; echo '<div id="mapid">'; echo "$ts3"; echo'</div>'; echo' </div>'; echo '</div>'; here is the error Parse error : syntax error, unexpected T_VARIABLE, expecting ',' or ',' in C: \ xampp \ htdocs \ wordpress \ wp-content \ themes \ Site info \ results.php on line 92 Link to comment https://forums.phpfreaks.com/topic/224074-display-link-in-href/#findComment-1157868 Share on other sites More sharing options...
hvandracas Posted January 11, 2011 Share Posted January 11, 2011 I don't think this is correct: echo '<a href='$ts2'>'; it should be: echo '< href="'.$ts2.'">'; but maybe i'm mistaken. Link to comment https://forums.phpfreaks.com/topic/224074-display-link-in-href/#findComment-1157872 Share on other sites More sharing options...
dragon_sa Posted January 11, 2011 Share Posted January 11, 2011 echo "<a href='$ts2'>"; Link to comment https://forums.phpfreaks.com/topic/224074-display-link-in-href/#findComment-1157877 Share on other sites More sharing options...
diasansley Posted January 12, 2011 Author Share Posted January 12, 2011 ok that works fine can i store a object tag in the db and show that same obj tag in the div ill paste my code but its hard coded <div id="resultmedia"> <object width="640" height="385"> <param name="movie" value="http://www.youtube.com/v/vFagaB9M6nQ?fs=1&hl=en_GB"></param> <param name="allowFullScreen" value="true"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/vFagaB9M6nQ?fs=1&hl=en_GB" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="155" height="131"> </embed></object> i want the entire obj to come from the db. thanks Link to comment https://forums.phpfreaks.com/topic/224074-display-link-in-href/#findComment-1158297 Share on other sites More sharing options...
dragon_sa Posted January 12, 2011 Share Posted January 12, 2011 how do you plan on inserting them into the database? ie. how are you going to get the objects and then put them in to your database? I personally would save them as files then save the file names in a database then you can get the list of files from the database and use include('videos/somevideo.inc'); assuming the store folder would be www.website.com/videos/ Link to comment https://forums.phpfreaks.com/topic/224074-display-link-in-href/#findComment-1158308 Share on other sites More sharing options...
diasansley Posted January 12, 2011 Author Share Posted January 12, 2011 enter it in a form ..... i wanted to knw if i can store the link(on top) and display that video in a div. from a db the db contains the path Link to comment https://forums.phpfreaks.com/topic/224074-display-link-in-href/#findComment-1158332 Share on other sites More sharing options...
dragon_sa Posted January 12, 2011 Share Posted January 12, 2011 do you mean just this link for example? http://www.youtube.com/v/vFagaB9M6nQ?fs=1&hl=en_GB Link to comment https://forums.phpfreaks.com/topic/224074-display-link-in-href/#findComment-1158344 Share on other sites More sharing options...
diasansley Posted January 12, 2011 Author Share Posted January 12, 2011 yes.. but the link that u have got is from the embed tag coz if i use the top link it dosent play. http://www.youtube.com/watch?v=vFagaB9M6nQ how do i convert the top link to a type below http://www.youtube.com/v/vFagaB9M6nQ?fs Link to comment https://forums.phpfreaks.com/topic/224074-display-link-in-href/#findComment-1158349 Share on other sites More sharing options...
dragon_sa Posted January 12, 2011 Share Posted January 12, 2011 $url="http://www.youtube.com/watch?v=vFagaB9M6nQ"; $replace=array("watch?", "="); $url=str_replace($replace, '/', $url); echo $url; Link to comment https://forums.phpfreaks.com/topic/224074-display-link-in-href/#findComment-1158355 Share on other sites More sharing options...
diasansley Posted January 13, 2011 Author Share Posted January 13, 2011 Thanks a lot... ur great!!!!! btw can u direct me to a site a code/tutorial for google maps with zip codes.As i want to integrate it with my application. thanks Link to comment https://forums.phpfreaks.com/topic/224074-display-link-in-href/#findComment-1158775 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.