Jump to content

JayNo

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

About JayNo

  • Birthday 05/25/1983

Contact Methods

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

Profile Information

  • Gender
    Not Telling
  • Location
    Toronto

JayNo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you Ray, this will probably be the answer for the other fields too. Would this work for numbers as well?
  2. I'm having trouble searching for things from my database. I have a drop down list of clients, eg.. - all clients <initially selected> - Asahi - Budweiser - Corona - Heineken if the user doesn't select anything I want to search for everything in the database no matter what the client name. If a client is selected i want it to search for data from only that client. The only problem is that there is about 20 other fields that have areas like this (so i can't just set up a different query for each) Anyone have an idea as to how to set up a search function to do this. My code right now looks like this: [code]$client = $_POST['client']; if ($client == 'All'){   $clientCompare = "NOT IN ('$client')"; }else{   $clientCompare = "= '$client'"; } mysql_select_db($mysqldatabase, $mysqlconnection); $exhibitQuery = "SELECT * FROM tbl_test1 WHERE col_clientName $clientCompare";[/code] Right now this works but only when there is a client selected on the form. but if i put in the "NOT IN()" directly into the WHERE clause it works... this is where i'm frustrated. I will need other conditions for the other form data, but just testing right now. Thanks.
  3. I'm having trouble searching for things from my database. I have a drop down list of clients, eg.. - all clients <initially selected> - Asahi - Budweiser - Corona - Heineken if the user doesn't select anything I want to search for everything in the database. If a client is selected i want it to search for data from only that client. The only problem is that there is about 20 other fields that have areas like this. Anyone have an idea as to how to set up a search function to do this. My code right now looks like this: [code]$client = $_POST['client']; if ($client == 'All'){   $clientCompare = '!='; } else {   $clientCompare = '='; } mysql_select_db($mysqldatabase, $mysqlconnection); $testQuery = " SELECT * FROM tbl_test1 WHERE col_clientName $clientCompare $client "; $testResult = mysql_query($testQuery) or die('Error, query failed');[/code] Obviously, i will need other conditions for the other form data, but just testing right now. Thanks.
  4. I'm page that has a mysql database. the database contains company names with some extra information. I need to build a page that has an alphabet at the top of the page, and if you click on one of the letters then you get the company names that start with that letter. Right now i have that, and it's working. But i've run into a problem. I want it so that when the alphabet at the top is generated, i only want letters that actually have stuff in the database to have links (so that a user knows where data is). Example, if the database contained "Adidas" "Nike" and "K-Swiss" then only A, N, and K would have links on them, the rest would still be there, but not have a link. here's the code that i have so far // query mysql_select_db($mysqldatabase, $mysqlconnection); $testquery = " SELECT col_clientName FROM tbl_TEST ORDER BY clientName asc "; $dotestquery = mysql_query($testquery, $mysqlconnection) or die(mysql_error()); $page = ""; if(isset($_GET['page'])) { $page = $_GET['page']; } // output alphabet for ($i=65; $i<=90; $i++){ $letter = chr($i); echo " <a href='letterTEST.php?page=$letter'>"; echo $letter; echo "</a>"; } echo "<br /><br />"; // array output while (list($col_clientName) = mysql_fetch_row($dotestquery)) { $wordLetter = substr($col_clientName,0,1); if ( $wordLetter==$page ){ echo "$clientName"; echo "<br />"; } } Has anyone done anything like this? Thank you in advance - JayNo
×
×
  • 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.