There are a number of errors in the code, and its all in examp2.php
OK, now your form fields need to be given variable names. In PHP now, you should start using $_POST[''] to do so. Your examp2.php file should look like this now:
Code: Select all
<?php
$user = $_POST['user'];
$password = $_POST['password'];
$link = mysql_connect( "localhost:3306" , $user , $password )
or die( "Could not connect: " . mysql_error() );
print( "Connected successfully" );
CREATE TABLE sup_table (mjgod varchar(20) ) type=heap;
INSERT INTO sup_table (1 , '$user' , '$password' );
?>
But this still isn't right! Why? Because your not actually connecting to the database. Remove the $link variable so it becomes:
Code: Select all
<?php
$user = $_POST['user'];
$password = $_POST['password'];
mysql_connect( "localhost:3306" , $user , $password ) or die( "Could not connect: " . mysql_error() );
print( "Connected successfully" );
CREATE TABLE sup_table (mjgod varchar(20) ) type=heap;
INSERT INTO sup_table (1 , '$user' , '$password' );
?>
Your next problem is, the number of fields in your create table sql doesn't match the amount of fields your trying to add into in your INSERT query.
If you reading from a book i suggest burning it. hehehe