A
A
alexandrtym2017-06-04 14:09:12
PHP
alexandrtym, 2017-06-04 14:09:12

Check the manual that corresponds to your MariaDB server version for the right syntax. Why is an error displayed?

Hello. I am learning how to interact with php with phpmyadmin.

$country = "SELECT `country`.`id` FROM `country`  
          where `country`.`country` = '".$_POST["country"]."' "; 
          $resultcountry = mysqli_query($link, $country );
          if (!$resultcountry) {
          printf("Error: %s\n", mysqli_error($link));
          exit();
          }

Gives the error
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 '.'id' FROM 'country' where 'country'.'country' = 'Italy'' at line 1
Data is passed using the post method
<div class="form-group has-feedback">
                    <label for="country" class="control-label">Введите ваше гражданство:</label>
                    <input type="text" id="country" name="country" class="form-control" required="required" value="" placeholder="Например, Италия" minlength="2" maxlength="30">
                    <span class="glyphicon form-control-feedback"></span>
                  </div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shagguboy, 2017-06-05
@shagguboy

query summary show

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question