![]() |
Hi guys,
I have a sql file exported from phpMyAdmin. Is there a way to import this file via the CI database classes? I tried reading the contents and then running it via simpleQuery() but it threw an exception.
See https://forum.codeigniter.com/showthread.php?tid=63410
The code is for CI3, but it can be ported to CI4 easily.
Thanks, it looks rather messy, so I found a library that can restore a sql file. If someone else reads this in the future, try https://github.com/ifsnop/mysqldump-php
It seems the package does not provide feature to import.
But there is a sample code to import: https://github.com/ifsnop/mysqldump-php/...p-from-php (02-05-2024, 05:06 PM)kenjis Wrote: It seems the package does not provide feature to import. There's no documented example but there is a "restore" function in the class which looks to use to incorporate that same code. The readme says one of the features is: Code: can restore a dump from a file, when no mysql executable is available. I was able to use it to restore a dump. |
Welcome Guest, Not a member yet? Register Sign In |