Posts

Showing posts from February, 2012

html - Flexbox support for Safari -

i have following code flexbox , works in chrome , firefox, it's not effective in safari(any version). have tried specific prefixes couldn't achieve same simple order. should modify/add safari work normal chrome , firefox? jsfiddle .container { display: -webkit-flexbox; display: flex; flex-flow: row wrap; justify-content: space-around; flex-direction: row; -webkit-flex-direction: row; list-style:none; } li { border:10px salmon solid; padding: 25px 15px; text-align: center; font-size: 1.2em; background: white; -webkit-flex-grow: 3; flex-grow: 3; } <ul class="container"> <li>alabama</li> <li>california</li> <li>florida</li> <li>idaho</li> <li>kansas</li> <li>nevada</li> <li>new york</li> </ul> safari 5 (the latest windows version of safari)

r - How to turn quoted string input into value of a vector? -

i accept input user in format such as: arg_from_user = "c(1,2,3)" and assign content of string vector, such that: vector = mystery_function(arg_from_user) vector [1] 1 2 3 what use in place of mystery_function ? you try eval(parse(text="c(1,2,3)"))

asp.net mvc 4 - Which files should be version controlled by Git? -

i'm starting on git environment , i'm little confuse .gitignore. i'd know kind of files should version controlled, because pushed project bitbucket when workmate pulled it, visual studio couldn't restore nu-get's dlls, generating many problems. normal or not? https://www.gitignore.io/ site set .gitignore file. can add frameworks, languages etc , generate basic .gitignore file. in end depends on project , setup , how want share code. there no general solution. some ideas: include make possible open project after checkout , being able compile/run/test/debug/deploy include has influence on build result (compiler options, file encodings, settings) don't include files absolute paths dont include own project settings, colors, etc consider have @ question , answer too: visual studio .gitignore

c# - type, which is not valid in the given context -

'dinnorapp.dinnorappweb2.addusuarioconimagendesktoprequest' 'type', not valid in given context i have problem kind of error, code here public int addusuario(string nombrecompleto, string usuario, string correo, string contraseña, string palabraclave, byte[] imagen) { users = new usuario(); dinnorappweb2.usuario usuario3 = new dinnorappweb2.usuario(); soap = new dinnorappweb2.webservice1soapclient(); usuario3 = soap.addusuarioconimagendesktop(dinnorappweb2.addusuarioconimagendesktoprequest(nombrecompleto, usuario, correo, contraseña, palabraclave, imagen)); users.nombrecompleto = usuario3.nombrecompleto; users.usuario = usuario3.usuario; if (users.nombrecompleto != null && users.usuario != null) { return 1; } return 0; } the code above, in winform, information use webservice on references file is // codegen: parameter 'imagen' requires

Java/Maven: how to remove content from shaded JAR at compile time? -

