Xtremer360 Posted July 19, 2011 Share Posted July 19, 2011 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 More sharing options...
IrOnMaSk Posted July 19, 2011 Share Posted July 19, 2011 So what did it return? PHP doesn't have a mind of its own; it only returns what you tell it to return Link to comment https://forums.phpfreaks.com/topic/242393-not-returning-correct-results/#findComment-1244922 Share on other sites More sharing options...
Xtremer360 Posted July 19, 2011 Author Share Posted July 19, 2011 It always returns the query plus 0 for the mysqli_num_rows. Link to comment https://forums.phpfreaks.com/topic/242393-not-returning-correct-results/#findComment-1244923 Share on other sites More sharing options...
Xtremer360 Posted July 19, 2011 Author Share Posted July 19, 2011 It still performs the update IF changes were made. Link to comment https://forums.phpfreaks.com/topic/242393-not-returning-correct-results/#findComment-1244925 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.