Jump to content

adp1207

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Everything posted by adp1207

  1. mjdamato: Query 1 gives me info about the particular record. Here's the code: $query = "select ls.username as email,ls.id,ls.listname as listname from users u join list_subscriber ls on ls.username = u.username where u.id = $eid LIMIT 1"; $runquery = mysql_query($query); $data = mysql_fetch_assoc($runquery); Query 2 gives me all of the possible checkboxes. Here's the code: $getListQuery = 'select distinct(listname) as listname from list_details order by listname'; $runListQuery = mysql_query($getListQuery); For each checkbox (needle, name = listname), I want to see if a user subscribes to the list (haystack, box should be checked).
  2. Hello: I'm trying to compare two mySQL result sets (for determining when to check a checkbox in an input form). $dataList['listname'] is my needle. (only the checkboxes I want to check) $data['listname'] is my haystack (the list of all checkboxes) while($dataList = mysql_fetch_array($runListQuery)) { $checked = ''; echo $data['listname'].'<br /><br />'; echo $dataList['listname'].' :: ' . $data['listname'] . '::' . (string)array_search ($dataList['listname'],$data['listname'],false) .'<br>'; echo in_array($dataList['listname'],$data['listname']); echo '<br>----------------------<br>'; var_dump($data['listname']); echo '<br>----------------------<br>'; var_dump ($dataList['listname']); echo '<br>----------------------<br>'; if(in_array($dataList['listname'],$data['listname'],false)) { echo 'found!!!!!!!!!!!'; $checked = 'CHECKED'; } echo '<tr>'; echo '<td>' . $dataList['listname'] . '</td>'; echo '<td><input type="checkbox" '. $checked . ' name="'.$dataList['listname'].'" />'; echo '</tr>'; } I never hit the 'found!!!!!!!!' string. My output is below: list-charter halwasiya :: list-charter:: ---------------------- string(12) "list-charter" ---------------------- string(9) "halwasiya" ---------------------- list-charter halwits :: list-charter:: ---------------------- string(12) "list-charter" ---------------------- string(7) "halwits" ---------------------- list-charter list-charter :: list-charter:: ---------------------- string(12) "list-charter" ---------------------- string(12) "list-charter" ----------------------
  3. Effigy: Thanks for the reply. What does "?:" mean? I know what the question mark is, but I've never seen the colon ( used. Also, what is /x? Thanks. -Allan
  4. Sorry, I forgot to mention that I strip off the parenthesis in a later piece of code. I also tried this regular expression to no avail: \([A-Z](2-5)\s\)
  5. I have a bunch of text, and I'm looking to recognize 2-5 UPPER CASE letters within a paragraph. A sample paragraph is this: ================== United Airlines' parent UAL (UAUA) sprang a surprise in July when it posted second-quarter earnings that handily beat Street forecasts. Another surprise was how the stock has bounced up after UAL emerged from bankruptcy in February, 2006--despite high oil prices, rising competition, and public outcry about the airlines' disruptive flight cancellations and delays. The stock climbed from 21 in February to 49 on July 23, 2007, the day before the market's plunge. ================== The regular expression that I'm currently using is: \(.*?\) However, it recently failed on the following paragraph (for obvious reasons). Regular Expressions are just so pesky! ======= FAILED ON THIS PARAGRAPH ======= Sweden's Elekta, which trades only in Stockholm, is getting more attention from American investors. (Its Bloomberg symbol is EKTAB.) Some 30% of its stock is owned by U.S. institutions, including Fidelity Investments and Lazard (LAZ). And nearly half of the global sales of Elekta's cancer radiation equipment are in the U.S. In that market Elekta is second only to Varian Medical Systems (VAR) in Palo Alto, Calif. No. 3 is Siemens (SI). ===================================== It picked up the following: Its Bloomberg symbol is EKTAB. I was HOPING it would only pick up: EKTAB Any help would be greatly appreciated!
×
×
  • 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.