By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,566 Members | 1,664 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,566 IT Pros & Developers. It's quick & easy.

detecting path from Mysql

imarkdesigns
P: 46
hello again guys... im in trouble here in my coding which i cannot open a link for the end user of the page in the site where there is a portal thru the folder... [sorry for my english ahehe..]

anyway, here is my code...

//-- for the table linkage with icon
Expand|Select|Wrap|Line Numbers
  1. <table>
  2. <tr>
  3. <td class="rowsavedisk"> <a href="<? echo $dirPath.$rows['name']; ?>" target="_blank" title="Poster"> <img src="imgs/icons/save.gif" alt="" border="0" /> </a> </td>
  4. </tr>
  5. </table>
however, when the database name and path are empty, i need to disable the current linkage in my table like this:

//-- for the table linkage with icon

Expand|Select|Wrap|Line Numbers
  1. <table>
  2. <tr>
  3. <td class="rowsavedisk"> </td>
  4. </tr>
  5. </table>
where there is no open link when the name and path of the database are empty... now i wish that someone can help me to correct my code...

here is my code for the path-link:

//--
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $source = $name . $path;
  4.  
  5. $query = "SELECT id, name, path FROM $sched LIMIT 1";
  6. $result = mysql_query($query) or die('Error, query failed');
  7. if($source == 0) {
  8. // empty space or no content instead
  9. echo "";
  10. } else {
  11. // include this path if the result is 1
  12. echo "<a href=\"<? echo '$dirPath.$rows['name']'; ?>\" target=\"_blank\" title=\"Poster\"><img src=\"imgs/icons/save.gif\" alt=\"\" border=\"0\" />";
  13.  
  14. ?>
sorry for my coding... ahehehe... im not so great in programming... so please understand in what i mean....
Jul 25 '07 #1
Share this Question
Share on Google+
4 Replies


pbmods
Expert 5K+
P: 5,821
imarkdesigns, please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.
Jul 25 '07 #2

imarkdesigns
P: 46
sorry about that...

anyway... i finally solved the case of this stuff...

here's my result:

[PHP]

<?php

$query = "SELECT * FROM $sched";
//$result = mysql_query($query);
//$rows=mysql_fetch_array($result);

$source = $rows['name'];

$dirPath = "picture/";
$mainPath = $dirPath . $rows['name'];

if(empty($source)) {
// Result 0
echo "The $source not exist";
}else{
// Result 1
echo "The <a href=\"$mainPath\"> $source </a>exist";
}

?>

[/PHP]
Jul 26 '07 #3

pbmods
Expert 5K+
P: 5,821
Heya, imarkdesigns.

Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Jul 26 '07 #4

imarkdesigns
P: 46
Heya, imarkdesigns.

Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
:) greetings...

thanks pbmods... since developing isn't my line.. but i am now taking the path for web development... haha... and im enjoy developing site now!

iMark Designs
Jul 26 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.