m00nz00mer Posted May 6, 2008 Share Posted May 6, 2008 hey i cant figure out why this doesnt work, i dont get any errors... anyone please? basically what i want it to do is: if $checkRevQuery is true then display 'the end is near' else add the data to the db. It does add the data to the db when $checkRevQuery is false, however i cant get the message 'the end is near' to display? and ideas? //////////////////////////////////// //Form Processing if(isset($_POST['submitted'])) { $formUser = trim($_POST['userName']); $formDate = trim(date("Y-m-d")); $formComment = trim($_POST['comments']); $checkRevQuery = "SELECT ID, ISBN FROM bookrev WHERE ISBN='".$_GET['bokID']."' AND ID LIKE '$formUser'"; $checkRevQueryResult = mysql_query($checkRevQuery); if (!$checkRevQueryResult[0]) { $formQueryCom = "INSERT INTO bookrev (ISBN, ID, revDate, revText) VALUES ('".$_GET['bokID']."', '$formUser', '$formDate', '$formComment')"; mysql_query($formQueryCom); //Refresh the page echo "<meta http-equiv='refresh' content='1'>"; } else { echo "the end is near"; } } Link to comment https://forums.phpfreaks.com/topic/104352-help-please/ Share on other sites More sharing options...
conker87 Posted May 6, 2008 Share Posted May 6, 2008 //////////////////////////////////// //Form Processing if(isset($_POST['submitted'])) { $formUser = trim($_POST['userName']); $formDate = trim(date("Y-m-d")); $formComment = trim($_POST['comments']); $checkRevQuery = "SELECT ID, ISBN FROM bookrev WHERE ISBN='".$_GET['bokID']."' AND ID LIKE '$formUser'"; $checkRevQueryResult = mysql_query($checkRevQuery); if (mysql_num_rows($checkRevQueryResult) == 1) { $formQueryCom = "INSERT INTO bookrev (ISBN, ID, revDate, revText) VALUES ('".$_GET['bokID']."', '$formUser', '$formDate', '$formComment')"; mysql_query($formQueryCom); //Refresh the page echo "<meta http-equiv='refresh' content='1'>"; } else { echo "the end is near"; } } Link to comment https://forums.phpfreaks.com/topic/104352-help-please/#findComment-534265 Share on other sites More sharing options...
m00nz00mer Posted May 6, 2008 Author Share Posted May 6, 2008 sorted thanks, apart from the logics are the wrong way round. Link to comment https://forums.phpfreaks.com/topic/104352-help-please/#findComment-534272 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.