Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,213 members, 7,815,238 topics. Date: Thursday, 02 May 2024 at 09:27 AM

PHP Programmers, Please Help - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / PHP Programmers, Please Help (568 Views)

Programmers, Please Your Golden Advise Is Needed / Programmers, Please Recommend A Good Laptop For Me. / Need Professional Php Programmers For A Project, Money Involved (2) (3) (4)

(1) (Reply) (Go Down)

PHP Programmers, Please Help by AllyPolly: 7:24am On Oct 16, 2021
Modified , I have attached link to the program codes to this post - Google drive , nairaland didn't allow txt file containing SQL query. l

I have an issue that I can't seem to find solution to for 3 days now.

Please help!

Overview : This a product rating / review system for a test website.

In the first screenshot below, the query on line 54 runs well.

In the second screenshot, I tried to get a value from a form in the previous page as use it as a variable in the query, then the query will not work.

The third screenshot, I realized that the if I put the codes such as below anywhere in the code, then the query won't work(including line 54 that was working before, and it doesn't return any error.

$work_id = $_POST['work_id'];


Link to the program file

Index
https://drive.google.com/file/d/1il156QZR3aWrCTg8q6rVCChvNWTD7YwO/view?usp=drivesdk

Submit rating
https://drive.google.com/file/d/1ibuXPrDmPYaIm5iLCxjImZjtZNJN3JNx/view?usp=drivesdk

Re: PHP Programmers, Please Help by Mrchusenvessel(m): 7:55am On Oct 16, 2021
Comment out the other part of the code, First is to know if the form is getting submitted, try to echo something out if submit is successful e.g echo "form submitted"

Or you can just return "form submitted";

Without commenting out anything

If unsuccessful, fix the form submit or the action path maybe.

If successful

Try to know if you're getting anything for $_POST ['work_id'], echo it

Or just echo Json_encode all the post it's getting, see it work_id is posted

If it's not working go to your form and fix the name probably

If all the above work correctly, then it's your sql statement most likely

Use a try catch to catch the exception abi na error you dey call am

Submit your code if nothing works for you make I help you check am...

Shalom
Re: PHP Programmers, Please Help by AllyPolly: 8:07am On Oct 16, 2021
Mrchusenvessel:
Comment out the other part of the code, First is to know if the form is getting submitted, try to echo something out if submit is successful e.g echo "form submitted"

Or you can just return "form submitted";

Without commenting out anything

If unsuccessful, fix the form submit or the action path maybe.

If successful

Try to know if you're getting anything for $_POST ['work_id'], echo it

Or just echo Json_encode all the post it's getting, see it work_id is posted

If it's not working go to your form and fix the name probably

If all the above work correctly, then it's your sql statement most likely

Use a try catch to catch the exception abi na error you dey call am

Submit your code if nothing works for you make I help you check am...

Shalom

Thanks for your response,

The form is getting submitted in the database actually.

I also echoed : $_POST['work_I'd] and I got a response, the issues comes when I try to use it as a variable in the query. Then it won't work. This is a big headache for me!

Link to the program file

Index
https://drive.google.com/file/d/1il156QZR3aWrCTg8q6rVCChvNWTD7YwO/view?usp=drivesdk

Submit rating
https://drive.google.com/file/d/1ibuXPrDmPYaIm5iLCxjImZjtZNJN3JNx/view?usp=drivesdk

Re: PHP Programmers, Please Help by stanliwise(m): 8:40am On Oct 16, 2021
AllyPolly:
I have an issue that I can't seem to find solution to for 3 days now.

Please help!

In the first screenshot below, the query on line 54 runs well.

In the second screenshot, I tried to get a value from a form in the previous page as use it as a variable in the query, then the query will not work.

The third screenshot, I realized that the if I put the codes such as below anywhere in the code, then the query won't work(including line 54 that was working before, and it doesn't return any error.

$work_id = $_POST['work_id'];

Why not use a var_dump($connect); die;

After you make the query
And see what happened to the connection

Also you could add an if clause just incase $result was false
You’re making some assumptions in your code
First
you’re thinking $result would always be an array

secondly you’re thinking
$connect->query() always would run successfully.
Re: PHP Programmers, Please Help by Mrchusenvessel(m): 4:20pm On Oct 16, 2021
AllyPolly:


Thanks for your response,

The form is getting submitted in the database actually.

I also echoed : $_POST['work_I'd] and I got a response, the issues comes when I try to use it as a variable in the query. Then it won't work. This is a big headache for me!

Lol... fixed yet? submit your code, you probably didn't turn on error reporting
Re: PHP Programmers, Please Help by AllyPolly: 4:44pm On Oct 16, 2021
Mrchusenvessel:


Lol... fixed yet? submit your code, you probably didn't turn on error reporting
No, please how can I do that?

I sent u a pm
Re: PHP Programmers, Please Help by AllyPolly: 4:48pm On Oct 16, 2021
stanliwise:

Why not use a var_dump($connect); die;

After you make the query
And see what happened to the connection

Also you could add an if clause just incase $result was false
You’re making some assumptions in your code
First
you’re thinking $result would always be an array

secondly you’re thinking
$connect->query() always would run successfully.

Nothing seem to be working sad
Re: PHP Programmers, Please Help by stanliwise(m): 6:16pm On Oct 16, 2021
AllyPolly:


Nothing seem to be working sad
When you dump $result what happened?
Was it an array?
You also didn’t show use the dump of $connect
After you pushed the query
Re: PHP Programmers, Please Help by Iambro(m): 6:41pm On Oct 16, 2021
"SELECT * FROM review_table WHERE work_id = 'work_id'"
Re: PHP Programmers, Please Help by femmix112(m): 9:28pm On Oct 16, 2021
Where is the connection file you didn't include any connection file
Re: PHP Programmers, Please Help by Nobody: 6:35am On Oct 18, 2021
Has it been solved?
If NO, the problem actually is that MariaDB does not support that syntax(I mean concatenating) due to some problems

WhatsApp 08122647016 for better communication
Re: PHP Programmers, Please Help by AllyPolly: 3:39am On Oct 19, 2021
Nurudeen06:
Has it been solved?
If NO, the problem actually is that MariaDB does not support that syntax(I mean concatenating) due to some problems

WhatsApp 08122647016 for better communication

Update
After 6 days of trying, my boss here took it upon himself to make it work. You are God sent sir, and may God bless you. Even when I wanted to give up on the project, you said 'no, it must work', and you made it work!

Thanks so much smiley
Re: PHP Programmers, Please Help by AllyPolly: 3:42am On Oct 19, 2021
Mrchusenvessel:


Lol... fixed yet? submit your code, you probably didn't turn on error reporting
Thanks to this boss also, you really tried on my case, no be small. I really appreciate, and may God reward you abundantly.

(1) (Reply)

Web Developer Newbie And Mathematics / Here Are Some Creative Ways You Can Money With Chat GPT / Engineering is still science

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 33
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.