Results 1 to 1 of 1
  1. #1
    Join Date
    Apr 2004
    Posts
    6

    Unanswered: help with error!

    Hi,
    I keep getting this error about the sql query on line 28, and I can't figure out why.
    This is the code im using, can anyone see what im missing?:

    Thanks!


    <?php


    include("connectBookdb.php");

    if($_POST['submit'])
    {

    //Add the stuff to insert it into your database

    $sql = ("INSERT INTO advert2 (username, mod_book_id, asking_price, condition, description, date_added)
    VALUES ('isxjm', '$id', '$askingPrice', '$condition', '$description', 'date') ;");

    $result = pg_exec($sql);



    echo "Thank you! Information entered.\n";
    echo "<META HTTP-EQUIV=Refresh CONTENT=\"1; URL=addDataToDatabase.php\">";


    $test = "$first$last$address$position";

    if($test != "")
    {
    #enter postgresql query into here to add details into db

    }else
    {
    echo "<br>Error you have not completed the form";

    }


    }
    else
    {

    $title = $_GET['title'];
    $author = $_GET['auth'];
    $publisher = $_GET['pub'];
    $pubYear = $_GET['pubYear'];
    $id = $_GET['id'];


    echo "<h1>Please enter further details for your advert</h1>";


    echo "<hr>";
    echo "<b>Book Details</b><br><br>";
    echo "<b>Title</b> : $title<br>";
    echo "<b>Author</b> : $author<br>";
    echo "<b>Publisher</b> : $publisher<br>";
    echo "<b>Year</b> : $pubYear<Br>";




    ?>

    <form method="post" action="<? echo $PHP_SELF?>">
    Asking Price:<INPUT TYPE="text" NAME="askingPrice" SIZE="30"><br><br>
    Condition of book:
    <select name="condition">
    <option value="Like new">Like New
    <option value="Good">Good
    <option value="Fair">Fair
    <option value="Worn">Worn
    <option value="Worn">Excellent
    </select><br><br>

    Additional Comments:<br><textarea name="textfield" cols="50" rows="5"></textarea> <br><br>

    <input type="Submit" name="submit" value="Enter information"></form>
    <?
    }
    ?>
    Last edited by louphp; 04-08-04 at 11:09.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •