“MySqli Real Escape String Php” Respostas de código

MySqli Real Escape String Php


<?php

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = mysqli_connect("localhost", "my_user", "my_password", "world");

$city = "'s-Hertogenbosch";

/* this query with escaped $city will work */
$query = sprintf("SELECT CountryCode FROM City WHERE name='%s'",
    mysqli_real_escape_string($mysqli, $city));
$resu = mysqli_query($mysqli, $query);
printf("Select returned %d rows.\n", mysqli_num_rows($result));

/* this query will fail, because we didn't escape $city */
$query = sprintf("SELECT CountryCode FROM City WHERE name='%s'", $city);
$result = mysqli_query($mysqli, $query);

Famous Frog

php var_export para string

$someString = var_export($anyVariable, true);
Brainy Bison

Respostas semelhantes a “MySqli Real Escape String Php”

Perguntas semelhantes a “MySqli Real Escape String Php”

Mais respostas relacionadas para “MySqli Real Escape String Php” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código