Jump to content

PHP file_exists


dnienhaus

Recommended Posts

is that a private bussness network address or sumthin cuz in my browser the link comes up with a dns error

[code]Bad Gateway
The following error occurred:
[code=DNS_HOST_NOT_FOUND] The host name was not found during the DNS lookup. Contact your system administrator if the problem is not found by retrying the URL.[/code][/code]
Link to comment
https://forums.phpfreaks.com/topic/15190-php-file_exists/#findComment-61287
Share on other sites

here the full page code :

[code]<?php
$username="root";
$password="";
$database="engineering";


mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

if(!empty($_POST['search']))
{
echo '<h1>test</h1>';
$query="SELECT * FROM Assembly WHERE PARTNUMBER LIKE '%" . $_POST['search'] . "%'";
$result=mysql_query($query) or die(mysql_error());

if($result != false)
{
echo "Here are the results:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center bgcolor=#00FFFF><b>Creation Date</b></td>
<td align=center bgcolor=#00FFFF><b>Creator</b></td>
<td align=center bgcolor=#00FFFF><b>Nomenclature</b></td>
<td align=center bgcolor=#00FFFF><b>OBID</b></td>
<td align=center bgcolor=#00FFFF><b>Part Number</b></td>
<td align=center bgcolor=#00FFFF><b>Part Drawing</b></td>
</tr>";

while ($r = mysql_fetch_array($result)) { // Begin while
$CREATIONDATE = $r["CREATIONDATE"];
$CREATOR = $r["CREATOR"];
$NOMENCLATURE = $r["NOMENCLATURE"];
$OBID = $r["OBID"];
$PARTNUMBER = $r["PARTNUMBER"];
$PARTNUMBER = str_replace('"','',$PARTNUMBER);

$url = "'http://intranet/engineering/drawings/$PARTNUMBER.pdf'";

include ('checkfile.php');

echo "<tr>
<td><center>$CREATIONDATE</center></td>
<td><center>$CREATOR</center></td>
<td><center>$NOMENCLATURE</center></td>
<td><center>$OBID</center></td>
<td><center><b>$PARTNUMBER</b></center></td>
<td><center>$url</center></td></tr><br><br><hr>";
} // end while
echo "</table>";
} else { echo "problems...."; }
} else {
echo "Search string is empty. <br> Go back and type a string to search";
}

?>[/code]

its grabbing checkfile.php which is the file_exists function and always returning false.

Partnumber is defined
PHP is 5+
url is valid i can paste it in my browser and open the file and yes it's on a business network.
Link to comment
https://forums.phpfreaks.com/topic/15190-php-file_exists/#findComment-61292
Share on other sites

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.