[Solved] How to Convert this sql query into laravel query builder

$result = DB::table(‘table as t’) ->select(‘t.product_id’, ‘t.on_hand’, ‘t.created_at’) ->join(DB::raw(‘(SELECT MAX(purchase_id) as pId FROM table Group by product_id) tg’), function($join) { $join->on(‘t.purchase_id’, ‘=’, ‘tg.pId’); })->get(); 1 solved How to Convert this sql query into laravel query builder

[Solved] How to tell who is logged in PHP? [closed]

$_SESSION A session is a way to store information (in the form of variables) to be used across multiple pages. <?php // this line starts the session and must be present in any page where you need to set or retrieve a session variable session_start(); // this sets variables in the session $_SESSION[‘userid’]=’123′; //obv it … Read more

[Solved] PHP MySQL query not returning a result [closed]

//Try This <?php // Some inputvalues (those are correct) $user = “”; $pass = “”; $host = “”; $db = “”; $conn = mysqli_connect($host, $user, $pass, $db) or die(“Het is niet gelukt om te verbinden met de database!”); // Vaststellen wat je wil weten $grab = $_GET[‘grab’]; $query = “SELECT * FROM informaticaproject WHERE id=1”; … Read more

[Solved] Ηow can I implement a clone of Digg? [closed]

You have to pass parameter between two pages So first of all your have to edit add link on it <?php try { $pdo = new PDO(‘mysql:host=localhost;dbname=informal’,’vad’,’6989′); $pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); $pdo->exec(‘SET NAMES “utf8″‘); } catch(PDOException $e) { echo $e->getMessage(); } $sql=”SELECT title,content FROM postID”; $result = $pdo->query($sql); while($row = $result->fetch()) { echo “<a href=anotherpage.php?id=”.$row[‘id’].”>”.$row[‘title’] . “</a><br />”; … Read more

[Solved] SQL statement thinking non distinct [closed]

A simple GROUP BY should work for you: SELECT Col1,Col2 FROM YourTable T GROUP BY Col1,Col2 HAVING COUNT(*) > 1 Please post what you have tried going forward… –EDIT– If you’re look at returning all rows that have the same lat/lon, then something like this would work: SELECT * FROM YourTable WHERE (lat,lon) IN ( … Read more

[Solved] SQL statement thinking non distinct [closed]

Introduction SQL statement thinking is a process of understanding how to use SQL to solve a problem. It involves understanding the structure of the data, the relationships between the data, and the logic of the query. It is important to think through the SQL statement before writing it, as it can save time and effort … Read more

[Solved] How to Delete Specific Multi Records in Codeigniter [closed]

4,6,8,11,12 records Deleted public function delete_data($id){ $this->db->where_in(‘campus_id’, $id); $this->db->delete(‘sections’); } 3,5,6,7 records not Deleted public function delete_data($id){ $this->db->where_not_in(‘campus_id’, $id); $this->db->delete(‘sections’); } Wow I Got It.. solved How to Delete Specific Multi Records in Codeigniter [closed]

[Solved] Php if session declare variable

I am not clear about question. as far as i understood check the below code <?php session_start(); // this is the first thing to do if(isset($_SESSION[‘admin_level’])){ $_SESSION[‘admin_level’]=10; //Set admin level if not available } $var=($_SESSION[‘admin_level’]==10)?”newclient”:”oldclient”; $qry=”SELECT * FROM client where client_status=””.$var.”””; 4 solved Php if session declare variable

[Solved] Can’t run MySQL query with an end of the year check [closed]

$gdate = date(“Y-m-d”, strtotime(‘today’)); if($gdate==date(“Y-m-d”,strtotime(‘last day of december’))){ $queryrun=mysql_query( $query); you were checking with d-m-Y which is wrong. both date format wasn’t same and that the query is not running. and also a closing ) bracket was missing. Note: mysql_query will be deprecated. solved Can’t run MySQL query with an end of the year check … Read more

[Solved] Have you an idea to send email in new way?

I don’t know adding another answer is allowed or not but let me try it. If anything is wrong kindly let me know. Hello Hope this will help. Ask question if have any confusion. First file q1.php and code for that <?php $con = mysqli_connect(‘localhost’,’root’,”,’test’); ?> <form action=’emailScript.php’ method=’post’> <div class=”control-group”> <label class=”control-label” for=”basicinput”> Select … Read more