Problem with list() function in PHP -


i've written code below:

$release_id = intval(filter_var($_get["rid"],filter_sanitize_string)); $query = "select * press_releases id = {$release_id}";  $result = $db->query($query); $row = $result->fetch_assoc();  list($id, $short_description, $description, $created_date) = $row;  $db->close(); 

and using variables such $description, $short_description inside of html tags nothing shows. if use code below same except list() function:

$release_id = intval(filter_var($_get["rid"],filter_sanitize_string)); $query = "select * press_releases id = {$release_id}";  $result = $db->query($query); $row = $result->fetch_assoc();  $id = $row["id"]; $short_description = $row["short_description"]; $description = stripslashes(html_entity_decode($row["description"])); $created_date = $row["created_date"];  $db->close(); 

it works perfectly. list() function cannot assign values coming $row array.

i don't understand why?

i don't believe list() function works associative arrays. try fetching query results (numerical indices) , see if resolves issue you.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -