Flame of Soul
03.08.2009, 20:55
Поправьте пожалуйста где я не права:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>MGB</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
<meta http-equiv="cache-control" content="no-cache">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<?php
// { Параметры }---------------------------------------------------------------
// { table names }------------------//
$posts_table="openbook_posts"; // name of table to store posts
$admin_table="openbook_admin"; // name of table for admin authentication
switch($page)
{
case "1":
// processes submission of form
if(isset($dbhost)){
if(isset($dbuser)){
if(isset($dbpass)){
if(isset($dbname)){
$link_id=@mysql_connect($dbhost,$dbuser,$dbpass);
if($link_id)
{
if(!@mysql_select_db($default_db,$link_id)){
die("Couldn't select database $default_db.");
$query="CREATE TABLE $posts_table (
entryid INT(4) UNSIGNED NOT NULL AUTO_INCREMENT,
username VARCHAR(30) DEFAULT 'anonymous' NOT NULL,
useremail VARCHAR(40),
homepage VARCHAR(50),
subject VARCHAR(40),
message TEXT NOT NULL,
postdate TIMESTAMP(14),
reply TEXT,
PRIMARY KEY (entryid)
)";
if(!mysql_query($query)){
echo "Error updating table";}
else{
echo "Successfully created table";}
}
}}}}}
mysql.close($link_id);
break;
default:
// displays form for signing guestbook
?>
<form name="sign" method="post" action="install.php?page=1">
dbhost: <input name="dbhost" type="text" value="localhost"><br>
dbuser: <input name="dbuser" type="text" value="root"><br>
dbpass: <input name="dbpass" type="text" value="root"><br>
dbname: <input name="dbname" type="text" value="eee"><br>
<input name="homepage" type="submit" value="next"><br>
</form>
<?php
break;
}
?>
почему-то проверка if(!mysql_query($query)) молчит, и ничего не происходит. :)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>MGB</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
<meta http-equiv="cache-control" content="no-cache">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<?php
// { Параметры }---------------------------------------------------------------
// { table names }------------------//
$posts_table="openbook_posts"; // name of table to store posts
$admin_table="openbook_admin"; // name of table for admin authentication
switch($page)
{
case "1":
// processes submission of form
if(isset($dbhost)){
if(isset($dbuser)){
if(isset($dbpass)){
if(isset($dbname)){
$link_id=@mysql_connect($dbhost,$dbuser,$dbpass);
if($link_id)
{
if(!@mysql_select_db($default_db,$link_id)){
die("Couldn't select database $default_db.");
$query="CREATE TABLE $posts_table (
entryid INT(4) UNSIGNED NOT NULL AUTO_INCREMENT,
username VARCHAR(30) DEFAULT 'anonymous' NOT NULL,
useremail VARCHAR(40),
homepage VARCHAR(50),
subject VARCHAR(40),
message TEXT NOT NULL,
postdate TIMESTAMP(14),
reply TEXT,
PRIMARY KEY (entryid)
)";
if(!mysql_query($query)){
echo "Error updating table";}
else{
echo "Successfully created table";}
}
}}}}}
mysql.close($link_id);
break;
default:
// displays form for signing guestbook
?>
<form name="sign" method="post" action="install.php?page=1">
dbhost: <input name="dbhost" type="text" value="localhost"><br>
dbuser: <input name="dbuser" type="text" value="root"><br>
dbpass: <input name="dbpass" type="text" value="root"><br>
dbname: <input name="dbname" type="text" value="eee"><br>
<input name="homepage" type="submit" value="next"><br>
</form>
<?php
break;
}
?>
почему-то проверка if(!mysql_query($query)) молчит, и ничего не происходит. :)