Laravel - SQL query Join Statement convert PHP syntax to Laravel syntax
![Multi tool use Multi tool use](http://sgv.ssvwv.com/sg/ssvwvcomimagb.png)
Multi tool use
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
php mysql sql laravel laravel-5
|
show 2 more comments
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
php mysql sql laravel laravel-5
Have you looked at the laravel manual yet? If not I'd start there, laravel.com/docs/5.7/queries#joins. If you have you should add what you tried that didn't work.
– user3783243
Dec 30 '18 at 0:53
@user3783243 yes sir! ive seen that manual but as ive said i also tried that syntax, but sadly nothing is being shown
– Uzumaki Minato
Dec 30 '18 at 0:56
Nothing in the error logs? Can you update the question with the code you tried?
– user3783243
Dec 30 '18 at 6:02
Possible duplicate of How to create SQL Join Statement in Laravel Controller
– user3783243
Dec 30 '18 at 6:59
@user3783243 sir i've done the code its fetching the data now with join . but lastly i want to make the program clean so i have a submit and textbox so when i input1
then the data will fetch here please answer here [my last problem] (stackoverflow.com/questions/53975715/…)
– Uzumaki Minato
Dec 30 '18 at 7:04
|
show 2 more comments
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
php mysql sql laravel laravel-5
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
php mysql sql laravel laravel-5
php mysql sql laravel laravel-5
asked Dec 30 '18 at 0:50
![](https://lh5.googleusercontent.com/-P6zYUPw8C0I/AAAAAAAAAAI/AAAAAAAAAAA/AKxrwcbTYvyMv1rIUqKPCYNLbLGndCQgLA/mo/photo.jpg?sz=32)
![](https://lh5.googleusercontent.com/-P6zYUPw8C0I/AAAAAAAAAAI/AAAAAAAAAAA/AKxrwcbTYvyMv1rIUqKPCYNLbLGndCQgLA/mo/photo.jpg?sz=32)
Uzumaki MinatoUzumaki Minato
64
64
Have you looked at the laravel manual yet? If not I'd start there, laravel.com/docs/5.7/queries#joins. If you have you should add what you tried that didn't work.
– user3783243
Dec 30 '18 at 0:53
@user3783243 yes sir! ive seen that manual but as ive said i also tried that syntax, but sadly nothing is being shown
– Uzumaki Minato
Dec 30 '18 at 0:56
Nothing in the error logs? Can you update the question with the code you tried?
– user3783243
Dec 30 '18 at 6:02
Possible duplicate of How to create SQL Join Statement in Laravel Controller
– user3783243
Dec 30 '18 at 6:59
@user3783243 sir i've done the code its fetching the data now with join . but lastly i want to make the program clean so i have a submit and textbox so when i input1
then the data will fetch here please answer here [my last problem] (stackoverflow.com/questions/53975715/…)
– Uzumaki Minato
Dec 30 '18 at 7:04
|
show 2 more comments
Have you looked at the laravel manual yet? If not I'd start there, laravel.com/docs/5.7/queries#joins. If you have you should add what you tried that didn't work.
– user3783243
Dec 30 '18 at 0:53
@user3783243 yes sir! ive seen that manual but as ive said i also tried that syntax, but sadly nothing is being shown
– Uzumaki Minato
Dec 30 '18 at 0:56
Nothing in the error logs? Can you update the question with the code you tried?
– user3783243
Dec 30 '18 at 6:02
Possible duplicate of How to create SQL Join Statement in Laravel Controller
– user3783243
Dec 30 '18 at 6:59
@user3783243 sir i've done the code its fetching the data now with join . but lastly i want to make the program clean so i have a submit and textbox so when i input1
then the data will fetch here please answer here [my last problem] (stackoverflow.com/questions/53975715/…)
– Uzumaki Minato
Dec 30 '18 at 7:04
Have you looked at the laravel manual yet? If not I'd start there, laravel.com/docs/5.7/queries#joins. If you have you should add what you tried that didn't work.
– user3783243
Dec 30 '18 at 0:53
Have you looked at the laravel manual yet? If not I'd start there, laravel.com/docs/5.7/queries#joins. If you have you should add what you tried that didn't work.
– user3783243
Dec 30 '18 at 0:53
@user3783243 yes sir! ive seen that manual but as ive said i also tried that syntax, but sadly nothing is being shown
– Uzumaki Minato
Dec 30 '18 at 0:56
@user3783243 yes sir! ive seen that manual but as ive said i also tried that syntax, but sadly nothing is being shown
– Uzumaki Minato
Dec 30 '18 at 0:56
Nothing in the error logs? Can you update the question with the code you tried?
– user3783243
Dec 30 '18 at 6:02
Nothing in the error logs? Can you update the question with the code you tried?
– user3783243
Dec 30 '18 at 6:02
Possible duplicate of How to create SQL Join Statement in Laravel Controller
– user3783243
Dec 30 '18 at 6:59
Possible duplicate of How to create SQL Join Statement in Laravel Controller
– user3783243
Dec 30 '18 at 6:59
@user3783243 sir i've done the code its fetching the data now with join . but lastly i want to make the program clean so i have a submit and textbox so when i input
1
then the data will fetch here please answer here [my last problem] (stackoverflow.com/questions/53975715/…)– Uzumaki Minato
Dec 30 '18 at 7:04
@user3783243 sir i've done the code its fetching the data now with join . but lastly i want to make the program clean so i have a submit and textbox so when i input
1
then the data will fetch here please answer here [my last problem] (stackoverflow.com/questions/53975715/…)– Uzumaki Minato
Dec 30 '18 at 7:04
|
show 2 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53974492%2flaravel-sql-query-join-statement-convert-php-syntax-to-laravel-syntax%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53974492%2flaravel-sql-query-join-statement-convert-php-syntax-to-laravel-syntax%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
DMrtI3f84A,df9XfG,xo1ocSSEo,ckNEEg,4z7,kJo,I0Co
Have you looked at the laravel manual yet? If not I'd start there, laravel.com/docs/5.7/queries#joins. If you have you should add what you tried that didn't work.
– user3783243
Dec 30 '18 at 0:53
@user3783243 yes sir! ive seen that manual but as ive said i also tried that syntax, but sadly nothing is being shown
– Uzumaki Minato
Dec 30 '18 at 0:56
Nothing in the error logs? Can you update the question with the code you tried?
– user3783243
Dec 30 '18 at 6:02
Possible duplicate of How to create SQL Join Statement in Laravel Controller
– user3783243
Dec 30 '18 at 6:59
@user3783243 sir i've done the code its fetching the data now with join . but lastly i want to make the program clean so i have a submit and textbox so when i input
1
then the data will fetch here please answer here [my last problem] (stackoverflow.com/questions/53975715/…)– Uzumaki Minato
Dec 30 '18 at 7:04