Today I was working with the web-crawl and found this interesting/useful lecture.
Friday, June 11, 2010
Sunday, June 6, 2010
many stories with many slides.
There are stories, and its name, and then their page(numbers), even creating dynamic page would me a problem if I dont arrange the stories in some order. Then 5 stories with 20-30 slides/pages each would be difficult to manage if there was proper organization and proper page inclusion.
When I went to this code:
This way I can restrict story to the name of the charater themselves and in other case it will redirect to the main story page, perfect!!!
and also the next advice on the same page:
will allow me to include the stories on the different folder, but without much work in the links that will show in one php file.
Source: http://inobscuro.com/tutorials/php-dynamic-includes-16/
I got an idea that I can do this for the stories -> name_of_character -> and the page number. This was very handy when I was thinking about how to put all those stories slides in form of html/images and I dont have to think about writing code for each pages. Perfect
When I went to this code:
$page = $_GET['page'];
$pages = array('page1', 'page2', 'page3');
if (!empty($page)) {
if(in_array($page,$pages)) {
$page .= '.php';
include($page);
}
else {
echo 'Page not found. Return to
index';
}
}
else {
include('page1.php');
}
?>
This way I can restrict story to the name of the charater themselves and in other case it will redirect to the main story page, perfect!!!
and also the next advice on the same page:
$url = '';
if (!empty($_GET['category'])) {
$url .= $_GET['category'] . '/';
}
if (!empty($_GET['page'])) {
$url .= $_GET['page'] . '.php';
}
include $url;
?>
will allow me to include the stories on the different folder, but without much work in the links that will show in one php file.
Source: http://inobscuro.com/tutorials/php-dynamic-includes-16/
I got an idea that I can do this for the stories -> name_of_character -> and the page number. This was very handy when I was thinking about how to put all those stories slides in form of html/images and I dont have to think about writing code for each pages. Perfect
Deleting all tables from the database...
after almost 2 hours of clogging my head and thinking about how to dump the data from the local forum that I created for the sura platform to the remote database in CS server, finally managed to create a page that will help me with this kind of situation further...
Then, to restore database from backup.
And thats all, the database from my local machine got transferred to the CS SQL server.
/* fill in your database name */
$database_name = "my_db";
/* connect to MySQL */
if (!$link = mysql_connect("db_host_name", "username", "pass")) {
die("Could not connect: " . mysql_error());
}
/* query all tables */
$sql = "SHOW TABLES FROM $database_name";
if($result = mysql_query($sql)){
/* add table name to array */
while($row = mysql_fetch_row($result)){
$found_tables[]=$row[0];
}
}
else{
die("Error, could not list tables. MySQL Error: " . mysql_error());
}
/* loop through and drop each table */
foreach($found_tables as $table_name){
$sql = "DROP TABLE $database_name.$table_name";
if($result = mysql_query($sql)){
echo "Success - table $table_name deleted.";
}
else{
echo "Error deleting $table_name. MySQL Error: " . mysql_error() . "";
}
}
In the local machine, the GUI can generate the sql script (along with insert commands), or from the command line can also be done as:
mysqldump -u username -ppassword --databases databasename > database_script.sql
(if no database is specified, all the databases will be dumped/copied)
Then, to restore database from backup.
mysql -u username -ppassword databasename < database_script.sql
And thats all, the database from my local machine got transferred to the CS SQL server.
Subscribe to:
Posts (Atom)