Jump to content

digitalgod

Members
  • Posts

    374
  • Joined

  • Last visited

    Never

Everything posted by digitalgod

  1. well what I'm trying to do is have the first query display the the club names and the date. Then when you click on that it will display all the names for that club on that date. makes any sense? So should I keep the first query you gave me and on the second page have a new query that will display all the names for that club on that night? [b]*edit* actually I also want it to display the number of names in the first query[/b]
  2. nope, I can't echo the name, anyone it can select everything but just have a DISTINCT club?
  3. thanks, I'll try that now, but will that still let me see the names? or will I only be able to echo the club and date?
  4. hey guys, I'm trying to figure out how to build a query. I have a table named list and in it there's "club" and "date" and "name" what I want is to display a list ordered by the name of the club and then ordered by the date. But there could more than 1 entry that has the same club name and date. so let's say I have club2 | 2006-08-23  | John club1 | 2006-08-24  | Jen club1 | 2006-08-24  | Sarah club1 | 2006-08-24  | Chris club3 | 2006-08-24  | Louis so it would display club2 2006-08-23 club1 2006-08-24 club3 2006-08-24 and if I click on club 1 I can see all the names. The 2nd part I can easily do it with by doing $_GET but I'm not too sure how to do the first one. any ideas?
  5. hey guys, I was wondering if it's possible to print info in an html table and if there are more than 48 cells it starts a new column? something like this ------------------------------------- |                  | |   INFO 1      |    INFO 49 |                  | ------------------------------------- |                  | |   INFO 2      |   etc |                  | ------------------------------------- |                  | |up to info 48 | |                  | ------------------------------------- and if there's more than 96 it will create a new page. Any ideas how to do that?
  6. hey guys, I have this mysql query [code] <?php mysql_query("SELECT * FROM events WHERE CURDATE() == date ORDER BY id") or die(mysql_error()); ?> [/code] and I get an error saying that it's somewhere here : == date ORDER BY id I just want it to find all the events that are dated for today. Any reason why it's giving me that error?
  7. ok did a few changes and made it work, I used a drop down instead with an onChange event. I'm guessing it would also work with a textbox and an onChange event but I'd have to limit the number allowed thanks! *edit* got another question.. If a user selects 2, it will make 2 other fields appear, now if a user selects 3 right after, it will add another 3 boxes.... Any way I can stop that from happening? [b]Nevermind I figured it out, simply added this at the begining of the function[/b] [code] document.getElementById('txtBoxArea').innerHTML = ''; [/code]
  8. thanks radalin I'll give it a shot the reason why I want to do it with ajax is that I don't want the user to click a button to add more boxes, I would really like it to be done as soon as the user enters a value. Why can't it be done with ajax? I know I have a lot of reading to do...
  9. darn it I forgot that the text is different from the value... the drop down looks like Wednesday (Aug 16th)  and the value looks like wednesday... I added that so that people don't get confused hmm any other suggestions?
  10. ahhh never thought of that, I'll give it a shot and post back
  11. well that's what I said.... I'd normally do that but I can't, I need the value to be a day because when the user selects a day javascript/php checks to see if that day has subcategories and if it does it populates the 2nd drop down. is there another way?
  12. hey guys, I was wondering how can I take a day (such as Friday) and transform it into something like this 0000-00-00 (year-month-day) I have a drop down that's being populated with an array like so [code=php:0] list($y,$m,$d) = explode("-",date("Y-m-d")); $daysValue = array(); for ($i=0;$i<=6;$i++) { array_push($daysValue,date("l", mktime(0,0,0,$m,$d+$i,$y))); } echo '<select name="night" onchange="Fill_Sub()" style="width:150px; height:17px; font-family:tahoma; font-size:10px; color:#9A400C "><option value="">Select one</option>'; for($i=0;$i<count($days);$i++) { echo  '<option value='.strtolower($daysValue[$i]).'>'.$daysValue[$i].'</option>'; } echo "</select>"; [/code] so when the form is submitted I'd like to take that day and transform it into a full date (0000-00-00). I'd normally give it that value in the drop down but I can't do that here because I need the value to be something like Friday. is there a way I can take just take that day and transform it? All the days start from today till the week after like Wednesday to Tuesday.
  13. I was just wondering if someone knew how can I have a text field where a user can enter a number and when he types lets say 3 it will add 3 text fields under it. I know it can be done in AJAX but I really know nothing about AJAX for now so if someone could point me to a tutorial or a script that already does that would be great. Thanks
  14. hey guys, I'm trying to make 2 dynamic drop downs where the 2nd one is populated with elements from a db depending on what was selected in the 1st drop down. The first drop down is populated with an array, it contains the days of the week. So when you choose a day I want the second drop down to be populated with the names of clubs that are opened on that day. something like SELECT club FROM clubnights WHERE club = "monday" this is what I have so far (got it from nogray's post somewhere on this forum [code] <?php $query = "SELECT * FROM clubs"; $result = mysql_query ($query); while ($row = mysql_fetch_array($result)) {     $query1 = "SELECT * FROM clubnights WHERE club = '".$row['name']."'"; $result1 = mysql_query ($query1);         if ($row['name'] !='') { $sub_arrays .= "subs[".$row['name']."] = new Array(";         while ($row1 = mysql_fetch_array($result1)) {         $sub_arrays .= "\"".$row1['club']."\",";     }     $sub_arrays = trim($sub_arrays, ",") .");\n"; } } list($y,$m,$d) = explode("-",date("Y-m-d")); $days = array(); for ($i=0;$i<=6;$i++) {     array_push($days,date("l", mktime(0,0,0,$m,$d+$i,$y))); } ?> <script language="javascript"> var subs = new Array(); <?= $sub_arrays ?> function fill_subs(val){     if (val != ""){         var sub_sel = document.getElementById('club');         sub_sel.innerHTML="";         opt = document.createElement("OPTION");         opt.value = "";         opt.innerHTML = "Select";         sub_sel.appendChild(opt);                 for(i=0; i<subs[val].length; i++){             opt = document.createElement("OPTION");             opt.value = subs[val][i];             opt.innerHTML = subs[val][i];                         sub_sel.appendChild(opt);         }     } } </script> //...... <form name="list" method="post" action="index.php?a=list"> <input type="hidden" name="process_a" value="yes"/> <? echo '<select name="night" onChange="fill_subs(this.value);"><option value="">Select one</option>'; for($i=0;$i<count($days);$i++) { echo  '<option value='.strtolower($days[$i]).'>'.$days[$i].'</option>'; } echo "</select>"; echo '<select id="club" name="club"><option value="">Select one</option>'; echo "</select>"; ?>         </form> [/code] it keeps telling me that I have an error on line 200 which is the onChange event : <select name="night" onChange="fill_subs(this.value);"> any ideas what I'm doing wrong?
  15. thanks AndyB that worked perfectly, for some reason I thought that I could have everything at 0 and just add a value for the days. DillyDong, yeah I also tried that and it worked but I needed a permanent solution
  16. hey guys, trying to build an array that cpntains all the days of the week starting by today. I have this so far but for some reason it shows the date starting wednesday and not thursday ( I already tried doing echo date("l"); and it prints Thursday) [code=php:0] $days = array(); for ($i=1;$i<=7;$i++) { array_push($days,date("l", mktime(0,0,0,0,+$i,0))); } [/code]
  17. I know and I tried different solutions but without any success.... here's what I have so far [code=php:0] echo '<SCRIPT language=JavaScript type=text/javascript> '; echo 'var store = new Array();'; for ($i=0; $i<$numRows; $i++){ //for each item $js_array = ""; $sql = 'SELECT * FROM clubnights'; $result = mysql_query($sql) or die (mysql_errno().": select ".mysql_error()."<BR>" . $sql); while ($row = mysql_fetch_array($result)) { $js_array .= "'" . $row['club'] . "','" . $row['club'] . "',"; } $js_array = rtrim( $js_array , ","); // trim final comma echo 'store['.$i.'] = new Array('; // start javascript array echo $js_array . "); "; } // end for echo '</SCRIPT>'; [/code] [code] <SCRIPT language=JavaScript type=text/javascript> <!-- Begin /* Execute init() function */ window.onload = initialize; function initialize () { if (self.init) self.init(); } function init() { optionTest = true; lgth = document.forms[0].night.options.length - 1; document.forms[0].night.options[lgth] = null; if (document.forms[0].night.options[lgth]) optionTest = false; if (optionTest) self.populate(); } function populate() { if (!optionTest) return; var box = document.forms[0].club; var number = box.options[box.selectedIndex].value; if (!number) return; var list = store[number]; var box2 = document.forms[0].night; box2.options.length = 0; for(i=0;i<list.length;i+=2) { box2.options[i/2] = new Option(list[i],list[i+1]); } [/code] where "night" is m first drop down and "club" is my second. night is populated by an array and I want "club" to be populated depending on what night is chosen my table clubnights looks like this id  | night      | club  |..... 1  | Friday     | Aria   | 2  | Thursday | Circus | ..... etc so a night can have several clubs I'm really lost
  18. anyone??? been trying to do this for a while without any success....
  19. hey guys, I have 2 drop downs, my first one is being populated by an array but I'd like to have my 2nd one populated from a db depending on the value of the first drop down. I already know how to do it but my way requires the form to be refreshed... would there be a simple way to do is without having to reload the page?
  20. yeah I did, it works perfectly akitchin, I'm just tired that's all :P
  21. k thanks guys just another question though I have this [code=php:0] $days = array(); for ($i=1;$i<=7;$i++) { array_push($days,date("l", mktime(0,0,0,0,+$i,0))); } echo "<select name='days' ><option value=''>Select one</option>"; for($i=0;$i<=count($days);$i++) { echo  '<option value='.$days[$i].'>'.$days[$i].'</option>'; } echo "</select>"; [/code] that's supposed to display all the days from today till next tuesday but for some reason it adds a blank choice after tuesday, any reason why? I know how to make it work, all I need to do is to replace the <= by <count($days).... never mind my brain isn't all there today by using <= it will loop 8 times instead of 7
×
×
  • 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.