got a code that searches relevant row(project) in mysql table and lists results.
table:
id_initials_project_picfile_comments
prints=
Home, material.jpg. Home, plant.jpg. Nepal, croc.jpg. Nepal, winroof.jpg. Nepal, watchtower.jpg. Nepal, moths.jpg. Nepal, mountainview.jpg. Nepal, tomb1.jpg. New York, scraper.jpg. Stuff, bike.jpg. Underground, stairwell.jpg. Underground, spiralstairwell.jpg. now i want to be able to get rids of the repeated $project as they are taking up needed space in my text box, any ideas?
It would be good if i could print something like this=
Nepal (croc.jpg winroof.jpg watchtower.jpg moths.jpg mountainview.jpg tomb1.jpg)
Any help would be great, this is really doing my head in. I think it needs an IF {}. somewhere but i can't get anything working.
php code=
<?
$value = $_POST['search'];
$s = @mysql_connect("localhost", "crabbe_crabbe", "unemployment1")
or die("Couldn't connect to database");
$sql = "SELECT id, picFile, project, initials, comments, ratio FROM $table_name ORDER BY project DESC";
$d = @mysql_select_db("crabbe_dantest", $s) //change database name
or die("Couldn't selectdatabase");
$result = @("select ratio, comments, project, initials, picFile from backfacefinal where initials like\"%$value%\" ORDER BY project");
$resultCount = 0;
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$ratio = $row['ratio'];
$picFile = $row['picFile'];
$comments = $row['comments'];
$project = $row['project'];
$initials = $row['initials'];
$display_block .= "<font color=\"#FF6600\"><b>$project</b></font>, <a href='asfunction:_root.showjpg,$picFile#$ratio'>$picFile</a>. ";
$resultCount++;
}
if (!$resultCount) {
echo "&root.results=Sorry, no records were found!";
}
echo "&root.move.list=$display_block";
?>
thanks in advance...