detecting path from Mysql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • imarkdesigns
    New Member
    • Jul 2007
    • 46

    #1

    detecting path from Mysql

    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
    [code=html]
    <table>
    <tr>
    <td class="rowsaved isk"> <a href="<? echo $dirPath.$rows['name']; ?>" target="_blank" title="Poster"> <img src="imgs/icons/save.gif" alt="" border="0" /> </a> </td>
    </tr>
    </table>[/code]

    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

    [code=html]<table>
    <tr>
    <td class="rowsaved isk"> </td>
    </tr>
    </table>[/code]

    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:

    //--[code=php]
    <?php

    $source = $name . $path;

    $query = "SELECT id, name, path FROM $sched LIMIT 1";
    $result = mysql_query($qu ery) or die('Error, query failed');
    if($source == 0) {
    // empty space or no content instead
    echo "";
    } else {
    // include this path if the result is 1
    echo "<a href=\"<? echo '$dirPath.$rows['name']'; ?>\" target=\"_blank \" title=\"Poster\ "><img src=\"imgs/icons/save.gif\" alt=\"\" border=\"0\" />";

    ?>[/code]

    sorry for my coding... ahehehe... im not so great in programming... so please understand in what i mean....
    Last edited by pbmods; Jul 25 '07, 05:09 PM. Reason: Added CODE tags.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    imarkdesigns, please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

    Comment

    • imarkdesigns
      New Member
      • Jul 2007
      • 46

      #3
      detecting path from Mysql

      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($qu ery);
      //$rows=mysql_fet ch_array($resul t);

      $source = $rows['name'];

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

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

      ?>

      [/PHP]
      Last edited by imarkdesigns; Jul 26 '07, 06:24 PM. Reason: Subject Solved

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, imarkdesigns.

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

        Comment

        • imarkdesigns
          New Member
          • Jul 2007
          • 46

          #5
          Originally posted by pbmods
          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

          Comment

          Working...