MySQL Unknown column in where clause error #1054 - mysql

SELECT oNum AS orderNumber,
cBillState AS Province
FROM orders
WHERE oNum IN ( '1482775424-189',
‘1482776094-127’,
‘1477536593-991’,
‘1479730802-590’,
‘1479920877-558’,
‘1479096422-217’,
‘1474903184-228’,
‘1477957959-648’,
‘1479275004-578’,
‘1480541117-247’,
‘1477092301-713’,
‘1477312082-716’,
‘1477398916-226’,
‘1477403920-962’,
‘1477413634-609’,
‘1477930535-606’,
‘1477955076-686’,
‘1478135196-101’,
‘1478276590-532’,
‘1478844924-162’,
‘1479359912-609’,
‘1479622476-128’,
‘1479623938-210’,
‘1479906995-505’,
‘1480054418-376’,
‘1480111928-502’,
‘1480125336-888’,
‘1480301567-671’,
‘1480365466-580’,
‘1480894281-609’,
‘1480949109-398’,
‘1479601155-364’,
‘1474307070-332’,
‘1480087806-183’,
‘1482787698-750’,
‘1469897352-353’,
‘1473537581-471’,
‘1473687519-991’,
‘1475351809-812’,
‘1476142232-535’,
‘1478902709-989’,
‘1482417573-419’,
‘1477361844-758’,
‘1480100297-559’,
‘1480994046-164’,
‘1478300763-269’,
‘1480056585-606’,
‘1480074372-121’,
‘1480380512-849’,
‘1480405548-219’,
‘1480945372-748’,
‘1480959346-958’,
‘1480979054-867’,
‘1480980513-214’,
‘1481068320-986’,
‘1481076087-716’,
‘1481305524-603’,
‘1481480028-875’,
‘1481733768-915’,
‘1480087091-948’,
‘1480439466-561’,
‘1482763826-493’,
‘1482905975-834’,
‘1486316457-550’,
‘1480018760-249’,
‘1479928546-617’,
‘1483471273-517’,
‘1484169298-747’,
‘1484190999-915’,
‘1477317500-446’,
‘1477971665-384’,
‘1478569145-467’,
‘1481561486-205’,
‘1481689248-289’,
‘1481689989-374’,
‘1482282006-867’,
‘1482425612-195’,
‘1482676243-627’,
‘1483240226-156’,
‘1483460319-161’,
‘1483465666-256’,
‘1486316720-332’,
‘1478731802-207’,
‘1482277678-164’,
‘1483984301-786’,
‘1483992584-520’,
‘1484020909-291’,
‘1480727936-335’,
‘1486869590-934’,
‘1483982035-667’,
‘1484018163-438’,
‘1484150283-139’,
‘1487613741-802’,
‘1483970473-109’,
‘1483974079-586’,
‘1483975971-790’,
‘1483978751-271’,
‘1483979075-338’,
‘1483983445-537’,
‘1483986171-592’,
‘1483986950-713’,
‘1483988578-641’,
‘1484019809-263’,
‘1484151424-647’,
‘1484171587-685’,
‘1484346681-146’,
‘1484509930-508’,
‘1484527687-400’,
‘1484757246-834’,
‘1486260387-326’,
‘1485277917-300’,
‘1487089945-259’,
‘1487300427-391’,
‘1487698559-786’,
‘1484418776-342’,
‘1480321037-286’,
‘1484262618-505’,
‘1484284655-434’,
‘1484447124-365’,
‘1482762650-132’,
‘1482851934-153’,
‘1482867677-237’,
‘1482956401-918’,
‘1484240287-695’,
‘1484445267-706’,
‘1484561817-854’,
‘1485565268-372’,
‘1487424684-789’,
‘1487467448-150’,
‘1488060650-455’,
‘1488066992-331’,
‘1488149236-354’,
‘1484063475-593’,
‘1484157094-588’,
‘1484859843-314’,
‘1485545522-819’,
‘1486516436-973’,
‘1486964775-771’,
‘1483145436-669’,
‘1483391592-704’,
‘1483502985-747’,
‘1483983727-219’,
‘1484023314-852’,
‘1484081233-200’,
‘1484322973-466’,
‘1484342291-447’,
‘1484406059-583’,
‘1484411015-328’,
‘1484425064-479’,
‘1484452295-582’,
‘1484515700-540’,
‘1484627708-335’,
‘1484632746-862’,
‘1485052037-249’,
‘1485128964-286’,
‘1485190492-888’,
‘1485195733-900’,
‘1485202785-384’,
‘1485216462-233’,
‘1485222790-976’,
‘1485357911-246’,
‘1485459961-895’,
‘1485483263-818’,
‘1485542911-608’,
‘1485568582-415’,
‘1485630460-879’,
‘1481134322-151’,
‘1484703008-980’,
‘1485846056-687’,
‘1484025532-550’,
‘1484066421-733’,
‘1484077460-592’,
‘1484149227-959’,
‘1484162618-303’,
‘1484420681-353’,
‘1484665197-540’,
‘1484755505-933’,
‘1484848858-607’,
‘1485217578-110’,
‘1485316847-965’,
‘1485567177-164’,
‘1485635160-954’,
‘1485713147-552’,
‘1485727727-861’,
‘1485868390-528’,
‘1485978054-311’,
‘1485995204-154’,
‘1486050211-126’,
‘1486232357-429’,
‘1483563899-665’,
‘1484482619-909’,
‘1487036669-169’,
‘1487531819-670’,
‘1489680045-522’,
‘1487607030-673’,
‘1487792756-848’,
‘1489592492-867’,
‘1485976581-271’,
‘1489762699-587’,
‘1489823936-264’,
‘1486680384-909’,
‘1490636775-210’);

