Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Install like database tables
- // Lets grab the database info
- define('LAZ_INCLUDE_PATH', dirname(__FILE__));
- require_once LAZ_INCLUDE_PATH.'/admin/config.inc.php';
- //
- // Now we connect to the MySQL server and select the database
- //
- if ($dbc = @mysql_connect ($GB_DB['host'], $GB_DB['user'], $GB_DB['pass']))
- {
- if (!@mysql_select_db ($GB_DB['dbName'], $dbc))
- {
- die ('<p>Could not select the database because: <b>'.mysql_error().'</b></p></div></body></html>');
- }
- }
- else
- {
- die ('<p>Could not connect to MySQL because: <b>'.mysql_error().'</b></p></div></body></html>');
- }
- //
- // End of MySQL database information check
- //
- // Set the prefix for the table names
- define('LAZ_TABLE_PREFIX', $table_prefix);
- $sqlQuery[] = "CREATE TABLE " . LAZ_TABLE_PREFIX . "_likes (
- `id` smallint(10) NOT NULL AUTO_INCREMENT,
- `ip` varchar(30) NOT NULL DEFAULT '',
- `likedid` int(10) NOT NULL DEFAULT 0,
- `time` int(11) NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`),
- INDEX(`liked`)
- )";
- $sqlQuery[] = "ALTER TABLE " . LAZ_TABLE_PREFIX . "_data (
- ADD likes int(10) NOT NULL DEFAULT 0'
- )";
- for($i=0; $i<sizeof($sqlQuery); $i++)
- {
- if(!mysql_query($sqlquery[$i],$dbc))
- {
- die("Encountered an error updating the tables");
- }
- }
- echo 'Tables successfully created/updated. Please delete this file.';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement