Jump to content

m2244

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by m2244

  1. Hello everyone, I am looking for a calendar plugin that can read from a DB and show that information on the calendar. This is a way to indicate to people which time slots and dates are available vs taken. Any help would be appreciated.
  2. I am not very good with PHP. I tried to cast as a string but I can't seem to get it.
  3. So, I am trying to build a SQL query dynamically from user input. The mysql_real_escape_string seems to be the problem. When I reun this I get the 'No fields entered' echo message. Can someone help me understand what's wrong here? $FName = $_POST['fname']; $LName = $_POST['lname']; $Email = $_POST['email']; $Organization = $_POST['organization']; $Supervisor = $_POST['supervisor']; $SuperEmail = $_POST['superemail']; //$Class = $_POST['courseID']; //$PGrade = $_POST['gs']; //$OccSeries = $_POST['occseries']; //$MilGrade = $_POST['milgrade']; //$MilSpec = $_POST['milspec']; $MajCom = $_POST['majcom']; //$LName = "FILLER"; echo "Here you are: " . $LName . "<br />" . $FName . "<br />"; //$tsql = "select ID,CourseID,lastname,firstname,email,paygrade,organization,supervisor,superemail,milgrade,milspec,majcom from Registrations"; // List of possible form fields. (The "name" attributes of the <input> elements.) $expectedKeys = array($LName, $FName, $Email, $Organization, $Supervisor, $SuperEmail, $MajCom); // A list to be populated with the "key=value" pairs you want in your WHERE clause. $fields = array(); // Loop through the keys and add the field to the list if needed. foreach ($expectedKeys as $key) { if (!empty($_POST[$key])) { $fields[] = sprintf("`%s` = '%s'", $key, mysql_real_escape_string($_POST[$key])); } } // Make sure there were actually some fields you can use. if (count($fields) > 0) { // Construct the WHERE clause by gluing the fields together with a " AND " separator. $whereClause = "WHERE " . implode(" AND ", $fields); // And then create the SQL query itself. $sql = "select ID,CourseID,lastname,firstname,email,paygrade,organization,supervisor,superemail,milgrade,milspec,majcom from Registrations " . $whereClause; echo $sql; } else { echo "No fields entered!"; }
  4. Hello, I am trying to make a web based application in which a user (internal office tool only) can query one of two databases. I have heard about some sort of PHP 'controls' which might help with things like querying a DB when the form fields are empty. In other words I am providing some text input fields like 'lastname', 'e-mail', etc and I want the user to be able to enter info into as many or as few of the fields as they wish, without messing up the query. I believe these controls have some handy tools like 'Exact Phrase' radio buttons, etc. Can anyone point me in a direction with this?
  5. Thanks for the help. this helps. The thing is that I need to populate another drop down based on the user's first selection. I guess this is the real challenge for me.
  6. Well, when a user here in the office (internal use only) hits this page they will need to select, from a drop down menu, one of two choices. These choices correspond to one of two databases. So they make this choice, enter some other information or not and hit a 'Search' button, this will show them the matching data from the correct database.
  7. Hello, I am trying to create a web based tool for use around the office. What this needs to do is present a drop down menu with, at this time, 2 choices. The choice selected determines the proper database to query. I am not sure how to do this at all. Not sure if I need to use JS (which I use a lot) or AJAX (which I am not familiar with). Can anyone get me going in a direction here?
×
×
  • 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.