Jump to content

help please


m00nz00mer

Recommended Posts

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

////////////////////////////////////
//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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.