i in project reusing open source maven-based component includes bunch of shaded (e.g, using maven-shade plugin) direct , transitive dependencies in component uber-jar. unfortunately of dependencies clash dependencies own project has. specifically, component's dependencies transitively include servlet-api 2.x whereas need 3.x in project - , appear in same namespace. component's top-level dependency pulls in servlet-api (lucene-demo) not needed functionality of component, i'd happy remove if possible. project built gradle. what recommended way of dealing type of situation? there way of removing offending dependencies reused uber-jar when build own project? or should rebuild reused component myself, excluding troublesome dependency? if so, can done in automatic manner, such don't need maintain own fork of open source component? component presently hosted in github , published via maven central. (as might understand, i'm bit of beginner both maven , gradle, don&

asp.net mvc 4 - Replicating web form in MVC 4 -

i'm new mvc, general concept. however, i'm stuck trying replicate page easy create in web forms. in web forms, have dropdownlist (majors), when selected, postback , displays listbox (courses) based on value ddl. then, when item listbox selected, postback occurs , grid (classes) displayed based on item listbox. during postbacks, selected items in ddl , listbox stay selected. in attempt @ in mvc, i've got spaghetti code over... my question is, can accomplish this, 1 controller, 1 view, , 3 partial views? want stick plain mvc, can work in jquery once working. you have load dropdowns , have model real record on page there alt least 3 models..... have use viewmodel bring 3 models so model classes classes\course\main model (student?) create viewmodel 3 then view has access viewmodel , classes/data

python - Django Admin Actions: Add "Students" to "Academic Class" -

django 1.7, python 3.0, postgresql thanks taking time read this, expect missing obvious here. for simplicity, let's models are: student academicclass i wanting use admin actions to: 1st: select students 2nd: create new yet-to-have-details-filled-in academicclass attached students attached adding actions = [make_new_academic_class] , linking page has been straight-forward, confused how attach queryset on new academicclass. students = manytomanyfield('mgmt.student', related_name='classes') i believe have correct, except part: def make_new_academic_class(modeladmin, request, queryset): stdnt in queryset: print(stdnt.id) #obviously want save somehow #then want insert in academicclass-student relationship return redirect("/school/class/add") update was told best way "pre-populate form" using django api. working on that. ok, figured out: def make_class(modeladmin, request, query

Special Java characters in String -

i confused, have strings in java that: string str = "str \u0923 else"; how handle characters casual characters (not java special characters), mean str[4] '\' not ण (in unicode \u0923 = ण) unicode character. asking mechanical solution not manual. the jls says unicode backslash escapes interpretted if file written actual character encoded there instead. it's source level replacements, , has nothing string literals. for example, here compilable java unicode escapes used instead of quotes , semicolons: class test { string = \u0022hello world"\u003b } this means given string reference, there no way determine if original source file contained ण or \u0923 in assignment. it's similar how there no way differentiate of s1 , s2 assigned + in it: string s1 = "hello " + "world"; string s2 = "hello world";

javascript - AJAX function w/ Mailgun, getting "ERROR Request header field Authorization is not allowed by Access-Control-Allow-Headers" -

i'm working on making ajax call hit mailgun api send email. documentation on mailgun says post requests should made " https://api.mailgun.net/v3/domain.com/messages ". i've included api key specified mailgun (they instruct use username of 'api'). since involves cors, can't past error: request header field authorization not allowed access-control-allow-headers. however, i've inspected requests/responses in network tab , "access-control-allow-origin" in response mailgun set "*"...which should indicate should allow it? (see request/response below): i've edited actual domain , api key. remote address:104.130.177.23:443 request url:https://api.mailgun.net/v3/domain.com/messages request method:options status code:200 ok request headersview source accept:*/* accept-encoding:gzip, deflate, sdch accept-language:en-us,en;q=0.8 access-control-request-headers:accept, authorization access-control-request-method:post connection:keep-

r - Add a where condition inside of aggregate function -

i have data this: head(data1[,1:5]) eid created class_id min.e.event_time. lead_date 2610966 284546 2015-03-19 11:21:17 36 2015-03-19 11:21:17 null 2610972 284554 2015-03-19 12:37:19 36 2015-03-19 12:37:19 null 2610973 284554 2015-03-19 12:37:19 36 2015-03-19 12:37:19 null 2610975 284558 2015-03-19 14:18:43 36 2015-03-19 14:18:43 null 2610976 284558 2015-03-19 14:18:43 36 2015-03-19 14:18:43 null 2610977 284558 2015-03-19 14:18:43 36 2015-03-19 14:18:43 null this events table , eid user id. each line instance of user experiencing event. i'd count of events each user: eid_email <- aggregate(data1$eid, list(data1$eid), function(x) length(x)) this appears work. great. but need add condition. need count events each user, above, event_time less lead_date. when type help(aggregate) manual says there subset argument can use aggregate(). can use argum

javascript - Which scenarios might make Chart.js's canvas element resize? -

question, in scenarios might canvas element resize? i'm trying save canvas image generated chart.js, via sending .tobase64image() output server, problem images being saved in different sizes. did create separate invisible canvas no animation , fixed height , width, took account window.devicepixelratio (that possible make element resize) element still resizing in scenarios escape sight :/ relevant code: var canvas = $('<canvas/>'); canvas[0].width = 680; canvas[0].height = 480; // mobile devices higher devicepixelratio cause chart.js resize // canvas, temporally modifying window.devicepixelratio avoid it. var originaldevicepixelratio = window.devicepixelratio; window.devicepixelratio = 0; window.myradar = new chart(canvas[0].getcontext("2d")).radar(radarchartdata, { animation: false, showscale: false, scaleshowlabels: false, showtooltips: false, scalelinewidth: 2, pointlabelfontfamily: "open sans", pointlabelfon

python - session_regenerate_id in Django. Does it exist? -

i wonder if there exists function in django similar in php , session_regenerate_id() . want use kind of function rotate sessionid on each n requests in order provide more security. in php use in manner described guy in post . want implement same thing in django project, i'm new django , not know if there exists such function change user's session id on fly. yes, such function exists in django - request.session.cycle_key() .

sql - Locate Cause of IBM DB2 CAST Failure -

i need work on ibm db2 database. the location field character(8) field of numbers. to sort table, column cast integer : select location, partno, instock inventory order cast(location integer) currently, fails with: error [22018] [ibm][db2/aix64] sql0420n invalid character found in character string argument of function "integer". is there quick way determine row failing? ibm's solution "insure results set query item cast being applied not contain non numeric sql constants when casting numeric type." that wasn't helpful. thinking inserted letter o or lower case l, tried this: select distinct location locations location '%l%' or location '%o%' order location zero records returned. that wasn't helpful. that's ibm error messages , documentation in nutshell. one place start translate() function . select location, partno, instock inventory translate(location, '', ' 01234567

yadcf - ambiguous multi_select filter - AND and OR condition - javascript -

multi_select filter select2 in yadcf (datatables plugin) has ambiguous solution filtering. if have inside rows single values like value1 value2 when filtering have or filtering. shows rows values1 , values2. if set text delimiter comma or multiple delimiters (using regex) multiple_select filter behaves and condition. example column 0: example possible have javascript function enables or , condition or or condition according suit needs? for better exposure made little video of problem , expect see in table. problem tricky should not difficult solve right javascript code video ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- adding feature improvement request: new video example used in video: table the purpose of text delimiter extract values column filter, but... when try pick value filter , apply table, rows selected value located in. i

switch statement help in R -

i've got following code in r: func.time <- function(n){ times <- c() for(i in 1:n){ r <- 1 #x room mouse in x <- 0 #time, starting @ 0 while(r != 5){ if(r == 1){ r <- sample(c(2,3),1) } else if(r == 2){ r <- sample(c(1,3), 1) } else if(r == 3){ r <- sample(c(1,2,4,5), 1) } else if (r == 4){ r <- sample(c(3,5), 1) } x <- x + 1 } times <- c(x, times) } mean(times) } func.time(10000) it works fine, i've been told using switch() can speed seeing i've got many if else statements can't seem work, appreciated in advance. edit i've tried this: func.time <- function(n) { times <- c() for(i in 1:n) { r <- 1 #x room mouse in x <- 0 #time, starting @ 0 while(r != 5) { switch(r, "1" = sample(c(2,3), 1), "2" = sample(c(1,3), 1), "3" = sample(c(1,2,4,5), 1),

assembly - Having trouble encrypting and decrypting with cmp -

i'm having issue cmp. need incorporate 3 tables encrypt , decrypt. can play code either n_tab, l_tab, or a_tab can't seem make sense of incorporating three. appreciated. thank .model small .stack 100h .data prompt1 db "enter message here: $" prompt2 db "encrypted: $" prompt3 db "decrypted: $" a_tab db "zyxwvutsrqponmlkjihgfedcba" buff db 50 dup(0) .code main: mov ax, @data mov ds, ax ; set addressability mov si, offset buff ; put buff lea dx, prompt1 ; load , print string prompt mov ah, 9 int 21h mov si, di mov ah, 3fh mov cx, 50 int 21h mov si, di mov bx, offset a_tab mov si, di l1: lodsb push bx mov ah, 6 mov dl, 0ffh int 21h pop bx mov dl, al mov al, 0 sub al, 'a' xlat loop l1 lea dx, prompt2 ; load , pri

mongodb - Given a list of unique discount codes, how to send each one only once -

i'm wondering best way solve problem: given pre-generated list of 500 unique discount codes e-commerce site, how ensure each of first 500 users receive discount code each receive unique one? e-commerce site making asynchronous request separate server list of discount codes stored in database. it's server's job make sure sends each discount code once, in chronological order requests received. as seems rather primitive problem, wonder if there clever , elegant way relatively low level of effort. if db has atomic transactions, no problem. make table discount 2 fields, code (varchar wide enough hold code) , used (boolean), indexed used , code . insert 500 rows, each used = false of course. whenever request comes, select min(code) discount update not used , , update discount set used = true not used , code = <that code> , inside single db transaction. (the not used part of update not necessary correctness, may speed things enabling index used.)

authorize.net - Magento Payment Gateways Not Working -

magento v 1.9.1.0 trying use authorize.net and/or paypal. neither working... appreciated. authorize gives error says "there error processing order. please contact or try again later." exception log follows: 2015-03-20t23:53:05+00:00 err (3): exception 'pdoexception' message 'sqlstate[hy000]: general error: 1205 lock wait timeout exceeded; try restarting transaction' in /..../public_html/lib/zend/db/statement/pdo.php:228 stack trace: 0 /..../public_html/lib/zend/db/statement/pdo.php(228): pdostatement->execute(array) 1 /..../public_html/lib/varien/db/statement/pdo/mysql.php(110): zend_db_statement_pdo->_execute(array) 2 /..../public_html/app/code/core/zend/db/statement.php(291): varien_db_statement_pdo_mysql->_execute(array) 3 /..../public_html/lib/zend/db/adapter/abstract.php(480): zend_db_statement->execute(array) 4 /..../public_html/lib/zend/db/adapter/pdo/abstract.php(238): zend_db_adapter_abstract-&

jquery - How to determine the ad rendered by google publisher tags -

essentially add classes parent elements of rendered slot depending on size of ad returned. possible? see there googletag.events.slotrenderendedevent gives me access slot. there not sure how determine element slot renders to. i've done bookkeeping , have access defined slots, comparing them doesn't seem work. any ideas? they exposed method information: getslotelementid

java - JPQL (Hibernate 4.3.6) subselect query not working -

i have problem can perform 2 separate queries; first set of ids, , second use ids in "in" clause; when try combine 2 1 query subselect, not work. this works: public list<lead> findleadsbysupplierandstatus(list<integer> supplierids, statuscode status){ query query = entitymanager.createquery("select ss.id statesupplier ss ss.supplier.id in :supplierids"); query.setparameter("supplierids", supplierids); @suppresswarnings("unchecked") list<integer> result = (list<integer>)query.getresultlist(); query query2 = entitymanager.createquery("from lead l l.statesupplier.id in :ids , l.leadstatus.id= :statusid"); query2.setparameter("ids", result); query2.setparameter("statusid", status.getdbid()); @suppresswarnings("unchecked") list<lead> result2 = (list<lead>)query2.getresultlist(); return result2; } but not: public list<l

javascript - How to split an array into 2, left and right -

i have array of menu links ['a','b','c','d','x','y','z'] , want split them array result {'left':['a','b','c','d'], 'right': ['x', 'y','z']} . want them split in half. number of items in list can variable. easiest way this? you can use array.prototype.slice extract subarrays array: var arr = ['a','b','c','d','x','y','z'], mid = math.ceil(arr.length/2), obj = { left: arr.slice(0, mid), right: arr.slice(mid) }; if don't mind altering original array, can use array.prototype.splice : var arr = ['a','b','c','d','x','y','z'], obj = { left: arr.splice(0, math.ceil(arr.length/2)), right: arr };

angularjs - Angular service and pouchdb -

how use angularjs service call pouchdb , return data controller? have been working on ionic app pouchdb local storage. have simple crud app built in controller. want start move pouchdb calls service. haven’t been able data service. how use service call pouchdb docs , return controller? one strategy think work angular services this one . describes method keeping in-memory array synced result of pouchdb's alldocs() . since it's array automatically stays synced pouchdb, can ng-repeat on it, , you're done. :)

travis-ci R suggested package -

in r package have few suggested packages i'm using in examples. such roracle, rpostgresql, rodbc. keeping them in suggests allows skip testing of them, doesn't seems work on travis-ci - recent language: r . i tried multiple cases: env: _r_check_force_suggests_=false env: global: - _r_check_force_suggests_=false nothing helps, package tries install suggested packages besides option i've set, , results build error. kind of: ** package ‘roracle’ unpacked , md5 sums checked configure: error: oci libraries not found error: configuration failed package ‘roracle’ 1: in utils::install.packages(deps, dependencies = na, ncpus = threads) : installation of package ‘rodbc’ had non-zero exit status 2: in utils::install.packages(deps, dependencies = na, ncpus = threads) : installation of package ‘roracle’ had non-zero exit status command "rscript -e 'options(repos = "http://cran.rstudio.com"); trycatch({ deps <- devtools::install_deps(depende

java - Different hashCode for the same string? -

i have made log-in screen , want check password client enters passwords in server's database. if hashcodes match, password accepted. however, hashcode when write password on client screen different hashcode of received string (password) on server side. does know why? in advance insight. you've misunderstood. you should using secure hash, not the hashcode() method. you must not store plaintext password in database. must store hash. you should getting database hashing , comparison: select count(*) users username = ? , password = md5(?) if query returns 1, user , password exist. if returns zero, don't. note don't want distinguish between wrong username , wrong password, information leak attacker. test them both above.

java - Strange JPA compilation errors -

i following compile errors when trying use jpa 2.1 , eclipselink 2.6 em.getcriteriabuilder() java: cannot find symbol symbol: method getcriteriabuilder() location: variable em of type javax.persistence.entitymanager expression<boolean> java: type javax.persistence.criteria.expression not take parameters typedquery<foo> query = em.createquery(querystring, foo.class); java: method createquery in interface javax.persistence.entitymanager cannot applied given types; required: java.lang.string found: java.lang.string,java.lang.class reason: actual , formal argument lists differ in length my pom.xml contains following dependencies jpa <dependency> <groupid>org.eclipse.persistence</groupid> <artifactid>javax.persistence</artifactid> <version>2.1.0</version> </dependency> <dependency> <groupid>org.eclipse.persistence</group

javascript - How to add css to a specific Array element on Jquery -

i'm trying develope code generates random rgb color each element name "title" on website. first, choose all elements specific class "title" : var element = $('.title') then, save on var called n , total number of titles (used on for) var n = element.length now. i'm trying traverse title elements , adding css random rgb color. note: use element[ ] , access each of array element. correct? for (var = 0; < n; i++) { element[ ].css({ "background": randomcolor(); }) } however doesn't work... how can solve that? idea. regards. element[i] refers dom element not have method css() provided jquery, need jquery wrapper object element @ index i can obtained .eq() for (var = 0; < n; i++) { element.eq(i).css({ "background": randomcolor(); }) } you can pass function .css() like element.css('background', function () { return randomcolor() })

zabbix server can't connect to java gateway -

Image
i have installed zabbix server , java gateway in same linux server , started zabbix-server , zabbix-java-gateway service. os centos 6.5, java jdk1.6.0_45, ip 192.98.12.240, zabbix server , zabbix java gateway version 2.2.9. have stop iptables service. then in zabbix web console, added host enabled jmx interface. host ip 192.98.12.198 , jmx post 9999. in jconsole, can connect jmx enabled java application. in zabbix web console, show error: below zabbix_server.conf logfile=/var/log/zabbix/zabbix_server.log logfilesize=0 debuglevel=4 pidfile=/var/run/zabbix/zabbix_server.pid dbhost=localhost dbname=zabbix dbuser=zabbix dbpassword=zabbix dbsocket=/var/lib/mysql/mysql.sock javagateway=192.98.12.240 javagatewayport=10052 startjavapollers=5 snmptrapperfile=/var/log/snmptt/snmptt.log alertscriptspath=/usr/lib/zabbix/alertscripts externalscripts=/usr/lib/zabbix/externalscripts below zabbix_java_gateway.conf listen_ip=192.98.12.240 listen_port=10052 pid_file="/var/run/zabbix

c# - Object coordinates not updating as expected -

Image
i'm having issue prefab i'm instantiating in script. i'm attempting simulate physics behind projectile motion of cannonball. have following script attached prefab: using unityengine; using system.collections; public class shootphysics : monobehaviour { // vectors & angles calculated private float fx = 0f; private float fy = 0f; private float angle; // forces acting upon object private float gravity = 9.8f; private float force = 1.2f; // new distance & vector variables private float dis_x = 0f; private float dis_y = 0f; // script & cannonball transform private cannonphysics cannon_angle; void start() { cannon_angle = gameobject.findwithtag("gun").getcomponent<cannonphysics>(); angle = cannon_angle.getangle (); fx = mathf.round (force * mathf.cos(mathf.deg2rad * angle)); fy = mathf.round (force * mathf.sin(mathf.deg2rad * angle)); } void fixedup

python - Django Admin Emails -

i've put django website production, , i've turned debug off. i've configured admins setting can informed of errors occurring. in settings.py, have following: admins = (('foo', 'bar@example.com')) i use zoho send out emails. when noticed wasn't receiving anything, checked "sent" folder on site. it's trying send email <r>, <n> why isn't name , email being parsed, , can fix it? admins should list of tuples. forgot add comma make list: admins = (('foo', 'bar@example.com'), ) or cat use list syntax: admins = [('foo', 'bar@example.com')]

java - Set large array of numbers to designated length per line -

int size = 50; // generates non-duplicated random numbers int[] values = new int[51]; int[] list = new int[size]; for( int = 0; < 51; i++ ) values[i] = i; random rand = new random(); int listsize = 0; int mylist = 0; while( true ) { int value = rand.nextint(51); if( values[ value ] == 0 ) continue; // number used list[ mylist++ ] = value; values[ value ] = 0; if( mylist == size || mylist == 50 ) break; } // displays non-duplicated random generated numbers for(int element : list) system.out.print(element + " "); i set large array of numbers designated length per line make numbers appear though they're in block left , right sides so: > 1 2 3 4 5 6 7 8 9 10 > 11 12 13 14 15 16 17 18 19 20 > 21 22 23 24 25 26 27 28 29 30 > 31 32 33 34 35 36 37 38 39 40 > 41 42 43 44 45 46 47 48 49 50 how accomplish using enhanced loop? help! add new line after read 10 value for(int i=0; i<list.length; i

python - How can I get http referrer in Tornado? -

class headerhandler(tornado.web.requesthandler): def get(request): print request.meta.headers["http_referer"] the code doesn't work, tell me headerhandler doesn't has attribute of meta. wrong code ? the attributes of tornado's request object documented @ http://www.tornadoweb.org/en/stable/httputil.html#tornado.httputil.httpserverrequest headers in self.request.headers , , not have cgi-style http_ prefix: print(self.request.headers.get("referer"))

hashtable - What is the use of a Hash range in a dynamodb table? -

i new dynamodb (ddb). going through documentation , says add hash key , hash range key. in documentation says ddb create usorted index on hash key , sorted index on hash range. what purpose of having these 2 keys rather 1 key. because first key used : hashtable contains : key - range of keys each value in hash range 2nd hashtable hash range key - actual data value. this segregate data , make lookup fast. why 2 levels of hashmaps, n number of layers , faster lookups. thank in advance. q:"what purpose of having these 2 keys rather 1 key?" in terms of data model , hash key allows uniquely identify record table, , range key can optionally used group , sort several records retrieved together. example: if defining aggregate store order items, orderid hash key , , orderitemid range key . can find below formal definition use of these 2 keys: "composite hash key range key allows developer create primary key composite of 2 attributes, 'hash at

javascript - how to close current window after href to a download link -

i have html code this: <script type="text/javascript"> initpage(); // someting location.href = "http://mail//download.php?lcaction=5" //download file link // window.open("http://mail//download.php?lcaction=5"); // close current window, can not work window.opener = null; window.open("", "_self"); window.close(); </script> when try use window.open instead of href , works in chrome, fails in ie. what can make work properly?

ios - Issue with finding the height of the main UIView between a Navigation Controller and Tab Bar -

i had issue of trying find displayed area of view under opaque tab bar , opaque navigation bar. frame evidently closer size of screen (likely includes tab , nav bar) visible , views being hidden. i know if there official way of finding view size , if there way think programmatically, except maybe subtract tab bar , nav heights (and ruin app in future change apple). apple's own autolayout works fine when pinning bottom of uiview (ie. not go under tab view). just screen size, , subtract known navigation bars , status bars. + (cgfloat) estimateviewheightvertical: (uiviewcontroller*)viewcontroller { cgrect screen_size = [[uiscreen mainscreen] bounds]; cgfloat screen_height = screen_size.size.height; cgfloat status_bar_height = [uiapplication sharedapplication].statusbarframe.size.height; cgfloat tab_bar_controller_height = 0; cgfloat nav_bar_controller_height = 0; if (viewcontroller.tabbarcontroller) { tab_bar_controller_height = v

PHP/Javascript + MySQL data is not being retrieved when query has variables -

so trying make simple login php. can retrieve rows fine in specific case there seems problem in getting data needed: when execute query condition in clause via variable, never data column. don't empty set either. i tested connection fine because when override variable inside method result returns fine. for instance, when this: $sql = "select name customers email='" . $email . "'"; $result = $mysql->executesql($conn, $sql); if(!empty($result)){ while($row = mysqli_fetch_array($result)){ echo $row['name']; } }else{ echo "empty set"; } it doesn't return @ all. but if this: $email = 'richardgwapo@gmail.com'; $sql = "select name customers email='" . $email . "'"; $result = $mysql->executesql($conn, $sql); if(!empty($result)){ while($row = mysqli_fetch_array($result)){ echo $row['name']; } }else{ echo "empty set"; }