Please try the following...
SELECT oNum AS orderNumber,
cBillState AS Province
FROM orders
WHERE oNum IN ( '1482775424-189',
'1482776094-127',
'1477536593-991',
'1479730802-590',
'1479920877-558',
'1479096422-217',
'1474903184-228',
'1477957959-648',
'1479275004-578',
'1480541117-247',
'1477092301-713',
'1477312082-716',
'1477398916-226',
'1477403920-962',
'1477413634-609',
'1477930535-606',
'1477955076-686',
'1478135196-101',
'1478276590-532',
'1478844924-162',
'1479359912-609',
'1479622476-128',
'1479623938-210',
'1479906995-505',
'1480054418-376',
'1480111928-502',
'1480125336-888',
'1480301567-671',
'1480365466-580',
'1480894281-609',
'1480949109-398',
'1479601155-364',
'1474307070-332',
'1480087806-183',
'1482787698-750',
'1469897352-353',
'1473537581-471',
'1473687519-991',
'1475351809-812',
'1476142232-535',
'1478902709-989',
'1482417573-419',
'1477361844-758',
'1480100297-559',
'1480994046-164',
'1478300763-269',
'1480056585-606',
'1480074372-121',
'1480380512-849',
'1480405548-219',
'1480945372-748',
'1480959346-958',
'1480979054-867',
'1480980513-214',
'1481068320-986',
'1481076087-716',
'1481305524-603',
'1481480028-875',
'1481733768-915',
'1480087091-948',
'1480439466-561',
'1482763826-493',
'1482905975-834',
'1486316457-550',
'1480018760-249',
'1479928546-617',
'1483471273-517',
'1484169298-747',
'1484190999-915',
'1477317500-446',
'1477971665-384',
'1478569145-467',
'1481561486-205',
'1481689248-289',
'1481689989-374',
'1482282006-867',
'1482425612-195',
'1482676243-627',
'1483240226-156',
'1483460319-161',
'1483465666-256',
'1486316720-332',
'1478731802-207',
'1482277678-164',
'1483984301-786',
'1483992584-520',
'1484020909-291',
'1480727936-335',
'1486869590-934',
'1483982035-667',
'1484018163-438',
'1484150283-139',
'1487613741-802',
'1483970473-109',
'1483974079-586',
'1483975971-790',
'1483978751-271',
'1483979075-338',
'1483983445-537',
'1483986171-592',
'1483986950-713',
'1483988578-641',
'1484019809-263',
'1484151424-647',
'1484171587-685',
'1484346681-146',
'1484509930-508',
'1484527687-400',
'1484757246-834',
'1486260387-326',
'1485277917-300',
'1487089945-259',
'1487300427-391',
'1487698559-786',
'1484418776-342',
'1480321037-286',
'1484262618-505',
'1484284655-434',
'1484447124-365',
'1482762650-132',
'1482851934-153',
'1482867677-237',
'1482956401-918',
'1484240287-695',
'1484445267-706',
'1484561817-854',
'1485565268-372',
'1487424684-789',
'1487467448-150',
'1488060650-455',
'1488066992-331',
'1488149236-354',
'1484063475-593',
'1484157094-588',
'1484859843-314',
'1485545522-819',
'1486516436-973',
'1486964775-771',
'1483145436-669',
'1483391592-704',
'1483502985-747',
'1483983727-219',
'1484023314-852',
'1484081233-200',
'1484322973-466',
'1484342291-447',
'1484406059-583',
'1484411015-328',
'1484425064-479',
'1484452295-582',
'1484515700-540',
'1484627708-335',
'1484632746-862',
'1485052037-249',
'1485128964-286',
'1485190492-888',
'1485195733-900',
'1485202785-384',
'1485216462-233',
'1485222790-976',
'1485357911-246',
'1485459961-895',
'1485483263-818',
'1485542911-608',
'1485568582-415',
'1485630460-879',
'1481134322-151',
'1484703008-980',
'1485846056-687',
'1484025532-550',
'1484066421-733',
'1484077460-592',
'1484149227-959',
'1484162618-303',
'1484420681-353',
'1484665197-540',
'1484755505-933',
'1484848858-607',
'1485217578-110',
'1485316847-965',
'1485567177-164',
'1485635160-954',
'1485713147-552',
'1485727727-861',
'1485868390-528',
'1485978054-311',
'1485995204-154',
'1486050211-126',
'1486232357-429',
'1483563899-665',
'1484482619-909',
'1487036669-169',
'1487531819-670',
'1489680045-522',
'1487607030-673',
'1487792756-848',
'1489592492-867',
'1485976581-271',
'1489762699-587',
'1489823936-264',
'1486680384-909',
'1490636775-210');
To fix your problem I simply used global search-and-replace's to replace all occurrences of ‘ and ’ with '.
This is a common error in programming. Some versions of SQL, and other languages, allow "other" single-quotes to be used in the same context as ', but as a rule you should avoid them unless you have a specific reason to use them and know that you can in that environment.
If you have any questions or comments, then please feel free to post a Comment accordingly.

After the first value in your 'In' clause, you are using the character ‘ rather than '.

Related

Mysql ST_Contains return wrong result

