[SOLVED] SQL Code won't insert values
Posted: Sun Jul 18, 2004 1:43 am
feyd | Please use
feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I am having the problem that my SQL code is not working in inserting the defined variables that are passed from a form into the MySQL. I tested the variables and they are being passed but the code is not inserting. The connection to the DB is active. Here is the code.Code: Select all
<?php
$name = trim($_POST["name"]);
$code = trim($_POST["code"]);
$month = trim($_POST["month"]);
$year = trim($_POST["year"]);
$URL = trim($_POST["URL"]);
$owner = trim($_POST["owner"]);
$category = trim($_POST["category"]);
$location = trim($_POST["location"]);
if ($category == ""){
$category = 5;
}
$runQuery ("INSERT INTO sites (site_name, site_code, site_startMonth, site_startYear, site_URL, site_owner, site_category, site_location)".
"VALUES ('$name', '$code', '$month', $year, '$URL', '$owner', $category, '$location'");
$projectAdded = 0;
?>feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]