Jump to content

jon23d

Members
  • Posts

    100
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jon23d's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Can we see the rest of your code please?
  2. You can put them into an array, then loop through by key. $rs = mysql_query("SELECT * FROM table WHERE week='$week' AND status='0'"); $games = array(); while ($r = mysql_fetch_assoc($rs)) { $games[$r['gameid']][] = array( 'hometeam' => $r['hometeam'], 'awayteam' => $r['awayteam'] ); } foreach ($games as $game_info_arr) { echo "<table><thead><tr><th>Home</th><th>Away</th></tr>"; foreach ($game_info_arr as $game) { echo "<tr><td>{$game['hometeam']}</td><td>{$game['awayteam']}</td></tr>"; } echo "</table>"; }
  3. Yes, I have tried this. According to the structure returned from imap_fetchstructure, the part has a charset of 'windows-1252'. At first I thought it might be because I'm on linux, but gmail displays it just fine (and is using the same character set I am, UTF-. I can remove the characters easily enough, but I would like to actually render them.
  4. I am terribly confused... I am trying to display the html body of a message pulled through imap. I thought that if I did this: <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> in the html head, that everything would be pretty much figured out for me, but... When I look at the original message in gmail (prior to being pulled with imap), I get an ellipses(...), but once I display it in my browser, I get a black diamond question mark thingy... Help! I've tried all manners of conversion, but suspect I'm completely missing the boat here. Thanks
  5. I have a class that I use for emailing. I've never needed attachments before, so I added the method to send them, but gmail seems to be the only place that I can see them. In Yahoo and mail.com they appear as zero-length files. I sent a test email to an anonymous email service, you can see it at http://mailinator.com/maildir.jsp?email=mail_class_outgoing_test Because peeps are going to wonder: /** * Add an attachment to the email * * @param STRING $path_to_file * @param STRING $attachment_name * * @return VOID */ function addAttachment($path_to_file, $attachment_name = null) { $this->attachments[$path_to_file] = $attachment_name; } This actually sends the email: private function sendMailWithAttachment() { // create the headers $boundary = 'jfd-' . md5(date('r', time())); foreach ($this->recipients as $email => $name) { // format to & from as 'name <email>' or just email $to = ($name != $email && $name) ? "$name <$email>" : $email; $from = ($this->from_address[1]) ? "{$this->from_address[1]} <{$this->from_address[0]}>" : $this->from_address[0]; $header = "From: $from\n" . "X-Mailer: FM5 1.0\n" . "MIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"$boundary\""; ob_start(); ?>This is a multi-part message in MIME format. --<?=$boundary?> Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit <?=$this->html?> <? $message = ob_get_clean(); foreach ($this->attachments as $system_filename => $save_as_filename) { if (!is_string($system_filename)) { $system_filename = $save_as_filename; $save_as_filename = basename($system_filename); } $filetype = mime_content_type($system_filename); $data = chunk_split(base64_encode(file_get_contents($system_filename)), 64); ob_start(); ?> --<?=$boundary?> Content-Type: <?=$filetype?>; name="<?=$save_as_filename?>" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="<?=$save_as_filename?>" <?=$data?> <? $message .= ob_get_clean(); } // add the last closing boundary $message .= PHP_EOL ."--$boundary--"; // send the message mail($email, $this->subject, $message, $header, "-f{$this->from_address[0]}"); } }
  6. Using a parent ID (leave the first record with a parent id of null), allows you to update only 1 row instead of all subsequent rows on reorder. For example, assume we have a table with id, title, parent_id, that has the following info: 1, Fred, null 2, Mary, 1 3, Mark, 2 SELECT `title` FROM `people` ORDER BY `parent_id` ASC will return: Fred, Mary, Mark Now we want to insert George between Mary and Mark: INSERT INTO `people` (`title`,`parent_id`) VALUES ('George', '2'); Then, update Mark (which will effectively update all subsequent rows): UPDATE `people` SET `parent_id` = 4 WHERE id = 3 (you get the new ID from mysql_insert_id) Now, when you select title ordered by parent_id asc, you will get the new record order. This should be a bit more efficient.
  7. I'm not 100% sure how, but I'm pretty sure you could pull it from a backtrace.
  8. You probably have it, try this: $xml = new SimpleXMLElement(); Does it throw an exception? If so, you're good.
  9. I believe this is backwards, don't you want to send only if the IP is NOT whatever you have?
  10. One possible solution would be to give a parent id to each record; alternatively, an array of elements could be stored, with 'page' being the numeric index of the object.
  11. Other than no closing for the config and list tags, this looks fine to me, but I guess you'd have to check the manual to know for sure. CSV is perfect for arrays, which lend themselves to other types of operations. Plain old strings are good for strpos, substr, and regular expressions.
  12. Good evening all, I upgraded a server today from php 5.1 to 5.3, and attempted to upgrade mysql to 5.1 at the same time. There server runs red hat 5, so I used remi's repository for the upgrade (which I have done many times in the past without issue), but it seems to have caused all sorts of issues with mysql. Initially I was unable to access mysql at all, so I uninstalled the remi version and installed whatever the default gave me, which seems to be somewhat incompatible with php, as I get this in phpymyadmin: Your PHP MySQL library version 5.1.40 differs from your MySQL server version 5.0.77. This may cause unpredictable behavior. This isn't such a big issue yet though, the real problem is that all my innodb tables are now unable to be read. I tried moving the logfiles and letting mysql rebuild them, moving them back, changing the size in my.cnf to match the file size, but none of this seems to work. I would be totally cool with just pulling the data out of one of them and then using the new files and restoring from backups, but one of the databases has no backup and I'm not sure how to get it! Mysql says: #1033 - Incorrect information in file: './my-database/my-table.frm' when attempting accessing from the client, mysqld.log says things like this: InnoDB: Error: log file ./ib_logfile0 is of different size 0 268435456 bytes InnoDB: than specified in the .cnf file 0 5242880 bytes! over and over again. I'm quite uncertain how to proceed! I can easily set up a virtual server for purposes of pulling this data from the files I have. I can get the server to a point where I can create new innodb tables, just not to where I can read the old ones! Thanks, I hope someone has some ideas.
  13. file_get_contents() or readfile()
×
×
  • 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.