Hey, I've been trying to code my own news/ blogging script, by following a tutorial, but unfortunately I keep getting these mysql errors when I submit an entry, and on the page where I want it to be displayed. And I don't know how to recognize the errors just by looking at the number line, or how to fix it.

index.php

<?php 

//$hostname="placid1.placid-soul.org";
$user="xxx"; //user name to access database
$pass= "xxx"; //password 
$dbase="xxx"; //database name

$q = "select * from blog order by date desc "; 
$result= mysql_query($q, $connection) or die 
("Could not execute query : $q." . mysql_error()); 

// dynamic navigation variables 
$rows_per_page=1; // adjust the number here to display number of entries per page 
$total_records=mysql_num_rows($result); 
$pages = ceil($total_records / $rows_per_page); 

$screen = $_GET["screen"]; 
if (!isset($screen)) 
$screen=0; 
$start = $screen * $rows_per_page; 
$q .= "LIMIT $start, $rows_per_page"; 
$result= mysql_query($q, $connection) or die 
("Could not execute query : $q." . mysql_error()); 

while ($row=mysql_fetch_array($result)) 
{ 
    $id=$row["id"]; 
    $name=$row["name"]; 
    $email=$row["email"]; 
    $entry=$row["entry"]; 
    $date=$row["date"]; 
    $icon=$row["icon"]; 
    $title=$row["title"]; 

?> 

    <table width="345" border="0" cellspacing="1" cellpadding="0" class="updates"> 
    <tr> 
    <td><h1><?php echo "$title"; ?></h1></td> 
    </tr> 
    <tr> 
    <td> 
    <img src="<?php echo "$icon"; ?>" alt="icon" align="left"><?php echo "$entry"; ?>
    <p>Posted by <a href="mailto:<?php echo "$email"; ?>"><?php echo "$name"; ?> on <?php echo "$date"; ?>.</p> 
    </td> 
    </tr> 
    </table> 
     
    <div align="center"> 

<?php 
} #end of while 

// Display dynamic navigation here 

// create the dynamic links 
if ($screen > 0) { 
    $j = $screen - 1; 
    $url = "display.php?screen=$j"; 
    echo "<a href=\"$url\">Prev</a>"; 
} 

// page numbering links now 

for ($i = 0; $i < $pages; $i++) { 
    $url = "display.php?screen=" . $i; 
    $j = $i + 1; 
    echo " | <a href=\"$url\">$j</a> | "; 
} 

if ($screen < $pages-1) { 
    $j = $screen + 1; 
    $url = "display.php?screen=$j"; 
    echo "<a href=\"$url\">Next</a>"; 
} 

?> 

</div>

<?php include 'bottom.php'; ?>

submit.php

<?php //
$hostname="xxx";
$user="xxx"; //user name to access database
$pass= "xxx"; //password 
$dbase="xxx"; //database name
// For Global Registers off 

$name = strip_tags($_POST["name"]); 
$email = strip_tags($_POST["email"]); 
$entry = strip_tags($_POST["entry"]); 
$title = strip_tags($_POST["title"]); 
$icon =  strip_tags($_POST["icon"]); 

// Check if user submit blank entry 
if ($name == "" || $email == "" || $entry == "" || $title == "") 
{  
    die ("You must fill in all fields, please click back and try again."); 
} 

else { 
    $q="insert into blog (id,name,title,email,entry,date,icon) VALUES ('','$name','$title','$email','$entry',now(),'$icon')"; 
    $result = mysql_query($q); 
     
    if ($result)  
    { 
        echo "thank you, blog has been submitted."; 
    } 

}  
?>

And these are the errors:
index.php

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/.fiorello/felaigne/placid-soul.org/index.php on line 45
Could not execute query : select * from blog order by date desc .

submit.php

Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/.fiorello/felaigne/placid-soul.org/submit.php on line 22

Warning: mysql_query(): A link to the server could not be established in /home/.fiorello/felaigne/placid-soul.org/submit.php on line 22

I've tried looking through the search feature, and I couldn't find another thread with the same problem I have, so I thought I should create a new topic. I've tried my best to explain it, so that it's understandable at least. And if you need anymore information just let me know. =) Thank you, in advance.

I can't seem to figure out how to edit my previous post. =\ So I'm sorry for double posting but anyways, I've solved my submission error problem, and I re-did the whole thing by using another tutorial. I had more success with it then the last one. (if you'd like the link let me know.) The only problem I'm getting now is that, my posts won't display, and it shows this instead:

Invalid ID specified.

I can't seem to figure out what's causing it to be invalid. I asked my friends about it, and they seem to think it's this line of code:

if(!isset($_GET['id']) || !is_numeric($_GET['id'])) {
    die("Invalid ID specified.");
}

There seems to something wrong with the top line, my friends and I were assuming that. Any suggestions? Also here's the new display code on index.php

<?php
mysql_connect ('xxx', 'xxx', 'xxx') ;
mysql_select_db ('xxx');

if(!isset($_GET['id']) || !is_numeric($_GET['id'])) {
    die("Invalid ID specified.");
}

$id = (int)$_GET['id'];
$sql = "SELECT * FROM php_blog WHERE id='$id' LIMIT 1";

$result = mysql_query($sql) or print ("Can't select entry from table php_blog.<br />" . $sql . "<br />" . mysql_error());

while($row = mysql_fetch_array($result)) {

    $date = date("l F d Y", $row['timestamp']);

    $title = $row['title'];
    $entry = $row['entry'];

    ?>

    <p><strong><?php echo $title; ?></strong><br /><br />
    <?php echo $entry; ?><br /><br />
    Posted on <?php echo $date; ?>
    </p>

    <?php
}

?>

<?php include 'bottom.php'; ?>

The problem is in the sintax of the if statement. When you write a if clause with two argument you shoulw write it like

if ( (firt argument) || (second argument) )

I think that's the problem with your code.
You should change your code to

if ((!isset($_GET['id'])) || (!is_numeric($_GET['id']))) {
die("Invalid ID specified.");
}

Thanks for the input, but unfortunately, I've tried changing my code to that, and the entrie(s) still won't display. I still get this:

Invalid ID specified.

Nevermind, I found out my error, I kept going to the wrong location. xD;

This question has already been answered. Start a new discussion instead.