Reputation: 1
in my code
Catchable fatal error: Object of class mysqli could not be converted to string in insert in phpmyadmin
$con = $_POST['con'];
$date =date('d-m-y');
$tag = $_POST['tag'];
$titel = $_POST['titel' ];
$by = $_POST['by'];
$mail = $_POST['mail'];
$img = $_FILES['up']['name'];
$iim = $_FILES ['up']['tmp_name'];
move_uploaded_file( $iim," ../Downloads");
$con = mysqli_connect('localhost' , 'root','','post');
$quu = "INSERT INTO post1 ".
"(email,post_by,post_titel,post_content,post_date,post_tages) ".
"VALUES ( '{$mail}','{$by}','{$titel}','{$con}',now(),'{$tag}')";
$finsh=mysqli_query($con, $quu)
Upvotes: 0
Views: 40
Reputation: 446
Your $con
(content) is overwritted by your $con
connection object.
So you try to insert in base your own database connection
Rename your mysqli connection
Upvotes: 1
Reputation: 9227
You have used $con
twice.
Both here
$con = $_POST['con'];
And here
$con = mysqli_connect(...
Just need to rename one of them. If it's the first, change the variable name in your query too.
Upvotes: 1