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"; } } ?> Link to comment https://forums.phpfreaks.com/topic/76524-is-this-possible/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.