url parameter in mysql resultset

Discussion in 'PHP' started by yibman, Jan 5, 2008.

  1. #1
    Can anybody please tell me how i can make a hyperlink in my mysql resultset. Se a screendump

    below. Here you can see links to different pages on my site in the column "url", but it is

    not possible to click on them.

    Brgds

    Allan

    Code :

    <div class="WADAResultsContainer"> <a name="top"></a>
    <div id="WADAPageTitleArea">
    <div id="WADAPageTitle">Page Title</div>
    <div><a href="photogallery_Search.php">New Search</a></div>
    </div>
    <div class="WADAHorizLine"><img src="WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
    <?php if ($totalRows_WADAphotogallery > 0) { // Show if recordset not empty ?>
    <div class="WADAResults">
    <div class="WADAResultsNavigation">
    <div class="WADAResultsCount">Records
    <?php echo ($startRow_WADAphotogallery + 1) ?>
    to
    <?php echo min($startRow_WADAphotogallery + $maxRows_WADAphotogallery, $totalRows_WADAphotogallery) ?>
    of
    <?php echo $totalRows_WADAphotogallery ?>
    </div>
    <div class="WADAResultsNavTop">
    <table border="0" cellpadding="0" cellspacing="0" class="WADAResultsNavTable">
    <tr valign="middle">
    <td class="WADAResultsNavButtonCell" nowrap="nowrap"><?php if ($pageNum_WADAphotogallery > 0) { // Show if not first page ?>
    <a href="<?php printf("%s?pageNum_WADAphotogallery=%d%s", $currentPage, 0, $queryString_WADAphotogallery); ?>" title="First"><img border="0" name="First" id="First" alt="First" src="WA_DataAssist/images/Desert Spice/Traditional_first.gif" /></a>
    <?php } // Show if not first page ?></td>
    <td class="WADAResultsNavButtonCell" nowrap="nowrap"><?php if ($pageNum_WADAphotogallery > 0) { // Show if not first page ?>
    <a href="<?php printf("%s?pageNum_WADAphotogallery=%d%s", $currentPage, max(0, $pageNum_WADAphotogallery - 1), $queryString_WADAphotogallery); ?>" title="Previous"><img border="0" name="Previous" id="Previous" alt="Previous" src="WA_DataAssist/images/Desert Spice/Traditional_previous.gif" /></a>
    <?php } // Show if not first page ?></td>
    <td class="WADAResultsNavButtonCell" nowrap="nowrap"><?php if ($pageNum_WADAphotogallery < $totalPages_WADAphotogallery) { // Show if not last page ?>
    <a href="<?php printf("%s?pageNum_WADAphotogallery=%d%s", $currentPage, min($totalPages_WADAphotogallery, $pageNum_WADAphotogallery + 1), $queryString_WADAphotogallery); ?>" title="Next"><img border="0" name="Next" id="Next" alt="Next" src="WA_DataAssist/images/Desert Spice/Traditional_next.gif" /></a>
    <?php } // Show if not last page ?></td>
    <td class="WADAResultsNavButtonCell" nowrap="nowrap"><?php if ($pageNum_WADAphotogallery < $totalPages_WADAphotogallery) { // Show if not last page ?>
    <a href="<?php printf("%s?pageNum_WADAphotogallery=%d%s", $currentPage, $totalPages_WADAphotogallery, $queryString_WADAphotogallery); ?>" title="Last"><img border="0" name="Last" id="Last" alt="Last" src="WA_DataAssist/images/Desert Spice/Traditional_last.gif" /></a>
    <?php } // Show if not last page ?></td>
    </tr>
    </table>
    </div>
    <div class="WADAResultsInsertButton"> </div>
    </div>
    <table class="WADAResultsTable" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <th class="WADAResultsTableHeader">ID:</th>
    <th class="WADAResultsTableHeader">Country:</th>
    <th class="WADAResultsTableHeader">City:</th>
    <th class="WADAResultsTableHeader">Island:</th>
    <th class="WADAResultsTableHeader">Url:</th>
    <th>&nbsp;</th>
    </tr>
    <?php do { ?>
    <tr class="<?php echo $WARRT_AltClass1->getClass(true); ?>">
    <td class="WADAResultsTableCell"><?php echo($row_WADAphotogallery['ID']); ?></td>
    <td class="WADAResultsTableCell"><?php echo($row_WADAphotogallery['Country']); ?></td>
    <td class="WADAResultsTableCell"><?php echo($row_WADAphotogallery['City']); ?></td>
    <td class="WADAResultsTableCell"><?php echo($row_WADAphotogallery['Island']); ?></td>
    <td class="WADAResultsTableCell"><?php echo($row_WADAphotogallery['Url']); ?></td>
    <td class="WADAResultsEditButtons" nowrap="nowrap"><table class="WADAEditButton_Table">
    <tr>
    <td><a href="photogallery_Detail.php?ID=<?php echo(rawurlencode($row_WADAphotogallery['ID'])); ?>" title="View"><img border="0" name="View<?php echo(rawurlencode($row_WADAphotogallery['ID'])); ?>" id="View<?php echo(rawurlencode($row_WADAphotogallery['ID'])); ?>" alt="View" src="WA_DataAssist/images/Desert Spice/Traditional_zoom.gif" /></a></td>
    </tr>
    </table></td>
    </tr>
    <?php } while ($row_WADAphotogallery = mysql_fetch_assoc($WADAphotogallery)); ?>
    </table>
    <div class="WADAResultsNavigation">
    <div class="WADAResultsCount">Records
    <?php echo ($startRow_WADAphotogallery + 1) ?>
    to
    <?php echo min($startRow_WADAphotogallery + $maxRows_WADAphotogallery, $totalRows_WADAphotogallery) ?>
    of
    <?php echo $totalRows_WADAphotogallery ?>
    </div>
    <div class="WADAResultsNavBottom">
    <table border="0" cellpadding="0" cellspacing="0" class="WADAResultsNavTable">
    <tr valign="middle">
    <td class="WADAResultsNavButtonCell" nowrap="nowrap"><?php if ($pageNum_WADAphotogallery > 0) { // Show if not first page ?>
    <a href="<?php printf("%s?pageNum_WADAphotogallery=%d%s", $currentPage, 0, $queryString_WADAphotogallery); ?>" title="First"><img border="0" name="First1" id="First1" alt="First" src="WA_DataAssist/images/Desert Spice/Traditional_first.gif" /></a>
    <?php } // Show if not first page ?></td>
    <td class="WADAResultsNavButtonCell" nowrap="nowrap"><?php if ($pageNum_WADAphotogallery > 0) { // Show if not first page ?>
    <a href="<?php printf("%s?pageNum_WADAphotogallery=%d%s", $currentPage, max(0, $pageNum_WADAphotogallery - 1), $queryString_WADAphotogallery); ?>" title="Previous"><img border="0" name="Previous1" id="Previous1" alt="Previous" src="WA_DataAssist/images/Desert Spice/Traditional_previous.gif" /></a>
    <?php } // Show if not first page ?></td>
    <td class="WADAResultsNavButtonCell" nowrap="nowrap"><?php if ($pageNum_WADAphotogallery < $totalPages_WADAphotogallery) { // Show if not last page ?>
    <a href="<?php printf("%s?pageNum_WADAphotogallery=%d%s", $currentPage, min($totalPages_WADAphotogallery, $pageNum_WADAphotogallery + 1), $queryString_WADAphotogallery); ?>" title="Next"><img border="0" name="Next1" id="Next1" alt="Next" src="WA_DataAssist/images/Desert Spice/Traditional_next.gif" /></a>
    <?php } // Show if not last page ?></td>
    <td class="WADAResultsNavButtonCell" nowrap="nowrap"><?php if ($pageNum_WADAphotogallery < $totalPages_WADAphotogallery) { // Show if not last page ?>
    <a href="<?php printf("%s?pageNum_WADAphotogallery=%d%s", $currentPage, $totalPages_WADAphotogallery, $queryString_WADAphotogallery); ?>" title="Last"><img border="0" name="Last1" id="Last1" alt="Last" src="WA_DataAssist/images/Desert Spice/Traditional_last.gif" /></a>
    <?php } // Show if not last page ?></td>
    </tr>
    </table>
    </div>
    </div>
    </div>
    <?php } // Show if recordset not empty ?>
    <?php if ($totalRows_WADAphotogallery == 0) { // Show if recordset empty ?>
    <div class="WADANoResults">
    <div class="WADANoResultsMessage">No results for your search</div>
    <div> </div>
    </div>
    <?php } // Show if recordset empty ?>
    </div>
    </body>
    </html>
    <?php
    mysql_free_result($WADAphotogallery);
    ?>

    the returned resultset :

    ID: Country: City: Island: Url:
    2 Greece 0 Aegina aegina.php
    View
    6 Tyrkey Alanya 0 alanya.php
    View
    9 Spain Almunecar 0 almunecar.php
    View
    17 Thailand Bangkok 0 bangkok.php
    View
    14 Jugoslavia Beograd 0 beograd.php
    View
    Records 1 to 5 of 31
    Next Last
     
    yibman, Jan 5, 2008 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    buddy use anchor tag to display the links and prefix the links with sitename/pathifany/

    which you may be using in wrong way if you are using double quotes inside double quotes thats now allowed

    concatenate php strings and variables by a . (dot)


    regards

    Alex
     
    kmap, Jan 5, 2008 IP