PHP - Php For Each Groups?
Hello
I am after some guidance on the following scenario: I have a news page that pulls from a database and would like to seperate it out by year, see below 2010 Bulletin 2 - 23/11/2010 - Some news here..... Bulletin 1 - 21/11/2010 - Some news here..... 2009 Bulletin 2 - 23/11/2009 - Some news here..... Bulletin 1 - 21/11/2009 - Some news here..... How can i do this automatically and seperate them out by year like above Similar TutorialsI'm using Active Directory and PHP with LDAP. I have been trying to create a script that will list all the members of each group in a OU. When I run this script in an OU with Users, it will return an array with all the available attributes of each User. However when I use it with a group, it doesn't return any attributes of the group. Code: [Select] <?php $ig_ldaphost="LDAP://domain/"; //filtered for security $ig_ldapou="OU=Drive Security,OU=Groups,DC=this,DC=and,dc=that"; //filtered for security $ig_ldapconn=ldap_connect($ig_ldaphost) or die("Could not connect to {$ig_ldaphost}"); $ig_ldapopt=ldap_set_option($ig_ldapconn,LDAP_OPT_PROTOCOL_VERSION,3) or die("Could not set options: {$ig_ldapopt}"); $ig_ldapbind=ldap_bind($ig_ldapconn) or die("Could not bind: {$ig_ldapbind}"); $ig_ldapsearch=ldap_search($ig_ldapconn,$ig_ldapou,"objectClass=*"); for ($ig_ldapentry=ldap_first_entry($ig_ldapconn,$ig_ldapsearch);$ig_ldapentry!=FALSE;$ig_ldapentry=ldap_next_entry($ig_ldapconn,$ig_ldapentry)) { $ig_ldapvalues=ldap_get_attributes($ig_ldapconn,$ig_ldapentry); $ig_ldapdn=ldap_explode_dn(ldap_get_dn($ig_ldapconn,$ig_ldapentry),1); echo "/".$ig_ldapdn[1]."/".$ig_ldapdn[0]."<br />"; var_dump($ig_ldapvalues); echo "<br /><br />"; } ldap_close($ig_ldapconn); ?> Can anyone help with this? Hello,
I am sending an email via phpmailer to a large group of recipients.
I bcc'd the entire group which of course failed after the max limit was reached so I thought what about sending in chunks....
Im just trying to figure out how to loop through the groups of bcc's
basically Im thinking something like this...
$mail = new PHPMailer(true); $mail->IsSMTP(); //setup from, replyto etc here... //email query here to get emails in array $bccz.. //chunk results $newArray = array_chunk($bccz, 50, false); // Now process array_chunk() $i = 0; foreach ($newArray as $inner_array) { $i++; while (list($key, $value) = each($inner_array)) { addBCC($value['email']); }$subject = '=?UTF-8?B?'.base64_encode($cobig).'?='; $mail->Subject = $subject; $mail->IsHTML(true); $mail->Body = $ermail; $mail->Send(); } $mail->clearBcc(); }Just wondering if someone can tell me if this basic logic is right? Dear all, I am new in this forum. This is my code $query = " SELECT webdb.id, webdb.writer, writer.picLoc, webdb.title FROM webdb, writer WHERE webdb.writer=writer.name and category = 'Researchworks' and language = 'Farsi' ORDER BY writer DESC"; $resultaat = mysql_query($query, $LinkID); $column_count = mysql_num_fields($resultaat) or die (mysql_error()."<br>Couldn't execute query: $SQLquery"); $counter=1; echo "<table border=\"0\" width=\"700\" border color=white><tr>"; while ($row = mysql_fetch_row($resultaat)) { if ($author !== $row[1]) { $author = $row[1]; echo "<td align=right width=220 valign=top style=\"margin: 5px; float: right border-bottom-color:#000; border-left-color:#000;\">"; echo "<img width=\"50\" height=\"80\" src=\"admin/writers/$row[2]\" border =\"0\"><br>".$row[1]."<br>"; echo "<a href=\"poems.php?writer=$row[1]\">".$row[3]."</a><br>"; echo "</td>"; if($counter%3==0) { echo"</tr><tr>"; } $counter++; } } echo"</tr></table>"; i have authors with different articles on a certain topic. What i want is, displaying the name of the author only once and all his titles under his name. I also want a dynamic table where i display three authors in each row and soon as there a fourth author a new row must start. My problem now is is the title is also being filtered and i can only display one title. Thanks in advance Hi, I know very little about binding PHP to AD. At the minute it is setup to Authenticate against AD (Via IIS), then from the that I have the following: Declare's the Logon_Name variable, so that it can be used to 'print' buttons, and links i.e. if ($logon_name==("Administrator")); {echo admin link here'}; $logon_name = basename($_SERVER['AUTH_USER']); What I would ideally like to do is be able to find the group the user is a member of, this way we can create custom AD groups like intra_admin and then if they are a member they will be able to see certain links to pages etc. Any ideas, I hope this makes sence I have a group of 4 radio buttons. my mysql database knows which one the user selected previously when they stored some information. I now wish to display the same buttons but have radio button checked that the user chose before. I know this can be done but having one of those mind melt moments where I cannot think of the solution so I have 4 buttons that look like this Code: [Select] <input type="radio" name="clarity" id="clarity" value="Opaque"> Opaque<br> <input type="radio" name="clarity" id="clarity" value="Deep"> Deep<br> <input type="radio" name="clarity" id="clarity" value="Mid"> Mid<br> <input type="radio" name="clarity" id="clarity" value="Pale"> Pale<br></td> I just need to attached a checked field to the correct item Hi
I have a two dimensional array and would like to output the results in groups depending upon one of the fields in the array. While i have managed this and have figured out how to create a header for each group, i would now like to create a footer (end of group) line where i could create a subtotal or similar.
my working code with the header is below but how do i add the footer?
$group = null; for($i=0;$i<count($rowKitCharges);$i++){ if($rowKitCharges[$i]['SubCategory'] != $group) { //echo the group header echo "<br><b>" . $rowKitCharges[$i]['SubCategory'] . "</b><br>"; $group = $rowKitCharges[$i]['SubCategory']; } echo $rowKitCharges[$i]['HireID'] . " " . $rowKitCharges[$i]['SubCategory']; echo "<br>"; }Thanks Jon Hey all, I'm wondering the best way to use foreach to break a list of records into groups. For example, the problem with this: Code: [Select] foreach($vanity_url as $v){ if($v->approved){ echo "Approved vanity urls:"; echo $v->url; } else { echo "Unapproved vanity urls:"; echo $v->url; } } is it will return this: Code: [Select] Approved vanity urls: michellefrancis Unapproved vanity urls: johnmerlino Unapproved vanity urls: ericmayers when I want it to return this: Code: [Select] Approved vanity urls: michellefrancis Unapproved vanity urls: johnmerlino ericmayers thanks for response I have started a project using laravel. I am in the process of builing User groups and permissions in the admin dashboard.
I have uploaded a snapshot of my views to which i want to restrict access. i want to structure it to be completely dynamic
views.PNG 9.41KB
0 downloads
What I am looking for is a small script that works in the way that http://www.groupsort.com/ works. This is for a sports organization. Loads of registrations entered into a MySQL database which need to be automatically sorted into classes that have already been created with an age range specified (Class: S1, From: 1997, To: 1999, Sex: Mixed) Whereas there are some classes with the same set of rules, I have no idea of how I should divide the correct amount of children into correct classes. Can you help? Hello Guys This is the first time i ask a question at php freaks. Hope i could find the answer. I want to create something similar to the image now the problem is that i want to get groups and their users in the same array. Notice something like Array => Group1 [1] => user1 [2] => user2 [3] => Group2 and so on. How could i do that. Thanks in advance. I have a form on a PHP page which has 11 groups of radio buttons. Is there way to use PHP instead of client-side JavaScript to submit the form values only when one radio button has been selected from each of the 11 groups? Also, is it possible to get the form elements in a PHP page with JavaScript? Why does this JavaScript: Code: [Select] myForm.elements.lengthstop working in a PHP page? I thought it wouldn't affect client-side JS since PHP is server-side code. Thank you! Hi, I need some help getting my head around arrays. I have a basket of fruit: $basket=("Apple","$Orange","$Banana","$Banana","$Peach","$Apple","$Banana","$Orange","$Apple"); I want to distribute and share this basket of fruit into bowls, such that each bowl contains the following: $bowl=("$Apple",$Orange,"$Banana","$Banana") ie. One Apple, One Orange & Two Bananas. I can't seem to figure out how to do it. Thanks in advance. Hi, I need to sort variables in groups of up to 15 and put it in an array. For example: $exstract['center_tabOpBody_0'] =5 $exstract['center_tabOpBody_1'] =6 $exstract['center_tabOpBody_2'] =8 $exstract['center_tabOpBody_3'] =1 Should yield: ARRAY( = center_tabOpBody_1,center_tabOpBody_2,center_tabOpBody_3 // <-----15 [1] = center_tabOpBody_0 //<----5 ) Is there some simple function do do the "efficiency" sort? Thanks, Vadim |