bCourtney07 Posted November 8, 2007 Share Posted November 8, 2007 With adodb, is it possible to have it return a value of 1 instead of -1? I want it to return a value of 1 if the user exists in a table. here is my code <?php require("config.php"); if($_GET['action'] == 'post') { if(empty($_POST['Employee_ID']) || empty($_POST['Date']) || empty($_POST['Activity']) || empty($_POST['Miles'])) { error("blank"); //Prints out error message if fields are blank exit; } if(!empty($_POST['Employee_ID'])) { $query="SELECT Employee_ID FROM analyzer_query WHERE Employee_ID = '{$_POST['Employee_ID']}'"; $rs = $conn->execute($query); $num_columns = $rs->RecordCount(); echo $num_columns . "<br>"; if($num_columns <= -1) { echo error ("user"); exit; } else { $conn->execute("INSERT INTO Activity_Log (`Employee_ID`, `Date`, `Activity`, `Miles`) VALUES ('{$_POST['Employee_ID']}', '{$_POST['Date']}', '{$_POST['Activity']}', '{$_POST['Miles']}')"); header("Location: success.php?action=success"); } } } function error($error) { if($error == 'blank') { echo "Please fill in all the required fields before submitting"; } if($error == 'user') { echo "Please fill in the correct Employee ID"; } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.