180 likes | 426 Views
MySQL / PHP. Steven Gangwisch. MySQL. MySQL is a multithreaded, multi-user, SQL Database Management System (DBMS) with more than six million installations. Most popular open source database MySQL available as free software under the GNU General Public License (GPL)
E N D
MySQL / PHP Steven Gangwisch
MySQL • MySQL is a multithreaded, multi-user, SQL Database Management System (DBMS) with more than six million installations. • Most popular open source database • MySQL available as free software under the GNU General Public License (GPL) • Acts as the database component of the LAMP (Linux-Apache-MySQL-PHP/Perl/Python) and WAMP platforms (same but utilizes Windows OS) • Works on many different platforms
MySQL cont. • "MySQL" is officially pronounced as "My Ess Queue Ell“ not "My sequel“ • Very Reliable • MySQL is the de-facto standard for high-traffic web sites because of its high-performance query engine, tremendously fast data insertion capability, and strong support for specialized web functions like fast full-text searches
PHP • Hypertext Preprocessor (1997) • Originally Personal Home Page Tools • PHP generally runs on a web server, taking PHP code as its input and creating Web pages as output. • PHP is one of the most popular programming languages for implementing websites with over 20 million Internet domains using PHP
PHP cont. • A Few Ex. • <? Echo “hello world”; ?> • @mysql_connect('localhost', ‘table_name', ‘password') or die('Cannot connect to MySQL server'); • @mysql_select_db(‘database_name'); • mysql_query("select * from table order by col_name DESC Limit 0, 10"); • A few uses: • Validate and Process form data • Create dynamic web pages • Process data from DB and output into HTML
My experience with PHP / MySQL • Website creation. www.tablaunch.com • Tablaunch – a website with a database full of guitar, bass, and drum tablature; intended audience: music fans, guitar, bass, and drum players. • My web server is a dedicated server that utilizes the Linux OS.
Search query • while (list(, $query) = each($newq)) { • if($t == "0"){ • $rel = "($tot * MATCH ($s) AGAINST ('$query'))"; • $search = "`$s` LIKE ('%$query%')"; • }else{ • $rel .= " + ($tot * MATCH ($s) AGAINST ('$query'))"; • $search .= " and `$s` LIKE ('%$query%')"; • } • $t++; • } • $sql = mysql_query("SELECT artist, song, type, crate, ratetotal, $rel as score FROM `tabs` WHERE $search $sort ORDER BY score DESC, `artist` ASC, `song` ASC LIMIT $from, $max_results"); • $total = mysql_query("SELECT id FROM `tabs` WHERE $search $sort");