I am using St_contains to find whether a point is in polygon, but the result seems to be inaccurate. If a point is not in the polygon, St_contains will still return 1.
here is my code
SET #i = ST_GeomFromText
(
'POLYGON((43.120825901794 -79.804519106556,43.121675995356 -79.808262109949,43.122060291437 -79.809953891553,43.122354803231 -79.811250508027,43.122502706668 -79.811978610103,43.122504906903 -79.811986283924,43.122508088955 -79.811996589915,43.122511303346 -79.812006400094,43.122515398461 -79.812018485988,43.122519502329 -79.812029908205,43.122524189401 -79.812042396061,43.122529607259 -79.812055910908,43.122534497156 -79.812067301339,43.122539412616 -79.812078511034,43.122544813239 -79.812089906984,43.122551308513 -79.812103104857,43.122556500525 -79.812113197823,43.122556947646 -79.81211402064,43.122561101914 -79.81212180938,43.122567611947 -79.812133297692,43.12257380731 -79.812143998195,43.122581413338 -79.812156209043,43.122588306761 -79.812166796322,43.122597209243 -79.812179886041,43.122606608303 -79.812192880573,43.122615299471 -79.812204285086,43.122624697158 -79.812215817893,43.122632697612 -79.812225210299,43.122640110139 -79.812233503458,43.122647597468 -79.812241602988,43.122654393768 -79.812248595486,43.122657689796 -79.81225190959,43.122665191582 -79.812259204694,43.122669705582 -79.812263383434,43.122673696679 -79.812267107346,43.122678788478 -79.812271587283,43.122683499255 -79.812275714497,43.122688998725 -79.812280192156,43.122693910958 -79.812284301463,43.122704110012 -79.812292282669,43.122706800281 -79.812294188955,43.122715799598 -79.812300708994,43.122730907194 -79.812312591598,43.122740295329 -79.812321516184,43.122746889145 -79.812328700988,43.122754011258 -79.812337105016,43.122760200793 -79.812345405227,43.122766789948 -79.812355097555,43.12277320192 -79.81236570656,43.12277941111 -79.812377413051,43.122783094344 -79.812385116304,43.122788695772 -79.812398304727,43.122793496059 -79.812411598466,43.122796593147 -79.812421300181,43.122799710508 -79.812432597886,43.122802193416 -79.812443191512,43.122803993055 -79.812452188659,43.122805891151 -79.812463701229,43.122806890277 -79.81247099346,43.122808511891 -79.812488705099,43.122809106538 -79.812503100133,43.122809109847 -79.812515282914,43.122808503102 -79.81253020137,43.122807204003 -79.812545092356,43.122805708405 -79.812556588469,43.122803493502 -79.812569317318,43.122800909017 -79.812581411864,43.122799110463 -79.812588392426,43.122797795926 -79.812593192326,43.122789308453 -79.812618807415,43.122785206163 -79.812630081095,43.122779307318 -79.812647986598,43.122773098226 -79.812668584165,43.122767591602 -79.812690007256,43.122761402516 -79.812718188204,43.12275719202 -79.812741395308,43.122753597693 -79.812765903096,43.122750802611 -79.812793195292,43.122750127663 -79.812802910099,43.122748997299 -79.812819183992,43.122748294917 -79.81283959272,43.12274821248 -79.812861510037,43.122748690312 -79.812882514783,43.122750411098 -79.81291109605,43.122752695783 -79.812933890352,43.122755301773 -79.812954616298,43.122758590734 -79.812975302669,43.122763193312 -79.812998986918,43.12276340289 -79.813000115557,43.122763695683 -79.813001292097,43.122763890121 -79.81300249433,43.122764303539 -79.81300489243,43.122764692381 -79.813007296966,43.122764989888 -79.813008507055,43.122765208902 -79.813009702853,43.122765792147 -79.813013309692,43.122766294518 -79.813015614871,43.122766513532 -79.813016810669,43.122766707928 -79.813018012913,43.122766902374 -79.813019215204,43.122767286494 -79.813021586131,43.122767608576 -79.813022789786,43.122767803022 -79.813023992078,43.122767997417 -79.813025194322,43.122768191856 -79.813026396555,43.122768694226 -79.813028701735,43.122768888629 -79.813029904037,43.122769107643 -79.813031099835,43.122769690888 -79.813034706674,43.122770013004 -79.81303591026,43.122770207408 -79.813037112563,43.122770401846 -79.813038314796,43.122770596249 -79.813039517099,43.122770790644 -79.813040719343,43.122771093897 -79.81304178867,43.1227712883 -79.813042990973,43.122771507314 -79.813044186771,43.12277170176 -79.813045389063,43.122771896155 -79.813046591307,43.122772193661 -79.813047801397,43.122772388099 -79.813049003631,43.12277260712 -79.813050199487,43.122772801515 -79.813051401732,43.122772995918 -79.813052604035,43.122773303885 -79.813053706912,43.122773498288 -79.813054909215,43.122774106142 -79.81305850955,43.122774398926 -79.813059686031,43.122774593372 -79.813060888323,43.122775201183 -79.813064488669,43.122775498731 -79.813065698749,43.12277589799 -79.813067996083,43.122776092393 -79.813069198386,43.122776389898 -79.813070408477,43.122776608911 -79.813071604275,43.122777192189 -79.813075211045,43.122777509557 -79.813076381151,43.122777703994 -79.813077583384,43.122778107974 -79.813079914327,43.122778400766 -79.813081090868,43.12277859516 -79.813082293113,43.122778789606 -79.813083495405,43.122779008619 -79.813084691203,43.122779203013 -79.813085893448,43.122779500519 -79.813087103539,43.122779694964 -79.813088305831,43.122779899828 -79.813089400921,43.122780094222 -79.813090603166,43.122780391727 -79.813091813256,43.122780610749 -79.813093009114,43.12278099958 -79.813095413592,43.122781292372 -79.813096590133,43.122781486766 -79.813097792378,43.122781705787 -79.813098988235,43.122781900224 -79.813100190469,43.122782208155 -79.813101293416,43.122782402593 -79.81310249565,43.122782791432 -79.813104900187,43.122783088937 -79.813106110278,43.12278330795 -79.813107306076,43.122783696746 -79.813109710625,43.12278398958 -79.813110887155,43.122784199114 -79.813112015806,43.122784612572 -79.813114413897,43.122784905355 -79.81311559038,43.122785488597 -79.813119197221,43.12278581072 -79.813120400866,43.122785990965 -79.813121502402,43.122786209977 -79.813122698201,43.122786404379 -79.813123900505,43.122786701919 -79.813125110526,43.122787309735 -79.813128710933,43.122787602518 -79.813129887415,43.122788001826 -79.813132184798,43.122788299331 -79.813133394889,43.122788907182 -79.813136995226,43.122789204686 -79.813138205317,43.12278939908 -79.813139407563,43.122789593525 -79.813140609855,43.122789901447 -79.813141712744,43.122790095892 -79.813142915037,43.122790509298 -79.813145313081,43.122790802089 -79.813146489623,43.122790996482 -79.813147691868,43.122791190927 -79.813148894161,43.122791488432 -79.813150104252,43.122791887688 -79.813152401588,43.122792106708 -79.813153597446,43.122792404204 -79.813154807479,43.122792598649 -79.813156009771,43.122792793042 -79.813157212017,43.122793085833 -79.813158388558,43.122793304845 -79.813159584358,43.122793704109 -79.813161881752,43.122794001657 -79.813163091833,43.122794390443 -79.813165496324,43.122794712566 -79.813166699969,43.122794906968 -79.813167902273,43.122795101404 -79.813169104507,43.122795409334 -79.813170207455,43.122795603771 -79.81317140969,43.122795798172 -79.813172611994,43.122795992608 -79.813173814228,43.122796309966 -79.813174984276,43.122796698803 -79.813177388815,43.122796996308 -79.813178598907,43.12279720117 -79.813179693997,43.122797395614 -79.81318089629,43.122797693118 -79.813182106382,43.12279791213 -79.813183302181,43.122798106523 -79.813184504427,43.122798404027 -79.813185714519,43.122798803291 -79.813188011914,43.122799096116 -79.813189188386,43.122799290517 -79.81319039069,43.122799509528 -79.81319158649,43.122799807032 -79.813192796582,43.122800400731 -79.813196296212,43.122800698235 -79.813197506304,43.122800892628 -79.813198708549,43.122801111648 -79.813199904408,43.122801409152 -79.8132011145,43.122801598874 -79.813202283184,43.122801793266 -79.81320348543,43.122802101239 -79.813204588367,43.122802295632 -79.813205790613,43.122802490068 -79.813206992848,43.122802812147 -79.813208196505,43.122803006591 -79.813209398798,43.122803200984 -79.813210601044,43.122803498487 -79.813211811136,43.122803703349 -79.813212906227,43.122804000853 -79.813214116319,43.122804195289 -79.813215318554,43.122804409543 -79.813216480815,43.12280470709 -79.813217690896,43.122804901491 -79.813218893201,43.122805095883 -79.813220095447,43.122805403856 -79.813221198384,43.122805598248 -79.81322240063,43.122805792692 -79.813223602923,43.122806090187 -79.813224812957,43.122806503599 -79.813227211061,43.122806796389 -79.813228387604,43.122807001251 -79.813229482695,43.122807195686 -79.81323068493,43.122807493189 -79.813231895022,43.122807906601 -79.813234293127,43.122808204104 -79.813235503219,43.12280839854 -79.813236705454,43.122808706469 -79.813237808403,43.122808900905 -79.813239010638,43.122809095305 -79.813240212943,43.122809388086 -79.813241389426,43.122809607105 -79.813242585285,43.122809801541 -79.81324378752,43.12281010947 -79.813244890469,43.122810303905 -79.813246092704,43.122810601409 -79.813247302796,43.122810990244 -79.813249707336,43.122811312323 -79.813250910994,43.122811506758 -79.813252113229,43.122811711576 -79.813253208332,43.122812004409 -79.813254384863,43.122812198801 -79.813255587109,43.122812496304 -79.813256797202,43.122812909715 -79.813259195307,43.122813193103 -79.813260304621,43.122813412079 -79.813261500491,43.122813606514 -79.813262702726,43.122813904017 -79.813263912819,43.122814098409 -79.813265115065,43.122814391241 -79.813266291597,43.122814790494 -79.813268588935,43.122815087997 -79.813269799028,43.122815307016 -79.813270994887,43.122815604519 -79.813272204979,43.122816003772 -79.813274502317,43.122816301274 -79.81327571241,43.122816690109 -79.813278116951,43.122817007509 -79.813279286989,43.122817201909 -79.813280489294,43.122817509872 -79.813281592173,43.122817704272 -79.813282794479,43.122818001775 -79.813284004572,43.122818390601 -79.813286409054,43.122818712723 -79.8132876127,43.122818892965 -79.813288714238,43.122819210372 -79.813289884335,43.122819599207 -79.813292288876,43.122819896709 -79.813293498969,43.122820091101 -79.813294701216,43.122820399073 -79.813295804154,43.122820812474 -79.813298202201,43.122821109977 -79.813299412294,43.12282130442 -79.813300614588,43.1228215972 -79.813301791073,43.122821802061 -79.813302886165,43.12282199646 -79.81330408847,43.122822293963 -79.813305298563,43.122822488397 -79.813306500799,43.122822810475 -79.813307704457,43.12282300491 -79.813308906693,43.122823312838 -79.813310009642,43.122823701672 -79.813312414183,43.122823994452 -79.813313590668,43.122824188895 -79.813314792962,43.122824510965 -79.813315996562,43.122824691258 -79.813317098148,43.122824988752 -79.813318308182,43.122825402161 -79.813320706289,43.122825699663 -79.813321916382,43.122825904524 -79.813323011474,43.122826197312 -79.813324188017,43.122826391746 -79.813325390253,43.122826689248 -79.813326600347,43.122826908258 -79.813327796147,43.12282720576 -79.813329006241,43.122827410621 -79.813330101333,43.12282760502 -79.813331303639,43.122827902522 -79.813332513732,43.122828096956 -79.813333715968,43.122828389744 -79.813334892512,43.122828594604 -79.813335987604,43.122828892106 -79.813337197697,43.122829111116 -79.813338393498,43.122829408618 -79.813339603592,43.122829603009 -79.813340805839,43.122829797451 -79.813342008134,43.122830105371 -79.813343111025,43.122830299813 -79.813344313319,43.122830592593 -79.813345489804,43.122830786992 -79.81334669211,43.122831109104 -79.813347895699,43.122831289354 -79.813348997296,43.122831611466 -79.813350200885,43.122831805865 -79.813351403191,43.122832103367 -79.813352613285,43.122832297801 -79.813353815521,43.122832502661 -79.813354910613,43.122832795449 -79.813356087157,43.122832989839 -79.813357289404,43.122833287341 -79.813358499498,43.12283350635 -79.813359695299,43.122833789703 -79.813360804684,43.122834008712 -79.813362000485,43.122834306214 -79.813363210579,43.122834500656 -79.813364412874,43.122834793435 -79.813365589359,43.122834987834 -79.813366791665,43.122835295797 -79.813367894546,43.122835490195 -79.813369096852,43.122835812307 -79.813370300441,43.122836006706 -79.813371502747,43.122836509067 -79.813373807933,43.12283680189 -79.813374984407,43.122837190679 -79.813377388961,43.12283769304 -79.813379694148,43.122837990585 -79.81338090423,43.122838209551 -79.813382100043,43.122838701493 -79.813384512432,43.122839004742 -79.813385581763,43.122839199133 -79.81338678401,43.122839496634 -79.813387994104,43.122839691075 -79.813389196399,43.122839988568 -79.813390406435,43.122840193436 -79.813391501586,43.122840490929 -79.813392711622,43.122841002725 -79.813395083968,43.122841197124 -79.813396286274,43.122841505086 -79.813397389155,43.122841699485 -79.813398591461,43.122841996986 -79.813399801555,43.122842191419 -79.813401003792,43.122842513495 -79.813402207451,43.122842693779 -79.813403308979,43.12284299128 -79.813404519073,43.122843205575 -79.813405681325,43.122843503076 -79.813406891419,43.122843707936 -79.813407986512,43.122844005437 -79.813409196606,43.122844199827 -79.813410398854,43.122844497328 -79.813411608949,43.12284469176 -79.813412811185,43.122844999688 -79.813413914136,43.122845194121 -79.813415116373,43.122845486908 -79.813416292917,43.122845809028 -79.813417496565,43.122846003417 -79.813418698813,43.122846311388 -79.813419801753,43.122846997711 -79.813423416332,43.122847290498 -79.813424592877,43.12292490524 -79.813778482048,43.123728589986 -79.817340495521,43.123819001797 -79.817730797992,43.125562096479 -79.82526180161,43.126352290224 -79.828680091806,43.126371493927 -79.828764987565,43.127407795926 -79.833244795444,43.129189298146 -79.841079299819,43.129566009762 -79.842707403722,43.128570609264 -79.843119504623,43.127118002929 -79.843724698354,43.126588898469 -79.843943683782,43.119640788552 -79.846975508053,43.116269602609 -79.848427805095,43.115463209268 -79.848823994691,43.113553793286 -79.849683312169,43.113553715867 -79.849683123551,43.111654261814 -79.841693177344,43.111654208955 -79.841692982329,43.110268846789 -79.835610897079,43.110268793917 -79.835610702076,43.109590047052 -79.832624887046,43.109589994225 -79.832624692097,43.108344757178 -79.827081207958,43.108344704287 -79.827081012972,43.107372852097 -79.822761396678,43.107372799197 -79.822761201701,43.106127695209 -79.817279292439,43.104760196603 -79.811320584182,43.106392005228 -79.810637687702,43.111636709371 -79.808422109977,43.114581813649 -79.80715971253,43.117057714176 -79.80609846923,43.117463786158 -79.805924387244,43.118438988571 -79.805514488995,43.12053000068 -79.804635487977,43.120825901794 -79.804519106556))',
4326
);
set #j = ST_GeomFromText('Point(43.6645419 -79.8133914)', 4326);
SELECT ST_Contains(#i, #j)
MySQL Online compiler
and here is the map, which shows the position of point and polygon
polygon & point position in map
I have been searching for a long time and still don't know where the problem is. Please help me to check it out. Thank you in advance.

Unexpected geometry from ST_Buffer

I am trying to buffer a handful of geometries and then run the same buffer as a negative. But am getting unexpected artifacts in the responding geometries.
Running a positive buffer (original geom is orange):
Running a positive and negative buffer (original geom is orange):
I can produce slightly better geometries by running the first buffer with side=left join-mitre but it's still not perfect and the geometry from the second buffer is messed up as a result.
SELECT st_buffer(st_geomfromtext(‘MULTIPOLYGON(((-99.400052685 43.795919295,-99.400064934 43.795917471,-99.400068168 43.795917099,-99.400072016 43.795917004,-99.400082687 43.795916553,-99.400087109 43.795916442,-99.400091512 43.795916534,-99.400102708 43.795917259,-99.400106058 43.795917354,-99.400109425 43.795917222,-99.400122303 43.795917659,-99.400125003 43.795917529,-99.40012833 43.795917182,-99.400140112 43.79591678,-99.400143939 43.795916284,-99.400151102 43.795914317,-99.400154258 43.795913273,-99.400162849 43.79591142,-99.400171678 43.795912113,-99.400173213 43.795911934,-99.400181806 43.795913203,-99.400190937 43.795912274,-99.400191842 43.795912096,-99.400200734 43.795910966,-99.400206629 43.795909874,-99.400219126 43.79590593,-99.400219643 43.795905808,-99.400219939 43.795905767,-99.400236211 43.795907224,-99.400238595 43.795907054,-99.40023996 43.795906474,-99.400241563 43.795905477,-99.400248384 43.795898859,-99.400257453 43.795894191,-99.400260802 43.795894113,-99.400270951 43.795895604,-99.400276405 43.795895518,-99.400280172 43.795894353,-99.400293104 43.795891574,-99.400294617 43.795891058,-99.40029532 43.79589091,-99.40029628 43.795890866,-99.40031001 43.795888446,-99.400314246 43.79588831,-99.400318686 43.795888268,-99.400328433 43.795888006,-99.400333187 43.795887963,-99.400340961 43.795885765,-99.400343233 43.795884967,-99.400352098 43.795883099,-99.400358531 43.795882286,-99.400366054 43.795881201,-99.400371025 43.79588054,-99.40037636 43.79588142,-99.400383229 43.795882428,-99.400389989 43.79588361,-99.400398278 43.795883486,-99.400400626 43.795883492,-99.400408932 43.795883369,-99.400416942 43.795883221,-99.400420381 43.795882834,-99.400427871 43.795882673,-99.400436963 43.795883927,-99.400437741 43.795883925,-99.400446837 43.795886037,-99.400450791 43.795888167,-99.40045281 43.795891014,-99.400456258 43.795897769,-99.400456352 43.79589789,-99.400458802 43.795904716,-99.400461192 43.795908137,-99.400465993 43.795917742,-99.4004662 43.795918263,-99.400466238 43.795918411,-99.40046624 43.795918586,-99.400469054 43.795929966,-99.400469142 43.795932123,-99.400469118 43.795934307,-99.400469016 43.795943781,-99.400468994 43.795945845,-99.400472371 43.795950296,-99.400474576 43.795953504,-99.400480276 43.795959528,-99.400482491 43.795961504,-99.400485252 43.79596483,-99.400490223 43.795969636,-99.400492709 43.795973206,-99.400495874 43.795979292,-99.400496256 43.795981086,-99.40049846 43.795986907,-99.40050068 43.795989566,-99.400502885 43.79599244,-99.400052685 43.795919295)))’), .0002, ‘join=mitre mitre_limit=5.0’)
Just add some 0 and change parameter of st_buffer
Here is example SQL query you can use
> SELECT st_buffer( st_geomfromtext('MULTIPOLYGON(((-99.400052685
> 43.795919295,-99.400064934 43.795917471,-99.400068168 43.795917099,-99.400072016 43.795917004,-99.400082687 43.795916553,-99.400087109 43.795916442,-99.400091512 43.795916534,-99.400102708 43.795917259,-99.400106058 43.795917354,-99.400109425 43.795917222,-99.400122303 43.795917659,-99.400125003 43.795917529,-99.40012833 43.795917182,-99.400140112 43.79591678,-99.400143939 43.795916284,-99.400151102 43.795914317,-99.400154258 43.795913273,-99.400162849 43.79591142,-99.400171678 43.795912113,-99.400173213 43.795911934,-99.400181806 43.795913203,-99.400190937 43.795912274,-99.400191842 43.795912096,-99.400200734 43.795910966,-99.400206629 43.795909874,-99.400219126 43.79590593,-99.400219643 43.795905808,-99.400219939 43.795905767,-99.400236211 43.795907224,-99.400238595 43.795907054,-99.40023996 43.795906474,-99.400241563 43.795905477,-99.400248384 43.795898859,-99.400257453 43.795894191,-99.400260802 43.795894113,-99.400270951 43.795895604,-99.400276405 43.795895518,-99.400280172 43.795894353,-99.400293104 43.795891574,-99.400294617 43.795891058,-99.40029532 43.79589091,-99.40029628 43.795890866,-99.40031001 43.795888446,-99.400314246 43.79588831,-99.400318686 43.795888268,-99.400328433 43.795888006,-99.400333187 43.795887963,-99.400340961 43.795885765,-99.400343233 43.795884967,-99.400352098 43.795883099,-99.400358531 43.795882286,-99.400366054 43.795881201,-99.400371025 43.79588054,-99.40037636 43.79588142,-99.400383229 43.795882428,-99.400389989 43.79588361,-99.400398278 43.795883486,-99.400400626 43.795883492,-99.400408932 43.795883369,-99.400416942 43.795883221,-99.400420381 43.795882834,-99.400427871 43.795882673,-99.400436963 43.795883927,-99.400437741 43.795883925,-99.400446837 43.795886037,-99.400450791 43.795888167,-99.40045281 43.795891014,-99.400456258 43.795897769,-99.400456352 43.79589789,-99.400458802 43.795904716,-99.400461192 43.795908137,-99.400465993 43.795917742,-99.4004662 43.795918263,-99.400466238 43.795918411,-99.40046624 43.795918586,-99.400469054 43.795929966,-99.400469142 43.795932123,-99.400469118 43.795934307,-99.400469016 43.795943781,-99.400468994 43.795945845,-99.400472371 43.795950296,-99.400474576 43.795953504,-99.400480276 43.795959528,-99.400482491 43.795961504,-99.400485252 43.79596483,-99.400490223 43.795969636,-99.400492709 43.795973206,-99.400495874 43.795979292,-99.400496256 43.795981086,-99.40049846 43.795986907,-99.40050068 43.795989566,-99.400502885 43.79599244,-99.400052685 43.795919295)))'),
> 0.00000001,'join=mitre' ) union all SELECT st_geomfromtext('MULTIPOLYGON(((-99.400052685
> 43.795919295,-99.400064934 43.795917471,-99.400068168 43.795917099,-99.400072016 43.795917004,-99.400082687 43.795916553,-99.400087109 43.795916442,-99.400091512 43.795916534,-99.400102708 43.795917259,-99.400106058 43.795917354,-99.400109425 43.795917222,-99.400122303 43.795917659,-99.400125003 43.795917529,-99.40012833 43.795917182,-99.400140112 43.79591678,-99.400143939 43.795916284,-99.400151102 43.795914317,-99.400154258 43.795913273,-99.400162849 43.79591142,-99.400171678 43.795912113,-99.400173213 43.795911934,-99.400181806 43.795913203,-99.400190937 43.795912274,-99.400191842 43.795912096,-99.400200734 43.795910966,-99.400206629 43.795909874,-99.400219126 43.79590593,-99.400219643 43.795905808,-99.400219939 43.795905767,-99.400236211 43.795907224,-99.400238595 43.795907054,-99.40023996 43.795906474,-99.400241563 43.795905477,-99.400248384 43.795898859,-99.400257453 43.795894191,-99.400260802 43.795894113,-99.400270951 43.795895604,-99.400276405 43.795895518,-99.400280172 43.795894353,-99.400293104 43.795891574,-99.400294617 43.795891058,-99.40029532 43.79589091,-99.40029628 43.795890866,-99.40031001 43.795888446,-99.400314246 43.79588831,-99.400318686 43.795888268,-99.400328433 43.795888006,-99.400333187 43.795887963,-99.400340961 43.795885765,-99.400343233 43.795884967,-99.400352098 43.795883099,-99.400358531 43.795882286,-99.400366054 43.795881201,-99.400371025 43.79588054,-99.40037636 43.79588142,-99.400383229 43.795882428,-99.400389989 43.79588361,-99.400398278 43.795883486,-99.400400626 43.795883492,-99.400408932 43.795883369,-99.400416942 43.795883221,-99.400420381 43.795882834,-99.400427871 43.795882673,-99.400436963 43.795883927,-99.400437741 43.795883925,-99.400446837 43.795886037,-99.400450791 43.795888167,-99.40045281 43.795891014,-99.400456258 43.795897769,-99.400456352 43.79589789,-99.400458802 43.795904716,-99.400461192 43.795908137,-99.400465993 43.795917742,-99.4004662 43.795918263,-99.400466238 43.795918411,-99.40046624 43.795918586,-99.400469054 43.795929966,-99.400469142 43.795932123,-99.400469118 43.795934307,-99.400469016 43.795943781,-99.400468994 43.795945845,-99.400472371 43.795950296,-99.400474576 43.795953504,-99.400480276 43.795959528,-99.400482491 43.795961504,-99.400485252 43.79596483,-99.400490223 43.795969636,-99.400492709 43.795973206,-99.400495874 43.795979292,-99.400496256 43.795981086,-99.40049846 43.795986907,-99.40050068 43.795989566,-99.400502885 43.79599244,-99.400052685 43.795919295)))')

