CREATE TABLE IF NOT EXISTS `Channels` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL,
`commercial` tinyint(1) NOT NULL DEFAULT '0',
`usrid` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
INSERT INTO `Channels` (`id`, `name`, `commercial`, `usrid`) VALUES
(2, 'ORF 1', 0, 0);
PHP:
<?php
if (isset($_POST['name'])){
mysql_connect("localhost", "test", "test") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());
$tmp = mysql_query("SELECT commercial
FROM Channels
WHERE name='".mysql_real_escape_string($_POST['name'])."'");
$row = mysql_fetch_row($tmp);
echo $row['commercial'];
}
else
{
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<input name="name" type="text">
<input type="submit" name="submit" value="submit" >
</form>
<?php
}
?>
There is no output when I submit "ORF 1".