Page 1 of 1

T_String error in sql

Posted: Mon Jun 14, 2004 10:21 am
by pinehead18

Code: Select all

<?php
<?PHP
                        if (isset($_POST['submit'])) {

                        $con = mysql_connect("localhost","pinehead","") or die(mysql_error());
                        $db = mysql_select_db("lkcforum",$con) or die(mysql_error());
                        $sql = "INSERT INTO topics (tid,topic,uname,body) VALUES ('$tid','$topic','$user','$body');
                        mysql_query($sql,$con) or die(mysql_error());
                        mysql_close();
                        }



                $output = "
                        <table id=table2>
                        <form method=post action=post.php>
                        <tr>
                           <td width=20%>Subject</td><td width=80%><input type=text name=subject</td>
                        </tr>
                        <tr>
                           <td width=20%>Message</td><td width=80%><input type=text name=body</td>
                        </tr>
                        <tr>
                           <td align=center><input type=submit name=submit value=Submit>&nbsp;&nbsp;<input type=reset
name=Reset></td>
                        </tr>
                       </table>
                        <input type=hidden value=$tid>
                        ";

                echo $output;

        }


?>


?>



Parse error: parse error, unexpected T_STRING in /home/pinehead/www/forums/post.php on line 14

that is my error. Thank you for your help.

Posted: Mon Jun 14, 2004 10:31 am
by Buddha443556
Closing quote?

Code: Select all

$sql = "INSERT INTO topics (tid,topic,uname,body) VALUES ('$tid','$topic','$user','$body')";