Log in

View Full Version : form help



llorax
03-28-2007, 05:31 AM
How come I keep getting this message: "Could not send query: Column count doesn't match value count at row 1"


<?php

include 'session.inc.php';
include 'config.inc.php';
include 'db.inc.php';


$link = db_connect();

$date = $_POST['date'];
$venue = $_POST['venue'];
$location = $_POST['location'];
$information = $_POST['information'];


$query = "INSERT INTO showdates VALUES ('','$date','$venue','$location','$information')";
db_query($query, $link);
db_close(null, $link);

$link = db_connect();

db_close($result, $link);

?>
<html>
<head>
<title>Show Updates</title>
<LINK REL="SHORTCUT ICON" HREF="../favicon.ico">
<link href="../admin/rustedshows.css" rel="stylesheet" type="text/css">
</head>
<body>
<center><img src="images/textbanner.gif" border=0></center>
<br><table border=0 width=55&#37; bgcolor="#BEC9D4" cellpadding=0 cellspacing=0 align=center style="border:1px solid #000;">
<tr>
<td style="padding:12px;">Add New Shows
<form action="<?=$_SERVER['PHP_SELF']?>" method="post" name="Add New Shows">
<table>
<tr>
<td>Date:</td>
<td><input name="date" type="date" id="date"></td>
</tr>
<tr>
<td>Venue:</td>
<td><input name="venue" type="text" id="venue"></td>
</tr>
<tr>
<td>Location:</td>
<td><input name="location" type="text" id="location"></td>
</tr>
<tr>
<td>Information:</td>
<td><input name="information" type="text" id="information"></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input name="submit" type="submit" id="submit" value="Submit">
<input name="reset" type="reset" id="reset" value="Reset">
</div></td>
</tr>
</table>
</form>
<a href="../admin/?logout">Logout</a>&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;<a href="admin.php">Back to Main Page</a></td>
</tr>
</table>
<p><br><p><br><center>Design &copy; Llora McGrath 2007</center>
</body>
</html>

codeexploiter
03-28-2007, 06:15 AM
Try to insert null value into your empty column and check whether you are getting the error.

llorax
03-28-2007, 04:57 PM
I'm sorry but I don't understand.

thetestingsite
03-28-2007, 05:10 PM
On this line:


$query = "INSERT INTO showdates VALUES ('','$date','$venue','$location','$information')";


try this (codex suggestion):



$query = "INSERT INTO showdates VALUES (null,'$date','$venue','$location','$information')";


Something else you could try is to assign what values go to what columns like so:



$query = "INSERT INTO showdates (`id`, `date`,`venue`,`location`,`information`) VALUES ('','$date','$venue','$location','$information')";


Hope this helps.