Hey Guys,
Basically, I have 2 tables, 'phone_man' and 'phones'.
The tables are set as such;
mysql> SHOW COLUMNS FROM phone_man;
+-------------------+-----
----------
-+------+-
----+-----
----+-----
----------
-+
| Field | Type | Null | Key | Default | Extra |
+-------------------+-----
----------
-+------+-
----+-----
----+-----
----------
-+
| phone_manid | int(11) | | PRI | NULL | auto_increment |
| name | varchar(100) | | | | |
| logo | varchar(100) | YES | | NULL | |
+-------------------+-----
----------
-+------+-
----+-----
----+-----
----------
-+
mysql> SHOW COLUMNS FROM phones;
+----------+--------------
-+------+-
-----+----
-----+----
----------
--+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------
-+------+-
-----+----
-----+----
----------
--+
| phoneid | int(11) | | PRI | NULL | auto_increment |
| name | varchar(100)| | | | |
| body | blob | | | | |
| image | varchar(100)| YES | | NULL | |
| price | varchar(100)| YES | | NULL | |
| man | varchar(100)| | | | |
+----------+--------------
-+------+-
-----+----
-----+----
----------
--+
Now, the plan is, that the phones that are made from phone_man will be listed under that; so for eg
SELECT * from phone_man
row, blah blah
SELECT * from phones WHERE $phone_man['name'] = man
See what i mean? man, its hard to explain, heres my code...
**************************
**********
**********
**********
$phone_man_query = "SELECT * FROM phone_man ORDER BY name DESC" or die(mysql_error());
$phone_man_r = mysql_query($phone_man_que
ry) or die(mysql_query());
$phone_man_row = mysql_fetch_assoc($phone_m
an_r);
do {
echo '<a name="' . $phone_man_row['name'] . '"><h1>' . $phone_man_row['name'] . '</h1></a>';
$query = "SELECT * FROM phones ORDER BY name WHERE man = '{$phone_man_row['name']}'
" or die(mysql_error());
$r = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_assoc($r);
do {
echo '<p><a name="' . $row['name'] . '"><b>' . $row['name'] . '</b></a><br />
<img src="./images/phones/thumb
s/tn_' . $row['image'] . '" /><br />
' . $row['body'] . '<br /></p>';
} while ($row = mysql_fetch_assoc($r));
mysql_close();
} while ($phone_man_row = mysql_fetch_assoc($phone_m
an_r));
**************************
**********
**********
**********
***
And its basically not working.. I dont know if I can have a do{}while win another one?
Thanks for any assistance.
Christian