Here’s my table :
CREATE TABLE `sections` (
`sections_id` int(11) NOT NULL auto_increment,
`sections_name` varchar(100) NOT NULL,
`sections_parent_id` int(4) NOT NULL default '0',
PRIMARY KEY (`sections_id`),
UNIQUE KEY `sections_id`
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data for table `sections`
--
INSERT INTO `sections` VALUES (1, 'HOME', 0);
INSERT INTO `sections` VALUES (2, 'NEWS', 0);
INSERT INTO `sections` VALUES (6, 'TESTING', 1);
Here’s my query:
<?php
$sections_name = $_GET['sections_parent_id'];
$subsectionssql = "SELECT * FROM sections WHERE sections_parent_id > 0";
$result = mysql_query($subsectionssql) or die("Invalid query: " . mysql_error());
while ($row = mysql_fetch_array($result)) {
if ($row['sections_id'] == $_SESSION['sections_id'])
?>
Within the table, I display the result with this :
<td bgcolor="#FFFFFF"><?php echo $row['sections_id']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $row['sections_name']; ?></td>
<td width="12%" bgcolor="#FFFFFF"><?php echo $row['sections_parent_id']; ?></td>
Under column "‘sections_parent_id’ the result display “1”.
Question:
I want, instead of display “1” the result display “Home”.
Here’s my attempt, that did not work :
<?php ($row['sections_parent_id'] == $sections_name) ?>
Can someone please help me?