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

Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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.