Skip to content
Advertisement

Tag: mysql

How to update mysqli field if the value is not empty

I am trying to update a specific value from my table getting them as row from a table let’s say the name but the problem is the image, cause i can’t pass a value to an input field type = file I need to update the value in the database only if there is a value to change if not

SELECT from database when i donĀ“t know position of null values

Good afternoon. I need your help to make correctly query into database. I have following table in DB with adresses, eg. id street house_nuber city district 1 First street 1225 City One NULL 2 NULL 25 Small city NULL 3 Second street 51 Roswell District nine 4 Third street 15963 Last city Another district In the table above you can

SQL query to update item quantity using PHP PDO

Good morning everyone I am trying to update the table with the new quantity selected, when I run the following function, however, I get this error: Function to update the quantity, function_products.php: product_update_process.php What could be the issue here? Thanks for your assistance. Answer To add to @TangentiallyPerpendicular’s comment, why are you binding to :orderedQuantity? This variable is not being

Get Count For A Set Of Fetched Field Values – MySQL / PHP

I have some data returned from a MySQL database that outputs the post details for a particular user. I’d like to output a count for the number of images (represented below by the $db_image_filename value). How do I get a count for the number of field values in a column? I thought I could use PHP’s count() function, but this

How to get array in array with laravel and mysql database?

I am using Laravel (PHP) and MySQL for my backend. I am creating methods for setting and getting information from the database. Those information are being send as a json to the frontend. I can send table information like: For this I am using laravel methods like: DB::table(‘user’)->select(‘user.id’, ‘user.name’)->get(); However my friend who is doing the frontend want the following

How can I update json column with a correct data type with PDO?

I have MySQL 5.7 and a query with PDO: But after it I’m having: id data 1 {“old_field”: 2, “new_field”: “1”} Why does my new value have a string type? Expected table: id data 1 {“old_field”: 2, “new_field”: 1} I have success without using PDO(JSON_OBJECT(‘new_field’, 1)), but I have a string type with using placeholders. Answer When you pass an

Advertisement