Jump to content

deejay

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.toerags.com

Profile Information

  • Gender
    Not Telling
  • Location
    Bournemouth, UK

deejay's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am using SELECT DISTINCT any ideas on how I can get around this. If I cant do it in the mySQL query should I try and write some PHP to sort it? <?php $query =\" SELECT DISTINCT products.products_model, product_pages.title, products.products_id, product_pages.products_id, LEFT(product_pages.main_desc,300) AS description_one FROM products,product_pages WHERE product_pages.title LIKE \'%$search_keyword%\' OR products.products_model LIKE \'%$search_keyword%\' ORDER BY products.products_date_added OR product_pages.products_date_added \"; ?> and the while code I am using to call up the rows of results is <?php while ($resultRow = mysql_fetch_assoc($searchResults)) { //open3 // following if we decide which table the information is got from $title = $resultRow[\'title\']; $products_model = $resultRow[\'products_model\']; $main_desc = $resultRow[\'description_one\']; $descLength = strlen( $main_desc ); if($descLength > 5){ echo \'<tr bgcolor=\"#FFFFFF\"> <td class=\"normal\">\'.$title.\' </td> <td height=\"30\" class=\"normal\">\'.$main_desc.\'</td> <td height=\"30\" class=\"normal\"><a href=\"products.php?title=\'.$title.\'\">Click Here</a></td> </tr>\'; } elseif($products_model){ echo \'<tr bgcolor=\"#FFFFFF\"> <td class=\"normal\">\'.$products_model.\' </td> <td height=\"30\" class=\"normal\">Shopping cart page for \'.$products_model.\' </td> <td height=\"30\" class=\"normal\"><a href=\"/catalog/product_info.php?products_id=\'.$resultRow[\'products_id\'].\'\">Click Here</a></td> </tr>\'; } else echo \'\'; } //end while echo \'</table>\'; } //close 2 ?> struggling with this code badly, does anyone know of a good mySQL book as I\'m finding the documentation heavy going. Thanks for any help
  2. hi Thanks for that, i found I had to add AS to get it to work. <?php LEFT(product_pages.main_desc,450) AS description_one, ?> and now works, cheers
  3. Hi basically i am making a search which has a description in it, what I want to do is only return 150 letters of that description. i thought this would work from the manual but it doesn\'t <?php SELECT table1.title, table1.idnumber, table1.description(LEFT,150) FROM table1 ?> anyone know what I should be doing. Thanks Deej
  4. :oops: how much of an idiot do i feel. cheers mate, sorted now.
  5. sorry, it fails on \'\'error making query\'
  6. I realise that this subject has already many post on it, its just I cant seem to get my head around it :? i have a table called \'cctvcity\' and inside that tables called \'products\', \'product_pages\', \'products_attributes\' and \'products_description\'. Say for example if I want to search for my keyword in the \'title\' or \'main_desc\' field of \'product_pages\' then what is wrong with this code. <?php \"SELECT * FROM cctvcity.products,cctvcity.product_pages,cctvcity.products_attributes,cctvcity.products_description WHERE product_pages.title LIKE \'%$search_keyword%\' OR product_pages.main_desc LIKE \'%$search_keyword%\' ORDER BY ASC \"; ?> thank you for any light you may be able to throw on this. Deej
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.