I can't get that to work.
Here is a simplified version of my system:
phpMyAdmin MySQL-Dump
version 2.3.1
#
Host: localhost
Generation Time: Oct 08, 2002 at 08:15 AM
Server version: 3.23.49
PHP Version: 4.1.2
Database : test
--------------------------------------------------------
#
Table structure for table parts
#
CREATE TABLE parts (
id int(11) NOT NULL auto_increment,
type varchar(15) NOT NULL default '',
desc varchar(30) NOT NULL default '',
KEY id (id)
) TYPE=MyISAM;
#
Dumping data for table parts
#
INSERT INTO parts VALUES (1, 'front', 'Front Part A');
INSERT INTO parts VALUES (2, 'back', 'Back Part A');
INSERT INTO parts VALUES (3, 'back', 'Back Part B');
INSERT INTO parts VALUES (4, 'back', 'Back Part C');
INSERT INTO parts VALUES (5, 'back', 'Back Part D');
INSERT INTO parts VALUES (6, 'front', 'Front Part B');
INSERT INTO parts VALUES (7, 'front', 'Font Part C');
INSERT INTO parts VALUES (8, 'front', 'Front Part D');
--------------------------------------------------------
#
Table structure for table systems
#
CREATE TABLE systems (
system_num int(11) NOT NULL default '0',
front_module int(11) NOT NULL default '0',
back_module int(11) NOT NULL default '0'
) TYPE=MyISAM;
#
Dumping data for table systems
#
INSERT INTO systems VALUES (1, 1, 2);
INSERT INTO systems VALUES (2, 8, 3);
INSERT INTO systems VALUES (3, 6, 5);
INSERT INTO systems VALUES (4, 7, 3);
INSERT INTO systems VALUES (5, 1, 5);
I need to be able to list all the sytems, including the description of their parts.
I also need to make a 'edit' page which will show the system as configured, but have all the parts in a drop down so you can change to a different part. For this I treid to do:
<?
$systems = mysql_query("select from systems where id = 1");
$row = mysql_fetch_array($systems);
?>
<form action="edit.php" methond="post">
<input type="text" name="id" value="<?echo $row["id"];?>">
<select name="front">
<?
$front_modules = mysql_query("select from parts where type = 'front'")
while ($front_row = mysql_fetch_array($front_modules)){
echo "<option value=\"".$front_row["id"]."\">".$front_row["desc"]."\n";
}
?>
</select>
<select name="back">
<?
$front_modules = mysql_query("select * from parts where type = 'back'")
while ($front_row = mysql_fetch_array($front_modules)){
echo "<option value=\"".$front_row["id"]."\">".$front_row["desc"]."\n";
}
?>
</select>
whch displayed the boxed, but if I want to display more stuff from the first query for example, I would get nothing
eg:
<? echo $row["front_module"]; ?>
would return nothing.