#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    New York, NY, USA
    Posts
    1
    Rep Power
    0
    Hi,

    I have a serious problem with PHP / MySQL not processing my queries correctly. For example, say I have 2 tables, "companies" and "categories", where "type" is a list of 10 or so types (small, big, large etc.). It has 2 columns, "type" and "price," both of which are string values.

    The "companies" table has a lot of columns. It also contains "type" column, indicating which company is of which type. The values in this column is the same as in "categories" table.

    Now, I want php to return a MySQL query result of roughly: "Select price from type where type = $companies["type"]" .. In other words, I want a "price" value for whatever type this company belongs to.

    Please help if you can-- anyone. I need to get this done in about a week... considering that there's still a ton left to do, please let me know if you're interested in working on this. I'm willing to hire anyone who's interested.

    Thanks,
    -Clueless newbie
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Location
    Gorakhpur,U.P.,India
    Posts
    24
    Rep Power
    0
    in this case you need to join the tables. you can use something like

    select categories.price from companies,categories where (
    (companies.type=categories.type) and (companies.name = "Name of the Company"))

    this should give you the desired result.

    I am also willing to work as a consultant. Please mail me separately for that.

    Hope you find the abobe info useful...


    ------------------
    Anish Modi
    Infotech World
    India

    [This message has been edited by amodi (edited March 03, 2000).]

Similar Threads

  1. php and mysql - alternative to nested queries??
    By gursharn in forum PHP Development
    Replies: 2
    Last Post: January 22nd, 2004, 02:49 PM
  2. php, mysql, and a tiny bit of javascript programmer for hire
    By benthekiller in forum JavaScript Development
    Replies: 0
    Last Post: January 21st, 2004, 02:15 PM
  3. UnixODBC + PHP + Apache + Empress
    By coder4hire in forum Database Management
    Replies: 0
    Last Post: January 15th, 2004, 02:41 PM
  4. php queries using mysql ver 4.0.16
    By hairbear in forum MySQL Help
    Replies: 7
    Last Post: January 12th, 2004, 12:36 PM

IMN logo majestic logo threadwatch logo seochat tools logo