php - Finding query in substring instead of full text -


I created a search function. It can get the address from the whole lesson, but how can I create query search from parts of the address? For example, the complete address is Paya lebar Road Blk27 , how can I do this so that the user can simply type in paya and it will still be visible?

SearchForm

  & lt; H2 & gt; See Patient Records & lt; / H2 & gt; & Lt; Body & gt; & Lt; Form action = "display_patient.php" method = "post" & gt; & Lt; P & gt; Choose: & lt; Select name = "patient_war" & gt; & Lt ;? Php $ value = array (see_now, name, address); Forex Currency ($ value $ option) {echo '& lt; Option value = "'. $ Option.' '' (Issued ($ _ POST ['Patient' '']) and $ _POST ['Patient' '] == $ Option?' Selected ':' ''). ' & Gt; ' . $ Option '& lt; / option & gt;';}? & Gt; & lt; / select & gt; & lt; input type = "text" name = "typed" value = "" /> ; & Lt; Input Type = "submit" value = "submit" />   <<> & lt ;? php if (Isset ($ _ POST ['disease_use'])) {$ type = $ _POST ['typed']; select $ $ = $ _POST ['patient' '']; if ($ Select == 'View_all' ) {Resonant "& lt; Table range = '1' & gt; "echo" & lt; Tr & gt; \ N "; echo" & lt; Th> id & lt; / Th & gt; \ N "; echo" & lt; Th & gt; Patient's name & lt; / Th & gt; \ N "; echo" & lt; Th & gt; Age & lt; / Th & gt; \ N "; echo" & lt; Th & gt; NRIC & lt; / Th & gt; \ N "; echo" & lt; Th & gt; Date of birth & lt; / Th & gt; \ N "; echo" & lt; Th & gt; Medical allergy & lt; / Th & gt; \ N "; echo" & lt; Th & gt; Medical History & lt; / Th & gt; \ N "; echo" & lt; Th & gt; Phone & lt; / Th & gt; \ N "; echo" & lt; Th & gt; Address & lt; / Th & gt; \ N "; echo & quot; and & gt; doctor assigned & lt; / th & gt; \ n"; Echo "& lt; / tr & gt;"; $ Pat_set = default_impressions (); While ($ mo = mysqli_fetch_array ($ pat_set)) {echo "<<"; Echo "& lt; td & gt;" . $ Mo ['id'] "& lt; / td & gt;"; Echo "& lt; td & gt;" $ Mo ['name'] "& lt; / td & gt;"; Echo "& lt; td & gt;" $ Mo ['age'] "& lt; / td & gt;"; Echo "& lt; td & gt;" $ Mo ['enric'] "& lt; / td & gt;"; Echo "& lt; td & gt;" $ Mo ['birthday'] "& lt; / td & gt;"; Echo "& lt; td & gt;" $ Mo ['medical_alleries'] "& lt; / td & gt;"; Echo "& lt; td & gt;" $ Mo ['medical_history'] "& lt; / td & gt;"; Echo "& lt; td & gt;" $ Mo ['phone'] "& lt; / td & gt;"; Echo "& lt; td & gt;" $ Mo ['address']. "& Lt; / td>"; Echo "& lt; td & gt;" $ Mo ['doctor_said'] "& lt; / td & gt;"; Echo "& lt; / tr & gt;"; }} Else {echo "and lieutenant table = '1' & gt; \ n"; Echo "& lt; tr & gt; \ n"; Echo "& lt; th> id  \ n"; Echo "& lt; th & gt; Patient's name & lt; / th & gt; \ n"; Echo " Age  \ n"; Echo "& lt; th & gt; NRIC & lt; / th & gt; \ n"; Echo " gt; date of birth & lt; / th & gt; \ n"; Echo "& lt; th & gt; Medical allergy & lt; / th & gt; \ n"; Echo "& lt; th & gt; Medical History & lt; / th & gt; \ n"; Echo "& lt; th> phone & lt; / th & gt; \ n"; Echo "& lt; th & gt; Address & lt; / th & gt; \ n"; Echo & quot; By & gt; The doctor was assigned & lt; / Th & gt; \ N "; echo" & lt; / Tr & gt; "; $ Patients_set = find_patients ($ choose, $ type); while ($ row = mysqli_fetch_array ($ patient_set)) {echo"  "$ line ['name']" & lt; / TD & gt; "; echo" & lt; Td> "$ line ['age']" & lt; / TD & gt; "; echo" & lt; Td> "$ line ['encryic']" & lt; / TD & gt; "; echo" & lt; Td> "$ line ['birthday']" & lt; / TD & gt; "; echo" & lt; Td> "$ line ['medical_allergies']" & lt; / TD & gt; "; echo" & lt; Td> "$ line ['medical_history']" & lt; / TD & gt; "; echo" & lt; Td> "$ line ['phone']" & lt; / TD & gt; "; echo" & lt; Td> "$ line ['address']." & Lt; / Td> "; echo" & lt; Td> "$ line [doctor-specific ']" & lt; / TD & gt; "; echo" & lt;    
Post-text "itemprop =" text ">

To search in MySQL, whether a column specific string is used

example

  SELECT * to the table WHERE Just like it in the column '% somestring%';   

Just try it in your case

  $ typed = $ _POST ['typed'];   

and do a MySQL query like this

  $ query = "Select * From the table where address '%". $ Typed. "%'"; < / Code>   

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -