I have a query… if the $id is empty or null, then I need to get all data from table where id is not null I already tried like following, But looking for the better solution without if condition, because I have lot of and conditions Thanks in advance… Answer Thank you so much @Akina for the comment… Here is
Tag: php
Trying to save drop-down menu to database using PHP
I have a form which has drop-down when I try to save the form to database using PHP the other fields are storing in the database but the select drop-down menu is not storing in the database it throws …
php mssql next row
I need some advice how to get the next value of a row with while loop in php-mssql. same articles My code:
How to assign random session key to visitor who visit the website in PHP?
I have not much experience in PHP. i am creating a shopping store in PHP where a visitor can add item into cart without creating account (as guest). so i just want to assign him a unique id or key for add to cart process. so how can i assign him a random key when he visit the website? Answer
Displaying Separate Column Values with PHP
I’m currently trying to link up database names with image filenames, and I’ve been successful in doing this so far. However, when I try to put these names on-top of an image, it only takes the last …
how get random questions from database include Categories?
Hallo i try to make a simple quiz application in php based on math tests from many years. I have database with such columns: -id -pytanie -a -b -c -d -poprawna -rok_id -typ_id I use rand function to get random id and next i use this in sql answer to get random question. However id dont know how get radnom
Seperate integer into character PHP
i try to make scoresheet where $row[“first”]=756987 show Math 7, Biology 5, Sport 6, Sociology 9, Chemist 8, English 7 but it keep showing all 7 can someone help solve this and show some example appreciate your help Answer Use str_split() and list() method for your use case, example below: Docs list() : https://www.php.net/manual/en/function.list.php str_split() : https://www.php.net/manual/en/function.str-split
Having trouble wrapping my head around how to write a particular loop
I am querying a SQL database to return open work order operations. My query is producing the Work Order number, operation status and due date. I am trying to figure out how to iterate through the array that is returned and: Gather the sum of operations due within a week Gather the sum of operations due in the second week
Can’t add row in sql server because of date
I have a web application where I need to insert data in my SQL Server table, the problem is that I have this error in my Apache log: General error: 241 Conversion failed when converting date and/or time from character string. I have the same error when I try directly inside ms sql server. There is my php code :
converting datetime field to date in sql query in laravel contorller
i have to execute an sql query into laravel controller the query inclueds where caluse in which it compares a field from database which is in datetime type with another field that i get from the blade which has a date type, so i have to convert the database field from datetime type to date type this is my query