I have problem to define the barcode number as the primary key at Item table. Previously I use the usual ID as the primary key. Schema::create(‘items’, function (Blueprint $table) { $table->…
Tag: mysql
Extracting a pack size from a column with mixed formats
I have a column pack_size in a table called product_master_test. The problem that I am facing is that the pack_size is in mixed formats, there is no uniformity to it. For example: 4 x 2kg (pack …
Backslash in json_encode (PHP) + JSON_ARRAYAGG (mySQL)
The problem is the backslashes with the quotes in the array colors. I think it’s because the JSON_ARRAYAGG but I don’t know how to print a correct json. Query: PHP: OUTPUT: Answer You are encoding colors twice. First in SQL and then in PHP. What you can do is either decode colors in PHP before you…
How to store my session array into my database
How do I store my data in session array into my database ? Upon entering the product and its quantity, the user will be directed to a checkout page. In the checkout page, upon filling up the necessary …
chose another column if the first column is null
how to chose another column if the first one is null i have users table who have email phone and other data i have registration form built with php what i want is check if user insert an email or …
How to update a database using php by uploading a CSV file?
I have some code here to update my database based on two columns in the CSV. The CSV file would look like this: ID Response 1 Hello1 2 Hello2 3 Hello3 In my database I have a table that also …
How can I join two tables apropreately in (My)SQL?
I need to join two tables together. I know, that there’s a JOIN in MySQL, but those results I’ve got weren’t that good for my purpose. Example: Say, I have two tables: a = {[1, 2]} {[3, 4]} b = …
Displaying data from mysql from datepicker
I need some suggestions/help with my code. Code: Start Date <input type='text' class='dateFilter' name='fromDate' value='<?php if(isset($…
How to fill blank array with in loop using PHP
I want have two tables in mysql “taxiInfo” and “booking”,Now i just want to show/fetch status of every taxi (whether every taxi is “booked” or “aviliable” ), Here is my table “taxiInfo” id …
Can’t connect to MySQL with PDO
I’m following this tutorial, I’m currently around minute 04:00 and I want to make a connection with my MySQL database through PDO. But my webpage will always give “Could not connect.” when I’m trying …