I made a similar function for an application, except it was a multidimensional array that contained data on table name, column name, row ID, and a type for each piece of data.
I never typed out the actual 'data', the application took input/output in this form. It was much easier to create the functionality for multiple databases and also different views on the application. Basically every table had a counterpart "view" mode for the application- it could a number of different views. Every piece of data in the table was used by the view controller- which only asked for data- not "mysql" or any other specific database.
I would use MySQLi extension for this, and why are you still using <font> tags???? For real, that's so 10 years ago

Originally Posted by
Ron
PHP Code:
<?php
// db() has all mysqli functions.
$db = new db();
$db->conn();
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$username = cleanfordb($username);
// other sanitization functions here
$db->q("INSERT INTO users (username, password, email) VALUES ('$username', md5('$password'), '$email');");
$db->close();
echo "Registration successful.";
?>
I hate to say it, but you're not using a good example of OOP or MySQLi.
If you must make a flaming point, try this:
PHP Code:
$db = new mysqli('host', 'user', 'pass', 'db_name');
if($stmt = $db->prepare('INSERT INTO users (username, password, email) VALUES(?,?,?)') )
{
$stmt->bind_param('sss', $_POST['username'], md5($_POST['password']), $_POST['email']);
$stmt->execute();
$stmt->close();
}
$db->close();
By flaming I mean, you said his 6 minutes of code lacks a point. It must serve some purpose to him