SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot prashidi's Avatar
    Join Date
    Mar 2001
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    First Character of String

    Hi everyone,

    I tried to find the solution to my question through the search feature but unfortunately I had no luck.

    Any Help would be greatly appreciated.

    This is what I am trying to do.

    "Search Driver Manufacturer" - http://www.3ddrivers.com/drivers.php

    In my mysql database I have a table named driver_prod and inside that table i have $pman which contains stuff like MSI Corporation, Micron... . How do i setup the coding so I can look in the driver_prod and match it so that for example if I want Manufacturers which start with M to be displayed?

    M = <first character in $pman> <--- This is mostly what I am looking for. I know how to display it.

    Thank you guys for the help.

    Is this done with the explode feature?

  2. #2
    Are you ready for BSD? Marshall's Avatar
    Join Date
    Dec 2001
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How do i setup the coding so I can look in the driver_prod and match it so that for example if I want Manufacturers which start with M to be displayed?
    You can do this in SQL using the LIKE string comparison function. The following query will return an alphabetical list of all entries in the `driver_prod' table that have a 'manufacturer' value start with `M':

    Code:
    SELECT * FROM driver_prod
    WHERE manufacturer LIKE 'M%'
    ORDER BY manufacturer
    This example assumes that you have a `manufacturer' column in your table that contains the name of the driver's manufacturer. You'll want to avoid using column names that start with a dollar sign ($) since PHP will try to parse these values as variables if double quotes are used around the SQL query string.

    - Marshall

  3. #3
    SitePoint Zealot prashidi's Avatar
    Join Date
    Mar 2001
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks

    Got it to work.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •