the code:
<?php
$db_name = "DBMedici";
$table_name = "specialita";
$connect = @mysql_connect("localhost", "root", "") or die("connect che????");
$select_db = @mysql_select_db($db_name, $connect) or die("cannot select db");
$sql = "
select specialita, url from $table_name order by specialita
";
$result = @mysql_query($sql, $connect) or die("non riesco a fare query");
echo "<tr class=`GridHeader`>
<th>specialita</th>
</tr>
";
while ($riga = mysql_fetch_array($result)) {
echo "<tr class=\"GridRow\"
onmouseover=\"this.className='GridMOverRow'\"
onmouseout=\"this.className='GridRow'\" id=\"ggg\">";
echo "<td><a href='$url'>" .$riga['specialita']."</a></td>";
$url .= $riga['url'];
;
echo "</tr>";
//}
}
?>
well, the pint is to get the right url for every data. consider the db is like this:
mysql> explain specialita;
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| Specialita | varchar(100) | | | | |
| url | varchar(100) | YES | | NULL | |
+------------+--------------+------+-----+---------+-------+
but now, with this code i get the url composed with all records like that.
how should i fix it??
tnx, pacho
url from db
Moderator: General Moderators
the prob is:
i get all data from my db, this is ok.
this is what i get:
specialita
Allergologia
Andrologia
Angiologia
Allergologia
....
now in the code i wrote:
echo "<td><a href='$url'>" .$riga['specialita']."</a></td>";
$url .= $riga['url'];
like this any field has the same url, not its own. remeber that in my db there is a field 'url' with the correct url.
i wany to get data so that i can click the ouput and go to the correct page, say:
Allergologia
http://www.pinco.it
Allergologia
http://www.palla.it
hope this helps,
pacho
i get all data from my db, this is ok.
this is what i get:
specialita
Allergologia
Andrologia
Angiologia
Allergologia
....
now in the code i wrote:
echo "<td><a href='$url'>" .$riga['specialita']."</a></td>";
$url .= $riga['url'];
like this any field has the same url, not its own. remeber that in my db there is a field 'url' with the correct url.
i wany to get data so that i can click the ouput and go to the correct page, say:
Allergologia
http://www.pinco.it
Allergologia
http://www.palla.it
hope this helps,
pacho