Box for mysql query filter

SO I created a combination of research and results page which works very well.  In the database, I have a Boolean variable that determines if the record is active.  I want to include a check box on the search form that returns only active records.  A little hard.  Here is the code:

<? php require_once('Connections/testmypms.php');? >

<? PHP

$currentPage = $_SERVER ['PHP_SELF'];

$maxRows_demographics = 10;

$pageNum_demographics = 0;

If (isset($_GET['pageNum_demographics'])) {}

$pageNum_demographics = $_GET ['pageNum_demographics'];

}

$startRow_demographics = $pageNum_demographics * $maxRows_demographics;

$vardemid_demographics = '% ';

If (isset($_POST['schDemID'])) {}

$vardemid_demographics = (get_magic_quotes_gpc())? $_POST ['schDemID']: addslashes($_POST['schDemID']);

}

$vardemfirstname_demographics = '% ';

If (isset($_POST['schDemFirstname'])) {}

$vardemfirstname_demographics = (get_magic_quotes_gpc())? $_POST ['schDemFirstname']: addslashes($_POST['schDemFirstname']);

}

$vardemsurname_demographics = '% ';

If (isset($_POST['schDemSurname'])) {}

$vardemsurname_demographics = (get_magic_quotes_gpc())? $_POST ['schDemSurname']: addslashes($_POST['schDemSurname']);

}

$vardemactive_demographics = "1";

If (isset($_POST['schActive'])) {}

$vardemactive_demographics = (get_magic_quotes_gpc())? $_POST ['schActive']: addslashes($_POST['schActive']);

}

@mysql_select_db ($database_testmypms, $testmypms);

$query_demographics = sprintf ("SELECT demographics.px_id, demographics.firstname, demographics.surname, demographics.address1, demographics.address2, demographics.town, demographics.postcode, title.title, demographics.active FROM demographics, title demographics WHERE.") ("FK_title_id = title.title_id AND demographics.px_id AS ' %s %' AND demographics.firstname AS ' %s %% ' AND demographics.surname AS ' %s %' ORDER BY demographics.surname an AND demographics.active='%s, demographics.firstname ', $vardemid_demographics, $vardemfirstname_demographics, $vardemsurname_demographics, $vardema ctive_demographics);

$query_limit_demographics = sprintf ("%s LIMIT %d, %d", $query_demographics, $startRow_demographics, $maxRows_demographics);

$demographics = mysql_query ($query_limit_demographics, $testmypms) or die (mysql_error ());

$row_demographics = mysql_fetch_assoc ($demographics);

If (isset($_GET['totalRows_demographics'])) {}

$totalRows_demographics = $_GET ['totalRows_demographics'];

} else {}

$all_demographics = mysql_query ($query_demographics);

$totalRows_demographics = mysql_num_rows ($all_demographics);

}

$totalPages_demographics = ceil($totalRows_demographics/$maxRows_demographics)-1;

$queryString_demographics = "";

If (! empty($_SERVER['QUERY_STRING'])) {}

$params = explode ("&", $_SERVER ['QUERY_STRING']);

$newParams = array();

{foreach ($params as $param)

If (stristr ($param, "pageNum_demographics") == false & &)

stristr ($param, "totalRows_demographics") == false) {}

return ($newParams, $param);

}

}

If (count ($newParams)! = 0) {}

$queryString_demographics = '& '. htmlentities (implode ("&", $newParams));

}

}

$queryString_demographics = sprintf ("& totalRows_demographics = %d %s", $totalRows_demographics, $queryString_demographics);

? >

< ! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional / / IN" "http://www.w3.org/TR/html4/loose.dtd" > ""

< html >

< head >

< meta http-equiv = "Content-Type" content = text/html"; charset = iso-8859-1 ">"

< title > Search < /title >

< / head >

< body >

Search Patient < p > < /p >

< do action = "" method = "post" name = "schDem" id = "schDem" > "

< table border = "1" cellspacing = "1" cellpadding = "5" >

< b >

ID < td > < table >

< td > < input name = "schDemID" type = 'text' id = 'schDemID' > < table >

< td > < table >

< /tr >

< b >

FirstName < td > < table >

< td > < input name = "schDemFirstname" type = 'text' id = 'schDemFirstname' > < table >

< td > < table >

< /tr >

< b >

last name < td > < table >

