The second script that has players the DB is it possible to call 2 DB instead of one what would the code look like if possible<? include("left.php") ?>
<!--TEXT-->
<td VALIGN="top" bgcolor="white" width="500"><span class='print'>
<table>
<?
mysql_pconnect("localhost","root","");
mysql_select_db("psn");
$result = mysql_query("SELECT * FROM clubs where id='$id'");
while($r=mysql_fetch_array($result))
{
$id=$r["id"];
$club_name=$r["name"];
$manager=$r["manager"];
$wmessage=$r["wmessage"];
$history=$r["history"];
$honors=$r["honors"];
$stadium_address=$r["stadium_address"];
$picture=$r["picture"];
$website=$r["website"];
$emblem=$r["emblem"];
$league=$r["league"];
echo "<tr bgcolor='#333333'>
<td with='600'>
<div class='header'>$club_name</div>
</td>
<tr>
<td><img src='images/$emblem'></td>
<tr>
<td><img src='images/$picture'align='left'width='200'height='210'><b>Club Name</b>:$club_name<br><b>Managers Name:</b>$manager<br><b>Website Address:</b><a href='$website'target='blank'>$website</a></td><tr><td><b>Stadium Address</b>$stadium_address</td><tr><td><b>History:</b>$history</td><tr><td><b>Honors:</b>$honors</td>";} ?>
</table>
<td Valign="top" width="200">
<table>
<?
mysql_pconnect("localhost","root","");
mysql_select_db("psn");
$result = mysql_query("SELECT * FROM players ORDER by name ASC");
while($r=mysql_fetch_array($result))
{
$id=$r["id"];
$name=$r["name"];
$position=$r["position"];
$club=$r["club"];
$country=$r["country"];
$info=$r["info"];
$picture=$r["picture"];
$height=$r["height"];
$weight=$r["weight"];
$dob=$r["dob"];
echo "<tr><td><div class=''><a href='players.php?id=$id' class='body'>$name</a></div></td>";}?>
</body>
</html>
About DB is PHP
Moderator: General Moderators
About DB is PHP
ok here the page script
This should work.
This might, but I've never tried it.
Good luck
Virgil
Code: Select all
$result = mysql_query("SELECT table1.fieldname, table2.fieldname FROM clubs where id='$id'");This might, but I've never tried it.
Code: Select all
$result = mysql_query("SELECT table1.*, table2.* FROM clubs where id='$id'");Good luck
no that didn't work. I'll try and explain it from the very beginning.
1) Ok we at the home page.
2) We open up Australia.php which has on the side all NSL clubs.
3) theres a php script which is getting from table clubs all the clubs that play in nsl.
4) We click on one of them.
eg clubs.php?id=$id or in browser clubs.php?id=1
5) this is were we see the profile. as we have a scipt that selects the id from the last page and we get the stuff heres the code
6) On the side is suppose to be were the players that play for the club are but im getting an error.
Heres the players code
From that we goto players.php which I'll just use the code like in the first one.
1) Ok we at the home page.
2) We open up Australia.php which has on the side all NSL clubs.
3) theres a php script which is getting from table clubs all the clubs that play in nsl.
4) We click on one of them.
eg clubs.php?id=$id or in browser clubs.php?id=1
5) this is were we see the profile. as we have a scipt that selects the id from the last page and we get the stuff heres the code
Code: Select all
<?
mysql_pconnect("localhost","xxxx","xxxx");
mysql_select_db("psn");
$result = mysql_query("SELECT * FROM clubs where id='$id'");
while($r=mysql_fetch_array($result))
{
$id=$rї"id"];
$club_name=$rї"name"];
$manager=$rї"manager"];
$wmessage=$rї"wmessage"];
$history=$rї"history"];
$honors=$rї"honors"];
$stadium_address=$rї"stadium_address"];
$picture=$rї"picture"];
$website=$rї"website"];
$emblem=$rї"emblem"];
$league=$rї"league"];
echo "<tr bgcolor='#333333'>
<td with='600'>
<div class='header'>$club_name</div>
</td>
<tr>
<td><img src='images/$emblem'></td>
<tr>
<td><img src='images/$picture'align='left'width='200'height='210'><b>Club Name</b>:$club_name<br><b>Managers Name:</b>$manager<br><b>Website Address:</b><a href='$website'target='blank'>$website</a></td><tr><td><b>Stadium Address</b>$stadium_address</td><tr><td><b>History:</b>$history</td><tr><td><b>Honors:</b>$honors</td>";} ?>Heres the players code
Code: Select all
<?
mysql_pconnect("localhost","","");
mysql_select_db("psn");
$result = mysql_query("SELECT * FROM clubs.name, players,name,id,club. ORDER by name ASC");
while($r=mysql_fetch_array($result))
{
$id=$rї"id"];
$name=$rї"name"];
$position=$rї"position"];
$club=$rї"club"];
$country=$rї"country"];
$info=$rї"info"];
$picture=$rї"picture"];
$height=$rї"height"];
$weight=$rї"weight"];
$dob=$rї"dob"];
$club_name=$rї"name"];
echo "<tr><td><div class=''><a href='players.php?id=$id' class='body'>$name</a></div></td>";}?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Try this:
and read this:
http://www.mysql.com/doc/S/E/SELECT.html
Mac
Code: Select all
$result = mysql_query("SELECT * FROM clubs.name, players,name,id,club. ORDER by name ASC") or die(mysql_error());http://www.mysql.com/doc/S/E/SELECT.html
Mac
what kinda query is this??
the query itself looks like it has a buncha errors....
why don't you just do:
Code: Select all
$result = mysql_query("SELECT * FROM clubs.name, players,name,id,club. ORDER by name ASC");why don't you just do:
Code: Select all
$result = mysql_query("SELECT * FROM clubs ORDER BY name");- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK