[Solved] show leave record in each month

[ad_1] Please use field value as a column name then you can easily solved this. Use below query: SELECT leaves.id, SUM( CASE WHEN (leaves.type=”Annual”) THEN leaves.noOfDays ELSE NULL END ) AS Annual, SUM( CASE WHEN (leaves.type=”Casual”) THEN leaves.noOfDays ELSE NULL END ) AS Casual, SUM( CASE WHEN (leaves.type=”Medical” ) THEN leaves.noOfDays ELSE NULL END ) … Read more

[Solved] MySQL Select from three tables [closed]

[ad_1] something like this? QUERY: SELECT country, profession, MAX(money) AS money FROM ( SELECT u.country, g.profession, SUM(um.money) AS money FROM user_money um JOIN users u ON u.id = um.user_id JOIN groups g ON g.id = um.group_id GROUP BY g.profession, u.country ORDER BY um.money DESC ) t GROUP BY country ORDER BY money DESC SEE DEMO … Read more

[Solved] PHP how to include everything i type in my textbox to mysql database [duplicate]

[ad_1] No, You dont use str_replace(), you have addslashes() and stripslashes(), those two are the two functions you are looking for. Changing a string with str_replace functions isnt a smart thing to do. Those functions aren’t created with this in mind, the add/striposlashes are. You might forget a character which you needed to str_replace with … Read more

[Solved] PHP – Login Form does not show [closed]

[ad_1] (tested) The reason why your form is not showing is because of these two lines: 1) This one had a missing closing parentheses ) at the end. $password = md5(md5(“Ji5t63s”.password.”v5h2ih47″); Should be: $password = md5(md5(“Ji5t63s”.password.”v5h2ih47″)); 2) The <a href=”https://stackoverflow.com/questions/19200663/./member.php”> – Problem is the (unescaped) double quotes or use of single quotes. Your existing line: … Read more

[Solved] mysql user defined variables as derived table

[ad_1] Are you looking for something like this? SELECT * FROM ( SELECT 1 value UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 ) table1 Here is SQLFiddle demo You can easily produce it in php like this using implode() $myArr = array(1,2,3,4); $sql=”SELECT * FROM (SELECT “; $sql .= implode(‘ … Read more

[Solved] Need to create a query for monthly data [closed]

[ad_1] You can get dynamic records using current month, by the following query SELECT * FROM table_name WHERE CREATED_DATE BETWEEN DATE_FORMAT(NOW(),’%Y-%m-20′) – INTERVAL 1 MONTH AND DATE_FORMAT( NOW(),’%Y-%m-20′) Check the live result at the fiddle http://sqlfiddle.com/#!2/4668c/7 7 [ad_2] solved Need to create a query for monthly data [closed]

[Solved] How to pass a variable from a page to other in php

[ad_1] You can store the order number in the session. This way, it will be protected and persisted across pages. When you insert the order in book_order.php, store it in the session: $sql2=mysql_query(….); // inserting if($sql2){ $_SESSION[‘order_id’] = mysql_insert_id(); } Now, in book_order2.php you can retrieve the order ID before you do the insert of … Read more

[Solved] Trying to not have repeating data (MySQL, php) [closed]

[ad_1] I’m not sure what are you trying to do, but you don’t want to use the GROUP BY clause. If you want to select all entries, use: mysql_query(“SELECT * FROM `testimonials`”); If you want to select one random entry, use: mysql_query(“SELECT * FROM `testimonials` ORDER BY RAND() LIMIT 1”); and get rid of the … Read more

[Solved] How to fetch all data from database? [closed]

[ad_1] DO NOT USE MYSQL, instead use MySQLi as MySQL is DEPRECATED . But: $tid=$_SESSION[‘id’]; $a=mysql_query(“select * from tbl_curriculum_sched where TEACHER_ID=’$tid'”) or die(“$ a error : “.mysql_error()); while($ad=mysql_fetch_array($a)){ $sql= mysql_query(“SELECT * from enrolled where CURRICULUM_SCHED_ID=’$ad[0]'”) or die(“inner while: “.mysqli_error()); … To those of you commenting and comlaining that the OP should be using $a, rather … Read more

[Solved] How I Can Use Multi Table for While my data in php? [closed]

[ad_1] Here is a query writen to get all rows from your table. //connect to database $dbhost=”localhost”; $dbuser=”root”; $dbpass=””; $dbname=”databasename”; $conn = mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname, $conn) or die (‘connection problem’); $html=””; $sql = “” . ” SELECT * FROM customer, sell, control ” . “”; $data = mysql_query($sql); if (mysql_num_rows($data) > 0) { $html … Read more

[Solved] Save position of element with Jquery, PHP and MySQL [closed]

[ad_1] I don’t know what do mean by “saving position of an element” and how can that be useful, but you can try jQuery position() and $.ajax() methods: Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. var t = $(‘a.icon’).position().top; var l = $(‘a.icon’).position().left; … Read more

[Solved] How to compare two variables in php

[ad_1] I want to compare coming get variable with nursery But then you are comparing with Nursery if ($results==”Nursery”) Are you aware that that comparison is case-sensitive? Also that code is poor. It should simply be $results=isset($_GET[‘results’]) ? $_GET[‘results’] : NULL; Do not use error suppression when you are learning something new. And Oh, How … Read more