Jump to content

lee20

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Contact Methods

  • MSN
    speedytwenty@hotmail.com
  • Yahoo
    speedylee20

Profile Information

  • Gender
    Not Telling

lee20's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am a Drupal advocate for CMS and eCommerce and I know how to spell Magento, but that's about all I know about it. Drupal is more flexible and has a larger community than Magento and Joomla. But it may be harder to learn to develop for. There are literally thousands of Drupal modules, but using each one requires some overhead in finding it, knowing what it does, and learning how to use it. If you have sufficient time to get acquainted with Drupal, do it! I pulled out all of my hair during my first project using Drupal. Now, three years later, Drupal is what I rely on for nearly every web application I build. It's hard to know which system matches your needs best and would require being familiar with all three systems. From what I know about Magento is a great choice for eCommerce as well. If you can get by using Magento, this may be the path of less resistance. Either one you choose will only get you part way there out of the box, from there you'll have to discover how to make changes to the system as you need. If you choose Drupal, you will be learning a system that can do many things beyond eCommerce. Whereas, Magento is more geared for eCommerce.
  2. If you are trying to save a file on the server, you are going to need PHP or an alternative scripting language to do that.
  3. This should do the trick. <?php require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->From = "sales@crossbonescharters.com"; $mail->FromName = "Alan & Alanna Godsey"; $mail->Subject = "Contract for $yachtname"; mysql_connect("mysql37.secureserver.net"); mysql_select_db("crossboneschart.Yachts"); $query = "SELECT owner,email,cya_number FROM crossboneschart.Yachts WHERE yachtname='1'"; $result = MYSQL_QUERY($query); // execute query list($owner, $email, $cya_number) = mysql_fetch_row($result); // abstract data from query resource // HTML body $body .= "Dear $owner, " ; $body .= "We have recieved a partially executed contract for $yachtname. "; $body .= "Paste 'http://www.crossbonescharters.com/contract_sign_in.php' into your browser and log in using your password: $cya_number. For this contract to become a definite booking, you will need to fill in your information and submit it. "; $body .= "If you have questions, please contact us. "; $body .= "Sincerely, "; $body .= "CROSSBONES CHARTERS "; $body .= "Alan & Alanna Godsey "; $body .= "sales@crossbonescharters.com "; $body .= "Toll Free 1-866-922-4802"; // Plain text body (for mail clients that cannot read HTML) $text_body .= "Dear {$owner}, \n\n"; $text_body .= "Paste 'http://www.crossbonescharters.com/contract_sign_in.php' into your browser\n"; $text_body .= "Your password is {$cya_number} \n"; $text_body .= "Sincerely, \n"; $text_body .= "Alan L. Godsey"; $mail->Body = $body; $mail->AltBody = $text_body; $mail->AddAddress($email, $owner); if(!$mail->Send()) echo "There has been a mail error sending to " . $row_recordset2['email'] . ""; // Clear all addresses and attachments for next loop $mail->ClearAddresses(); $mail->ClearAttachments(); ?>
  4. I didn't notice before, but if your selecting from two tables you need to put both tables in the FROM or use a JOIN. You also need to "alias" one of the customer id variables when selecting two or more fields with the same name. But in this case, you only need to select one because they're equal. Try: $sql = "SELECT ER_ID, ENQUIRY_RESERVATION.CUSTOMER_ID CUSTOMER.CUSTOMER_ID AS CUSTOMER_ID2 FROM ENQUIRY_RESERVATION, CUSTOMER WHERE ENQUIRY_RESERVATION.CUSTOMER_ID = CUSTOMER.CUSTOMER_ID";
  5. Your first query ($query0) only checks on friend_id. That would mean that everyone can only have 1 friend! $query0 = "SELECT `friend_id` FROM `friends` WHERE friend_id`='$friend_to_adds_id'"; // SHOULD BE $query0 = "SELECT `friend_id` FROM `friends` WHERE friend_id`='$friend_to_adds_id' AND user_id = '$logged_in_users_id'"; // BUT REALLY MAY NEED TO BE $query0 = "SELECT `friend_id` FROM `friends` WHERE (friend_id`='$friend_to_adds_id' AND user_id = '$logged_in_users_id') OR (friend_id`='$logged_in_users_id' AND user_id = '$friend_to_adds_id')"; If you used the middle query above, then the order of your INSERT appears to be backwards as well: $query2 = "INSERT INTO `friends` (`user_id`,`friend_id`) VALUES ('$friend_to_adds_id','$logged_in_users_id')"; // SHOULD BE $query2 = "INSERT INTO `friends` (`user_id`,`friend_id`) VALUES ('$logged_in_users_id','$friend_to_adds_id')"; You could bypass the whole issue by creating a unique index on user_id and friend_id, and use the following: // the friend with the lowest id will be stored in user_id, and the other stored in friend_id // ie: user_id = 1, friend_id = 2 $friends = array($logged_in_users_id, $friends_to_adds_id); asort($friends); $query2 = "REPLACE INTO `friends` (`user_id`, `friend_id`) VALUES ('{$friends[0]}', '{$friends[1]}'"; Cheers
  6. I explained this issue in this topic: http://www.phpfreaks.com/forums/index.php/topic,140975.0.html
  7. My bad should be: $mailer->AddAddress('njacob@camdendiocese.org', 'Eric Rosebrock'); $mailer->Sender = 'njacob@camdendiocese.org';
  8. I think of delegation as a way to extend the methods of an object. This allows you to create flexible "worker" classes that you will be able to resuse with less or no modifications because the worker class only handles logic specific to itself. class Delegator { private $worker; function doSomething($param) { // Logic above the scope of worker goes here $this->worker->doSomething($param); // Logic above the scope of worker goes here } } Logic above the scope of a worker may include anything from error handling, i18n, l10n, or caching to name a few. Consider this pseudo code example: class DB { // delegator protected $db; public function Query($sql) { if (sql is cached) return cache; $res = $this->db->query($sql); if (query is successful) { add sql to cache return $res; } else show an error } } class MySQL { // worker public function Query($sql) { return mysql_query($sql); } } class PgSQL { // worker public function Query($sql) { return pg_query($sql); } } Essentially the worker's query function isn't that useful. But a complete "worker" class would be very useful and afterwards you can take your worker and plug it into many other applications that perhaps do not need caching or handle errors differenctly, etc, etc. Not to confuse the matter, but a delegator can also be a worker. But you have a tiered seperation of logic that is very flexible. Cheers!
  9. Your query doesn't make any since because with what you are only selecting one unique field (ER_ID) and you have no actual where conditions. Your query is equivalent to: "SELECT ER_ID, CUSTOMER_ID FROM `ENQUIRY_RESERVATION`" (the table would be whichever able ER_ID is in) Also, when you select fields in a query "SELECT table_name.field_name FROM `table_name`" the result does not include the "table_name." in the index. You don't need to select customer_id twice. Nevertheless, your query should work assuming you have atleast one row in each table with equal CUSTOMER_ID's. Try the following: <table> <?php $sql = "SELECT ER_ID, CUSTOMER_ID FROM ENQUIRY_RESERVATION"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { echo "<tr>"; echo "<td>".$row['ER_ID']."</td>"; echo "<td>".$row['CUSTOMER_ID']."</td>"; echo "</tr>"; } </table> ?>
  10. Revert any changes you made to class.phpmailer.php! In your script where you are sending the email change it to look like this: // Add an address to send to. $mailer->AddAddress('njacob@camdendiocese.org', 'Eric Rosebrock'); $mailer->Sender('njacob@camdendiocese.org');
  11. You don't need to edit the class. Just add: $mailer->Sender = 'valid@email.com';
  12. I agree that it's a good practice, and improves the readability of your class. Declaring your variables gives you a standard place to comment on what that variable is for. It also prevents the E_NOTICE errors which some programmers choose to ignore but each error comes at a processing expense. And displaying all errors while you are developing/debugging is a useful tool and can reduce time wasted when you mispell a variable somewhere along the way. Also, if you use PHP5's overloading capabilities, you would NOT declare variables that you wish to overload. So declaring or not declaring even your public variables can therefore determine the behavior of your class.
  13. Both your loops have the same 1st condition, so once the first loop finishes the second loop will obviously never execute. while ((($file = readdir($dh)) !== false)... ... while ((($file = readdir($dh)) !== false)... You need to reopen the directory between your loops like so: if (is_dir($dir)){ if ($dh = opendir($dir)) { // removes two hidden files "." and ".." if($file != "." && $file != "..") { while ((($file = readdir($dh)) !== false) && (filetype($dir . $file) == "dir" )) { echo $file; echo 'folder'; } closedir($dh); $dh = opendir($dir); // Reopen the directory while ((($file = readdir($dh)) !== false) && (filetype($dir . $file) == "file" )) { echo $file; echo 'file'; } } } closedir($dh); }
  14. Try building an array while looping the results, and then loop the array in your second loop like so: <?php $rows = array(); while($row2 = mysql_fetch_array($sql)){ $rows[] = $row2; $file_amount += $row2['size']; } $file_space = round($file_amount/1024,2); if($file_space <= 1024){ echo "<b>$file_space"."KB</b>"; }elseif($file_space >= 1024 && $file_space < 1073741824){ $file_space = round($file_space/1024,2); echo "<b>$file_space"."MB</b>"; }elseif($file_space >= 1073741824){ $file_space = round($file_space/1073741824,2); echo "<b>$file_space"."GB</b>"; } foreach ($rows AS $row) { echo '<p>'.$row['file_name'].'</p>'; } ?> Note: You may want to use a for loop instead of a foreach loop because if there are no results you will get an error in this case. Cheers
  15. It appears you are using PHPMailer and if so try: $mailer->Sender = 'valid@email.com'; I encountered a similar type of issue, and I'm not sure if the problem your having is the same as mine but I will post the solution that I found as well. I was using a basic implementation of PHP's mail function and wasn't receiving the emails that were being sent. The logs from my incoming mail server told me that the emails had been rejected because it couldn't check the return path (some mail servers do this to block spam). I had to set an extra parameter like so: mail($to, $subject, $body, $headers, " -f valid@email.com"); This from PHPMailer's documentation: This from http://www.php.net/function.mail Hope this helps. Cheers!
×
×
  • 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.