This is my html page, which takes in an input by the user and the searches the database for the word, also there is a function which is suppose to display the results here is the html code

require_once ( 'browsing.php' );

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8"/>
<link rel="STYLESHEET" type="text/css" href="../../style/Browse.css">

<div id="search_box">
<form name="input" action="" method="post">
Search <input type="text" name="search" />
<input type="submit" value="Submit" />

<p><?= $browsing->searchbrowse() ?></p>



The function does not work, i keep getting this error

Fatal error: Call to a member function searchbrowse() on a non-object in D:\Hosting\9791131\html\uploads\upload\browse.php on line 26

This is the code for the funtion

     function searchbrowse()

if (isset($_POST['search'])) {

      $search= $_POST['search'];
      $con = mysql_connect("","xxxx","xxxx");
      if (!$con) {
      die('Could not connect: ' . mysql_error());

      mysql_select_db("xxxx", $con); 
      $result = mysql_query("

      SELECT videos.videoname, videos.id_video 
      FROM videos
      WHERE videos.videoname=$search


        echo "Videos:";
      while ($row = mysql_fetch_array($result)) {
      echo "<div id=\"Search_Browse\">";
      echo "<a href='uploads/upload/browseplayer.php?num=$file_location'>$link</a>";
      echo "</div>";



What is going wrong?

Member Avatar for iamthwee

From what I see browing is not a member function in a Class.

Therefore just call it searchbrowse()

instead of:


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.