I'm trying to write this function of this program that will extract a value (one that they click on from a list of values) from a mySQL table. When I write this code, It always gives me the error "No database Selected."
I am trying to extract values from a table (performed_in) inside of the schema movies. The user selects a name, then the program is supposed to search the table "performed_in" and return values (all of the fields) that match what the user selected.
Even if my type something like this, it doesnt connect.
mysql_connect('localhost', 'uMoviesUser', '');
The problem seems to be inside of the query line. What is wrong with it?
$moviesdb = new mysqli('localhost', 'uMoviesUser', '', 'movies');
if (mysqli_connect_errno()) {
echo '<h3>Database Access Error!</h3>';
}
else {
$select = "select * from performed_in";
$select .= " where name = '".$_GET['name']."'";
$res = mysql_query($select) or die(mysql_error());
while($row = mysql_fetch_array($res)){
echo $row;
}