|
Hello!
I try to start doing some basic MySQL but it just wont work.
I've read thru some basic manuals but the problems are awesome.
So far it looks like my server is working, the PHP is doing fine, even the database is somewhere out there but I cant fetch the data...
Here is my simplified attempt to write and read.
All help welcome! If you have the time list up the errors for me.
<?
$user="xxx";
$password="xxx";
$database="xxx";
mysql_connect("mysql",$user,$password);
mysql_select_db($database) or die( "Unable to select database");
// first we create the table, with three fields
mysql_query("CREATE TABLE chat (one, two, three)");
// ... and now we write
mysql_query( "INSERT INTO chat VALUES ('Paul','John','Smith')" );
// ...and now we try to read
$query="SELECT * FROM chat";
$result=mysql_query($query);
$a=mysql_result($result,"0", "one");
$b=mysql_result($result,"0", "two");
$c=mysql_result($result,"0", "three");
// here we print the result
echo "$a $b $c<br>";
mysql_close();
?>
|