Page 1 of 1

Opening External Files

Posted: Fri Apr 29, 2005 11:44 am
by Arsenal Rule
I am trying to open an external file with the folder names given in the database under the field folder_name

This is my code trying to

Code: Select all

<?php
			if(isset($_REQUEST['id']))
			{
			$client_id = $_REQUEST['id'];
			
			$conn = mysql_connect("localhost","root","") or die("Could Not Connect To The Database"); 
		mysql_select_db("aziz",$conn) or die("Could Not Select The Database"); 
			
			//sql query somethinglike
			
			$sql = "SELECT * FROM client WHERE client_id = '".$client_id."'"; 
			$result = mysql_query($sql); 
			$row = mysql_fetch_assoc($result); 
			
		echo "<h1>"."Company Name:" . " " . $row['c_company_name'] . " " . "</h1>";
		echo "<h1>"."Company Registratiom Number:" . " " . $row['c_registration_no'] . " " . "</h1>";
		echo "<h2>"."Type Of Company:" . " " . $row['type_of_company'] . " " . "</h2>"; 
		echo "<h4>"."Street Address:" . " " . $row['c_street_address'] . " " . "</h4>";
		echo "<h4>"."Town:" . " " . $row['c_town'] . " " . "</h4>";
		echo "<h4>"."City:"." " . $row['c_city']. "</h4>";
		echo "<h4>"."County:" . " " . $row['c_county'] . " " . "</h4>";
		echo "<h4>"."Postcode:" . " " . $row['c_postcode'] . " " . "</h4>";
		echo "<h4>"."Telephone Number:" . " " . $row['c_tel_no'] . " " . "</h4>";
		echo "<h4>"."Extnsion Number:" . " " . $row['c_ex_no'] . " " . "</h4>";
		echo "<h4>"."Mobile Number:" . " " . $row['c_mobile_no'] . " " . "</h4>";
		echo "<h4>"."Fax Number:" . " " . $row['c_fax_no'] . " " . "</h4>";
		echo "<h4>"."Email Address:" . " " . $row['c_email'] . " " . "</h4>";
		echo "<h4>"."Website Address:" . " " . $row['c_website'] . " " . "</h4>";
		echo "<h4>"."Regular Or Irregular:" . " " . $row['reg_irreg'] . " " . "</h4>";
		echo "<h4>"."View Clients Folder Work:" . " " . $row['folder_name'] . " " . "</h4>";
		echo "View Clients Folder Work:" ." "."<a href=\"clientwork\"".$row['folder_name']."/>".$row['folder_name']."</a>";
		echo '<br> ';
		echo '<br> ';
		if (isset($HTTP_REFERER)) {echo "<a href='$HTTP_REFERER'>BACK</a>"; } 
		else {echo "<a href='javascript:history.back()'>BACK</a>"; 
		}
			  
			
			}
			?>
this below is part of the code is going wrong:

Code: Select all

echo "View Clients Folder Work:" ." "."<a href=\"clientwork\"".$row['folder_name']."/>".$row['folder_name']."</a>";
Basically this code is only opening the folder called "clientwork" but I want it to access the folders with in this folder which name depends on what the folder name is called in the database under the field "folder_name "that is why I have devised this part

Code: Select all

href=\&quote;clientwork\&quote;&quote;.$row&#1111;'folder_name'].&quote;
hoping that it will open the clientwork folder and then open the chosen folder the is fetched from the database. But no matter how hard I try and different way to overcome this problem I just can't seem to get this working properly.

All I want it to do is open the the specified folder within the "clientworks" folder depending on the folder name given in the database.

I hope some one can help me to solve this problem

Thank You For Your Time

Posted: Fri Apr 29, 2005 12:28 pm
by Burrito
You're escaping a quote in your echo which means it will put that in the output.

ie:

Code: Select all

echo "<a href=\"http://www.mydomain.com\"".$row['bob']."\">here</a>";
//this will output (<a href="http://www.mydomain.com"%valueofbob%">here</a>)
don't escape that quote in your echo and it won't output it and you'll get the results you desire.

Opening External Files

Posted: Fri Apr 29, 2005 6:37 pm
by Arsenal Rule
Thanx alot for your replies it was a great help to me in solving this problem thank you very much really appreciate it so much

Take Care

Thanx Again :D