i.*******@onmail.co.uk (ian justice) wrote in message news:<f6**************************@posting.google. com>...
I'm sending this via web tv, so i'll post the scripts on a pc come
Sunday. The versions i am using are;
PHP4u Version 3.0 Based on PHP-4.3.2
MySQL 3.23.52
The basic and simple form and scripts are given below.
#######SHORT FORM########
<form method="get" action="file_name.php">
Write In Here <input type="textarea" name="write" rows="1"
cols="400"><br><br>
<input type="submit" value="SEARCH">
<input type="reset" value="RESET">
######SHORT SCRIPT########
<?php
$conn=@mysql_connect("localhost", "user_name", "password") or
die("could not connect");
$rs=@mysql_select_db("database_name", $conn) or die("could not connect
to database");
$sql="$write";
$rs=mysql_query($sql, $conn) or die("could not execute query");
$list="<table border=\"1\" cellpadding=\"2\">";
$list.="<tr><th>SONG</th>";
$list.="<th>FOLDER</th>";
$list.="<th>FORMAT</th>";
$list.="<th>ARTIST</th></tr>";
while($row=mysql_fetch_array($rs))
{
$list.="<tr>";
$list.="<td>".$row["SONG"]."</td>";
$list.="<td>".$row["FOLDER"]."</td>";
$list.="<td>".$row["FORMAT"]."</td>";
$list.="<td>".$row["ARTIST"]."</td>";
$list.="</tr>";
}
$list.="</table>";
echo($list);
?>
################################################## #############################
BE A GOD----SEND ME TO HEAVEN
If you want to have a great time and loads of fun. Please feel free to
tackle the problem with my 'Utopian script', which would send me
soaring to Heaven, emotionally, that is.
It produces the following parse error "Parse error: parse error in
/data/members/paid/x/x/user_name/htdocs/directory_name/file_name.php
on line 9"
###LONG SCRIPT#######
<?php
$conn=@mysql_connect("localhost", "user_name", "password") or
die("could not connect");
$rs=@mysql_select_db("database_name", $conn) or die("could not connect
to database");
$sql="select * from table_name where";
if(isset($song)){
$sql.="song="$song" and"
}
if(isset($folder)){
$sql.="folder="$folder" and"
}
if(isset($format)){
$sql.="format="$format" and"
}
if(isset($artist)){
$sql.="artist="$artist" and"
}
$sql=ereg_replace("and", "", "$sql");
if(isset($order)){
$sql.="order="$order"
}
$rs=mysql_query($sql, $conn) or die("could not execute query");
$list="<table border=\"1\" cellpadding=\"2\">";
$list.="<tr><th>SONG</th>";
$list.="<th>FOLDER</th>";
$list.="<th>FORMAT</th>";
$list.="<th>ARTIST</th></tr>";
while($row=mysql_fetch_array($rs))
{
$list.="<tr>";
$list.="<td>".$row["song"]."</td>";
$list.="<td>".$row["folder"]."</td>";
$list.="<td>".$row["format"]."</td>";
$list.="<td>".$row["artist"]."</td>";
$list.="</tr>";
}
$list.="</table>";
echo($list);
?>
######LONG FORM#######
<form action="form_name.php" method="GET">
<b>SONG</b><br>
<input type="text" name="song" size="50"><br>
<b>FOLDER</b><br>
<input type="text" name="folder" size="2"><br>
<b>FORMAT</b><br>
<input type="text" name="format" size="20"><br>
<b>ARTIST</b><br>
<input type="text" name="artist" size="40"><br>
The percent sign can be used as a wildcard. You can place it at the
start, end or both ends with appropiate results.<br>
<b>ORDER RESULTS BY;</b><br>
<input type="radio" name="order" value="order by song"
checked><b>SONG</b><br>
<input type="radio" name="order" value="order by
folder"><b>FOLDER</b><br>
<input type="radio" name="order" value="order by
artist"><b>ARTIST</b> 
<input type="submit" value="SEARCH"><input type="reset"
value="RESET"><br><br>
</form>