this is the php code for me that gives me error

Parse error: syntax error, unexpected T_STRING in C:\xampplite\htdocs\eurofrit\insert_ac.php on line 35

i will be thankfull if someone helps me because for days i can't fix it

<?php

$host="localhost";
$username="";
$password="";
$db_name="member";
$tbl_name="produktet";

// konoktimi ne server dhe zgjedhja e bazes
$conn=mysql_pconnect("$host", "$username", "$password");
$select=mysql_select_db("$db_name", $conn);

// marim vlerat nga forma
$pid=$_POST;
$kid=$_POST;
$pemri=$_POST;
$pnjm=$_POST;
$psasia=$_POST;
$pcmimi=$_POST;
$pfoto=$_POST;
$pverejtje=$_POST;


// Insertojm te dhena ne mysql
$sql="INSERT INTO $tbl_name VALUES('$pid','$kid', '$pemri', '$pnjm', '$psasia', '$pcmimi', '$pfoto', '$pverejtje');
$result=mysql_query($sql);

// nese eshte e sukseshme inserto te dhena ne databaze dhe jep mesazh se eshte kryer me sukses
if($result){

echo "GOOD";
}

else {
echo "ERROR";
}


?>

Recommended Answers

All 5 Replies

I dont know if it is as simple as this, but you have left out a " at the end of your $sql = part before the ;

I dont know if it is as simple as this, but you have left out a " at the end of your $sql = part before the ;

:) Absolutely right.

$sql="INSERT INTO $tbl_name VALUES('$pid','$kid', '$pemri', '$pnjm', '$psasia', '$pcmimi', '$pfoto', '$pverejtje'");

$sql="INSERT INTO $tbl_name VALUES('$pid','$kid', '$pemri', '$pnjm', '$psasia', '$pcmimi', '$pfoto', '$pverejtje'");

You got the " at the wrong place!

$sql="INSERT INTO $tbl_name VALUES('$pid','$kid', '$pemri', '$pnjm', '$psasia', '$pcmimi', '$pfoto', '$pverejtje')";

$sql="INSERT INTO $tbl_name VALUES('$pid','$kid', '$pemri', '$pnjm', '$psasia', '$pcmimi', '$pfoto', '$pverejtje')";

The above is what your SQL query should be

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.