Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 16th, 2007, 08:09 PM
Registered User
 
Join Date: Feb 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default adding varchar string to hyperlink

I'm trying to design a drilldown page using data queried from an oracle db. I would like to display the data from two columns at the end of the link to take the user to a map of the location. One problem I have is the data displayed in the link shows only the first word in the string. The other problem is how do I add the results of two columns to the link. This is what I'm working with:

$query = "select * from adr_main";



$result = Ora_Parse($cursor, $query);

if ($result == false){
  echo Ora_ErrorCode($cursor).": ".Ora_Error($cursor)."<BR>";

  exit;
}

$result = Ora_Exec ($cursor);

if ($result == false){
    echo Ora_ErrorCode($cursor).": ".Ora_Error($cursor)."<BR>";

  exit;
}


echo "<table align=\"center\" border=1>";
echo "<th colspan=\"6\"><h2>Cost Center Information For:</h2></th>";
//****************Column Names*******************************
$numcols = ora_numcols($cursor);
echo "<tr>";
for($column=0; $column < $numcols; $column++){
    $data = trim(Ora_ColumnName($cursor, $column));
    echo "<td><b>" . $data . "</b></td>";
}
echo "</tr>";
//************************************************** **********


//****************Cell Data***********************************
while(ora_fetch($cursor)){
   echo "<tr>";
   for($column=0; $column < $numcols; $column++){
        $data = (ora_getcolumn($cursor, $column));
        if($column == 6) $data = "<a href=http://www.google.com/maps?q=".$data.">" . $data . "</a>";
        if($data =="") $data = " ";
        echo "<td>" . $data . "</td>";
    }
    echo "</tr>";
}
//************************************************** ********



echo "</table>";

Ora_Close ($cursor);
Ora_Logoff ($connection);
?>


Thanks for any help you can provide!
 
Old February 19th, 2007, 05:56 AM
Authorized User
 
Join Date: Feb 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi greep,

i think u can display the data in two columns like this below. I have showed with three columns i hope this will help u.

mysql_connect(DB_SERVER,DB_USER,DB_PASSWORD) or die(mysql_error()); //connecting to mysql
mysql_select_db(DATABASE) or die(mysql_error()); //connecting to mysql database

$result1=mysql_query("SELECT name,email,comments FROM ".DATABASE_TABLE." ORDER BY id DESC") or die(mysql_error());

echo "GUEST BOOK";
echo "<table bgcolor=\"#CCCCCC\" border=\"1\" align=\"center\">";
echo "<tr><th>NAME</th><th>EMAIL</th><th>COMMENTS</th></tr>";
while($row=mysql_fetch_array($result1))
{
            echo "<tr><td>";
            echo $row['name'];
            echo "</td><td>";
            echo $row['email'];
            echo "</td><td>";
            echo $row['comments'];
            echo "</td></tr>";
        }
        echo "</table>";





Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding new row, hyperlink and sheet with a button Shaolin1976 Excel VBA 0 May 8th, 2008 09:01 AM
store hyperlink into a string. europhreak Classic ASP Basics 1 February 2nd, 2006 11:16 PM
Adding functionality to the String class? RobMeade BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 5 February 9th, 2005 02:11 PM
Adding Hyperlink or Button to DataGrid koneruvijay VS.NET 2002/2003 3 November 13th, 2003 12:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.