I have a very simple question I want to know the id of the last query that I inserted in my MySql DB. It’s safe and efficient to use mysqli_insert_id() and if not what should I use? Answer Yes, it’s the recommended way to retrieve an ID value generated by an insert when using auto-increment. But i…
Tag: mysql
insert query mysql throws PDO::exec() expects exactly 1 parameter, 2 given
I’ve pieced together some code I’ve gleaned from the internet: I’m trying to scan a directory to insert file names and index into MariaDB table. My last hurdle it seems is this PDO error: PDO::exec() …
How do I get data from another table in MySQL?
I’m currently trying to link some databases up for a project I’m working on for my business. Here’s my below SQL I’m using for my PHP website. At the moment my output goes like this to show what’s in each row using e.g. $lname=$lname[“variable”] I have another “…
PHP trying to simply a repetitive script involving rowsets
I’m trying to simplify a repetitive script that I’m doing in PHP. I’ve looked at a few loop options but since it involves rowsets being returned from a MySQL stored procedure it’s not acting properly. I’m doing this same script about 15 times to return all the data. Ultimately I&…
PHP, MySQL date calculations
I’m trying to add a number of weeks to date, both will be taken from a database, I successfully fetch both needed but I can’t figure out how to make the calculations. So far I tried with “strtotime” but it gave me some weird results How do I do this the right way? The desired result sh…
PHP – Loop through UNION ALL query and add custom text once after the last item per category
I have a union query which joins several categories. I want to include the link after the last item of the category. The query goes like: … the result is The output should be like this: Here is the loop thanks to user @Luuk, but now I would like to include a link after the last item from the category.
How to have only 3 checkboxes per line with dynamic checkbox number
How to have only 3 checkboxes per line with dynamic checkbox number, for example I have 21 checkboxes (read checkbox name form a database). This is my code I have the following situation But I would like to have only 3 checkboxes per line, for example the 3 with black dot on the first line, the 3 with the red
PHP MYSQL Displaying the same data from table to another page
Asset Approval List is a table with lots of row of data and a button, after clicking the button, it will link to Asset Approval Form. I would like to fetch the data from the same row in Asset Approval List to my Asset Approval Form. The data in the table of Asset Approval List is fetched from mysql phpmyadmin…
MySQL select query and PHP convert as nested JSON object
I am try to retrieve unique object with nested object property and value, is there a possible way to retrieve as json object key and their child property and value SELECT id,name,year FROM `…
Displaying same message for both save and submit after updating data into database in php [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year. Improve this question Hi iam updating the form in php. I have two buttons like save and submit button. Need to displ…