Yeah for Undefined Variables

I’m currently trying to use PHP to insert and correct information in my database. Running IIS and PHP. I can connect fine to the database and Php is working as it should (I think). I’m submitting information from an HTML form to a PHP one that “should” insert the data to the database. I keep getting an undefined variable and honestly this is the exact same script that ran fine with apache and php. no changes using “post” “get” or “default” any ideas?

<?php

mysql_connect (‘localhost’, ‘user’, ‘pass’);

mysql_select_db (‘database_name’);

$result= mysql_query (“INSERT INTO items (id, name, truename, charges, magic, lore, nodrop, container, expendable, tradeskill, wt, trades, slot, size, type, race, class)
VALUES (’$id’, ‘$name’, ‘$truename’, ‘$charges’, ‘$magic’, ‘$lore’, ‘$nodrop’, ‘$container’, ‘$expendable’, ‘$tradeskill’, ‘$wt’, ‘$trades’, ‘$slot’, ‘$size’, ‘$type’, ‘$race’, ‘$class’);”);

if(!$result)
{
echo "INSERT unsuccessful: ", mysql_error();
exit;
}

print ($name);

print (" ");

print ("
");

print (“Has been added to the database.”);

print ("
");

print ("
");

?>

Nevermind, Took a few but I figured it out. Had to make a few small changes to the way it was inserting the data… here’s the change for those that want to know. (plus I had an extra ; in the line… go figure)

$sql= mysql_query ("INSERT INTO items (id, name, truename, charges, magic, lore, nodrop, container, expendable, tradeskill, wt, trades, Slot, size, type, race, Class) VALUES ('$id', '$name', '$truename', '$charges', '$magic', '$lore', '$nodrop', '$container', '$expendable', '$tradeskill', '$wt', '$trades', '$Slot', '$size', '$type', '$race', '$Class')"); $result = mysql_query ($sql);
Sponsor our Newsletter | Privacy Policy | Terms of Service