PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table if not exists test ( name varchar(200) not null ); insert into test (name) values ('test'), ('testelem'), ('stelem'), ('vala');
Copy Clear
Copy Format Clear
<?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)); $result = mysqli_query($mysqli, $query); printf("Select returned %d rows.\n", mysqli_num_rows($result));
Show:  
Copy Clear