I am a new person to PHP.  I have purchased and read PHP fast & easy by
Julie Meloni and have also read the 24 hours PHP book.  I am able to connect
to the SQL database and insert into the database via my html form.  However,
the values are null.  When I look at the data in my database, it reads " ",
" ", " ", etc.

I have tried a couple different code:

$query = "INSERT INTO MemberReviews
 VALUES (' ','$memb_name', '$bookname','$author', '$grade', '$review') ";
mysql_query($query);

mysql_close();

or in the form itself, I have tried:

<?
    # this is processed when the form is submitted
    # back on to this page (POST METHOD)
    if ($REQUEST_METHOD=="POST") {

        # double-up apostrophes
        $review = str_replace("'","''",$review);
        $author = str_replace("'","''",$author);

        # setup SQL statement
        $SQL = " INSERT INTO MemberReviews ";
        $SQL = $SQL . " (memb_name, bookname, author, grade, review) VALUES
";
        $SQL = $SQL . " ('$memb_name', '$bookname','$author', '$grade',
'$review') ";

        #execute SQL statement
        $result = mysql_db_query($db,"$SQL",$cid);

        # check for error
        if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n");    }

        echo ("<P><B>New Record Added</B></P>\n");

    }

?>

Thanks in advance for your help

Jennifer




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to