I am trying to save a string which is just $id = "27491";
into a database table called users
under a field called user id
here's what I have tried currently but it's not working...
mysqli_query($DB,"INSERT INTO `users` SET `id` = '".$id."'");
EDIT: The content just does not go into the database, the issue before was just a typo.
Also does not work with my $title
string.
mysqli_query($DB,"INSERT INTO `users` SET `title` = '".mysqli_real_escape_string($DB,$title)."'");
You can use like below, One more suggetion for you, this is not good practice to use space in field name. So, you can use field name like user_id, this is good to go.:
mysqli_query($DB,"INSERT INTO `users` SET `user id` = '".$id."'");
// ^ you miss
OR
mysqli_query($DB,"INSERT INTO `users` (`user id`) VALUES('".$id."')";
Parenthesis aren't closing in your code...
mysqli_query($DB,"INSERT INTO `users` SET `user id` = '".$id."'");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With