samedi 29 décembre 2018

Laravel - SQL query Join Statement convert PHP syntax to Laravel syntax

I am trying to convert PHP syntax join statement into Laravel Syntax but whatever what ill do nothing is being shown in the page test. I am new and beginner in Laravel so please guide me thank you! so here is my code

so let's say that i have this controller

public function queryJoinTest()
{

$query = "SELECT c.*, s.* FROM tbl_customer c JOIN tbl_stock s ON s.customer_id = c.customer_id AND c.customer_id = 1";

}

and let's say i have this view

here I have an input text and submit button so when I change the c.customer_id = 1 I can choose what customer_id i will type in and it will not be default in 1

<input type=text name="customerID" placeholder="Input an ID">

<input type="submit" value="Submit" name="submit">

OUTPUT

so overall i would like to achieve this

please take a look at this image

enter image description here

i have a textbox and there I input customer id so the default 1 customer id in my query will be removed and changed it into textbox

P.S any suggestions or advice on making join statement in laravel and i will take thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire