hey guys,<br>i dont know is anyone can help me i have been having trouble.<br>i am using the follonwing code to do an INSERT query <br><br><br><br><br><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><br> <html><br>
<head></head><br> <body> <br><br> <?php<br> if ($_POST['submit']) {<br> // attempt a connection<br> $dbh = pg_connect("host=localhost dbname=postgres user=postgres password=quash");<br>
if (!$dbh) {<br> die("Error in connection: " . pg_last_error());<br> }<br> else{<br> echo "this was okay";<br> }<br> //exit; <br> <br> // escape strings in input data<br>
// $code = pg_escape_string($_POST['code']);<br>//$name = pg_escape_string($_POST['name']);<br> //$president = pg_escape_string($_POST['president']);<br> <br> // execute query<br> $sql = "INSERT INTO countries (CountryID, CountryName, President) VALUES('{$_POST['code']}', '{$_POST['name']}', '{$_POST['president']}')";<br>
$result = pg_query($dbh, $sql);<br> if (!$result) {<br> die("Error in SQL query: " . pg_last_error());<br> }<br> <br> echo "Data successfully inserted!";<br> <br> // free memory<br>
pg_free_result($result);<br> <br> // close connection<br> pg_close($dbh);<br> }<br> ?> <br><br> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><br>
Country code: <br> <input type="text" name="code" size="2"> <br> <p><br> Country name: <br> <input type="text" name="name"> <br>
<p><br> President's name: <br> <input type="text" name="president"> <br> <p><br> <input type="submit" name="submit"><br>
</form> <br> <br> </body><br> </html><br><br><br><br><br>but i am getting the following error<br><br>
this was okay<br>
<b>Warning</b>: pg_query() [<a href="http://localhost/bongamate/function.pg-query">function.pg-query</a>]: Query failed: ERROR: column "countryid" of relation "countries" does not exist
LINE 1: INSERT INTO countries (CountryID, CountryName, President) VA...
^ in <b>C:\xampp\htdocs\bongamate\weka.php</b> on line <b>25</b><br>
Error in SQL query: ERROR: column "countryid" of relation "countries" does not exist
LINE 1: INSERT INTO countries (CountryID, CountryName, President) VA...
^<br><br><br>can anyone help me on this? thank you<br> with regards geekmate!<br>