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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.