Question: Please I need help in this question. I am new to connect php to mysql database. the homework is t... please I need help in
Please I need help in this question. I am new to connect php to mysql database. the homework is t...
please I need help in this question. I am new to connect php to mysql database.
the homework is thatOnce the user enters a keyword, such as life in the example below, the PHP program displays all film with titles containing the keyword
then when the user click on the one of the title it should appears on the URL the film_id of this title

I tried to write the code but I am not sure about it. please can some on check it for me.
if(!isset($_POST['submit'])) { header("Location:index.php"); } $submit_sql=" select title from film where name like '%" .$_POST[ 'submit'] ."%'; $submit_quary=mysql_quary($submit_sql); if(mysql_num_rows($submit_quary)!=0){ $submit_rs= mysql_fetch_assoc($submit_quary); } ?> if ($stmt = $mysqli->prepare($submit_sql)) { $stmt->execute(); $stmt->bind_result($title); $stmt->store_result(); $numResult = $stmt->num_rows; }
if ($numResult == 0) { $result .= Search results for keyword: "; $result .= "
"; $selfURL = selfURL(); // Remove query string in the URL. $selfURL = substr( $selfURL, 0, strrpos( $selfURL, "?")); while ($stmt->fetch()) { $result .=
__A_CATEGORY; } } $stmt->free_result(); return $result; } // categoryLinks
// Get the film titles, length and actor counts, actors names $query = prepare($query)) { $stmt->bind_param('i', $fid); $stmt->execute(); $stmt->bind_result($film_id, $film_title, $actor_count, $actor_name); $stmt->store_result(); $numResult = $stmt->num_rows; } if ($numResult == 0) { $result .=
{ $result .= "
search result for the keyword life:
- "; $selfURL = selfURL(); // Remove query string in the URL. if (strrpos($selfURL, "?")) { $selfURL = substr($selfURL, 0, strrpos($selfURL, "?")); } while ($stmt->fetch()) { $result .= $catName __ONE_CATEGORY; } $result .= "
"; } $stmt->free_result(); return $result; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