< td > < input name = "schDemSurname" type = 'text' id = 'schDemSurname' > < table >

< td > assets show only

< input name = "schActive" type = "checkbox" id = "schActive" value = "0" checked > < table >

< /tr >

< b >

< td > < table >

< td > < input name = "Search" type = "submit" id = "Search" value = "Search" > < table >

< td > < table >

< /tr >

< /table >

< / make >

< p > < a href = "<?" PHP printf ("%s? (pageNum_demographics = %d %s", $currentPage, max (0, $pageNum_demographics - 1), $queryString_demographics);? > "> previous < /a > < a href =" <? PHP printf ("%s? (pageNum_demographics = %d %s", $currentPage, min ($totalPages_demographics, $pageNum_demographics + 1), $queryString_demographics);? > "> Next < /a > < /p >"

< table border = "1" >

< b >

px_id < td > < table >

title < td > < table >

FirstName < td > < table >

last name < td > < table >

address1 < td > < table >

address2 < td > < table >

< td > city < table >

< Td > < table > zip code

< /tr >

<? PHP {? >}

< b >

< td > < a href = "main.php? pxID = <?" PHP echo $row_demographics ["px_id"];? > "> <?" PHP echo $row_demographics ["px_id"];? > < /a > < table >

< td > <? PHP echo $row_demographics ['title'];? > < table >

< td > <? PHP echo $row_demographics ["FirstName"];? > < table >

< td > <? PHP echo $row_demographics ['name'];? > < table >

< td > <? PHP echo $row_demographics ['Address1'];? > < table >

< td > <? PHP echo $row_demographics ["address2"];? > < table >

< td > <? PHP echo $row_demographics ['city'];? > < table >

< td > <? PHP echo $row_demographics ['postal code'];? > < table >

< /tr >

<? PHP} while ($row_demographics = mysql_fetch_assoc ($demographics));? >

< /table >

< / body >

< / html >

<? PHP

mysql_free_result ($Demographics);

? >

Any suggestion would be great

Thank you

This is because your logic is reversed. You should show the default value of 0 (zero) and then a value of 1 if it is defined. Try this

$vardemactive_demographics = 0;

If (isset($_POST['schActive'])) {}

$vardemactive_demographics = 1;

}

Tags: Dreamweaver

