"Tom Thackrey" <us***********@ nospam.com> wrote in message news:<x%******* ********@newssv r29.news.prodig y.com>...
On 1-Nov-2003, i.*******@onmai l.co.uk (ian justice) wrote:
"Tom Thackrey" <us***********@ nospam.com> wrote in message
news:<FW******* ***********@new ssvr14.news.pro digy.com>...
You'd save us all a lot of time if you'd just post the sql
statement that's failing along with the mysql error message.
The basic and simple form and scripts are given below.
#######SHORT FORM########
<form method="get" action="file_na me.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_co nnect("localhos t", "user_name" , "password") or
die("could not connect");
$rs=@mysql_sele ct_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>FOL DER</th>";
$list.="<th>FOR MAT</th>";
$list.="<th>ART IST</th></tr>";
while($row=mysq l_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_co nnect("localhos t", "user_name" , "password") or
die("could not connect");
$rs=@mysql_sele ct_db("database _name", $conn) or die("could not connect
to database");
$sql="select * from table_name where";
if(isset($song) ){
$sql.="song="$s ong" and"
}
if(isset($folde r)){
$sql.="folder=" $folder" and"
}
if(isset($forma t)){
$sql.="format=" $format" and"
}
if(isset($artis t)){
$sql.="artist=" $artist" and"
}
$sql=ereg_repla ce("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>FOL DER</th>";
$list.="<th>FOR MAT</th>";
$list.="<th>ART IST</th></tr>";
while($row=mysq l_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_na me.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>FOLD ER</b><br>
<input type="radio" name="order" value="order by
artist"><b>ARTI ST</b> 
<input type="submit" value="SEARCH"> <input type="reset"
value="RESET">< br><br>
</form>