Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP mailing database search
    text
    copied!<p>I made a PHP page that looks up Constant Contact e-mail addresses in a database and returns a table listing their name, e-mail address, and mailing list they are in. You enter the addresses here: Contact Lookup Tool along with your Constant Contact user name and password.</p> <p>For some reason, only the last row of the results page has a list of mailing lists. The other ones have the word "Array," which I stripped out, so now those rows are blank. Here is a screen shot of what I mean:</p> <p><a href="http://www.advantage-computer.com/images/ScreenCap.png" rel="nofollow">http://www.advantage-computer.com/images/ScreenCap.png</a></p> <p>They're all in a list, though. Here's the code for search.php. The form submits to that file:</p> <pre>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;List of Contacts&lt;/title&gt; &lt;style type=&quot;text/css&quot;&gt; .hdr { margin-bottom: 0px; padding-bottom: 0px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;table width=&quot;75%&quot;&gt; &lt;tr&gt; &lt;td class=&quot;hdr&quot;&gt;Name&lt;/td&gt; &lt;td class=&quot;hdr&quot;&gt;E-mail address&lt;/td&gt; &lt;td class=&quot;hdr&quot;&gt;List(s)&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan=&quot;3&quot;&gt; &lt;hr style=&quot;padding:0; margin:0&quot;&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?PHP require_once('./class.cc.php'); /*VARIABLES*/ $cc = new cc($_POST['userName'], $_POST['password']); if($cc) { $strEmails = $_REQUEST['emails']; $aryEmails = explode(&quot;\n&quot;, $strEmails); $page = (isset($_GET['page'])) ? $_GET['page'] : 'lists'; $lists = $cc-&gt;get_lists($page); /*METHODS*/ foreach ($aryEmails as $email) { if($lists) { foreach($lists as $k =&gt; $v) { $list = $v['Name']; $page = (isset($_GET['page'])) ? $_GET['page'] : 'members'; $members = $cc-&gt;get_list_members($v['id'], $page); if($members) { foreach($members as $k =&gt; $v) { if($v['EmailAddress'] == $email) { $strLists .= $list . &quot;, &quot;; } } } } } $strLists = str_replace(&quot;Array&quot;, &quot;&quot;, $strLists); $strLists = substr($strLists, 0, -2); $contact = $cc-&gt;query_contacts(trim($email)); if($contact) { $strName = $contact['Name']; if(is_array($strName)) { $strName = &quot;&quot;; } echo ( &quot;&lt;tr&gt;&lt;td&gt;&quot;.$strName.&quot;&lt;/td&gt;&quot;. &quot;&lt;td&gt;&quot;.$contact['EmailAddress'].&quot;&lt;/td&gt;&quot;. &quot;&lt;td&gt;&quot;.$strLists.&quot;&lt;/td&gt;&lt;/tr&gt;&quot; ); } else { echo(&quot;&lt;tr&gt;&lt;td colspan='3'&gt;Could not find {$email}.&lt;/td&gt;&lt;/tr&gt;&quot;); } } } else { echo &quot;Invalid user name or password&quot;; } ?&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt;</pre> <p>Here is the class.cc file: <a href="http://advantage-computer.com/tools/class.cc.txt" rel="nofollow">http://advantage-computer.com/tools/class.cc.txt</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload