Jump to content

Not returning correct results


Xtremer360

Recommended Posts

Now what is supposed to happen is when the form is submitted it gathers the description and short name post values and gets the editid from the hidden field and checks the database to make sure there isn't another content page with the same description OR shortname that doesn't have that same editID. I think my issue is the way I have the parenthesis but I'm not sure.

 

$checkQuery = "SELECT * FROM manager_site_contentPages WHERE ((description = '".$description."') OR (shortname = '".$shortName."')) AND (id != '".$editID."')";
        $checkResult = mysqli_query ( $dbc, $checkQuery ); // Run The Query
        echo $checkQuery;
        echo mysqli_num_rows($checkResult);                
        
        if (mysqli_num_rows($checkResult) == 0) {  
            
            $query = "UPDATE manager_site_contentPages SET description = '".$description."', shortName = '".$shortName."', content = '".$content."', lineBreaks = '".$lineBreaks."', status = '".$status."'  WHERE id = '".$editID."'";  
            mysqli_query($dbc,$query);
              
            // Insert was sucessful
            $errors = false;
            $message = "Content Page was updated successfully!";
            
            $output = array('errorsExist' => $errors, 'message' => $message); 
             
        } else {
            
            // Content Page doesn't exist in database error
            $errors = true;
            $message = "No changes were made to the content page!";
               
            $output = array('errorsExist' => $errors, 'message' => $message); 
            
        } 

Link to comment
https://forums.phpfreaks.com/topic/242393-not-returning-correct-results/
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.