Querying Intersection of two geometry columns in Mysql

I have tables with Geometry (Multipolygon Shape field) in Mysql. I am able to successfully run Area and Centroid. Is there a way in MySql however to query the intersection between two shapes expressed as a percentage of one in the other?
As per comment/request I am pasting in two mutlipoint geometry fields as I cannot figure out how to create a shape based table in sqlfiddle to make that easier, my apologies.
Zip Code 07024:
POLYGON((-73.982967 40.85601, -73.982439 40.856535, -73.982753 40.856696, -73.981338 40.858725, -73.98116 40.858553, -73.98071 40.858127, -73.979611 40.860178, -73.979382 40.860799, -73.978783 40.860699, -73.977687 40.8605, -73.977625 40.861338, -73.976375 40.863927, -73.975979 40.866037, -73.97581 40.86715, -73.97595 40.867368, -73.976498 40.868123, -73.975997 40.868331, -73.975852 40.868393, -73.975695 40.868462, -73.975424 40.868732, -73.975409 40.868767, -73.973501 40.867578, -73.972993 40.867361, -73.969825 40.865568, -73.969308 40.866081, -73.96889 40.866665, -73.967939 40.86767, -73.967224 40.868426, -73.966833 40.868573, -73.966599 40.868801, -73.965903 40.868417, -73.966106 40.868212, -73.965416 40.867819, -73.964641 40.867337, -73.963922 40.866921, -73.963033 40.866334, -73.961553 40.865627, -73.961057 40.865172, -73.959983 40.864747, -73.959338 40.864314, -73.958603 40.864012, -73.957929 40.863618, -73.95707 40.863094, -73.956499 40.862808, -73.955373 40.862408, -73.954582 40.861799, -73.953682 40.861199, -73.948385 40.858471, -73.951755 40.852121, -73.952044 40.851599, -73.952172 40.851368, -73.953482 40.849, -73.953982 40.848, -73.961982 40.8481, -73.96428 40.845936, -73.964416 40.846578, -73.965254 40.846613, -73.965508 40.846873, -73.965588 40.847314, -73.965493 40.847721, -73.965655 40.847583, -73.966297 40.847017, -73.967897 40.847412, -73.968466 40.84673, -73.968146 40.845991, -73.968481 40.845201, -73.969975 40.843707, -73.970303 40.843316, -73.971301 40.84213, -73.971575 40.841806, -73.972478 40.839104, -73.973107 40.835428, -73.973165 40.834416, -73.972952 40.834229, -73.972949 40.834164, -73.972968 40.834096, -73.973174 40.833617, -73.973334 40.832466, -73.973306 40.831923, -73.973267 40.831735, -73.973956 40.831892, -73.974176 40.831515, -73.974314 40.831326, -73.975646 40.828897, -73.976382 40.8276, -73.977731 40.82829, -73.978276 40.828543, -73.979977 40.829541, -73.98278 40.83107, -73.983573 40.831429, -73.983872 40.831592, -73.984742 40.832144, -73.985562 40.832688, -73.986268 40.833146, -73.986988 40.833553, -73.987719 40.83392, -73.988414 40.834306, -73.988761 40.83452, -73.989092 40.834704, -73.989874 40.835095, -73.990621 40.835377, -73.991325 40.835884, -73.991221 40.836037, -73.991102 40.836253, -73.990782 40.836634, -73.990063 40.83715, -73.988368 40.838989, -73.98773 40.839638, -73.987034 40.840345, -73.985915 40.841463, -73.984496 40.84288, -73.982203 40.84517, -73.982909 40.845573, -73.981298 40.847192, -73.981261 40.847214, -73.981144 40.847338, -73.981849 40.847781, -73.982608 40.848169, -73.98345 40.848469, -73.983527 40.848719, -73.984391 40.849063, -73.984835 40.849151, -73.984801 40.849419, -73.984896 40.850679, -73.985459 40.851398, -73.986166 40.850754, -73.98666 40.850301, -73.986718 40.850249, -73.987145 40.850414, -73.987891 40.850822, -73.987985 40.850884, -73.985961 40.853208, -73.984196 40.854911, -73.984091 40.854855, -73.98367 40.85531, -73.98354 40.85544, -73.982967 40.85601))
Fort Lee, NJ:
POLYGON((-73.985961 40.853208, -73.985344 40.853804, -73.984777 40.854344, -73.984228 40.854929, -73.983651 40.85551, -73.983092 40.856083, -73.982599 40.856605, -73.982753 40.856696, -73.981338 40.858725, -73.98116 40.858553, -73.980744 40.858154, -73.98071 40.858127, -73.980363 40.858773, -73.979611 40.860178, -73.979382 40.860799, -73.978783 40.860699, -73.977687 40.8605, -73.977625 40.861338, -73.976375 40.863927, -73.975979 40.866037, -73.97581 40.86715, -73.975695 40.868462, -73.97569 40.868903, -73.975409 40.868767, -73.973501 40.867578, -73.972993 40.867361, -73.970023 40.865686, -73.969825 40.865568, -73.969308 40.866081, -73.96889 40.866665, -73.967939 40.86767, -73.967224 40.868426, -73.966833 40.868573, -73.966106 40.868212, -73.965416 40.867819, -73.964641 40.867337, -73.963922 40.866921, -73.963033 40.866334, -73.962108 40.865929, -73.961553 40.865627, -73.961057 40.865172, -73.959983 40.864747, -73.959338 40.864314, -73.958603 40.864012, -73.957929 40.863618, -73.95707 40.863094, -73.956499 40.862808, -73.955373 40.862408, -73.954582 40.861799, -73.953682 40.861199, -73.948385 40.858471, -73.951755 40.852121, -73.952044 40.851599, -73.952172 40.851368, -73.953482 40.849, -73.953982 40.848, -73.961982 40.8481, -73.96428 40.845936, -73.964416 40.846578, -73.965212 40.846846, -73.96479 40.84776, -73.965493 40.847721, -73.965655 40.847583, -73.96588 40.847401, -73.965979 40.847321, -73.966155 40.847204, -73.966226 40.847134, -73.966286 40.847041, -73.966297 40.847017, -73.966418 40.847051, -73.966735 40.847137, -73.967225 40.847271, -73.967897 40.847412, -73.968193 40.847056, -73.968203 40.847044, -73.968466 40.84673, -73.968146 40.845991, -73.968303 40.845524, -73.968481 40.845201, -73.969975 40.843707, -73.970303 40.843316, -73.971301 40.84213, -73.971575 40.841806, -73.972478 40.839104, -73.973107 40.835428, -73.973165 40.834416, -73.973225 40.834413, -73.973289 40.834392, -73.973332 40.834364, -73.973379 40.834284, -73.973394 40.834221, -73.973391 40.834167, -73.973355 40.833909, -73.973351 40.833778, -73.973398 40.833352, -73.973433 40.833179, -73.973485 40.833009, -73.973814 40.832198, -73.973956 40.831892, -73.97406 40.831701, -73.974176 40.831515, -73.974314 40.831326, -73.975646 40.828897, -73.976382 40.8276, -73.977731 40.82829, -73.978276 40.828543, -73.979977 40.829541, -73.98278 40.83107, -73.983573 40.831429, -73.983872 40.831592, -73.984742 40.832144, -73.985562 40.832688, -73.986268 40.833146, -73.986988 40.833553, -73.987719 40.83392, -73.988414 40.834306, -73.988761 40.83452, -73.989092 40.834704, -73.989874 40.835095, -73.990621 40.835377, -73.991325 40.835884, -73.991221 40.836037, -73.991102 40.836253, -73.990782 40.836634, -73.990707 40.836688, -73.990063 40.83715, -73.988368 40.838989, -73.98773 40.839638, -73.987034 40.840345, -73.985915 40.841463, -73.984496 40.84288, -73.982203 40.84517, -73.981262 40.84611, -73.980579 40.846792, -73.980459 40.846915, -73.981144 40.847338, -73.981849 40.847781, -73.982608 40.848169, -73.98345 40.848469, -73.983527 40.848719, -73.984391 40.849063, -73.984835 40.849151, -73.985717 40.849611, -73.98625 40.850043, -73.986394 40.850027, -73.986431 40.850024, -73.986718 40.850249, -73.987145 40.850414, -73.987891 40.850822, -73.987985 40.850884, -73.985961 40.853208))

