Jeg har et her jeg bruger i mit dvd kartotek måske du kan bruge det ??
her er det
<?PHP
session_start();
/*
* +-----------------------------------------------------------------------------+
* Projekt Name: Show products
* +-----------------------------------------------------------------------------+
* Copyright Notes: Copyrights 2003 pc-dk.dk
* +-----------------------------------------------------------------------------+
* Disclaimer Notice(s)
* DONT USE THIS SCRIPT UNLESS YOU HAVE MY PERMISSIONS ON PARER
* WITH MY PERSONAL SIGNATURE ANY QUESTIONS FOR THAT
* SEND ME A MAIL: TLARSEN@PC-DK.DK
* IF YOU WANT TO USE THIS SCRIPT THEN MAIL ME AND PAY FOR IT
* +-----------------------------------------------------------------------------+
* Author(s): Thomas Larsen / Dk-Medieburner E-Mail: Tlarsen@pc-dk.dk
* +-----------------------------------------------------------------------------+
*/
#error_reporting(E_ALL); //For debuggin only, prints all error!
//remove the # to debug
/**
* Module comments (Brief shorly what this piece of code do)
This script is Searcing the movie database
*/
/*
Here starts the code
*/
//This includes the file there is opening a connection to a MySql-database
include_once("dbconnect.php");
//Search code
//to avoid warning i am setting $search to emty here
$result = "";
if ($_SESSION['tjek'] !== "OK") {
header("location:
http://www.pc-dk.dk/video3/");
} else {
//$_POST['search'] is a formfield
$t_start = array_sum(explode(' ', microtime()));
if (isset($_POST['search'])) {
//searching the database
$res = mysql_query("SELECT * FROM film WHERE titel LIKE '%$_POST[search]%'") or die(mysql_error());
//to avoid a warning i am setting $row to an emty array here-->
$row = array();
//runs the $res trough a while statement
while ($row[] = mysql_fetch_array($res));
//finds the numers of posts in the database
$antal = mysql_num_rows($res);
//Fjerner det største element i arrayet altid være et element med værdien false.
array_pop($row);
$exec_time = array_sum(explode(' ', microtime())) - $t_start;
$result = $exec_time * 100;
}
}
//end if
/*
Here stops the code
if you have any html
write it belowe here
*/
?>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body background="">
<?php echo "<div style='color:white;'>Søgningen tog " .substr($result,0,5). " secunder</div>"; ?>
<table border="0">
<?php
if(isset($_POST['search'])) {
foreach ($row as $film) {
?>
<tr>
<td><?PHP echo $film['id'] ?></td>
<td><?PHP echo $film['titel'] ?></td>
<td><?php echo "<a href='read_rest_movie.php?id=$film[id]&titel=$film[titel]' target='_new'>Læs resten</a>"; ?></td>
</tr>
<?php
} //end foreach
} //end if
?>
</table>
<form action="search_movie.php" method="POST">
<table>
<tr>
<td>Søg på titel</td>
</tr>
<tr>
<td><input type="text" name="search" id="txt_box"></td>
</tr>
<tr>
<td><input type="submit" name="sog" value="Søg" id="submit"></td>
</tr>
</body>
</html>
<?php
?>