[Wolves] Mysql join help

Wayne Morris waynelists at machx.co.uk
Fri Jun 28 15:14:05 UTC 2013


On 28/06/2013 13:37, David Goodwin wrote:
>
>
> Something like the following, presumably ? :
>
> SELECT property.address1, property.address2, repair.date_reported FROM property, repair WHERE property.id = repair.pid;
>
> (that's an INNER JOIN).
>
> See also :
>
> http://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins
>
> Perhaps the venn diagram towards the bottom will help.
>
>
> David.
>
>
Thanks for that - getting there now - now have:


echo "All Repairs Needed";
     $query = "SELECT property.id, property.address1, property.address2, 
repairs.repairtype, repairs.lastinspectedby, repairs.timelogged
FROM property, repairs
WHERE property.id = repairs.pid";

Which as a mysql select query gives me what I want, having trouble with 
creating page

adding this
     $result = mysql_query($query);
     $num_rows = mysql_num_rows($result);
$row = mysql_fetch_array($result);
for($i=1; $i <= $num_rows; $i++)

{
print("<TD wrap style=\"wrap: 1 solid #800000\">".$row["repairtype"]." 
</td>");
(more rows)
}

just prints the first line of data over and over again.

how do I get it to clock up and print the next row?

cheers









More information about the Wolves mailing list