Skip to content

Handle empty variable in a prepared statement

Sometimes my script receives a $_POST[“is_searchfield”] request from a form. Then I want to use this variable as a part of a “Where” clause of a MySQL query. Otherwise this part of the “Where” clause shouldn’t afflict the rest of the query. For the query I use a prepa…

PHP script does not execute the MYSQL command

I want to update price on invoice with this PHP code (the config file is included, more SQL statements are executed above this): full code (html form): Whole script and things around are working, but the MYSQL exec. isnt working for some reasons (no errors at all) Answer This: should be: Don’t put param…

Subscript in PHP and Loops

I am using ACF and PHP to create a WordPress website currently working through basically a loop and looking to connect a subscript and a tag by an ID that needs to have a counter increment on it so that the ID can change from #footnote-top-1 to #footnote-top-2, #footnote-top-3, etc and have the link also chan…

POST variable verification

I want to build a simple discount system. My idea is something like this: user will enter code & I want to verify it with PHP & update the price on the invoice (can do this part, that’s why i …

Show the users that I liked using Laravel

I’m working on a small project using Laravel, and I would like to create a like and dislike system, so a user can like one to many more users. I already have a table called Users (default by Laravel), now I have created another table called favorite_user with id, user_id and liked_the_user. How can I ge…

HTML button not selecting correct form value

HTML button not selecting correct form value. The following code selects data and displays it correctly in a html table: fname, lname , customer_id and the last column in the table shows a button …