Jump to content

bradkenyon

Members
  • Posts

    179
  • Joined

  • Last visited

    Never

Everything posted by bradkenyon

  1. Didn't know you give it nicknames, such as vol and ven, thank you! It is fixed now.
  2. I tried this and nothing is printing, could anyone see what may be wrong with this. <?php $sql = "SELECT venues.venue_name as 'Venue', COUNT(volunteers_2009.id) as 'Number Of Volunteers' FROM venues ven JOIN volunteers_2009 vol ON (venues.id=volunteers_2009.venue_id) GROUP BY venues.venue_name ORDER BY venues.venue_name ASC"; $result = mysql_query($sql); while(list($name,$vols) = mysql_fetch_array($result)) { print '<p>'.$name.': '.$vols.'</p>'; } ?>
  3. Another question, how would I go about printing out these values to the web page. I imagine I would have to loop thru and print each venue name, then pull the count for that venue and print that along side the venue name. Thanks for the help, anymore would be greatly appreciate, thanks again!
  4. I have two tables, one that contains volunteers, and one that contains venues. Volunteers are assigned one venue each. The id of the venues table (venues.id) is placed within the volunteers table in the venue_id column (volunteers.venue_id). I know I could get a count of of how many matching values are in the volunteers.venue_id column by SELECT venue_id, COUNT(*) FROM volunteers GROUP BY venue_id; Why I want to do this: so the user can go in and see how many volunteers are assigned to each venue. table: volunteers columns: id, name, venue_id table: venues columns: id, venue_name volunteers.venue_id = venues.id I know this would be a join statement of some sort so it will get a count of each venue, then match up volunteers.venue_id to venues.id and print out the venues.venue_name along with the count. Any help would be appreciated - Thank you.
  5. I have a table (venues) that has 21 different items. Then I have a table (volunteers_2009) that I store volunteer info into, for a festival. Each volunteer will be assigned a venue, so volunteers_2009.venue_id is venues.id I want to display each volunteer, with the select drop down box pre-selected to the venue they are assigned. Here is the query statement that allows me to display the venue that is assigned for each volunteer, but I need to populate a select drop down box with all the venues (venues.venue_name) from the table venues. $query = "SELECT volunteers_2009.id, volunteers_2009.comments, volunteers_2009.choice1, volunteers_2009.choice2, volunteers_2009.choice3, volunteers_2009.lname, volunteers_2009.fname, volunteers_2009.venue_id, venues.venue_name FROM volunteers_2009 AS volunteers_2009 LEFT OUTER JOIN venues ON (volunteers_2009.venue_id = venues.id) ORDER by $order $sort"; table: volunteers_2009 columns: id, lname, fname, comments, interest, choice1, choice2, choice3, venue_id table: venues columns: id, venue_name How do I go about populating the select drop down box with all the venues within the venues table, and pre-select the venue that volunteer (volunteers_2009.venue_id == venues.id) is assigned to? Example: volunteer (volunteers_2009.id) 7 has venue_id (volunteers_2009.venue_id, venues.id) 4 <form action="upd.php?id=7"> <select name="venue_id"> <option value="1">Bagpipe Competition</option> <option value="2">Band Assistance</option> <option value="3">Beer/Wine Pouring</option> <option value="4" selected>Brochure Distribution</option> <option value="5">Childrens Area</option> <option value="6">Cleanup</option> <option value="7">Cultural Center Display</option> <option value="8">Festival Merch</option> </select> <input type="submit" value="submit" name="submit"> </form> I appreciate any help, thank you.
  6. Thank you. $query = "SELECT volunteers_2009.id, volunteers_2009.lname, volunteers_2009.fname, volunteers_2009.venue_id, venues.venue_name FROM volunteers_2009 AS volunteers_2009 LEFT OUTER JOIN venues ON (volunteers_2009.venue_id = venues.id) ORDER by $order $sort";
  7. So I could list all the general volunteers_2009 data, as well as joining the volunteers_2009 and venues table? I want to get the following data: table: volunteers_2009 columns: id, lname, fname, comments, venue_id table: venues columns: id, venue_name I need to match volunteers_2009.venue_id to venues.id, to display venues.venue_name I hope this makes sense.
  8. this is the code i have now. i want it to go to the volunteers_2009 table, grab the venue_id, go to the venues table, match up volunteers_2009.venue_id to venues.id, to display venues.venue_name, so in the list it will display the volunteer's venue assignment. <?php // ----------------------------------------------------- //it displays appropriate columns based on what table you are viewing function displayTable($table, $order, $sort) { $query = "select * from $table ORDER by $order $sort"; $result = mysql_query($query); // volunteer's venue query $query_venues = "SELECT volunteers_2009.venue_id, venues.venue_name FROM volunteers_2009 JOIN venues ON volunteers_2009.venue_id = venues.id"; $result_venues = mysql_query($query_venues); if($_POST) { ?> <table id="box-table-a"> <tr> <th>Name</th> <?php if($table == 'maillist') { ?> <th>Email</th> <?php } ?> <?php if($table == 'volunteers_2008' || $table == 'volunteers_2009') { ?> <th>Comments</th> <?php } ?> <?php if($table == 'volunteers_2009') { ?> <th>Interests</th> <th>Venue</th> <?php } ?> <th>Edit</th> </tr> <tr> <?php while($row = mysql_fetch_array($result)) { $i = 0; while($i <=0) { print '<td>'.$row['fname'].' '.$row['lname'].'</td>'; if($table == 'maillist') { print '<td><a href="mailto:'.strtolower($row['email']).'">'.strtolower($row['email']).'</a></td>'; } if($table == 'volunteers_2008' || $table == 'volunteers_2009') { print '<td><small>'.substr($row['comments'], 0, 32).'</small></td>'; } if($table == 'volunteers_2009') { print '<td><small>1) '.$row['choice1'].'<br>2) '.$row['choice2'].'<br>3) '.$row['choice3'].'</small></td>'; ?> <td> <?php if($row_venues['venue_name'] != '') { // print venue assigned print $row_venues['venue_id'].' '.$row_venues['venue_name'].' '; } else { print 'No Venue Assigned'; } ?> </td> <?php } ?> <td><a href="?mode=upd&id=<?= $row[id] ?>&table=<?= $table ?>">Upd</a> / <a href="?mode=del&id=<?= $row[id] ?>&table=<?= $table ?>" onclick="return confirm('Are you sure you want to delete?')">Del</a></td> <?php $i++; } print '</tr>'; } print '</table>'; } } // ----------------------------------------------------- ?> [attachment deleted by admin]
  9. should i put the query statement outside that while loop?
  10. this is my function and it seems to be printing out the same venue_name in each <td></td>, it prints out the same venues in each row of the table, it doesn't specify the venue for that appropriate volunteer, can you see what i am doing wrong? <?php // ----------------------------------------------------- //it displays appropriate columns based on what table you are viewing function displayTable($table, $order, $sort) { $query = "select * from $table ORDER by $order $sort"; $result = mysql_query($query); if($_POST) { ?> <table id="box-table-a"> <tr> <th>Name</th> <?php if($table == 'maillist') { ?> <th>Email</th> <?php } ?> <?php if($table == 'volunteers_2008' || $table == 'volunteers_2009') { ?> <th>Comments</th> <?php } ?> <?php if($table == 'volunteers_2009') { ?> <th>Interests</th> <th>Venue</th> <?php } ?> <th>Edit</th> </tr> <tr> <?php while($row = mysql_fetch_array($result)) { $i = 0; while($i <=0) { print '<td>'.$row['fname'].' '.$row['lname'].'</td>'; if($table == 'maillist') { print '<td><a href="mailto:'.strtolower($row['email']).'">'.strtolower($row['email']).'</a></td>'; } if($table == 'volunteers_2008' || $table == 'volunteers_2009') { print '<td><small>'.substr($row['comments'], 0, 32).'</small></td>'; } if($table == 'volunteers_2009') { print '<td><small>1) '.$row['choice1'].'<br>2) '.$row['choice2'].'<br>3) '.$row['choice3'].'</small></td>'; $query_venues = "SELECT volunteers_2009.id, venues.venue_name FROM volunteers_2009 JOIN venues ON volunteers_2009.venue_id = venues.id"; $result_venues = mysql_query($query_venues); ?> <td> <?php while($row_venues = mysql_fetch_array($result_venues)) { if($row_venues['venue_name'] != '') { // print venue assigned print $row_venues['venue_name']; } else { print 'No Venue Assigned'; } } ?> </td> <?php } ?> <td><a href="?mode=upd&id=<?= $row[id] ?>&table=<?= $table ?>">Upd</a> / <a href="?mode=del&id=<?= $row[id] ?>&table=<?= $table ?>" onclick="return confirm('Are you sure you want to delete?')">Del</a></td> <?php $i++; } print '</tr>'; } print '</table>'; } } ?>
  11. i have a volunteers table, which each volunteer will be assigned to a venue. i have a venue table which has the venue name w/ their own unique id (id). and in the volunteers table, the venue id will be stored within the venue_id column. i want to display venue name when i display that volunteer's info. table for volunteers, is volunteers_2009: id, etc..., venue_id table for venues, is venues: id, venue_name so i would have to compare volunteers_2009.venue_id to venues.id How would I properly write out the join to display the venue_name? Thanks in advance, I appreciate it.
  12. I am having trouble grabbing the values from the form once processed. I need your help. function updateUser($table, $id) { if($_POST) { processUpdate($table, $id); } else { updateForm($table, $id); } } function processUpdate($table, $id) { print $table; //testing print $id; //testing $email=addslashes($HTTP_POST_VARS['email']); $lname=addslashes($HTTP_POST_VARS['lname']); $fname=addslashes($HTTP_POST_VARS['fname']); print $lname; //which table do we update switch($table) { case "maillist": $result = mysql_query("UPDATE $table SET email='$email', lname='$lname', fname='$fname' WHERE id='$id'") or die(mysql_error()); break; } } The function updateForm($table, $id); just outputs the form, has email, lname, fname fields. And when you process the form, the action is the same, w/ the table and id being passed thru the url, so it GET's the id and table that way, and for lname, fname, and email, it should grab it via post. But for some reason, it does not post the values.
  13. They can only be assigned to one venue, for each year. So right now, I am just managing the 2009 Volunteers, for the festival that takes place in July of 2009.
  14. Does this look good? <?php foreach ($_POST['venue'] as $volID => $venueID) { // process volID and venueID if ($venueID != 0) { // insert ids into database $result = mysql_query("UPDATE volunteers_2009 SET venue_id='$venueID' WHERE id=$volID") or die(mysql_error()); } } ?>
  15. i have a table that has volunteers in it, then a table that has venues stored. each volunteer will be assigned to a certain venue, and i list all the volunteers w/ their name, and each has a drop down list of all the venues, the volunteer chairman will go in and assign each volunteer by the drop down which will be next to each volunteer's name. what i envision is for the volunteer chair to go down thru the list and assign each volunteer and hit a button that will grab all the volunteers and plug the venue the chairman assigned them to, so it will store the venue id from the venues table into the volunteers table, within its venue_id column. what i really need to know how to do is how to assign all the selected drop downs and assign the values into each volunteer's venue_id record field with a click of the button. so it will go thru the form and grab each value and store it into the venue_id column of the volunteers table. thanks in advance! <?php // ----------------------------------------------------- //it displays appropriate columns based on what table you are viewing function displayTable($table, $order, $sort){ $query = "select * from $table ORDER by $order $sort"; $result = mysql_query($query); if($_POST) { ?> <table border="1" cellpadding="5" width="850px"> <tr> <th>Name</th> <?php if($table == 'volunteers_2008' || $table == 'volunteers_2009') { ?> <th>Comments</th> <?php } ?> <?php if($table == 'volunteers_2009') { ?> <th>Interests</th> <th>Venue</th> <?php } ?> <th>Edit</th> </tr> <tr> <?php while($row = mysql_fetch_array($result)) { $i = 0; while($i <=0) { print '<td>'.$row['fname'].' '.$row['lname'].'</td>'; if($table == 'volunteers_2008' || $table == 'volunteers_2009') { print '<td><small>'.substr($row['comments'], 0, 32).'</small></td>'; } if($table == 'volunteers_2009') { print '<td><small>1) '.$row['choice1'].'<br>2) '.$row['choice2'].'<br>3) '.$row['choice3'].'</small></td>'; //display list of venues $query_venues = "select * from venues ORDER by venue_name ASC"; $result_venues = mysql_query($query_venues); ?> <td><select name="venue"> <option>Not Assigned</option><?php while($row_venues = mysql_fetch_array($result_venues)) { print '<option value="'.$row_venues['id'].'">'.$row_venues['venue_name'].'</option>'; } ?> </select></td> <?php } ?> <td><a href="?mode=upd&id=<?= $row[id] ?>&table=<?= $table ?>">Upd</a> / <a href="?mode=del&id=<?= $row[id] ?>&table=<?= $table ?>" onclick="return confirm('Are you sure you want to delete?')">Del</a></td> <?php $i++; } print '</tr>'; } print '</table>'; } }?>
  16. i have a table that has volunteers in it, then a table that has venues stored. each volunteer will be assigned to a certain venue, and i list all the volunteers w/ their name, and each has a drop down list of all the venues, the volunteer chairman will go in and assign each volunteer by the drop down which will be next to each volunteer's name. what i envision is for the volunteer chair to go down thru the list and assign each volunteer and hit a button that will grab all the volunteers and plug the venue the chairman assigned them to, so it will store the venue id from the venues table into the volunteers table, within its venue_id column. what i really need to know how to do is how to assign all the selected drop downs and assign the values into each volunteer's venue_id record field with a click of the button. so it will go thru the form and grab each value and store it into the venue_id column of the volunteers table. thanks in advance! <?php // ----------------------------------------------------- //it displays appropriate columns based on what table you are viewing function displayTable($table, $order, $sort){ $query = "select * from $table ORDER by $order $sort"; $result = mysql_query($query); if($_POST) { ?> <table border="1" cellpadding="5" width="850px"> <tr> <th>Name</th> <?php if($table == 'volunteers_2008' || $table == 'volunteers_2009') { ?> <th>Comments</th> <?php } ?> <?php if($table == 'volunteers_2009') { ?> <th>Interests</th> <th>Venue</th> <?php } ?> <th>Edit</th> </tr> <tr> <?php while($row = mysql_fetch_array($result)) { $i = 0; while($i <=0) { print '<td>'.$row['fname'].' '.$row['lname'].'</td>'; if($table == 'volunteers_2008' || $table == 'volunteers_2009') { print '<td><small>'.substr($row['comments'], 0, 32).'</small></td>'; } if($table == 'volunteers_2009') { print '<td><small>1) '.$row['choice1'].'<br>2) '.$row['choice2'].'<br>3) '.$row['choice3'].'</small></td>'; //display list of venues $query_venues = "select * from venues ORDER by venue_name ASC"; $result_venues = mysql_query($query_venues); ?> <td><select name="venue"> <option>Not Assigned</option><?php while($row_venues = mysql_fetch_array($result_venues)) { print '<option value="'.$row_venues['id'].'">'.$row_venues['venue_name'].'</option>'; } ?> </select></td> <?php } ?> <td><a href="?mode=upd&id=<?= $row[id] ?>&table=<?= $table ?>">Upd</a> / <a href="?mode=del&id=<?= $row[id] ?>&table=<?= $table ?>" onclick="return confirm('Are you sure you want to delete?')">Del</a></td> <?php $i++; } print '</tr>'; } print '</table>'; } }?> [attachment deleted by admin]
  17. $(document).ready(function() { $('select').change(function() { var thisValue = $(this).val(); switch (thisValue) { case "1": $("div.event_fields").fadeIn("slow"); break; case "2": $("div.event_fields").fadeIn("slow"); break; case "3": $("div.event_fields").fadeIn("slow"); break; case "4": $("div.event_fields").fadeOut("slow"); break; case "5": $("div.event_fields").fadeOut("slow"); break; case "6": $("div.event_fields").fadeOut("slow"); break; case "7": $("div.event_fields").fadeOut("slow"); break; } }); }); <select name="event_type_id"> <option>Select Event Type</option> <option value="2">Events Student</option> <option value="3">Events Faculty/Staff</option> <option value="1">Events FS & Students</option> <option value="5">Announcements Student</option> <option value="6">Announcements Faculty/Staff </option> <option value="7">Announcements FS & Students</option> <option value="4">Food Item</option> </select> <div class="event_fields" style="display: none">Display Events</div>
  18. I have a drop down box that I want to display certain information if that item is selected within the select drop down box. So if that item is selected, then it will automatically display another part of the form the user will need to fill out. i want to do this, so it will shorten the form up for the user, basically only showing the fields they need to fill out based on what item they select in the drop down box. How do I accomplish this using jQuery?
  19. Thanks, tried it out. $today = date("Y-m-d"); $todays_date = strtotime("$today +1 day"); printed out: 1222228800 must be doing something wrong.
  20. I have $todays_date = date("Y-m-d"); it says 2008-09-23 I want to add to the day, so it will be 2008-09-24 How do I go about that?
  21. when i hit submit, it seems to not post the table value, because im trying to grab the value from that drop down list, then put it into the other function to display the table i selected from the drop down.
  22. i have a small drop down form to select the table to view, i try to capture the value and put into the function to display it properly but i ran into a little problem, any help would be appreciated. switch($_GET['mode']) { case "view": getTableToList(); break; case "logout": print 'logout'; break; case "export"; print 'export'; break; } i select to 'view' then it displays me w/ the drop down menu to select from, then it is suppose to grab the value and use it within a function being called within that function. kind of new to functions, so a function within a function is kind of new to me. <?php // ----------------------------------------------------- //list volunteers in admin section function displayList($table, $order, $sort){ $query = "select * from $table ORDER by $order $sort"; $result = mysql_query($query); ?> <table border="1" cellpadding="5" width="100%"> <tr> <th>Name</th> <th>Comments</th> <th>Venue Preference</th> <th>Venue</th> <th>Edit</th> </tr> <tr> <? while($row = mysql_fetch_array($result)) { $i = 0; while($i <=0) { print '<td>'.$row['fname'].' '.$row['lname'].'</td>'; print '<td><small>'.substr($row['comments'], 0, 32).'</small></td>'; print '<td><small>1) '.$row['choice1'].'<br>2) '.$row['choice2'].'<br>3) '.$row['choice3'].'</small></td>'; print '<td><small>1) '.$row['choice1'].'<br>2) '.$row['choice2'].'<br>3) '.$row['choice3'].'</small></td>'; ?> <td><a href="?mode=upd&id=<?= $row[id] ?>">Upd</a> / <a href="?mode=del&id=<?= $row[id] ?>" onclick="return confirm('Are you sure you want to delete?')">Del</a></td> <? $i++; } print '</tr>'; } print '</table>'; } // ----------------------------------------------------- // ----------------------------------------------------- //get table you want to list function getTableToList(){ print ' <form method="post" action="?mode=view"> <select name="table"> <option>Select</option> <option value="volunteers_2009">2009 Volunteers</option> <option value="volunteers_2008">2008 Volunteers</option> <option value="maillist">Festival Updates</option> </select> <input type="submit" value="View" name="submit"> </form>'; displayList($HTTP_POST_VARS['table'], 'lname', 'ASC'); } // ----------------------------------------------------- ?>
×
×
  • 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.