Escape HTML special characters in awk

From an awk script I want to generate a HTML file. My string could include characters like "<" and "&". Is there a short and proven function for awk which does the escaping?
Sure. Just call makeEntities() for each line ($0) you want to convert. Or modify it to accept an argument. I made this for working with the British National Corpus, which has a high degree of overlap with HTML entities, but not 100%, so if there are some exotic characters you need, you should verify that they are correct.
function makeEntities() {
gsub(/á/, "\\á");
gsub(/Á/, "\\Á");
gsub(/ă/, "\\&abreve;");
gsub(/â/, "\\â");
gsub(/´/, "\\´");
gsub(/æ/, "\\æ");
gsub(/Æ/, "\\Æ");
gsub(/α/, "\\&agr;");
gsub(/à/, "\\à");
gsub(/ā/, "\\&amacr;");
gsub(/Ā/, "\\&Amacr;");
gsub(/&/, "\\&");
gsub(/ą/, "\\&aogon;");
gsub(/å/, "\\å");
gsub(/Å/, "\\Å");
gsub(/ã/, "\\ã");
gsub(/ä/, "\\ä");
gsub(/Ä/, "\\Ä");
gsub(/β/, "\\&bgr;");
gsub(/\\/, "\\&bsol;");
gsub(/•/, "\\•");
gsub(/ć/, "\\&cacute;");
gsub(/č/, "\\&ccaron;");
gsub(/Č/, "\\&Ccaron;");
gsub(/ç/, "\\ç");
gsub(/Ç/, "\\Ç");
gsub(/ĉ/, "\\&ccirc;");
gsub(/✓/, "\\&check;");
gsub(/ˆ/, "\\ˆ");
gsub(/#/, "\\&commat;");
gsub(/©/, "\\©");
gsub(/‐/, "\\&dash;");
gsub(/ď/, "\\&dcaron;");
gsub(/°/, "\\°");
gsub(/δ/, "\\&dgr;");
gsub(/Δ/, "\\&Dgr;");
gsub(/¨/, "\\&die;");
gsub(/\$/, "\\&dollar;");
gsub(/đ/, "\\&dstrok;");
gsub(/é/, "\\é");
gsub(/É/, "\\É");
gsub(/ě/, "\\&ecaron;");
gsub(/ê/, "\\ê");
gsub(/è/, "\\è");
gsub(/È/, "\\È");
gsub(/ε/, "\\&egr;");
gsub(/ē/, "\\&emacr;");
gsub(/Ē/, "\\&Emacr;");
gsub(/ę/, "\\&eogon;");
gsub(/ð/, "\\ð");
gsub(/ë/, "\\ë");
gsub(/Ë/, "\\Ë");
gsub(/♭/, "\\&flat;");
gsub(/½/, "\\½");
gsub(/⅓/, "\\&frac13;");
gsub(/¼/, "\\¼");
gsub(/⅕/, "\\&frac15;");
gsub(/⅙/, "\\&frac16;");
gsub(/⅛/, "\\&frac18;");
gsub(/⅔/, "\\&frac23;");
gsub(/⅖/, "\\&frac25;");
gsub(/¾/, "\\¾");
gsub(/⅗/, "\\&frac35;");
gsub(/⅜/, "\\&frac38;");
gsub(/⅘/, "\\&frac45;");
gsub(/⅝/, "\\&frac58;");
gsub(/⅞/, "\\&frac78;");
gsub(/′/, "\\&ft;");
gsub(/γ/, "\\&ggr;");
gsub(/>/, "\\>");
gsub(/½/, "\\&half;");
gsub(/ħ/, "\\&hstrok;");
gsub(/í/, "\\í");
gsub(/Í/, "\\Í");
gsub(/î/, "\\î");
gsub(/Î/, "\\Î");
gsub(/ì/, "\\ì");
gsub(/ī/, "\\&imacr;");
gsub(/″/, "\\&ins;");
gsub(/¿/, "\\¿");
gsub(/ï/, "\\ï");
gsub(/Ï/, "\\Ï");
gsub(/ĺ/, "\\&lacute;");
gsub(/Ĺ/, "\\&Lacute;");
gsub(/\{/, "\\&lcub;");
gsub(/≤/, "\\≤");
gsub(/λ/, "\\&lgr;");
gsub(/_/, "\\&lowbar;");
gsub(/\[/, "\\&lsqb;");
gsub(/ł/, "\\&lstrok;");
gsub(/Ł/, "\\&Lstrok;");
gsub(/</, "\\<");
gsub(/—/, "\\—");
gsub(/μ/, "\\&mgr;");
gsub(/µ/, "\\µ");
gsub(/·/, "\\·");
gsub(/ń/, "\\&nacute;");
gsub(/ň/, "\\&ncaron;");
gsub(/ņ/, "\\&ncedil;");
gsub(/–/, "\\–");
gsub(/ñ/, "\\ñ");
gsub(/Ñ/, "\\Ñ");
gsub(/#/, "\\&num;");
gsub(/ó/, "\\ó");
gsub(/Ó/, "\\Ó");
gsub(/ô/, "\\ô");
gsub(/œ/, "\\œ");
gsub(/ò/, "\\ò");
gsub(/Ω/, "\\&ohm;");
gsub(/ō/, "\\&omacr;");
gsub(/ø/, "\\ø");
gsub(/Ø/, "\\Ø");
gsub(/õ/, "\\õ");
gsub(/ö/, "\\ö");
gsub(/Ö/, "\\Ö");
gsub(/φ/, "\\&phgr;");
gsub(/\+/, "\\&plus;");
gsub(/±/, "\\±");
gsub(/£/, "\\£");
gsub(/ŕ/, "\\&racute;");
gsub(/√/, "\\√");
gsub(/ř/, "\\&rcaron;");
gsub(/Ř/, "\\&Rcaron;");
gsub(/\}/, "\\&rcub;");
gsub(/®/, "\\®");
gsub(/-/, "\\&rehy;");
gsub(/\]/, "\\&rsqb;");
gsub(/ś/, "\\&sacute;");
gsub(/Ś/, "\\&Sacute;");
gsub(/š/, "\\š");
gsub(/Š/, "\\Š");
gsub(/ş/, "\\&scedil;");
gsub(/Ş/, "\\&Scedil;");
gsub(/ŝ/, "\\&scirc;");
gsub(/σ/, "\\&sgr;");
gsub(/♯/, "\\&sharp;");
gsub(/\//, "\\&shilling;");
gsub(/∼/, "\\∼");
gsub(/\//, "\\&sol;");
gsub(/²/, "\\²");
gsub(/ß/, "\\ß");
gsub(/ť/, "\\&tcaron;");
gsub(/ţ/, "\\&tcedil;");
gsub(/τ/, "\\&tgr;");
gsub(/þ/, "\\þ");
gsub(/Þ/, "\\Þ");
gsub(/×/, "\\×");
gsub(/™/, "\\™");
gsub(/ú/, "\\ú");
gsub(/Ú/, "\\Ú");
gsub(/û/, "\\û");
gsub(/ù/, "\\ù");
gsub(/ū/, "\\&umacr;");
gsub(/¨/, "\\¨");
gsub(/ů/, "\\&uring;");
gsub(/ü/, "\\ü");
gsub(/Ü/, "\\Ü");
gsub(/\|/, "\\&verbar;");
gsub(/ŵ/, "\\&wcirc;");
gsub(/ý/, "\\ý");
gsub(/ŷ/, "\\&ycirc;");
gsub(/¥/, "\\¥");
gsub(/ÿ/, "\\ÿ");
gsub(/Ÿ/, "\\Ÿ");
gsub(/ź/, "\\&zacute;");
gsub(/Ž/, "\\&Zcaron;");
gsub(/ž/, "\\&zcaron;");
gsub(/ż/, "\\&zdot;");
}
To escape the bare minimum you can do:
function escapeHtml(t)
{
# Must do this one first
gsub(/&/, "\\&", t);
gsub(/</, "\\<", t);
gsub(/>/, "\\>", t);
return t;
}

How do I search a table for multiple rows?

So this is my first question on stackoverflow and I've searched for day's but can't find the results I am looking for. I'm not looking for someone to write the code for me as I prefer to figure it out on my own, but I am looking for some assistance on finding how to do it.
My problem is I don't know how to word my search for what I'm looking for and this is what I want to do. I want to be able to search a MySQL database by using keywords such as "U10 Mustangs" where U10 would be data in a row called 'divisions' and Mustangs would be data in a row called 'club', I know I can use the OR statement like this
(`division` LIKE '%".$query."%') OR (`club` LIKE '%".$query."%')
but that only allows me to search by division or club not both. So basically I'm looking for a tutorial to show me how I can search by more than one keyword. I'm sure I'm wording this wrong and that's why I'm unable to find what I want.
I'm new to MySQL and PHP so please be understanding if this makes no sense!
*UPDATE*
here is my search code:
<body>
<?php include 'menu.php';?>
<br/><br/><br/>
<div id="searchcontainer" style="width: 55%; height: 132px;">
<fieldset style="width: 330px"><legend>Search Criteria</legend>
<form action="search.php" method="POST">
<td>Enter Search</td><td> <input type="text" name="query"/></td><td> <input type="submit" name="submit" id="table_button" value="Search" action="search.php"/></td>
<br />
</form>
</fieldset><br/>
<fieldset><legend>Search Results</legend>
<?php
include 'connect/local_connect.php';
$query = $_POST['query'];
// gets value sent over search form
// $min_length = 3;
// you can set minimum length of the query if you want
// if(strlen($query) >= $min_length){ // if query length is more or equal minimum length then
$query = htmlspecialchars($query);
// changes characters used in html to their equivalents, for example: < to >
$query = mysql_real_escape_string($query);
// makes sure nobody uses SQL injection
$raw_results = mysql_query("SELECT * FROM players
WHERE (`team_name` LIKE '%".$query."%' AND `division` LIKE '%".$query."%') OR (`last_name` LIKE '%".$query."%') OR (`division` LIKE '%".$query."%') ORDER by id ASC") or die(mysql_error());
// * means that it selects all fields, you can also write: `id`, `first_name`, `any`
// players is the name of our table
if(mysql_num_rows($raw_results) > 0){ // if one or more rows are returned do following
}
else{ // if there is no matching rows do following
echo "<font color=red>No Results!</font>";
?><br/><br/>
<?php
}
// else{ // if query length is less than minimum
// echo "Minimum length is ".$min_length;
// }
// Define $color=1
$color="1";
echo '<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0">';
echo '<th>ID</th><th>Club</th><th>Last Name</th><th>First Name</th><th>Division</th>';
while($rows = mysql_fetch_array($raw_results)){
echo "<tr bgcolor='#fff000'>
<td><center>".$rows['id']."</td></center><td><center>".$rows['club']."</center></td><td><center>".$rows['last_name']."</td></center><td><center>".$rows['first_name']."</center></td></td><td><center>".$rows['division']."</center></td></td></tr>";
}
echo '</table>';
mysql_close();
?>
</fieldset>
</div>
</body>
Are yu looking for concat
where CONCAT(`division`,' ',`club`) like '%".$query."%'
I will suggest to create a full text index on division and club like this FULLTEXT (club,division)
and search using query like this
SELECT * FROM db
WHERE MATCH (club,division)
AGAINST ('search');
'...but that only allows me to search by division or club not both...'
You can split your search string in words and then use a condition like this
SELECT *
FROM table1
WHERE (division LIKE '%U10%' AND club LIKE '%Mustang%')
OR (division LIKE '%Mustang%' AND club LIKE '%U10%')
Here is SQLFiddle demo