[Solved] Using a Case Statement With IS NULL and IS NOT NULL

You are misusing the case expression. There are two forms. The form you want is: (CASE WHEN userName IS NULL THEN ‘was null’ WHEN userName IS NOT NULL THEN ‘was not null’ END) AS caseExpressionTest Note: There is no userName after the CASE. This checks each condition stopping at the first. MySQL interprets booleans as … Read more

[Solved] PHP Login & MySql Query

There are a few problems with your script. First off, you start by using PDO to connect to the database, then you use mysql_* functions (which are deprecated, stick to PDO !!!). Plus, you are not properly escaping your data, and your code is potentially vulnerable to SQL injection. Secondly, the query you are using … Read more

[Solved] mysql , max ,groub by [closed]

suggest that if your above SQL statement can query the result. maybe you can just skip the “order by” and simply just select * from (/* your SQL statement without “order by”*/) a order by a.message_id desc sorry that as it is difficult to see your screen capture and help you to resolve the SQL … Read more

[Solved] what is the correct syntax for this SQL SELECT statement

select query will be something like below for selecting particular field $sql = “SELECT `coloumname1`,`coloumname2` from `tablename` where `someid`=’matchingvalue'”; for selecting all the field sql query will be like below $sql = “SELECT * from `tablename` where `someid`=’matchingvalue'”; hope you understand this, so from next time please google first and than come here if not … Read more

[Solved] Mysql query – how to do this? [closed]

Try – SELECT id, SUM( DISTINCT ss ) AS “Sum (ss)” FROM tblData GROUP BY id; Note : Without GROUP BY SUM() will try to add up all values of ss, even with the DISTINCT qualifier. If you use GROUP BY but not DISTINCT then SUM() will add up all the values of ss for … Read more

[Solved] MySQL Error 1064 (42000) when running UPDATE query [closed]

In this: UPDATE MATERIAL_MASTER SET MST_NAME=’XXX’ MAT_DESC=’YYY’ MAT_TYPE=’Raw Material’ MAT_GRP=’H’ UOM=’kg’ CURRENCY=’inr’ ENTITY_ASSEMBLED=’A’ where idMATERIAL_MASTER=3; You’re missing commas between fields in SET zone. The correct query is: UPDATE MATERIAL_MASTER SET MST_NAME=’XXX’, MAT_DESC=’YYY’, MAT_TYPE=’Raw Material’, MAT_GRP=’H’, UOM=’kg’, CURRENCY=’inr’, ENTITY_ASSEMBLED=’A’ where idMATERIAL_MASTER=3; 0 solved MySQL Error 1064 (42000) when running UPDATE query [closed]

[Solved] MySQL and PHP Select Option with information from database

I’ll give you a short example. Right now, you’r code will give you 1 option <select name =”Employee Name” style=”width: 160px” > <option value =””>Please select …</option></select> Let’s take an array like: $array = array(‘0’ => ‘test’, ‘1’ => ‘test1’); To populate your array as options, you can simply do <select> <?php foreach ($array as … Read more