I have a small php project with OOP. I have 3 Klasse that represent the Objects User.php Transaction.php and BankAccount.php. They work fine if I’m in the index.php but as soon i go to an other site it states: The project structure is like this app/public models Database.php User.php Transaction.php Ban…
Tag: mysql
Updating multiple tables in SQL using an Array
Currently I had a table called crm_leads for my Leads page where I already have many records. Now for the same page I have created few new fields which is now going to be stored in another table called crm_leads_details. Now I’m storing all my POST values in an array format like so: Now in my model I…
Refactor database schema on migration
This is my initial migration Now, the easy time ended and now I have to move name and phone to customer table. This is my create customer migration. I don’t know where to do this operation so I just throw all in the migration. And alter order migration Now I’m stuck with empty customer_id. I have …
MySQL split table amounts based on another table information
I need to split amounts in a table (transactions) accord to another related table information (bill_details). Base table (transactions): ID amount document_id 1 100.00 11 2 80.00 12 3 120.00 13 Another table (bill_details): ID amount document_id description 1 20.00 11 A 2 60.00 11 B 3 20.00 11 C 4 80.00 12 D …
Yiimp: CDbException: CDbConnection failed to open the DB connection. error when hasGetInfo is set to false
I’m getting the CDbConnection failed to open the DB connection error. The thing is, my database connection seems to be okay, as evident from the fact that the YIIMP logs display the retrieved values that I print out (see the text in the yiimp-logs/debug.log). I haven’t modified the YIIMP source co…
Alphabetic ordering for names
I have been struggling with this for almost 2 days now and i just can not get it to work myself. Basically my goal is to make a list from A to Z, with values from a database. Example: Now my php code looks like this: Now, it does work when i put strings inside the array and remove the
IlluminateDatabaseQueryException SQLSTATE[HY000] [2002] No such file or directory but migrations works [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 months ago. Improve this question first time I ask via the web, but I don’t know what I can do anymor…
PHP MySQL GET RESULT from INSERT INTO IF NOT EXIST
I know how to do INSERT INTO if the record doesn’t exist. But if it does exist, mysql doesn’t treat it as an error. It just treats it as 0 rows inserted. I want to know if that was the case and return that message to the user that the data they submitted already exists. I know I can do
Doctrine ORM: Ignore all events with persist and flush
I’m working on a system which uses doctrine/orm 2.6 (PHP 7.1 & MySQL 5.7) and am trying to update a large number of entities using the following code: The issue I’m running into is that the entities have lots of lifecycle events registered (preUpdate, prePersist, postUpdate, postPersist), and …
How to disable edit function when database signed=1 in php
if I want to disable the edit when database signed=1, how to change it? Thank you. Answer You need to add the condition if ($row[‘signed’] !=1){ …. } so that the system can allow editing (or not) Hence Change to