$string="City" $consonants=array("B","b","C","c","D","d","F","f","G","g","H","h","J","j","K","k","L","l","M","m","N","n", "P","p","Q","q","R","r","S","s","T","t","V","v","W","w","X","x","Y","y","Z","z"); foreach($consonants as $chk2) { if(strpos($string,$chk2)!= false) { $ans2[]=$chk2; } } if(isset($ans2)) { $comment2="Consonants in this string: ".join(" ",$ans2); } else { $comment2="Consonants in this string: None"; } echo "".$comment2."<br/>"; so the error is that the displayed consonants does not include the first letter. what could be wrong?

Member Avatar
Member Avatar
+0 forum 3

Hi there been having this problem for a while now and i need guidance the only thing that is showing me only **111** when looping through i have 3 data in my database and its not showing me the result i want any ideas?? thanks in advance **edit** the result would be 1 2 3 not 1 1 1 $cruds = DB::table('cruds')->where('id', $id)->get(); $user_name = $request->Division; $users = DB::table('users')->where('division' ,$user_name)->get(); foreach($users as $key){ foreach($cruds as $cey => $name){ $user_id = $key->id; $cruds_id = $key->id; $cruds_owner = $cey->document_owner; $cruds_division = $key->division; $cruds_document = $cey->document; $cruds_year_release = $cey->year_release; $cruds_sharetoken = $cey->sharetoken; $cruds_privacy …

Member Avatar
+0 forum 0

I'm having a little brain fart and I just want to double check something ... // Array of [a,b,c,d] $array = array('a', 'b', 'c', 'd'); // Loop through array foreach ($array AS $letter) { // Break out of the loop on a specific condition if ($letter == 'c') { break; } } echo $letter; I just want to double check $letter's scope. $letter exists outside of the foreach loop and retains the value of 'c', right?

Member Avatar
Member Avatar
+0 forum 3

I have this function: function (Blobs) { console.log(JSON.stringify(Blobs)); // Make the progress bar here Blobs.forEach(function(Blob) { console.log(Blob); $.post(window.location.href + '/add', Blob); // Increment the progress bar by the correct amount, once above request has completed }); } (This function is passed as an argument, hence no name) I want a progress bar to be shown, showing how many of the 'n' requests have returned. The page the request is POSTing to may take some time (5ish seconds) to respond, and the loop may need to run multiple tens of times. Once all the requests have completed, I need to redirect …

Member Avatar
Member Avatar
+0 forum 2

TLDR: When large amounts of files (array values) are in the array, the loop will iterate through all the values but only execute part of the foreach statement for some of them. When that happens, it will always affect the same files (in file order, not file name). Detailed version: Recently, I have written a script which scans webserver folders for new files (invoices) by name. Through using arrays the script separates the new files from the old files and inserts them as links into the body of an email to be sent out to a client at the end …

Member Avatar
Member Avatar
+0 forum 2

Hi, I would like to loop the data-attribute to contain all column names and values from a mysql table. This is what it looks like today: while ($row = $result->fetch()) { echo "<div id='{$row['namn']}' data-column1='{$row['column1']}' data-column2='{$row['column2']}'... So some kind of magic :) loop inside there so I don't have to write all the column names manually. Is this possible? Cheers! /Adam

Member Avatar
Member Avatar
+0 forum 2

Im having a problem using foreach i cant seem to understand this yet. my problem is when i enter all the data needed it shows many inserting code I cant seem to figure this out This is the Output INSERT INTO `dependents`(`d_name`, `d_age`) VALUES (1,1) INSERT INTO `dependents`(`d_name`, `d_age`) VALUES (1,2) INSERT INTO `dependents`(`d_name`, `d_age`) VALUES (1,3) INSERT INTO `dependents`(`d_name`, `d_age`) VALUES (1,4) INSERT INTO `dependents`(`d_name`, `d_age`) VALUES (2,1) INSERT INTO `dependents`(`d_name`, `d_age`) VALUES (2,2) INSERT INTO `dependents`(`d_name`, `d_age`) VALUES (2,3) INSERT INTO `dependents`(`d_name`, `d_age`) VALUES (2,4) INSERT INTO `dependents`(`d_name`, `d_age`) VALUES (3,1) INSERT INTO `dependents`(`d_name`, `d_age`) VALUES (3,2) INSERT …

Member Avatar
Member Avatar
+0 forum 1

how to display this array.i tried sevaral way.does not working. Array ( [0] => Array ( [date] => Array ( [epoch] => 1401197400 [pretty] => 7:00 PM IST on May 27, 2014 [day] => 27 [month] => 5 [year] => 2014 [yday] => 146 [hour] => 19 [min] => 00 [sec] => 0 [isdst] => 0 [monthname] => May [monthname_short] => May [weekday_short] => Tue [weekday] => Tuesday [ampm] => PM [tz_short] => IST [tz_long] => Asia/Colombo ) [period] => 1 [high] => Array ( [fahrenheit] => 88 [celsius] => 31 ) [low] => Array ( [fahrenheit] => 78 [celsius] …

Member Avatar
Member Avatar
+0 forum 4

i using this code to display radio buttons for selection. somehow the its not working correctly, plz guide on this issue. thanks in advance. <div class="register-section" id="user-role-section"> <label for="wp_rar_user_role"><?php echo $this->wp_rar_role_label; ?></label> <?php foreach($this->wp_selected_rar_roles as $role) { ?> <input type="radio" name="wp_rar_user_role" id="wp_rar_user_role" class="input select" value="<?php echo $role; ?>" /> <label> <?php echo $wp_roles->roles[$role]['name']; ?> </label> <?php } ?> </div>

Member Avatar
Member Avatar
+0 forum 9

i keep getting a error on the next page saying that hotel1 is an undefined index: page 1: foreach($child->children() as $gchild) { //echo ">> " . $gchild->getName() . ": " . $gchild . "<br>"; echo "<tr><td><input type='radio' name='my' value='my" . $gchild->name . "'></td>"; echo "<td><input type='checkbox' name='hotel". $r."' value='" . $gchild->hotelId . "'>" . $gchild->name . "</td></tr>"; $r++; } page 2: if(isset($_POST["hotel1"])) { $hotel1= $_POST["hotel1"]; } if(isset($_POST["hotel2"])) { $hotel2= $_POST["hotel2"]; } can someone tell me what i am missing or if im doing this wrong?

Member Avatar
Member Avatar
+0 forum 1

So I actually posted this in the C# section, but despite peoples best efforts, all all the help there, the problem is still not solved. Background: Im making a game in xna/c# (Who isnt these days). For collision detection, I though I would use rectangles and lists. My thought process was: 1. Load collision map file 2. Parse file, where there is a 1, create a rectangle and add to list 3. In the player class, iterate through the list of rectangles (I called the list 'badTiles') 4. If the player intersects one of the rectangles, prevent them from moving, …

Member Avatar
Member Avatar
+0 forum 3

I would like to convert Control objects wich are in my array to progress bar Objects if possible. I know that the reverse conversion can be done explicitly without a problem but this one seems tricky. If impossible then please suggest something else instead. TNX

Member Avatar
Member Avatar
+0 forum 2

i am trying to get all the result from my databse table but this query is not working. <?php try { $pdo = new PDO('mysql:host=localhost;dbname=articles', 'Avik', ''); } catch (PDOException $e) { $output = 'Unable to connect to the database server.'; echo $output; exit(); } try { $sql = 'SELECT * FROM `post_series`'; $result = $pdo->query($sql); } catch(PDOException $e) { echo "something wrong"; exit(); } foreach ($result as $row) { $series_options[] = array( 'post_series_id_option' => $row['post_series_id'], 'post_series_name_option' => $row['post_series_name'] ); } echo $series_options['post_series_name_option']; ?> it gives me a error : `Notice: Undefined index: post_series_name_option in E:\wamp\www\test.php on line 30`

Member Avatar
Member Avatar
+0 forum 1

index.php coding <td><input type="text" name="slno[]" value="" size="2"></td> <td><input type="text" size="10" name="date[]" id="SelectedDate" onClick="GetDate(this);" readonly="readonly"/></td> <td><input size="24" type="text" name="particulars[]" value="" placeholder="Description"></td> <td><select name="noofnights[]" value="0"> <option value="empty"></option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <input size="14" type="text" onKeyUp="return valtxt(this)" name="rate[]" value="0"> <input size="14" type="text" name="price[]" value="0" …

Member Avatar
Member Avatar
+0 forum 5

Hey guys, I'm having difficulties with a problem. I iterate over an array of data with X rows And i have the positions of each row incremented, i would like that when i found an exception i shift all the position id's so after each exception the next ID has to be +2 as seen in the second attachment. After each exception i woul like to have a free unused position so i can use it later. Any idea of how could i make this ? Picture one is the data array ![368b1e79027f622224713a0d830a0fac](/attachments/large/2/368b1e79027f622224713a0d830a0fac.png "368b1e79027f622224713a0d830a0fac") Picture two is the desired result …

Member Avatar
Member Avatar
+0 forum 6

Hi Everyone... I have been digging around the web for the last two days trying to fix this problem myself, but have come to the realization that I need some help. I have a mysql query that selects all country names from my country db, (works as described) I then have a select dropdown that is populated from the above query. Here is the mysql select. $result_country = $Db->query('select Country from countries order by Country Desc '); Here is the select dropdown. <select name="country" tabindex="2" class="span3" value='<?php echo $country; ?>' id="country" data-placement="right" rel="tooltip" title="Select your Country.."> <?php if($country!=''){?> <option value="<?php …

Member Avatar
Member Avatar
+0 forum 2

I have the following: in my **MODEL:** function get_advert() { $sql = "SELECT * FROM job_advert"; $advert = $this->db->query($sql)->result(); return $advert; } in my **CONTROLLER:** function get_detailed_list() { $job_advert = $this->ranking_model->get_advert(); echo '<pre>'; foreach ($job_advert as $j) { $job_id = $j->advert_id; $sql = "SELECT r.rank, a.advert_id AS job_id, a.job_title, d.firstname, d.uacc_email, d.id_number AS app_id FROM rank_results AS r INNER JOIN job_advert AS a ON r.job_id = a.advert_id INNER JOIN applicant_details AS d ON r.applicant_id = d.id_number WHERE a.advert_id = '{$job_id}' ORDER BY r.rank, d.firstname"; $results[] = $this->db->query($sql)->result(); return $results; } public function index() { $data['content'] = 'admin/ranking/ranking'; $data['results'] = $this->get_detailed_list(); …

Member Avatar
Member Avatar
+0 forum 1

am trying to show assigned variable for failed submission on a smarty form. array assigned as $arr = array($_POST[number]); $smarty->assign(number,$arr); and on tpl form, i added as below. {foreach from=$number item=no} <input name="number[]" type="text" value="{$no[{counter start=1}]}" /> {/foreach} am starting the counter from 1 because this is for dynamically added from jquery, hence am skipping the {$no[0]} from the above input. But when form gets failed, the counter stays at 1 and does not increase. How can i increase the number counter to get the exact input array value. And I also tried, <input name="number[]" type="text" value="{foreach $smarty.request.no as $no}{$no}{/foreach}" …

Member Avatar
Member Avatar
+0 forum 2

Okay i have 2 variable named bid price and offer price . I need to fill in the values into the variables through cases. For each row of data ,i want to retrieve the rates for the currency pairs (eg. eur/usd,audusd) . I have 2 values for each currency for bid and offer price which are already defined( eg $bid ,$bid1,$bid2,$bid3,$bid4,$bid5,$bid6.) For clarification , one pair has 2 variables which i want to put the variables in. So EG. if the row's currency pair is eur/usd , i want to take $bid and $bid1 or if its usd/jpy, i want …

Member Avatar
Member Avatar
+0 forum 1

Kill me now! I have two tables in my DB. One has a list of certifications and one has a list of exam boards. I need to list the exam boards in a foreach loop giving each one an accordion. The certifications must be listed under their correct exam board. I have the code below but it of course lists things all over the shop. Any help would be appriciated. I can't figure out the best method to list the correct courses under their correct exam boards using a nested foreach loop. Thanks for any help! <div class="row-fluid "> <div …

Member Avatar
Member Avatar
+0 forum 6

Hello everyone, I have a search form that i am working on, and I have a huge array of checkboxes that I am using so people can refine the search down to just 1 or 2 things if they want to. In the search.php page, i have an implode function to return the array down to a string so it can be passed through the query. But now something strange has happened, it return everything because it is searching for a Comma(,) and a Space and returning all the results on the search page... I would like to know if …

Member Avatar
Member Avatar
+0 forum 18

Is it possible to iterate using foreach loop on multiple groupBox. I have 6 GroupBox named as gBox1,gBox2,gBox3,gBox4,gBox5,gBox6 AND each gBox contain 21 ComboBox named as slot1,slot2,slot3,slot4,slot5.... so on out of which I want to select only 7 comboBoxes for operation. For eaxmple if user enter 2 in textbox then from gBox1->cb15,slot1,slot2,slot3,slot4,slot5,slot6,slot7 and from gBox2->slot8,slot9,slot10,slot11,slot12,slot13 text of all comboBox should be stored in a string array. Now problem is I am able to Iterate on ComboBox like this if (no_of_period == 2) { if (duration == 1) { foreach (var comboBox in gBox2.Controls.OfType<ComboBox>().OrderBy(m => m.Name)) { if (comboBox.Name.Substring(0, 4).Equals("slot")) { …

Member Avatar
Member Avatar
+0 forum 4

I'm dealing with a SOAP client response for a flight booking application, I successfully got the response, See the response below: <arzoo__response> <Response__Depart> <OriginDestinationOptions> <OriginDestinationOption> <FareDetails> <ChargeableFares> <ActualBaseFare>4850</ActualBaseFare> <Tax>4267</Tax> <STax>31</STax> <SCharge>0</SCharge> <TDiscount>0</TDiscount> <TPartnerCommission>0</TPartnerCommission> </ChargeableFares> <NonchargeableFares> <TCharge>0</TCharge> <TMarkup>0</TMarkup> <TSdiscount>0</TSdiscount> </NonchargeableFares> </FareDetails> <FlightSegments> <FlightSegment> <AirEquipType>321</AirEquipType> <ArrivalAirportCode>DEL</ArrivalAirportCode> <ArrivalDateTime>2013-05-20T08:00:00</ArrivalDateTime> <DepartureAirportCode>BOM</DepartureAirportCode> <DepartureDateTime>2013-05-20T06:00:00</DepartureDateTime> <FlightNumber>601</FlightNumber> <OperatingAirlineCode>AI</OperatingAirlineCode> <OperatingAirlineFlightNumber>601</OperatingAirlineFlightNumber> <RPH></RPH> <StopQuantity>0</StopQuantity> <airLineName>Air India</airLineName> <airportTax>4267</airportTax> <imageFileName>http://live.arzoo.com/FlightWS/image/AirIndia.gif</imageFileName> <viaFlight></viaFlight> <BookingClass> <Availability>4</Availability> <ResBookDesigCode>U</ResBookDesigCode> </BookingClass> <BookingClassFare> <adultFare>4850</adultFare> <bookingclass>U</bookingclass> <classType>Economy</classType> <farebasiscode>fjyS3YyUlEusLfJ4bwgPvQ==</farebasiscode> <Rule>This fare is Refundable &lt;br&gt; Baggage : 25K&lt;br&gt;Booking Class : U|Re-Schedule Charges: Rs. 750 per sector + Fare difference (If any) +admin fee 500 + Service Fee of Rs. 250 Sector .|Cancellation Charges : …

Member Avatar
Member Avatar
+0 forum 6

Hi guys, I'm hoping you can help me find a more elegant solution to my query inside a foreach loop. Here is the loop in question: foreach (DataRow row in dt_blah.Rows) { SqlCommand sc = con.CreateCommand(); sc.CommandType = CommandType.Text; sc.CommandText = "select blah blah blah .. where S = @s1 and p = @p1"; sc.Parameters.AddWithValue("@s1", ddl.SelectedValue); sc.Parameters.AddWithValue("@p1", row["Category"]); con.Open(); SqlDataAdapter sda = new SqlDataAdapter(sc); DataTable dt = new DataTable(); sda.Fill(dt); con.Close(); } the problem is that the query relies on the value of each "Category" row in the dt_blah table. I have ran the query as a standalone and it …

Member Avatar
Member Avatar
+0 forum 7

Hi, I'm transferring data from one table to another and one of the fields is an email field. I would like to check if the emailfield is empty or otherwise faulty and skip that record if it is. This is how it looks at the moment but it's problamatic since some emails are not filled out or not correct format (spaces etc): try { // Define and perform the SQL SELECT query $sqlish = "SELECT * FROM account WHERE application_type = 'NEW' and DATE(date) > DATE_SUB(CURDATE(), INTERVAL 13 DAY)"; $resultish = $DBH->prepare($sqlish); $resultish->execute(); $number_of_rows = $result->fetchColumn(); // If the SQL …

Member Avatar
Member Avatar
+0 forum 4

Hi, I use this script to extract and insert the desired variables to mysql.It does the job. $xml = new SimpleXMLElement('file.xml'); foreach($xml->loanaccount as $mess){ $account_number= mysql_real_escape_string($mess->account_number); $main= mysql_real_escape_string($mess->main); $type= mysql_real_escape_string($mess->{'application-array'}->{'application-type'}), $date= mysql_real_escape_string($mess->{'application-array'}->{'application-date'}), //insert into databse mysql_query("INSERT INTO account (account_number, main) VALUES ('$account_number', '$main')") or die(mysql_error()); echo "inserted into mysql<br /><br />"; //show updated records printf ("Records inserted: %d\n", mysql_affected_rows()); } The problem I have is that the xml can contain several application-array and I need to insert the application-date and application-type from the most recent application-array. This is what the xml looks like. <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <account-information report-date="2012-12-31T23:59:59.000+01:00" xmlns="http://www.XXX.SE/XXX"> …

Member Avatar
Member Avatar
+0 forum 4

I am getting the error message "Invalid argument supplied for foreach()". I can't see to figure out what. Below is my query. Is there something I'm missing? Thanks public function editRole($id) { $q = $this->_db->query("SELECT * FROM `" . TP . "roles` WHERE `ID` = '" . floatval($id) . "' LIMIT 1"); while($r = $q->fetch_array()) { $id = $r[0]; } return $id; }

Member Avatar
Member Avatar
+0 forum 1

Could you help me solve the problem The code bellow locate the image path just in "image1" Something like this id image1 image2 image3 image4 image5 image6 1 pic1 2 pic2 but I need to get something like this id image1 image2 image3 image4 image5 image6 1 pic1 pic2 pic2 pic2 pic2 pic2 2 foreach($active_keys as $key) { @move_uploaded_file($_FILES[$fieldname]['tmp_name'][$key], $uploadFilename[$key]) or error('receiving directory insuffiecient permission', $uploadForm); $query_part_1 = ''; $query_part_2 = ''; $i = 1; // add the comma AFTER you write the key/values to the strings $query_part_1 .= " image" . $i++ . ","; $query_part_2 .= " '" . …

Member Avatar
Member Avatar
+0 forum 2

I can't seem to wrap my head around this. I'll need a seasoned programmer to push in the right direction. I have a listView with 7 sub items. What I'm looking to do is populate a table in an .mdb file with the data. The listView box is almost the same as the .mdb table I'm attempting to populate. It contains a static number of rows and about 10 columns (some of the columns will be populated with static data others with the dynamic data from the listview. cnn.Open(); //Open database connection foreach (ListViewItem toSenditems in this.listView1.Items) { //insert a …

Member Avatar
Member Avatar
+0 forum 1

I'd like to search this before asking a question but I'm not sure exactly what to search for. Posting for help is always a last resort for me. What I'd like to find is I think it's called a loop? or foreach? I think.. What I want to do is the following. I have a mailing list that I use at work that we can add a company to at anytime. Which I have setup and working to a point. Once I add the company in it will add a new table for them which works. But how do I …

Member Avatar
Member Avatar
+0 forum 9

The End.