Jump to content

Devil_Banner

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Posts posted by Devil_Banner

  1. Thanks alot for helping me out on that one.
    Say I wanted to improve and have the user choose in a first dorpdownlist, and by doing so have it populate the second dropdownlist with stuff relevant to the first choice?
    Lemme explain :
    Say the user chooses "printer" in the first dropdownlist (populated by "ArticleType" column (Article.ArticleType)), then I would want the second dropdownlist (Article.ArticleBrand) to display choices like HP, Epson, and so on...
    Is this easy to do ? I mean, dynamically  ?
    Thanks very much for you guys' time :-)
  2. Hi there,

    I have this really dumb problem with my query. I have to admit i'm a newbie, hence my stupid problem.
    I Use MySQL 5. (Easyphp 1.8 )
    I have a table which has a column named ArticleModel.
    I Have four entries in this table.
    My goal is to select the entries in this table and output them into a dropdown list.
    For example, I want the list to contain
    LaserJet 4000
    Deskjet 1200
    Latitude D515
    Cisco 2950 series

    I can't get further than having 4 times 'array' written in my dropdown list. I have managed to get the first one (Laserjet 4000) to get into the list, but I can't figure out how to loop so it continues to fill my list...

    Here's my code:

    [color=green]$conn[/color] = [color=blue]mysql_connect[/color]([color=green]$dbHost[/color], [color=green]$dbUser[/color], $dbPassword) or die([color=orange]'DB connexion error'[/color]);
    [color=blue]mysql_select_db[/color]($dbName) or die ([color=orange]"DB not reachable"[/color]);

    //query
    [color=green]$sql[/color] = [color=orange]"SELECT * FROM article "[/color];
    [color=green]$query[/color] = [color=blue]mysql_query[/color]([color=green]$sql[/color]);
    if (![color=green]$query[/color]) {
                  // error handler
                  echo [color=orange]'Query failed. SQL: '[/color], [color=green]$sql[/color], [color=orange]'<br />Error # '[/color], [color=blue]mysql_errno()[/color], [color=orange]' Error msg: '[/color], [color=blue]mysql_error()[/color];
                  exit;
                 }
    //end of query

    [color=green]$row[/color] = [color=blue]mysql_fetch_array[/color]([color=green]$query[/color]);
    [color=green]$item[/color] = [color=green]$row[/color][[color=orange]'ModeleArticle'[/color]];
    echo "<option value=\"[color=limegreen]$item[/color]\">[color=green]$item[/color]</option>";

    Now, I suppose that before the next to last line of code, there should be a loop, but like I said : can't figure out how...

    Thanks alot for helping me out.
×
×
  • 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.