Help - Search - Members - Calendar
Full Version: Build A blog part one...
Codegrrl.com Forums > Script Help > Tutorial Help
christopher

Warning: mysql_connect(): Can't connect to MySQL server on 'www.whispering-screams.net' (111) in /home/content/t/s/u/tsuki/html/me/blog/blog.php on line 3

Warning: mysql_select_db(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/content/t/s/u/tsuki/html/me/blog/blog.php on line 4

Warning: mysql_select_db(): A link to the server could not be established in /home/content/t/s/u/tsuki/html/me/blog/blog.php on line 4

Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/content/t/s/u/tsuki/html/me/blog/blog.php on line 15

Warning: mysql_query(): A link to the server could not be established in /home/content/t/s/u/tsuki/html/me/blog/blog.php on line 15
Can't create the table 'php_blog' in the database.
CREATE TABLE php_blog ( id int(20) NOT NULL auto_increment, timestamp int(20) NOT NULL, title varchar(255) NOT NULL, entry longtext NOT NULL, PRIMARY KEY (id), UNIQUE KEY id (id) )
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Warning: mysql_close(): no MySQL-Link resource supplied in /home/content/t/s/u/tsuki/html/me/blog/blog.php on line 21


what am i doing wrong??? Cus i am just starting SQL really and the same for PHP and was just wondering where i am going wrong.... : -

<?php

mysql_connect ('www.whispering-screams.net', 'whisp_blog', ' ') ;
mysql_select_db ('whisp_blog');

$sql = "CREATE TABLE php_blog (
id int(20) NOT NULL auto_increment,
timestamp int(20) NOT NULL,
title varchar(255) NOT NULL,
entry longtext NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY id (id)
)";

$result = mysql_query($sql) or print ("Can't create the table 'php_blog' in the database.<br />" . $sql . "<br />" . mysql_error());

if ($result != false) {
echo "Table 'php_blog' was successfully created.";
}

mysql_close();

if ($result != false) {
echo "Table 'php_blog' was successfully created.";
}

?>
Amelie
Are you sure your database host is correct? Normally that is localhost, but if you're not sure, ask your host.
Sairah
And I'm pretty sure I read somewhere that the primary and unique keys aren't both supposed to be "id". I thought it was changed to just Primary Key = id. O.o
Sunnefa
QUOTE(Sairah @ Feb 28 2008, 07:40 PM) *

And I'm pretty sure I read somewhere that the primary and unique keys aren't both supposed to be "id". I thought it was changed to just Primary Key = id. O.o


You seem to be right... in the original first part of the tutorial there is no mention of UNIQUE KEY id (id)... I have it in my table though... I don't know if it changes anything....
Neuriel
The socket error that you are getting deals with your database host. As Amelie said, check and make sure that is correct.

As for as the primary key goes, remove the unique key line but that is not the cause of your error right now.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.