Jump to content

Database connection help


CageyJ0nnY

Recommended Posts

Hello, i have a database an i am trying to insert records using PHP and HTML. I keep getting this error:

 

Invalid query: Column count doesn't match value count at row 1

 

this is becuase i jhave told it to give me an error message but i cant find what the problem is...

 

here is the HTML:

 

<html>

<head>

<title>Insert a Property</title>

</head>

<body>

<form method="post" action="http://jjennings3.bimserver2.com/siteadmin2.php">

<p>Property Name: <input name="PropertyName" type="text"></p>

<p>Location: <input name="Location" type="text"> </p>

<p>Property Price: <input name="Saleprice" type="text"></p>

<p>Let Price:<input name="LetPrice" type ="text"></p>

<p>Garden Size: <input name="GardenSize" type ="text"></p>

<p><input type="submit" name="Submit" value="Insert Record"></p>

<p><a href = "http://jjennings3.bimserver2.com/home-page.php"></p>

<li>Back</li>

</form>

</body>

</html>

 

and here is the PHP it links to:

 

<?php

$conn = mysql_connect('jjennings3db.bimserver2.com', 'jjennings3db', 'bullet83478345');

mysql_select_db('jjennings3db', $conn);

$sql = "INSERT INTO tblProperties values ('', '$_POST[PropertyName]', '$_POST[Location]', '$_POST[salePrice]', '$_POST[LetPrice]', '$POST[GardenSize]')";

$result = mysql_query($sql);

if (!$result) {

die('Invalid query: ' . mysql_error());

}

else {

echo "Record Inserted. Would you like to <a href=\"lecture09example3.php\">view the full list of books</a> or <a href=\"lecture09example1.php\">insert another</a>?";

}

?>

 

any help would be appriciated

 

Jonny

Link to comment
https://forums.phpfreaks.com/topic/202146-database-connection-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.