Search the Community
Showing results for tags 'mysql'.
-
I'm trying to insert data into a MySQL table using PHP, but I'm encountering some issues. I have a form where users can input their information, and upon submission, the data should be added to the MySQL database. However, I'm not sure how to structure the PHP code for the insertion process. Here's what I have so far: <?php // Database connection credentials $servername = "localhost"; $username = "your_username"; $password = "your_password"; $dbname = "your_database"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // Assuming we have form data in variables (e.g., $name, $email, $age) $name = $_POST['name']; $email = $_POST['email']; $age = $_POST['age']; // SQL query for inserting data into the table 'users' $sql = "INSERT INTO users (name, email, age) VALUES ('$name', '$email', '$age')"; if ($conn->query($sql) === TRUE) { echo "Data inserted successfully!"; } else { echo "Error: " . $sql . "<br>" . $conn->error; } // Close the database connection $conn->close(); ?> When I try to submit the form, the data is not being inserted into the database, and I'm not seeing any error messages. Could someone please review my code and point out what I might be doing wrong? Any help or suggestions would be greatly appreciated. Thank you!
-
I am looking to create a google feed for my instance of osCommerce. However, I have the ultimate SEO URL's 5 installed on my 2.3.1 instance. How do I get the product URL's for each product at they are not stored in the database in the products table? Any help would be appreciated.
-
Native MySQL extension is slightly faster than the improved MySQLi extension, but the latest more stable and have more features. This addon simply replicate the default database function, so you don't have to worry that you need to edit many files. The installation process as easy as uploading a file (database_mysqli.php) and edit one line in application.top.php. As a bonus, this addon add new tep_db_multi_query function (see: mysqli.multi-query.php), so now you can make multi query in one call. Sample of using "tep_db_multi_query" can be found in the archive. Download it here: http://addons.oscommerce.com/info/8168 Best, @zaenal