Php database newbie

I have had some experience using databases but not much.

I have managed to connect to my database I think… yet it does not seem to insert new records.

Here are my details

DATABASE NAME:new
USERNAME:castcou7_df
PASSWORD:ch
TABLE NAME: dreem
FIELD: postno

Here is my code



<?php
$today=getdate();

$con = mysql_connect('localhost','castcou7_df','ch');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("castcou7_new", $con);

mysql_query("INSERT INTO dreem (postno)
VALUES (4)");


mysql_close($con);


?>



Change these lines


mysql_select_db("castcou7_new", $con);
mysql_query("INSERT INTO dreem (postno)VALUES (4)");

in


mysql_select_db("castcou7_new", $con) or die('Could not select: ' . mysql_error());
$query = "INSERT INTO dreem (postno)VALUES (4)";
mysql_query($query) or die("mysql error " . mysql_error() . " in query $query");

And see if any errors appear.

Thanks

I think I have found the error

The database was named castcou7_new_(1) not castcou7_new as I thought

I don’t know how the 1 got added