Jump to content

Is this possible?


bCourtney07

Recommended Posts

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