Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 16th, 2007, 08:09 PM
Registered User
 
Join Date: Feb 2007
Location: Hidden Valley Lake, CA, USA.
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!
Reply With Quote
  #2 (permalink)  
Old February 19th, 2007, 05:56 AM
Authorized User
 
Join Date: Feb 2007
Location: , , .
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>";
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:54 AM.


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