About 996,000 results
Open links in new tab
  1. Loading .sql files from within PHP - Stack Overflow

    Sep 29, 2008 · The simplest solution is to use shell_exec() to run the mysql client with the SQL script as input. This might run a little slower because it has to fork, but you can write the code in a couple of minutes and then get back to working on something useful. Writing a PHP script to run any SQL script could take you weeks.

  2. How to execute an SQL query and fetch results using PHP

    Apr 18, 2022 · In this article, we will discuss how to execute an SQL query and how to fetch its result? We can perform a query against the database using the PHP mysqli_query() method. Syntax: We can use the mysqli_query( ) method in two ways: Object-oriented style; Procedural style; Parameters: connection: It is required that specifies the connection to use.

  3. How to run PHP programs - GeeksforGeeks

    Apr 14, 2025 · To run PHP programs, you need to set up a suitable environment, either locally or on a live web server. For local development, you can install server packages like XAMPP, WAMP, or MAMP, which provide PHP, Apache, and MySQL in one installation.

  4. Empower Your Database: Execute SQL Files in PHP with Precision

    Jul 31, 2022 · One of the simplest ways to execute SQL files in PHP is by leveraging the MySQL command-line tool. You can use the shell_exec() function to execute shell commands and pass the SQL file to the MySQL command-line tool.

  5. Running MySQL *.sql files in PHP - Stack Overflow

    Oct 27, 2010 · You should run your .sql script in PHP by invoking the mysql tool, for instance with shell_exec(). I got this test working: $command = "mysql --user={$vals['db_user']} --password='{$vals['db_pass']}' " . "-h {$vals['db_host']} -D {$vals['db_name']} < {$script_path}"; $output = shell_exec($command . '/shellexec.sql');

    Missing:

    • Projects

    Must include:

  6. Build a PHP & MySQL CRUD Database App From Scratch

    Connect to a MySQL database with PHP using the PDO (PHP Data Objects) method. Create an installer script that creates a new database and a new table with structure. Add entries to a database using an HTML form and prepared statements. Filter database entries and print them to the HTML document in a table.

  7. Voxold/PHP-Mini-Projects-Collection - GitHub

    Import the provided SQL files located in the /database folder into your MySQL database. Configure database connection settings in each project's config.php file. Run the project on your local PHP server.

  8. A Practical Guide to Using SQL Server with PHP

    Jun 19, 2024 · This comprehensive guide will explore how PHP can interface with SQL Server, starting from the basics and covering essential aspects such as connecting to a SQL Server database, executing queries, and handling data efficiently.

  9. Basic Usage of SQL Server in a PHP Application

    Oct 18, 2023 · In this article, we’ve covered the basic usage of SQL Server in a PHP application. You’ve learned how to connect to a SQL Server database, execute SQL queries for data manipulation, retrieve data, update records, and delete records.

    Missing:

    • Projects

    Must include:

  10. Execute Sql Script From a File Using PHP – Luca Corbo

    Jun 4, 2008 · The code below allows to retrieve and execute all SQL statements defined in a SQL script file removing all comments.

  11. Some results have been removed