Skip to content

Tag: mysql

avoid same numbers and zero in array

I have a form with that table: jsfiddle In this form i need to enable to edit the number fields. After submit i collect the data and write to mysql. Before mysql insert i want to check that the $number array does not contain the same numbers and zero (like: 0,1,1,101,150). If yes give an error to the user tha…

Decimal are converted to String in Laravel, cast is not working

I have a problem changing data type column in my table, from double to decimal each (6,2). Olso trying to $cast the variable to float, I’ve tried to cast olso as decimal, but nothing change, nothing change: if I dd $this in my resource I got this: The data back to be a number only if I rollback the data

Race condition with multiple updates PHP & MySQL

I have a table called cards, Each user can create/have multiple cards. One of the cards must be set as default. Sometimes when a user performs multiple requests to set another card as default at the same time, In the end, There are two or more default cards. Initial table: id user_id is_default 1 50 0 2 50 1 …

Is there a way to decrypt a NULL text?

I am new to phpmyadmin and mysql. I have created a localhost WordPress community website where users can upload posts. I need to get access at the text of every post they upload via phpmyadmin because I want to connect the website with an android app. What I can’t figure out is why the text field is sho…

User Redirection accordingly an enum input. PHP code

I’m trying to redirect the logged-in user to a different page according to the enum input was stored at db. I was trying those lines, but it always redirects me at pro.php. How can I do this with the right way? What is the issue with the code? Here is my table definition: # Name Type Null Default 1 id