Click here to Skip to main content
15,904,288 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
connected Successfully error: UPDATE INTO 'mymap'
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO 'mymap'' at line 1


idont lnow what is the wrong so please help
this is my code

<?php
// set connection variables


$Host_name = "localhost";
$db_user ="root";
$db_password="";
$db_name = "rmap";



// connection to server & database
$conn =new mysqli($Host_name,$db_user ,$db_password, $db_name,);


  // check connection
  if ($conn->connect_error) {
    die('Connect Error: ' . $conn->connect_error);
}
   
   echo "connected Successfully";
   $sql ="UPDATE INTO 'mymap'";

    if($conn->query($sql)=== true) {
echo"New record oreated Successfully";
} else{
echo " error: ".$sql."<br>" . $conn->error;
}
$conn->close();
?>


What I have tried:

i have tried many things but nothing work
Posted
Updated 29-Jun-21 9:10am

Quote:
idont lnow what is the wrong so please help

Simple, your UPDATE command is not SQL, and we can't help you because this command makes no sense.
Quote:
i have tried many things but nothing work

You can try random things for as long as you want, you will get tired before your SQL server.
PHP
$sql ="UPDATE INTO 'mymap'";

Where have found that this is SQL ?
Only 1 possibility: READ SQL DOCUMENTATION, as suggested in error message.
SQL UPDATE Statement[^]
 
Share this answer
 
Based on the code you're probably looking for INSERT, not UPDATE. INSERT adds a new record while UPDATE updates an existing one.

Have a look at the syntax and the examples at INSERT - MariaDB Knowledge Base[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900