MySQL Forums
Forum List  »  PHP

Re: Select Match Against Problem PHP/Mysql
Posted by: Chris Brocklesby
Date: February 15, 2006 08:35AM

Hi Nick


<?

// Search Query //
$result = mysql_query("SELECT * FROM customer_attachments WHERE customer_id = '$customer_id' AND customer_attachment_filename LIKE '%". $q ."%' OR customer_attachment_title LIKE '%". $q ."%' ORDER BY $sort_by LIMIT $page, $limit");
while ($row =mysql_fetch_array($result)){
extract($row);
?>

<tr class="tr-highlight-off" onMouseOver="className='tr-highlight-on'" onMouseOut="className='tr-highlight-off' ">

<td>
<a href='?action=display_attachment&customer_id=<? echo $customer_id ?>&customer_attachment_id=<? echo"$customer_attachment_id" ?>' ><img src='../images/common/icons/icon-clip.gif' alt='Open Attachment - <? echo substr($customer_attachment_filename, 14) ?>' width="16" height="16" border=0></a><a href="attachments/<? echo $customer_attachment_filename ?>" title="Download <? echo substr($customer_attachment_filename, 14) ?>"><img src="../images/common/icons/icon-download.gif" alt="Download <? echo substr($customer_attachment_filename, 14) ?>" border="0" ></a></td>


<td><a href='?action=display_attachment&customer_id=<? echo $customer_id ?>&customer_attachment_id=<? echo"$customer_attachment_id" ?>' ><b><? echo"$customer_attachment_title" ?></b></a></td>
<td><a href='?action=display_attachment&customer_id=<? echo $customer_id ?>&customer_attachment_id=<? echo"$customer_attachment_id" ?>' ><? echo substr($customer_attachment_filename, 14) ?></a></td>
<td><a href='?action=display_attachment&customer_id=<? echo $customer_id ?>&customer_attachment_id=<? echo"$customer_attachment_id" ?>' ><? echo"$customer_attachment_owner" ?></a></td>
<td><a href='?action=display_attachment&customer_id=<? echo $customer_id ?>&customer_attachment_id=<? echo"$customer_attachment_id" ?>' ><? echo"$customer_attachment_date" ?></a></td>
<td align="right" class="table-results-line"><a href="javascript:confirmDelete('?action=delete_attachment&customer_id=<? echo $customer_id ?>&customer_attachment_id=<? echo"$customer_attachment_id" ?>&customer_attachment_filename=<? echo"$customer_attachment_filename" ?>')"><img src='../images/common/icons/icon-delete.gif' border=0></a></td>
<td></td>
</tr>

<? ;} ?>


This code is bring up the results for ALL customers attachments in stead of the single customer attachments related to that customer_id.... I need to be able to search customer_attachment_filename and customer_attachment_title without bringing up all the customers.....

Any Ideas ?

Thanks
Chris

Options: ReplyQuote


Subject
Written By
Posted
Re: Select Match Against Problem PHP/Mysql
February 15, 2006 08:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.