0

I want to take this SELECT query and pass it to the variable $names, then have $name equal to the updates.update_id. It's not working.

<?php
$names = $modelbio_names['update_id']; 
// QUERY THE DATABASE FOR THE MODEL NAMES ON THE [BROWSE VIDEOS] PAGE  
$browse_modelbio_names = "SELECT updates.update_id, models.model_id,     first_name, last_name, updates_models.update_id, updates_models.model_id
FROM updates, models, updates_models
WHERE updates.update_id = updates_models.update_id AND models.model_id =     updates_models.model_id AND updates.update_id = $names";
$browse_modelbio_names_query = mysqli_query($connection,     $browse_modelbio_names);
// TEST IF THERE WAS A QUERY ERROR
if (!$browse_modelbio_names_query) {
    die("THE QUERY FOR THE MODEL NAMES ON THE [BROWSE VIDEOS] PAGE HAS     FAILED.");
}
 ?>   
codeman
  • 11
  • 4
  • 1
    of course it's not. you never bother FETCHING any rows from your result `$browse_modelbio_...`. and you're undoubtedly vulnerable to [sql injection attacks](http://bobby-tables.com) and need to QUOTE `$names`. – Marc B Oct 14 '16 at 14:05
  • Are you getting any error message here ? Are you sure you have proper value for the `$names` variable? Your approach looks right although you should consider using bind variables. – Maximus2012 Oct 14 '16 at 14:06
  • It is unclear what you ask. You never assign the query string to that variable, the code says something else. And then, why would you want to reuse the same variable name for different things? – arkascha Oct 14 '16 at 14:06

0 Answers0