Jump to content

problem with variable <a>


denoteone

Recommended Posts

Can I reference a local server that has images on it with a PHP variable.

I created a database that has the paths to all the images on our image server.

 

the variable $path is equal to Ocds1/data1/

 

and my code looks like this

 

$path = $row['path'];
<a href='$path'>Click here for image</a> $path /n

 

but the URL is not pointing to the server. it is pointing to the url of the website it is on

 

 

Link to comment
Share on other sites

the links will only be used by people in my office. so we are accessing the application online to find out were a selected image is located on our image server. the path to the server is always going to be "Ocfds1\Data1"  and on click i want the browser to go to that location on the server so the user can just click and open the image.

my full page of code is

 


<?
include "connect.php";


if (isset($_POST['submit'])) // name of submit button
{
$choice=$_POST['option'];
$query = "SELECT * from strata_links WHERE name='$choice' "; 

$result = mysql_query($query);
if (!($result))
{
echo "<br><B>ERROR</B>query did not happen result is false";
echo "<BR>query= $query";
echo "<BR>result= $result";
echo "<BR>mysql error no= ".mysql_errno().": ".mysql_error()."<BR>";
}; 


while ($row = mysql_fetch_assoc($result))
{
$path = $row['path'];
echo "<a href='$path'>Click here for image</a> $path /n";
$description = $row['description'];
echo "$description";
}

} 
else{
print "<center>";
  print "<table>";
  print "<tr><td><center>please select a File first</center></td></tr>";
  print "<tr><td><center>";   
  print "You have to Selct Image name first..... <META HTTP-EQUIV = 'Refresh' Content = '2; URL =getimage.php'></center>";
  print "</td></tr></table></center>";
  }

?>

Link to comment
Share on other sites

That makes perfect sense, but the path will still have to be a useable UNC path.

 

For example, hop on the server and connect to the folder with the images in it. Whatever path you have to use to connect from there, is the path you need to use in code.

 

I would assume something like \\Ocds1\data1\

 

assuming that the location is a valid network share.

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.