Working with databases UPDATE
Due to the fact that the mysql_connect extension is deprecated as of PHP 5.5.0, and will be removed in the future ref: http://www.php.net/manual/en/function.mysql-connect.php
here is an update using the MySQLi extension:
function query($query) {
$database = $this->options['database'];
$host = $this->options['host'];
$username = $this->options['username'];
$password = $this->options['password'];
$link = mysqli_connect($host,$username,$password, $database);
if (!$link) {
die(mysqli_error());
}
$result = mysqli_query($query);
mysqli_close($link);
return $result;
}
that's it, simple and neat ;)
The "Working with databases is a user contribution and not maintained by me. The wiki is user editable, so if you like, you can either update an existing article or add a new one. Thanks!
I've added a sample as official doc: https://github.com/blueimp/jQuery-File-Upload/wiki/PHP-MySQL-database-integration
I do not mind to hold credit, but a simple mention would be nice. ;)
greetz
2013/9/12 Sebastian Tschan [email protected]
I've added a sample as official doc:
https://github.com/blueimp/jQuery-File-Upload/wiki/PHP-MySQL-database-integration
— Reply to this email directly or view it on GitHubhttps://github.com/blueimp/jQuery-File-Upload/issues/2587#issuecomment-24340267 .
I always give credit where credit is due, but I didn't use any of your code. First, the code I pasted into the new doc was taken from a customization project which I implemented last week. Second, your code uses the procedural style, while the code I used makes use of the object-oriented interface. See also: http://mx2.php.net/manual/en/mysqli.quickstart.dual-interface.php
I think database is a good way to save additional properties,also convenient for search.But a question,If you use databae store file information,I think when load download files("get" method), no need to scandir first and then get additional properties from database,just get all the properties from database at one time,how do you think @blueimp
Yeah, certainly. The version found in the wiki is just a sample and I've deliberately kept it close to the original files. Since the Wiki is used editable, feel free to improve on it, as long as you keep the object oriented style and don't introduce any security issues.