Forums

This topic is locked

How to show information based upon another table

Posted 06 Mar 2004 21:29:49
1
has voted
06 Mar 2004 21:29:49 Luc GIS posted:
Hi all,

My first post and as most people have done i guess....starting with a question.

What is wrong with this code, i have tried everything. <pre id=code><font face=courier size=2 id=code>&lt;?php do { ?&gt;

&lt;?php
mysql_select_db($database_serv, $serv);
$query_sources = "SELECT * FROM source";
$sources = mysql_query($query_sources, $serv) or die(mysql_error());
$row_sources = mysql_fetch_assoc($sources);
$totalRows_sources = mysql_num_rows($sources);

mysql_select_db($database_serv, $serv);
$query_countries = "SELECT * FROM country WHERE country_ID = ".$row_sources['country_ID']." ORDER BY country_ID ASC";
$countries = mysql_query($query_countries, $serv) or die(mysql_error());
$row_countries = mysql_fetch_assoc($countries);
$totalRows_countries = mysql_num_rows($countries);
?&gt;

&lt;tr&gt;
&lt;td width="15"&gt; &lt;/td&gt;
&lt;td class="title_family" width="10"&gt; &lt;/td&gt;
&lt;td class="title_species"&gt;&lt;?php echo $row_countries['country_GB']; ?&gt;&lt;/td&gt;
&lt;td class="title_family" width="10"&gt; &lt;/td&gt;
&lt;td width="15"&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;?php } while ($row_countries = mysql_fetch_assoc($countries)); ?&gt;
&lt;/table&gt;

&lt;br&gt;

&lt;/body&gt;

&lt;/html&gt;

&lt;?php
mysql_free_result($countries);

mysql_free_result($sources);
?&gt; </font id=code></pre id=code>

Thanks in advance.


Kind regards

Edited by - Luc_GIS on 06 Mar 2004 21:38:46

Replies

Replied 10 Mar 2004 03:04:33
10 Mar 2004 03:04:33 Phil Shevlin replied:
Not sure what you are trying to do, but your repeat region is repeating the whole page not the row. You also have a RS (Sources) that isn't needed for anything. I also do not see what this has to do with your post title?

WHat are you trying to do?

Reply to this topic