This topic is locked

Coding resources for INSERT statement

5/21/2010 2:15:29 PM
PHPRunner General questions
X
xahama author

I've inserted the code below as an event to occur after successful login. My data file has 1 record in it. I get no error but my INSERT doesn't load my 1 record either. If this forum is the wrong place to get assistance like this, where is a place that that a beginner can go to get coding issues solved?
$filename = "../hestimate.txt";

$fp = fopen($filename, "r") or die("could not open $filename");
$hestimate = fgets($fp, 2048);
fclose($fp);
$hedata = explode(',', $hestimate);
$name = $hedata[0];

$email = $hedata[1];

$phone = $hedata[2];

$address = $hedata[3];

$city = $hedata[4];

$state = $hedata[5];

$zip = $hedata[6];

$year = $hedata[7];

$make = $hedata[8];

$model = $hedata[9];

$vin = $hedata[10];

$corrosion = $hedata[11];

$exceedsize = $hedata[12];

$htotal = $hedata[13];

$comments = $hedata[14];
$result = mysql_query("INSERT INTO 'Estimate Masters' (name,email,phone,address,city,state,zip,year,make,model,vin,corrosion,exceedsize,htotal,comments) VALUES ($name,$email,$phone,$address,$city,$state,$zip,$year,$make,$model,$vin,$corrosion,$exceedsize,$htotal,$comments)");

Sergey Kornilov admin 5/21/2010

This forum is for PHPRunner questions only.

ficcionista 5/27/2010

Hi, have tried using " ' " on the values variables?
Like this:

$result = mysql_query("INSERT INTO 'Estimate Masters' (field1, field2, etc.)

VALUES ('$name','$email','$phone','$address','$city', etc.)");