|
#1
|
|||
|
|||
|
Search Function [mission accomplished]
Okay no one responded to my search function request.
Keep in mind i'm not a PHP coder so any input would be helpful. I copied a goofy script that I edited to search mysql for title names. look: http://www.nauglevision.com/pix/search.htm search "dog" What this gives me is printout: 2004-10-22 12:45:39 JJ Doggle jj_pola.jpg - - - - - - 2004-10-29 10:48:51 Sitting Dog IMG_0124.jpg - - - - - - okay so it's successfully searching the table i want and returning the results. Now, how can i make these results hyplerlinked to the image/page? I know generating a thumbnail in the search result would be rad but that ain't going to happen. -OR- Would there be a way to search the RSS / feed file and give me the results as a link? Again, any input would be great. Attached is the PHP file i made the search from: Code:
<?
//connect to mysql
//change user and password to your mySQL name and password
mysql_connect("localhost","dodobaseXXX","XXXXX");
//select which database you want to edit
mysql_select_db("XXXXXXX");
$search=$_POST["search"];
//get the mysql and store them in $result
//change whatevertable to the mysql table you're using
//change whatevercolumn to the column in the table you want to search
//$result = mysql_query("SELECT * FROM news WHERE message LIKE '%$search%'");
$result = mysql_query("SELECT * FROM pixelpost_pixelpost WHERE headline LIKE '%$search%'");
//grab all the content
while($r=mysql_fetch_array($result))
{
//the format is $variable = $r["nameofmysqlcolumn"];
//modify these to match your mysql table columns
$datetime=$r["datetime"];
$headline=$r["headline"];
$body=$r["body"];
$image=$r["image"];
$category=$r["category"];
$id=$r["id"];
//display the row
echo "$datetime <br> $headline <br> $image <br>- - - - - -<br>";
}
?>
Here's the result i get: 2004-10-22 12:45:39 JJ Doggle jj_pola.jpg - - - - - - 2004-10-29 10:48:51 Sitting Dog <--- i want this linked IMG_0124.jpg - - - - - - Great, but how about a link....or a thumbnail? Thanks Pixel peeps. -nauz
__________________
www.nauglevision.com/pix |
|
#2
|
||||
|
||||
|
Re: Search Function - any PHP coders for advice??
Code:
//display the row
echo "$datetime <br> <a href=\"index.php?showimage=$id\">$headline</a> <br> <a href=\"index.php?showimage=$id\"><img src=\"thumbnails/thumb_$image\"></a> <br>- - - - - -<br>";
}
?>
__________________
icq: 66760929 |
|
#3
|
|||
|
|||
|
The pixel master solves it again!!
You rock!
I figured you knew the code inside and out. Thanks again. -N
__________________
www.nauglevision.com/pix |
|
#4
|
|||
|
|||
|
Works check it out
__________________
www.nauglevision.com/pix |
| Post Reply |
| Thread Tools | |
|
|