Reputation: 71
I am trying the following:
mysql_query("SELECT `lastUpdate` FROM `summoner` WHERE `name` = '$summoner['name']';");
But it doesn't work. I think its because of the '
in $summoner['name']
.
Any way to workaround without:
$summonerName = $summoner['name'];
?
Upvotes: 0
Views: 89
Reputation: 2847
You really want to use prepared statements and mysqi_* PHP Manual
//assume you have $conn made and working
if ($stmt = mysqli_prepare($conn, "SELECT `lastUpdate` FROM `summoner` WHERE `name`=?"){
mysqli_stmt_bind_param($stmt, "s", $summoner['name']);
$stmt->execute();
$result = $stmt->get_result();
}
//use $result to loop or whatever...
Upvotes: 2
Reputation: 3118
Try this
"SELECT `lastUpdate` FROM `summoner` WHERE `name` = '$summoner[name]'";
Upvotes: 0
Reputation: 94672
You can use (no single quotes on the occurance)
"SELECT `lastUpdate` FROM `summoner` WHERE `name` = '$summoner[name]'";
Or wrap the Whole array with quotes in curly brackets
"SELECT `lastUpdate` FROM `summoner` WHERE `name` = '{$summoner['name']}'";
Upvotes: 2