this is my php code,it works properly before inserting,can it be the fact that i have attatched a photo to my form?
the other problem is,i dont know what type is photo for my xampp database,i left it a VARCHAR, the error i get is:
Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\toyota\test.php on line 14

<?php
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db("forum") or die(mysql_error());
$username = $_POST['username'];
$photo = $_POST['photo'];
$comment = $_POST['comment']; 
$query = "INSERT INTO comments(username, photo, comment) values('$username','$photo','$comment');
$result=mysql_query($query);
if ($results) 
{ 
echo "insert complete";
}
mysql_close($link);
?>

your help will be highly appriciated

Line 10 has no closing double quote.

@pritaeas,thanks a lot for helping me with the stupid mistake i made,so what happens now is,after i submit my form,it redirects to a blank page of URL:
http://localhost/toyota/test.php which is the path of my php code,still my database is not inserted,pls help

@pritaeas,thanks once again,every field is well updated except for photos,i have never worked with photos,cant it be that i dont know photo datatype amongst those predefined for xampp?

What are you trying to store in the photos column? Is it a path, or a file? In case of the latter you'll need to use a blob field. If you search this forum, you'll find examples for inserting an image into MySQL.

In phpMyadmin select the database forum, and click on SQL
In the box insert:

DROP TABLE photo;


    CREATE TABLE files (
  id int(11) NOT NULL AUTO_INCREMENT,
  mime varchar(255) NOT NULL,
  data blob NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;

If you do not have phpmyadmin installed use this php script

<?php
//connect to db
    $con = mysql_connect("localhost","root",""); 
    if (!$con) 
    { 
    die('Could not connect: ' . mysql_error()); 
    } 
    mysql_select_db("forum") or die(mysql_error());

    mysql_query("CREATE TABLE files (
      id int(11) NOT NULL AUTO_INCREMENT,
      mime varchar(255) NOT NULL,
      data blob NOT NULL,
    ) ENGINE=InnoDB;"); 
    Print "Your table has been created"; 
 ?> 
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.