Global Peace output
| From: | Remember14a at aol dot com | Date: | Sun, 22 Aug 2004 21:32:39 +0000 |
| Subject: | Global Peace output | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-35846@lists.php.net to get a copy of this message | ||
Dear friends,
I have pasted table structure and
php script
below,
Output I am getting is company name and web address,
like pasted below
Global Coalition For Peace
http://www.globalcoalitionforpeace.net/
Physicians For Social Responsibility
http://www.psr.org/
However, I want output page to print,url with link to website,
With present script, its printing web address in table, however, onclick it
doesn't take me to website.
Any guidance, so that onclick, its takes, to website in "webaddress" column,
please.
------------------------------------------------------------------------------
-------------
table structure
------------------------------------------------------------------------------
-------------
mysql> use b
Database changed
mysql> describe comp;
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| id | int(5) | | PRI | NULL | auto_increment |
| company | varchar(100) | | PRI | | |
| webaddress | varchar(100) | | PRI | | |
+------------+--------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)
mysql>
---------------------------------------------------------------------------
php script
-------------------------------------------------------------------------
<?php
include 'menufile.php';
?><center>
<?php
// open the connection
$conn = mysql_connect("localhost", "", "");
// pick the database to use
mysql_select_db("b",$conn);
// create the SQL statement
$sql = "SELECT * FROM comp ORDER BY company";
// execute the SQL statement
$result = mysql_query($sql, $conn) or die(mysql_error());
//go through each row in the result set and display data
while ($newArray = mysql_fetch_array($result)) {
// give a name to the fields
$id = $newArray['id'];
$company = $newArray['company'];
$company = $newArray['company'];
$webaddress = $newArray['webaddress'];
//echo the results onscreen between ""can also //type$id is and &company
is
echo " $company <br>$webaddress<br>";
}
?></center>