Hello,
I have a problem with a solution. I was trying to find the problem for days now with no lack.
In this project there is an option to change the template of the webpage accotding to 10 predefine templates.
Herewith is the code for the file change_template. When I execute this commant an error appears “OBJECT NOT FOUND”. I know tha SQL database has no problem because if I manually change the “templateid” number from lets say 1 -> 2 then my template is changing. So I thought that the problem might be is this code here.
Can you help me please?
[code]<?php
include("includes/functions.php");
include("includes/connect.php");
include('includes/config.php');
include('validate.php');
//ADD CATEGORY,DESCRIPTION AND IMAGE ON SUBMIT
$caption="Add";
$caption="Update";
$title="Choose Template Setting";
$sql="select * from ".$prefix."setting where id='1'";
$rs=mysql_query($sql) or die("Error".mysql_error());
if(mysql_num_rows($rs))
{
$rows = mysql_fetch_object($rs);
$templateid = $rows->templateid; // type
}
if($_POST['submit'] == "Update")
{
$templateid = trim($_POST['templateid']);
$query2="update ".$prefix."setting set templateid='$templateid' where id=1";
$result2=mysql_query($query2) or die("Erron in updating".mysql_error());
if($result2)
$msg = "<center>Template Setting Updated Successfully...</center>";
else
$err="Erron in updating";
}
?>
<table width="90%" cellpadding="5" cellspacing="1" border="0" class="borderbrwn" align="center" >
<tr>
<td colspan="6"><font class="titleinner"><b><?=$title?></b></font> </td>
</tr>
<tr>
<td colspan="6" height="1" bgcolor="#990000"> </td>
</tr>
<tr>
<td align='center'><img src="./template/template1.gif"><br><br><input class = textbox type=radio name=templateid value="1" <? if ($templateid == "1") echo 'checked'; ?> ></td>
<td align='center'><img src="./template/template2.gif"><br><br><input class = textbox type=radio name=templateid value="2" <? if ($templateid == "2") echo 'checked'; ?> ></td>
<td align='center'><img src="./template/template3.gif"><br><br><input class = textbox type=radio name=templateid value="3" <? if ($templateid == "3") echo 'checked'; ?> ></td>
</tr>
<tr>
<td align='center'><img src="./template/template4.gif"><br><br><input class = textbox type=radio name=templateid value="4" <? if ($templateid == "4") echo 'checked'; ?> ></td>
<td align='center'><img src="./template/template5.gif"><br><br><input class = textbox type=radio name=templateid value="5" <? if ($templateid == "5") echo 'checked'; ?> ></td>
<td align='center'><img src="./template/template6.gif"><br><br><input class = textbox type=radio name=templateid value="6" <? if ($templateid == "6") echo 'checked'; ?> ></td>
</tr>
<tr>
<td align='center'><img src="./template/template7.gif"><br><br><input class = textbox type=radio name=templateid value="7" <? if ($templateid == "7") echo 'checked'; ?> ></td>
<td align='center'><img src="./template/template8.gif"><br><br><input class = textbox type=radio name=templateid value="8" <? if ($templateid == "8") echo 'checked'; ?> ></td>
<td align='center'><img src="./template/template9.gif"><br><br><input class = textbox type=radio name=templateid value="9" <? if ($templateid == "9") echo 'checked'; ?> ></td>
</tr>
<tr>
<td align='center'><img src="./template/template10.gif"><br><br><input class = textbox type=radio name=templateid value="10" <? if ($templateid == "10") echo 'checked'; ?> ></td>
<td align='center'> </td>
<td align='center'> </td>
</tr>
<tr>
<td colspan=3 align='center'><input type='submit' name='submit' class='button' value='<?=$caption?>'></td>
</tr>
</table>
</form>
</td>