Jump to content

rahjiggah

Members
  • Posts

    18
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

rahjiggah's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Awesome! Just use the join, I get it now, thanx.
  2. Ya I really couldnt figure out a way to do this with the sql query to be honest, I know that would be a more efficient way to do this its for editing choices in a form, there are 5 sectors, so query 1 calls the sector_id and name from that table, query 2 calls the persons choices from the choice table. then I just display all the sectors and used the second foreach like Ch0cu3r showed, but it would check all the sector boxes, It was because I was declaring $y=''; outside the first foreach block leaving meaning if it hit a match it was just showing checked for all.
  3. foreach ($sectors as $sector) { $y = ''; // reset $y to empty string for each value foreach($uc_sid as $uc) { if($sector['sid'] == $uc['sid']) $y = '*'; } echo $y.$sector['sid'].'<br />'; } This did it, and was what I had before I asked, Im an idiot, it didnt work because I was declaring $y=''; outside the code block! thank you guys....
  4. Great, thanks for the help, and the snarky answers I prefaced this whole thing at the top... so go ahead and give'r Im so tired and batsh!t crazy right now its all good. Again thanks for taking the time to answer the question.
  5. hmmmm ya I tried that one as well, didnt work Here is the actual array via print_r $uc_sid = Array ( [0] => Array ( [sid] => 11 [0] => 11 ) [1] => Array ( [sid] => 12 [0] => 12 ) ) $sectors = Array ( [0] => Array ( [sid] => 10 [0] => 10 [sSector] => Pharma [1] => Pharma ) [1] => Array ( [sid] => 11 [0] => 11 [sSector] => Energy [1] => Energy ) [2] => Array ( [sid] => 12 [0] => 12 [sSector] => Mining [1] => Mining ) [3] => Array ( [sid] => 13 [0] => 13 [sSector] => Special Situations [1] => Special Situations ) [4] => Array ( [sid] => 14 [0] => 14 [sSector] => Technology [1] => Technology ) ) foreach ($sectors as $s){ if(in_array($s[sid], $uc_sid)){ $y='*'; } echo $y.$s[sid].'<br />'; } just gives me: 10 11 12 13 14
  6. Hello I have two arrays of mysql values $a1, $b1 I am trying to loop through each $a value, no problem, but I want to see if each element in $a = one of the values in $b so: $a = array(1, 2, 3, 4, 5, 6); $b = array(4, 6); $y = ''; foreach ($a1 as $a){ foreach ($b1 as $b){ if ($a[val] == $b[val]){ $y = '*'; } } echo $y.$a.'<br />'; } I was kinna hoping it would give me 1 2 3 *4 5 *6 Its most definitely not though... Im sure Im flawed in my logic but have coded so much other crap I just can't see the answer! ty for the look/help.
  7. 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?
  8. Its ok, The query is fine, exclusion was for wrong analystid, Sorry, please remove...
  9. Hello my query is not excluding the exclusion (sectorid != 33) in my sql query, any chance someone can see where Ive gone wrong? ty kindly SELECT sectorid, coname, coticker, analystid, cocurr, corating, cotarg FROM newone WHERE (analystid = 12 AND active = 1) OR (analystid = 17 AND active = 1) OR (analystid = 24 AND active = 1 AND sectorid != 33) ORDER BY analystid, coname
  10. got it just did a simple if for the variables in question... figured Id post it here in case anyone else has this prob... Thx for the help Guru! try{ $sql1="UPDATE newone SET est1=:est1, est2=:est2, WHERE coID=:coID"; $q1 = $dbh->prepare($sql1); if ($est1 == ""){ $est1 = null; } $q1->bindValue(':est1', $est1); if ($est2 == ""){ $est2 = null; } $q1->bindValue(':est2', $est2); $q1->execute();
  11. hmmmm so you mean the actual sql table would determine if the value is NULL? basically this was to prevent that col from assigning 0.00 value, 0.00 can be a legitmate number for those columns but nothing (ie no value) also shows up as 0.00. how would I set that up in mysql?
  12. yup must be that, I used the setAttribute and saw this: ERROR: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
  13. ya sorry that makes sense! yup so code executes but nothing is updated in the table. There are so many different ways to do this, but this seemed like the easiest way to go. the error isnt showing up so I assume Ive got the syntax wrong...
  14. Hello, can someone please let me know if my code here is wrong? Im trying to upgrade old mysql to PDO. Just a simple update command and on a few values if the $variable = "" then make the value null in DB. thank you try{ $sql1="UPDATE newone SET corating=:corating, cotarg=:cotarg, coclose=:coclose, ROI=:ROI, est1=:est1, est2=:est2, basicos=:basicos, mktcap=:mktcap, coNav=:nav, WHERE coID=:coID"; $q1 = $dbh->prepare($sql1); $q1->execute(array( ':corating'=>$corating, ':cotarg'=>$cotarg, ':coclose'=>$coclose, ':ROI'=>$ROI, ':est1'=>isset($est1) ? $est1 : null, ':est2'=> isset($est2) ? $est2 : null, ':basicos'=>$basicos, ':mktcap'=>$mktcap, ':coNav'=>isset($nav) ? $nav : null, ':coID'=>$coID, )); } catch(PDOException $e) { echo 'ERROR: ' . $e->getMessage(); }
  15. awesome thx for the hint... this is the third time I've made that mistake, gonna have to sticky it to my comp! @ me.
×
×
  • 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.