p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   PHP Databases (http://p2p.wrox.com/forumdisplay.php?f=97)
-   -   adding varchar string to hyperlink (http://p2p.wrox.com/showthread.php?t=54191)

dgreep February 16th, 2007 08:09 PM

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!

prashu_hi25 February 19th, 2007 05:56 AM

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>";


All times are GMT -4. The time now is 03:09 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.