livewirerules Posted July 29, 2008 Share Posted July 29, 2008 When i execute this code, the relevant form and all the error codes are also displayed. eg: when the UCP link is clicked , it displays the UCP form and both the error codes(error inserting and error). Can someone pls help me to fix this problem <?php if ($_GET['ads']==en) { ?> <div align="center"> <form name="ucp" method="post" action="settings.php"> <p>UCP: <input name="acode" type="text" /> Eg xxxxxxxxxxxxx <input type="submit" name="add" value="Submit" /> </p> </form> <?php $ad1=$_POST['add']; $acode=$_POST['acode']; if($ad1) { $sql="insert into `settings` set adsense='$acode"; $result=mysql_query($sql) or die(mysql_error()); } else { echo"error inserting"; } } else {echo "error";} if ($_GET['lmt']) { ?> <form id="limit" method="post" action="settings.php"> <p>limit: <input name="turns" type="text" /> <input type="submit" name="limit" value="Submit" /> </p> </form> <?php $limit=$_POST['limit']; $turns=$_POST['turns']; if($limit) { $sql="insert into `settings` set limit='$turns'"; $result=mysql_query($sql) or die(mysql_error()); } else { echo"Invalid limit action"; } } else {echo "error setting user limit";} ?> any help will be appreciated Link to comment https://forums.phpfreaks.com/topic/117192-nested-if-problem/ Share on other sites More sharing options...
d.shankar Posted July 29, 2008 Share Posted July 29, 2008 Is the sql query right ? Link to comment https://forums.phpfreaks.com/topic/117192-nested-if-problem/#findComment-602797 Share on other sites More sharing options...
craygo Posted July 29, 2008 Share Posted July 29, 2008 Use single or double quotes around strings if ($_GET['ads']== 'en') You forgot a single quote in your query $sql="insert into `settings` set adsense = '$acode'"; Link to comment https://forums.phpfreaks.com/topic/117192-nested-if-problem/#findComment-602800 Share on other sites More sharing options...
revraz Posted July 29, 2008 Share Posted July 29, 2008 Is mysql_error showing you an error? Is error display turned on? mysql_error should have gave you a fieldname error when you omit single quotes. Link to comment https://forums.phpfreaks.com/topic/117192-nested-if-problem/#findComment-602803 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.