Jump to content

display link in href


diasansley

Recommended Posts

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

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

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

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

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/

 

Archived

This topic is now archived and is closed to further replies.

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