Problem in Fetching Table contents when adding rows in same table
- by jasmine
Im trying to write a function for adding category:
function addCategory() {
$cname = mysql_fix_string($_POST['cname']);
$kabst = mysql_fix_string($_POST['kabst']);
$kselect = $_POST['kselect'];
$kradio = $_POST['kradio'];
$ksubmit = $_POST['ksubmit'];
$id = $_POST['id'];
if($ksubmit){
$query = "INSERT INTO category VALUES (' ', '{$cname}', '{$kabst}', {$kselect}, {$kradio}, ' ') ";
$result = mysql_query($query);
if ($result) {
echo "ok";
}
else{
echo $query ;
}
}
$text .= '<div class="form">
<h2>ADD new category</h2>
<form action="?page=addCategory" method="post">
<ul>
<li><label>Category</label></li>
<li><input name="cname" type="text" class="inp" /></li>
<li><label>Description</label></li>
<li><textarea name="kabst" cols="40" rows="10" class="inx"></textarea></li>
<li>Published:</li>
<li>
<select name="kselect" class="ins">
<option value="1">Active</option>
<option value="0">Passive</option>
</select>
</li>
<li>Show in home page:</li>
<li>
<input type="radio" name="kradio" value="1" /> yes
<input type="radio" name="kradio" value="0" /> no
</li>
<li>Subcategory of</li>
<li>
<select>';
while ($row = mysql_fetch_assoc(mysql_query("SELECT * FROM category"))){
$text .= '<option>'.$row['name'].'</option>';
}
$text .= '</select>
</li>
<li><input name="ksubmit" type="submit" value="ekle" class="int"/></li>
</ul>
</form>
';
return $text;}
And the error:
Fatal error: Maximum execution time of 30 seconds exceeded
What is wrong in my function?