Jump to content

select

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

select's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I used the value it worked but i am not too sure it's pretty. $query = "SELECT bmodel FROM cars WHERE bid = {$_SESSION['cars']}";
  2. Hi, I am pretty new to these drop down menus and this is pretty much a example I followed. I need to some how get the selected or ($row['bmodel']) put in a session, so I can echo on another page. $_SESSION['sel'] = $row['bmodel']; dbConnect(); $query = "SELECT bid, bmodel FROM cars"; $result = mysql_query($query); $car_menu = ''; $car_menu .= "<option value=\"0\">" . "Choose cars..." . "</option>\n"; while ($row = mysql_fetch_assoc($result)) { $selected = ($row['bid'] == $_POST['cars']) ? ' selected="selected"': ''; $car_menu .= "<option value=\"{$row['bid']}\"{$selected}>". ($row['bmodel']) ."</option>\n"; } <select name="cars" id="cars"> <?php echo $car_menu; ?> </select>
  3. I got first part working, but I see that this might not be the way to do it at all, since the id=”here” gets assigned to all the links all the time, because of the while loop I suppose.
  4. Hi, I am trying to do a dynamic menu based on page id. This is what I got: $id = clean($_GET['id']); $current_page = $id; if($current_page == $id) { echo 'id="here"'; } This is how I get the menu from the database: while($row = mysql_fetch_assoc($result) ) { echo "<li>" . "<a href=" . $row['mlink'] . " title=" . $row['mtitle'] . ">" . $row['mname'] . "</a>" . "</li>"; } Can I somehow work the if $current_page statement into the <a> tag and assign the id to the link?
  5. Thank you so much. It is perfect.
  6. Thank you. I have put the values into a session. [article_id] => 13,2 What I am trying to do is the following; get the first value, here 13, in a session. [article_id] => 13 Then get the second value, here 2, into a different session. [picture_id] => 2
  7. Hi I have a drop-down list and need to have more then one value to just one option. echo "<option value=" . $row['ii'], $row['bi'] . ">" . $row['io'] . "</option>"; So I somehow need to split the two values so I can use each individually.
  8. Thank you so much kickstart! That did it; so far so good it works. I really need to get better with INNER JOIN’s. What I am trying to do is this, in one query. Get one or multiply articles (or content) to each page according to URL id and URL section. One or more pictures can be associated with one article.
  9. Hi, can anyone tell me if I can use some sort conditional statement in this query. "content.fk_pictures = pictures.pid" That's the part I would like to make Conditional, something like, if false (or null maybe) then ignore, else show result. The problem is that if no pictures are present then there's no result. SELECT content.cheader as ch, content.ctekst as ct, pictures.ppath as pp FROM content, section, pictures WHERE content.fk_section = section.sid AND section.sid = 1 AND content.fk_menu = 1 AND content.fk_pictures = pictures.pid I would really appreciate it, if you need more info just tell me what to post.
  10. Hi I am fairly new to MySQL and have a bit of a hard time especially with relations. I am trying to achieve the following. Getting articles with pictures according to page id. Each article should only be shown if it match a page id. Each article can have multiply pictures. If you could give me an idea on how to set up the tables with relations I would really appreciate it.
×
×
  • 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.