|
[ djovan01 @ 19.12.2006. 13:55 ] @
| Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' , , , , )' at line 1
Sta to znaci? Na prvoj liniji mi je <?php ne znam zasto pokazuje gresku.
|
[ dakipro @ 19.12.2006. 14:18 ] @
Postuj query. Ovo "at line 1" nije vration php vec mysql, sto znaci da je greska u queriju na liniji 1, a ne u fajlu. deluje mi kao da unosis prazne vrednosti u bazu (mozda tako treba?)...
[ djovan01 @ 19.12.2006. 14:20 ] @
Evo koda
Code:
<?php
$hostname = "localhost";
$username= "dani";
$password= "jovan";
$dbid="betaquote";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die ("Unable to connect to MySQL");
print "Connected to MySQL";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-13" />
<title>Quote Request</title>
<link rel="stylesheet" type="text/css" href="slashfiles/menu.css" />
<script type="text/javascript" src="slashfiles/menu.js">
</script>
<style>
.styleForTable {
font-family: Verdana;
font-size: 8.5pt;
color: #0099CC;
border: 1px solid #E0E0E0;
border-collapse: collapse;
}
</style>
</head>
<body>
<?php
if (!isset($_POST['submit'])) {
?>
<form action="" method="post">
<table width="560" border="1" class="styleForTable">
<tr bgcolor="#999999">
<td colspan="3" class="styleForTable"><div align="center"><strong><font color="#FF3300">--- Quote
Request form ---</font></strong></div>
</td>
</tr>
<tr bgcolor="#CCCCCC">
<td colspan="3" class="styleForTable"><strong><em><font color="#000000">Contact
Information</font></em></strong></td>
</tr>
<tr>
<td width="208" class="styleForTable">Company Name </td>
<td colspan="2" class="styleForTable"><input name="c_name" type="text" id="c_name3">
</td>
</tr>
<tr>
<td class="styleForTable"><div align="left">Primary Contact</div>
<div align="left">
<input name="contact_name" type="text" id="contact_name3">
</div>
</td>
<td width="186" class="styleForTable"><div align="left">Phone</div>
<div align="left">
<input name="phone" type="text" id="phone3">
</div>
</td>
<td width="144" class="styleForTable"><div align="left">email</div>
<div align="left">
<input name="email" type="text" id="email3">
</div>
</td>
</tr>
<tr>
<td class="styleForTable">Job Location </td>
<td colspan="2" class="styleForTable"><input name="j_location" type="text" id="j_location3">
</td>
</tr>
<tr>
<td class="styleForTable">Approximate Start Date</td>
<td colspan="2" class="styleForTable"><input name="start_date" type="text" id="start_date3">
</td>
</tr>
<tr bgcolor="#CCCCCC">
<td colspan="3" class="styleForTable"><strong><em><font color="#000000">Facility
Information</font></em></strong></td>
</tr>
<tr>
<td class="styleForTable">Hours of Operation </td>
<td colspan="2" class="styleForTable"><input name="hours" type="text" id="hours3">
</td>
</tr>
<tr>
<td class="styleForTable">Ceiling Height
<input name="ceiling_ht" type="text" id="ceiling_ht3">
</td>
<td colspan="2" class="styleForTable">Floor Thickness<br>
<input name="floor" type="text" id="floor3">
</td>
</tr>
<tr>
<td class="styleForTable">Loading Dock<br>
<strong> <font color="#FFCC33">Yes </font></strong>
<input name="dock_yes" type="checkbox" id="dock_yes3" value="Yes">
<strong> <font color="#FFCC33">No </font> </strong>
<input name="dock_no" type="checkbox" id="dock_no3" value="No">
</td>
<td colspan="2" class="styleForTable">Size<br>
<input name="dock_size" type="text" id="dock_size3">
</td>
</tr>
<tr>
<td class="styleForTable">Ground Level Door<br>
<strong> <font color="#FFCC33">Yes </font></strong><font color="#FFCC33"> </font>
<input name="ground_yes" type="checkbox" id="ground_yes3" value="Yes">
<font color="#FFCC33"> <strong>No</strong></font>
<input name="ground_no" type="checkbox" id="ground_no3" value="No">
</td>
<td colspan="2" class="styleForTable">Size<br>
<input name="ground_size" type="text" id="ground_size3">
</td>
</tr>
<tr>
<td class="styleForTable">Crane<br>
<strong> <font color="#FFCC33">Yes </font></strong><font color="#FFCC33"> </font>
<input name="yes3" type="checkbox" id="yes33" value="Yes">
<font color="#FFCC33"><strong> No</strong></font>
<input name="crane_no" type="checkbox" id="crane_no3" value="No">
</td>
<td colspan="2" class="styleForTable">Size<br>
<input name="crane_size" type="text" id="crane_size3">
</td>
</tr>
<tr bgcolor="#CCCCCC">
<td colspan="3" class="styleForTable"><em><strong><font color="#000000">Services
Needed</font></strong></em></td>
</tr>
</table>
<div class="sdmenu">
<span class="title" id="top"><img src="slashfiles/expanded.gif" class="arrow" alt="-" />Electrical</span>
<div class="submenu"><a>
<table width="560" border="1" class="styleForTable">
<tr>
<td width="189" class="styleForTable">Buss Manufacturer</td>
<td width="355" class="styleForTable"><select name="b_manuf" id="b_manuf">
<option value="American">American</option>
<option value="Bryant">Bryant</option>
<option value="Challenger">Challenger</option>
<option value="Crouse Hinds">Crouse Hinds</option>
<option value="Cutler Hammer">Cutler Hammer</option>
<option value="Federal Pacific">Federal Pacific</option>
<option value="General Electric">General Electric</option>
<option value="ITE Siemens">ITE Siemens</option>
<option value="Murray">Murray</option>
<option value="Square D">Square D</option>
<option value="Sylvania">Sylvania</option>
<option value="Thomas & Betts">Thomas & Betts</option>
<option value="Wadsworth">Wadsworth</option>
<option value="Westinghouse">Westinghouse</option>
<option value="Zinsco">Zinsco</option>
<option value="Select" selected="selected">Select</option>
</select></td>
</tr>
<tr>
<td class="styleForTable">Buss Voltage</td>
<td class="styleForTable"><input name="b_voltage" type="text" id="b_voltage" /></td>
</tr>
<tr>
<td class="styleForTable">Buss Amperage</td>
<td class="styleForTable"><input name="b_amperage" type="text" id="b_amperage" /></td>
</tr>
<tr>
<td class="styleForTable">Panel Board Manufacturer</td>
<td class="styleForTable"><select name="p_manuf" id="p_manuf">
<option value="American">American</option>
<option value="Bryant">Bryant</option>
<option value="Challenger">Challenger</option>
<option value="Crouse Hinds">Crouse Hinds</option>
<option value="Cutler Hammer">Cutler Hammer</option>
<option value="Federal Pacific">Federal Pacific</option>
<option value="General Electric">General Electric</option>
<option value="ITE Siemens">ITE Siemens</option>
<option value="Murray">Murray</option>
<option value="Square D">Square D</option>
<option value="Sylvania">Sylvania</option>
<option value="Thomas & Betts">Thomas & Betts</option>
<option value="Wadsworth">Wadsworth</option>
<option value="Westinghouse">Westinghouse</option>
<option value="Zinsco">Zinsco</option>
<option value="Select" selected="selected">Select</option>
</select></td>
</tr>
<tr>
<td height="28" class="styleForTable">Panel Board Voltage</td>
<td class="styleForTable"><input name="p_voltage" type="text" id="p_voltage" /></td>
</tr>
<tr>
<td class="styleForTable">Panel Board Amperage</td>
<td class="styleForTable"><input name="p_amperage" type="text" id="p_amperage" /></td>
</tr>
<tr>
<td class="styleForTable">What is the full load amperage of the equipment? </td>
<td class="styleForTable"><input name="amp_of_equipment" type="text" id="amp_of_equipment" /></td>
</tr>
<tr>
<td class="styleForTable">How far is the power source from the machine including
up, over and down?</td>
<td class="styleForTable"><input name="distance" type="text" id="distance" /></td>
</tr>
</table>
</a>
</div>
<span class="title"><img src="slashfiles/expanded.gif" class="arrow" alt="-" />Rigging </span>
<div class="submenu"> <a>
<table width="560" border="1" class="styleForTable">
<tr>
<td width="188" class="styleForTable">Machine Manufacturer</td>
<td colspan="3" class="styleForTable"><input name="machine_manuf" type="text" id="machine_manuf" />
</td>
</tr>
<tr>
<td class="styleForTable">Machine Serial Number</td>
<td colspan="3" class="styleForTable"><input name="serial" type="text" id="serial" />
</td>
</tr>
<tr>
<td class="styleForTable">Machine Weight</td>
<td colspan="3" class="styleForTable"><input name="weight" type="text" id="weight" />
</td>
</tr>
<tr>
<td class="styleForTable">Dimensions</td>
<td colspan="3" class="styleForTable"><font color="#FFCC33"><strong>Height</strong></font>
<input name="ht" type="text" id="ht" size="5" />
<font color="#FFCC33"> <strong>Width</strong></font>
<input name="wt" type="text" id="wt" size="5" />
<strong> <font color="#FFCC33">Length</font></strong>
<input name="lt" type="text" id="lt" size="5" />
</td>
</tr>
<tr>
<td class="styleForTable">Location to be picked from</td>
<td width="144" class="styleForTable">Address<br>
<input name="p_address" type="text" id="p_address">
</td>
<td width="144" class="styleForTable">City<br>
<input name="p_city" type="text" id="p_city">
</td>
<td width="56" class="styleForTable">State
<input name="p_state" type="text" id="p_state" size="5" />
</td>
</tr>
<tr>
<td class="styleForTable">Location to be delivered to</td>
<td class="styleForTable">Address<br>
<input name="d_address" type="text" id="d_address">
</td>
<td valign="top" class="styleForTable"><div align="left"> City<br>
<input name="d_city" type="text" id="d_city">
</div></td>
<td class="styleForTable">State
<input name="d-city" type="text" id="d-city" size="5" />
</td>
</tr>
<tr>
<td class="styleForTable">For any aditional machines please list
them here: </td>
<td colspan="3" class="styleForTable"><textarea name="additional" id="additional"></textarea></td>
</tr>
</table>
</a>
</div>
<span class="title"><img src="slashfiles/expanded.gif" class="arrow" alt="-" />Foundation</span>
<div class="submenu">
<a>
<table width="560" border="1" class="styleForTable">
<tr>
<td width="189" class="styleForTable">Local soil conditions if known</td>
<td width="355" class="styleForTable"><input name="soil_condition" type="text" id="soil_condition" /></td>
</tr>
<tr>
<td class="styleForTable">Size and Depth</td>
<td class="styleForTable"><input name="size" type="text" id="size" /></td>
</tr>
<tr>
<td class="styleForTable">Cad Drawings/Print</td>
<td class="styleForTable"><font color="#FFCC33"><strong>Yes
</strong></font>
<input name="cad_drawings_yes" type="checkbox" id="cad_drawings_yes" value="checkbox" />
<strong> <font color="#FFCC33"> No</font></strong> <input name="cad_drawings_no" type="checkbox" id="cad_drawings_no" value="checkbox" /></td>
</tr>
<tr>
<td class="styleForTable">Closest dimensions from wall of footing's</td>
<td class="styleForTable"><input name="dimensions_from_wall" type="text" id="dimensions_from_wall" /></td>
</tr>
</table>
</a>
</div>
<span class="title"><img src="slashfiles/expanded.gif" class="arrow" alt="-" />Piping</span>
<div class="submenu"> <a>
<table width="560" border="1" class="styleForTable">
<tr>
<td width="190" class="styleForTable">Size of Piping</td>
<td colspan="2" class="styleForTable"><input name="pipe_size" type="text" id="pipe_size" /></td>
</tr>
<tr>
<td class="styleForTable">Length of run</td>
<td colspan="2" class="styleForTable"><input name="length" type="text" id="length" /></td>
</tr>
<tr>
<td class="styleForTable">Materials to be used</td>
<td colspan="2" class="styleForTable"><input name="materials" type="text" id="materials" /></td>
</tr>
<tr>
<td height="31" class="styleForTable">What kind of substances are running through pipes? </td>
<td colspan="2" class="styleForTable"><input name="substance" type="text" id="substance" /></td>
</tr>
<tr>
<td valign="top" class="styleForTable">Are lifts required?<br />
<strong><font color="#FFCC33">Yes</font></strong>
<input name="lifts_yes" type="checkbox" id="lifts_yes" value="checkbox" />
<strong> <font color="#FFCC33">No</font></strong>
<input name="lifts_no" type="checkbox" id="lifts_no" value="checkbox" /></td>
<td width="161" valign="top" class="styleForTable">If yes,what size?<br />
<br />
Lift Type: </td>
<td width="187" valign="top" class="styleForTable"><div align="left">
<input name="lift_size" type="text" id="lift_size" />
<br />
<font color="#FFCC33"><strong>Scissors</strong>
<input name="scissors" type="checkbox" id="scissors" value="checkbox" />
<strong>Boom </strong></font>
<input name="boom" type="checkbox" id="boom" value="checkbox" />
<font color="#FFCC33"> </font></div></td>
</tr>
</table>
</a></div>
</div>
<table width="560" border="1" class="styleForTable">
<tr>
<td bgcolor="#CCCCCC" class="styleForTable"><input name="submit" type="submit" id="submit" value="Submit Quote Request"></td>
</tr>
</table>
</form>
<?php
$c_name = addslashes($_POST['c_name']);
$contact_name = addslashes($_POST['contact_name']);
$phone = addslashes($_POST['phone']);
$email = addslashes($_POST['email']);
$j_location = addslashes($_POST['j_location']);
$start_date = addslashes($_POST['start_date']);
$hours = addslashes($_POST['hours']);
$ceiling_ht = addslashes($_POST['ceiling_ht']);
$floor = addslashes($_POST['floor']);
$dock_yes = addslashes($_POST['dock_yes']);
$dock_no = addslashes($_POST['dock_no']);
$dock_size = addslashes($_POST['dock_size']);
$ground_yes = addslashes($_POST['ground_yes']);
$ground_no = addslashes($_POST['ground_no']);
$ground_size = addslashes($_POST['ground_size']);
$crane_yes = addslashes($_POST['crane_yes']);
$crane_no = addslashes($_POST['crane_no']);
$crane_size = addslashes($_POST['crane_size']);
$b_manuf = addslashes($_POST['b_manuf']);
$b_voltage = addslashes($_POST['b_voltage']);
$b_amperage = addslashes($_POST['b_amperage']);
$p_manuf = addslashes($_POST['p_manuf']);
$p_voltage = addslashes($_POST['p_voltage']);
$p_amperage = addslashes($_POST['p_amperage']);
$amp_of_equipment = addslashes($_POST['amp_of_equipment']);
$distance = addslashes($_POST['distance']);
$machine_manuf = addslashes($_POST['machine_manuf']);
$serial = addslashes($_POST['serial']);
$weight = addslashes($_POST['weight']);
$ht = addslashes($_POST['ht']);
$wt = addslashes($_POST['wt']);
$lt = addslashes($_POST['lt']);
$p_address = addslashes($_POST['p_address']);
$p_city = addslashes($_POST['p_city']);
$p_state = addslashes($_POST['p_state']);
$d_address = addslashes($_POST['d_address']);
$d_city = addslashes($_POST['d_city']);
$d_state = addslashes($_POST['d_state']);
$additional = addslashes($_POST['additional']);
$soil_condition = addslashes($_POST['soil_condition']);
$size = addslashes($_POST['size']);
$cad_yes = addslashes($_POST['cad_yes']);
$cad_no = addslashes($_POST['cad_no']);
$dimensions_from_wall = addslashes($_POST['dimensions_from_wall']);
$pipe_size = addslashes($_POST['pipe_size']);
$run_length = addslashes($_POST['run_length']);
$materials = addslashes($_POST['run_length']);
$substance = addslashes($_POST['substances']);
$lift_yes = addslashes($_POST['lift_yes']);
$lift_no = addslashes($_POST['lift_no']);
$lift_size = addslashes($_POST['lift_size']);
$scissors = addslashes($_POST['scissors']);
$boom = addslashes($_POST['boom']);
mysql_query("INSERT INTO customer (c_name, contact_name, phone, email, j_location, start_date) VALUES($c_name, $contact_name, $phone, $email, $j_location, $start_date) ");
if (!$insert1) {
die('Invalid query: ' . mysql_error());
}
mysql_query("INSERT INTO facility (hours, ceiling_ht, floor, dock_yes, dock_no, dock_size, ground_yes, ground_no, ground_size, crane_yes, crane_no, crane_size) VALUES($hours, $ceiling_ht, $floor, $dock_yes, $dock_no, $dock_size, $ground_yes, $ground_no, $ground_size, $crane_yes, $crane_no, $crane_size)");
if (!$insert2) {
die('Invalid query: ' . mysql_error());
}
mysql_query("INSERT INTO electrical (b_manuf, b_voltage, b_amperage, p_manuf, p_voltage, p_amperage, amp_of_equipment, distance) VALUES($b_manuf, $b_voltage, $b_amperage, $p_manuf, $p_voltage, $p_amperage, $amp_of_equipment, $distance)");
if (!$insert3) {
die('Invalid query: ' . mysql_error());
}
mysql_query("INSERT INTO rigging (machine_manuf, serial, weight, ht, wt, lt, p_address, p_city, p_state, d_address, d_city, d_state, additional) VALUES ($machine_manuf, $serial, $weight, $ht, $wt, $lt, $p_address, $p_city, $p_state, $d_address, $d_city, $d_state, $additional)");
if (!$insert4) {
die('Invalid query: ' . mysql_error());
}
mysql_query("INSERT INTO foundations (soil_condition, size, cad_yes, cad_no, dimensions_from_wall) VALUES ($soil_condition, $size, $cad_yes, $cad_no, $dimensions_from_wall)");
if (!$insert5) {
die('Invalid query: ' . mysql_error());
}
mysql_query("INSERT INTO piping (pipe_size, run_length, materials, substance, lift_yes, lift_no, lift_size, scissors, boom) VALUE ($pipe_size, $run_length, $materials, $substance, $lift_yes, $lift_no, $lift_size, $scissors, $boom)");
if (!$insert6) {
die('Invalid query: ' . mysql_error());
}
}
?>
</body>
</html>
[Ovu poruku je menjao flylord dana 19.12.2006. u 16:54 GMT+1]
[ dakipro @ 19.12.2006. 14:46 ] @
Mnogo ti je dug kod, mrzi me da gledam . probaj da stavis jednostruke navodnike oko vrednosti koje unosis u bazu, mislim da je to problem.... znaci gde je
mysql_query("INSERT INTO electrical (b_manuf, b_voltage, b_amperage, p_manuf, p_voltage, p_amperage, amp_of_equipment, distance) VALUES($b_manuf, $b_voltage, $b_amperage, $p_manuf, $p_voltage, $p_amperage, $amp_of_equipment, $distance)");
stavi da bude
mysql_query("INSERT INTO electrical (b_manuf, b_voltage, b_amperage, p_manuf, p_voltage, p_amperage, amp_of_equipment, distance) VALUES('$b_manuf', '$b_voltage', '$b_amperage', '$p_manuf', '$p_voltage', '$p_amperage', '$amp_of_equipment', '$distance')");
[ djovan01 @ 19.12.2006. 15:10 ] @
falili su mi navodnici. sada radi. hvala
[ sale83 @ 20.12.2006. 01:10 ] @
Ja bi taj tvoj kod malo preuredio...
Recimo ovo
Code:
$lift_yes = addslashes($_POST['lift_yes']);
$lift_no = addslashes($_POST['lift_no']);
$cad_yes = addslashes($_POST['cad_yes']);
$cad_no = addslashes($_POST['cad_no']);
$crane_yes = addslashes($_POST['crane_yes']);
$crane_no = addslashes($_POST['crane_no']);
$ground_yes = addslashes($_POST['ground_yes']);
$ground_no = addslashes($_POST['ground_no']);
$dock_yes = addslashes($_POST['dock_yes']);
$dock_no = addslashes($_POST['dock_no']);
Za sve to je dovoljno da imas
5 polja a svako polje ce da sadrzi YES - NO ili 0 - 1 :)
Poz
sale
Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.
|