Similar Questions

  • Storage from multiple tables in one MySQL query

    So I would like, with a single MySQL query, extract data from a table (say 15 rows of data) and then extract data from another table (lets say another 15 ranks) and who joined the first, so that I can view and paginate a single list (of 30 rows now).  I don't think that a join is what I'm looking for, because I want the second list should be annexed to the first and not mixed in.  I would just use different queries, but I already have the paging function implemented for a single set of records, and implementation with two (where the second begins when the first leaves) seems daunting. However, if you have any tips on one, they would really help.

    Thank you

    You need to use a UNION to join the two select statements. The number of columns and the data types of each selection must match.

  • Is there a waterproof box for the Apple Watch of 38mm?

    l'm looking for a reliable sealed subwoofer for my Apple Watch of 38mm. Everywhere I looked was up here only for the 42mm case. If anyone has any suggestions please let me know.

    Hello

    Sorry, but I'm not aware of any waterproof box for the 38mm Apple Watch.

  • Cannot type in any text box for a specific Web site

    Hello

    I have a site and I can't type anything whether in any textbox (search box, for example) when you use FireFox. I tried the site safe without the effect of loading Mode, I can not type anything.

    I've seen similar behavior, but it always seems to get it fixed by disabling modules while in my case is not.

    I checked out the site on Windows, Mac and Linux, in all, it's the same behavior if you are using FireFox. With all other browsers, the site is very good and I can type in these text boxes.

    Let me know if this has happened to someone else, I am trying to settle this problem because it's really annoying for readers.

    Thanks in advance!

    I see the same thing on this web page.

    It seems that some JavaScript on this page is not working properly and therefore does not select the input field or text box when you click it.


    I can achieve input field by pressing the Tab key until I get a slider, so you can use it as a workaround for now.

    You can contact the site and inform them that their site does not work in Firefox.

  • The small icons to the left of Web site names (for example the white boy 'f' in a blue box for Facebook) on my list of bookmarks disappeared for that I now only have the names themselves, making it more difficult to navigate.

    Normally, when I click on the bookmarks at the top of my screen, the list of Web sites that appears contains a small icon to the left of each bookmark. Now I get only a list. No icons. What happened to the little flag four colors for Hotmail, the 'f' in a blue box for facebook and all the rest? It is now much more difficult to navigate.

    https://support.Mozilla.org/en-us/questions/910682

    Thank you

  • OfficeJet 3830: dialog box for the scanner

    Just replaced an Officejet 6500 with an Officejet 3830.  The 6500 had a dialog box analysis from the top of the office, which showed levels of ink and scanner options.  The new 3830 seems not to have this.  Is there a way to get this dialog box for the the 3830?

    Hello

    Please install the software and driver from the CD that came with your printer to your computer.

    Kind regards.

  • Children through the box for Rise of Nations!

    Children through the box for the rise of the game of nations. Got a new computer and went to download the game from the disc and is now applying the security code... what > all solutions?

    Thank you, Russ

    You must contact the support of Rise of Nations / or whatever company you bought.

  • In the Internet properties and connections and the local network settings, I uncheck the box for a proxy server, but in a few moments, the computer checks the box

    In the Internet properties and connections and the local network settings, I uncheck the box for a proxy server (because it is blocking my access to Internet Explorer), but within moments, the computer checks the box. What can I do to stop the area of the check proxy server box?

    original title: LAN settings

    Have you checked for viruses?

    http://www.eset.com/us/online-scanner/

    It is very common that the virus to do.

  • The check box for "see windows contents while dragging", shoots himself

    The check box for "see windows contents while dragging", shoots himself.    Irritating!   Any ideas?

    Hi Mr_Sleeze,

    See if you can set a registry key verification:
    How to use Group Policy to configure auditing of Windows registry keys
    (The above article was written for Windows XP Home edition, but should work as well under Vista).

    DragFullWindows is the value you want to monitor.
    http://TechNet.Microsoft.com/en-us/library/cc787526.aspx Ramesh Srinivasan, Microsoft MVP [Windows Desktop Experience]

  • How or there is no model code keep update/sync the local database indexedDB for MySQL database online?

    How or there is no model code keep update/sync the local database indexedDB for MySQL database online?

    Unfortunately there is no direct connector for an application of WebWorks to a back-end database. You will need to do, is to have some middleware web server (Apache, Node.js, etc.) who manages a web service that you can make an HTTP request to and GET, POST, UPDATE, DELETE data. Middleware and then transmits commands to the back-end database and returns the results to the finished device.

  • Digital signature is required for the AVG filter driver, I had to disable AVG filter driver to connect to the internet.

    Hello

    Apparently, after the updates (don't know where exactly), a digital signature is required for the AVG filter driver. I had to uncheck AVG filter driver in network card to connect to the internet settings. Now the AVG firewall has stopped and the Windows Firewall is enabled.

    Does this mean that AVG is not compatible with the new updates?

    Hey Deiry,.

    Why don't disable you driver signing in Windows 7 and you would be able to use the AVG firewall. Take a look at the section of the Web site.
    See you soon!
  • How to make a box for error off my screen. Wrong e-mail address does not pass & I always get error days later

    How to make a box for error off my screen.  Wrong e-mail address does not pass & I always get error days later

    Hello

    Welcome to the Microsoft community. I appreciate your efforts to resolve the issue. I will certainly help you with the problem you are experiencing.

    The description of the problem seems a little unclear and I wish I had a better understanding before you start working on it. I would be grateful if you could help me with more information.

    • You use the Windows 8 Mail or any other email client?
    • When was the last time it was working fine?

    If you encounter problems with Windows Mail app, try the following steps.

    Step 1:

    Please go to the link below, download the file and run it.

    Run applications troubleshooting

    Download and run the troubleshooter modern UI App.

    http://download.Microsoft.com/download/F/2/4/F24D0C03-4181-4E5B-A23B-5C3A6B5974E3/apps.diagcab

    Step 2:

    I suggest to go through the link and follow the given procedure. Here is the link for your reference.
    Solving problems with a soft

    Hope this information was useful.

  • Two criteria in mind: one for af:query, second with bind var, both use same result table

    JDeveloper 12.1.2

    I have two display criteria, VC1 and VC2 are based both on the same VO. For example, let's say that I have used VO

    SELECT Employees.EMPLOYEE, Employees.EMPLOYEE_ID, Employees.FIRST_NAME, Employees.LAST_NAME, Employees.DEPARTMENT_ID

    Employees;

    Let this be VC1:

    SELECT * from (SELECT Employees.EMPLOYEE, Employees.EMPLOYEE_ID, Employees.FIRST_NAME, Employees.LAST_NAME, Employees.DEPARTMENT_ID

    EMPLOYEES employees ) QRSLT WHERE 1 = 2


    Used for af:query


    So let's say I have VC2 with bind variable


    SELECT * from (SELECT Employees.EMPLOYEE, Employees.EMPLOYEE_ID, Employees.FIRST_NAME, Employees.LAST_NAME, Employees.DEPARTMENT_ID

    EMPLOYEES employees ) QRSLT WHERE 1 = 2 AND ((UPPER (QRSLT. Department_id) = UPPER(:DeptIdBind))) )

    The user runs the af:query research and resulting table lists some employees. The last value of the column in the table of results, I did as links:

    < af:column headerText = 'Department' id = "c1" width = "140" >

    < af:link shortDesc = "#{bindings.myVO.hints.DepartmentId.tooltip}" id = "ot4" text = ' #{row. "" DepartmentId}'

    action = "#{backingBeanScope.MyBean.byDept}" partialTriggers =": t1" / >

    < / af:column >

    If the user now clicks on the link, I would expect the following:

    1. the values entered in the af: query to stay

    2. the table refreshes since the underlying VC2 is defined and executed VO. Here is the code VOImpl and backingbean

    The bean of support code

    public String byDept() {}

    Links DCBindingContainer = (DCBindingContainer) BindingContext.getCurrent () .getCurrentBindingsEntry ();

    DCIteratorBinding dcItteratorBindings = bindings.findIteratorBinding("EmployeesIterator");

    Line r = dcItteratorBindings.getCurrentRow ();

    Object keyvar = r.getAttribute ("DepartmentId");

    OperationBinding searchExp = ADFUtils.findOperation ("searchByDept");

    searchExp.getParamsMap () .put ("deptId", keyvar);

    searchExp.execute ();

    Returns a null value.

    }

    Impl VO

    {} public void searchByDepartment (String deptId)

    setDeptIdBind (deptId);

    executeQuery();

    }

    Problem:

    Query (VC2) runs but table does not reflect that. That is to say I don't see the list of employees of the selected Department

    Any idea?

    RPP = partial page request

    PPR refresh a component jsf

    AdfFacesContext.getCurrentInstance () .addPartialTarget (UIComponent);

    Where component is the component that you want to refresh.

    Have you checked that the query executed vc ID?

    Timo

  • Dialog boxes for the interface user uses the wrong font

    Don't know how to explain it.  Windows 7 x 64 bit with adobe reader 10.1.10.  It seems that the dialog box for example use a courier font.  Don't know what it is supposed to be using.  Forums suggest Segoe.  I went into regedit and here's what I see here, but when I go in c:\windows\fonts, I see only 5 fonts listed.  Microsoft has an update of symbol Segoe font but do not know if this is what I have to replace all of these missing fonts or if that's still the problem.  This isn't only the dialog box, this whole adobe reader has this particular font.  S Windows 7 fonts, however, are not at all this font and displays correctly anywhere else.  Any suggestions?

    Adobe Dialog Box.png

    Segoe.png

    Hi mo4ya2000,

    Try the latest Adobe Acrobat Reader DC Adobe - Adobe Acrobat Reader DC Distribution.

    Kind regards
    Nicos

  • PDFMaker, Options, create PDF/A-1 a in Word. Where can I change the setting so I did not check the box for each file, I create?

    PDFMaker, Options, create PDF/A-1 a in Word. Where can I change the setting so I did not check the box for each file, I create?

    Win OS: Windows 7

    Acrobat 9 Pro

    Hello

    You can do this to change the registry settings.

    Go to run type Regedit to open it.

    First make a backup of the registry.

    Here is how do.

    Go to HKEY_CURRENT_USER > software > Adobe > Acrobat > PDFMaker 9.0 > > Word > settings

    You need to change the DWORD values & chain listed below.

    Chain: JobOptions

    Value: PDFA1b 2005 RGB

    DWORD: PDFComplianceIndex

    Value: 1

    DWORD: PDFComplianceLevel

    Value: 1

    Close the registry editor

    Thank you

    Abhishek

Maybe you are looking for