View Single Post
Old 12-13-2004, 02:50 PM  
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
Quick PHP Question

I am new to PHP and trying to insert information into a table automatically by going to a URL. For example. I want it so when I go to www.url.com?user=test&password=word

it will automatically add the user name and password into the table (users)

I tried using the following for www.url.com/index.php

<?

$DBhost = "localhost";
$DBuser = "userdb";
$DBpass = "password";
$DBName = "namedb";

mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");

@mysql_select_db("$DBName") or die("Unable to select
database $DBName");


mysql_query("INSERT INTO `Users` VALUES ('$user','$password')") or die(mysql_error());


mysql_close();

?>

This brings me to a blank page but does not add anything to the table


Is there something I might be doing wrong?
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote