Having trouble with INSERT INTO
Posted: Fri Sep 15, 2006 12:48 am
Weirdan | Please use
The " and ' stuff confuses me. So I'm guessing it has to do with that somehow.
Weirdan | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I've tried just about everything I can think of. I have a form that posts to this script. It seems to work (I don't get error connecting to mysql) but what I'm doing isnt showing up in the database. I am new to php so it's probably something stupid.Code: Select all
<?php
$dbhost = 'localhost';
$dbuser = $_POST["username"];
$dbpass = $_POST["pw"];
$dateStamp = date("Y-m-d");
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'games';
mysql_select_db('$dbname');
mysql_query("INSERT INTO games (Name, Description, Author)
VALUES ('$_POST[subname]','$_POST[desc]','$_POST[auth]')");
mysql_close();
echo "Success";
echo $dateStamp;
?>Weirdan | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]