Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Muddy_Funster

  1. how are you storing and retrieving the information from the table?
  2. ok, so how are you populating your comments? I thought is was from the INSERT query whuch is looking for them in the students table... $query = "select upn from students where upn = '".$student_upn."'"; $result = doquery($query); $row = mysql_fetch_array($result); ... $overall_comment = $row['english_overall_comments']; also, could you list the fields that you need to return from each table.
  3. I don't see any reason for the comments not to show, are there comments in both tables? to join the tables together you would use JOIN in your sql FROM clause e.g. SELECT first_name, last_name, job_title, job_description FROM employee INNER JOIN job_list ON employee.employee_number = job_list.employee_number This is joining the tables employee, which holds the name information, with the job_list table, which holds information about the jobs the employees have. employee_number is the primary key field in the employee table, and is included as a forign key field in the job_list table. the forign key is irrelevent for this discussion, it could be that there is no pre-established relationship at all. however the field must exist so that each table can refference each other. using INNER JOIN generates a one-to-one relationship so you will get back results for each entry of employee_number that is present as the same value in both tables. Any values that do not match, for example a job is available and has no one working in that possition, and thus no employee_number associated with it, then it will not be included. The other main JOIN is LEFT JOIN. This is used to create a one-to-many relationship in the same manner.
  4. have you tried including those characters within the regular expression?
  5. you have the print command within your <<<HTML, that's why it's getting upset with that one. also, when including array values within parsable strings wrap them within curly braces: {array['key']} Also, your tutors comment on that line is antiquated logic, both PHP and MySQL are robust enough to work out whither you want to use a string or integer value. e.g. <?php $a="3"; $b= 7; $c = $a+$b; echo $c; //shows 10, even though $a is a string
  6. ok, I don't know what this line means... $student_upn = (integer) $_POST["stu_upn"]; But I also don't know what's going wrong...repost your updated code and let me know what / where it's going wrong.
  7. OK, all sorted. Here's the functional code, commented and generified (is that even a word...? ) I did want to put this in the snippits section as there is very little on this class that is easily accessable. anyway, hope this helps save someone the three days it wound up taking me. <?php require_once 'Net/SMTP.php'; //stick this line somewhere at the top of your page /*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* I wrote this function to use the PEAR Net_SMTP class as I needed something that would pass SMTP authentication information, and didn't want to install any new librarys. The most important parts of this were getting the right line terminator and then getting the right number of them for each line! Feel free to tweek this as much as you like, just don't change any of the line ends or your fixing it on your own --This is NOT configured to work with SSL or TSL (so no sending through gmail) Any questions you can get in touch at: [email protected] *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*/ function sendSMTP($subject, $body, $user='defaultUserName', $pass='defaultPass', $to='Friendly Name', $destination='[email protected]', $from='Friendly Name', $sender='[email protected]', $fName=null, $attachment=null){ //set defaults for user name, password, to, from, sender and recipient here ^^^ $e = "\n"; //end of line $bound= "==MUDDY_FUNSTER_".md5(time()); //create a unique boundary for this mail to separate each different type in the message. @$smtp = new Net_SMTP("your.mailserver.ext", 25); // set to youe mail providers A record and port number (IP Addresses will also work for server) @$smtp->connect(60); //create connection and set timeout duration @$smtp->helo('your_mail_domain.ext'); //start comunication with server --change to your mail providers domain @$smtp->auth($user, $pass); //authenticate account @$smtp->mailFrom("$sender"); //email address of authenticated account, can set default in function declaration @$smtp->rcptTo("$destination"); //recipient of mail, can set default in function declaration $header = ""; //set header as empty $header .= "From: $to <$sender>".$e; // Set Friendly Name and address of sender $header .= "To: $from <$destination>".$e; // Set Friendly name and address of recipient $header .= "Subject: $subject".$e; //Set mail Subject $header .= "Reply-To: $sender".$e; //Set Reply-to address $header .= 'MIME-Version:1.0'.$e; //use MIME transport $header .= "Content-type:multipart/mixed;"; // Define multipart mail contnent $header .= "boundary=\"".$bound."\"".$e.$e; //set unique boundary for each different type of content $message = $header; //include headers into message information $message .= "--".$bound.$e; //open boundary $message .= "Content-type:text/html;"; //set contnent as html for mail body $message .= "charset=\"iso-8859-1\";".$e; //set charactor set to be used in mail body - can be changed to suit $message .= "Content-disposition:inline;"; //use inline to inferr displaying of contnet in the body without need for end user input $message .= "Content-transfer-encoding:quoted-printable".$e.$e.$e; //set transfer encoding for html text content $message .= $body.$e.$e; //add the contnent of $body which is passed into the function if($attachment != null && $fName != null){ //check if there is an attchment being passed into the function and that it has a name $message .= "--".$bound.$e; //add boundary to change to next content type $message .= "Content-type:application/octet-stream;"; //set content type to suitable type for attachment (octet-stream is for generic binary data other are available) $message .= "name=\"$fName.xml\"".$e; //set the file name $message .= "Content-disposition:attachment;"; //use attachment to infer data that is being passed as a file $message .= "filename=\"$fName.xml\";".$e; //set the filename as it will be recieved $message .= "Content-transfer-encoding:base64".$e.$e; // encode the file for transfer $message .= $attachment.$e.$e; // add attachment contents } $message .= "--$bound--".$e; //closing boundary shows it's the last part of the MIME and the mail is now complete @$smtp->data($message); //send message to the server $msg = $smtp->getResponse(); // get server response array format -- $msg = Array([0]=>'server numeric code' [1]=>'Text message from server for code') -- hMailServer success response code is 250. This can be called after any of the $smtp-> calls for error capture @$smtp->disconnect(); // close server connection return $msg; //pass out server response array } //call function using $var = sendSMTP($subject, $body, $user, $pass, $to, $recipientAddress, $from, $senderAddress, $filenameOfAttachment, $attachmentContent); //$to and $from are the "Friendly Name" values for the message e.g. John Doe //if you are passing in attachment content you MUST pass in a file name (prefferably with extension, but thats your targets problem) for it as well. ?>
  8. what's the actual problem?
  9. youre not closing your <<<HTML block at the end of the function
  10. if (strtoupper($_POST['validate']) != 'FIRE'){ $errors->add('empty_username', __('<strong>ERROR</strong>: Please check your validation answer.')); }
  11. Not with php I don't think. You would need something setup on your router it's self. Most routers come with a traffic meter of some description, and a lot of ISP's will provide traffic reports on request.
  12. if it's a big problem for you the "solution" is to turn it off in the php.ini file
  13. dunno about yahoo, but gmail treats mime html mail as an attachment. try it without the mime header in.
  14. Damn! Is there any way to specify an EOF equivelent termination at the end of a sring variable? The attachment doesn't close off, it's as though it doesn't know where to terminate the file contents and where to start looking for header information again. I am assuming this is delt with in file format by recognising the EOF, so can I hard code an EOF into a string variable?
  15. Think i've got a work arround using the PEAR Net_SMTP Class. Having played about with it: it's looking like a pretty well rounded class (function wise) although it is rather undocumented in it's usage. Anyone any experience of this? Is there a season it's practicly unused?
  16. mail() doesn't support SMTP authentication on win32 servers (tried using ini_set and editing the php.ini file to no avail, constant error 530 returned from server). as well as that I just couldnt get it to send both parts of a multipart MIME message (1 attachment and 1 HTMLbody) in the same message. I could send the attachment through fine (to an internal address) and I could send the body through IF I left the attachment off (again to internal addresses). I'm not too fussed about getting the external addresses working, but this whole "mail with attachment" idea is starting to annoy the hell out of me.
  17. //Inset into database $insert_status = mysql_query(" insert into `status` (`status`, `date`) values ('$status', '$date')") or die (mysql_error()); //Line break after every 80 $status = wordwrap($status, 80, "\n", true); is all you need, just make sure and use backticks around field and table names that you have used reserved words to name.
  18. Yeah, I seen that, and I would happily do it if the mail was actualy sending :'(. I suspect there is an error occuring that isn't being captured properly because of the Strict call-method problems? But this is all new to me so im somewhat baffled.
  19. I think your getting mixed up. You are setting $check_location = ""; EVERY run through the loop, you are by doing this forcing the contents of $_check_location to be set to "" EVERY time you compare it to your database result. This meens that it will only ever match results that are themselves empty strings. This is not what you actualy want to happen. Move the $check_location = ""; to the line above where your while loop starts and run the code, just to see what happens.
  20. Having given up on mail() I'm trying to work out PEAR mail sending through SMTP with outgoing authentication. Unfortunately I have no experiance with using PEAR for anything, and the error messages are far from helpfull to me. Here's what I get after what I assume to be a timeout: starting build of mail message... Message body built ok... Attachment built ok... Headers built ok... SMTP Paramaters built ok... Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\mime.php on line 416 Strict Standards: Non-static method PEAR::raiseError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\mime.php on line 465 Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\mime.php on line 1024 Strict Standards: Non-static method Mail_mimePart::encodeHeader() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\mime.php on line 1322 Strict Standards: Non-static method Mail_mimePart::encodeHeader() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\mime.php on line 1322 Strict Standards: Non-static method Mail_mimePart::encodeHeader() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\mime.php on line 1322 Strict Standards: Non-static method Mail_mimePart::encodeHeader() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\mime.php on line 1322 Strict Standards: Non-static method Mail_mimePart::_explodeQuotedString() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\mimePart.php on line 812 Strict Standards: Non-static method Mail_mimePart::encodeHeader() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\mime.php on line 1322 Strict Standards: Non-static method Mail_mimePart::_explodeQuotedString() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\mimePart.php on line 812 Strict Standards: Non-static method Mail_mimePart::encodeHeader() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\mime.php on line 1322 Strict Standards: Non-static method Mail_mimePart::_explodeQuotedString() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\mimePart.php on line 812 Strict Standards: Non-static method Mail::factory() should not be called statically in C:\xampp\htdocs\fos\index3.php on line 13 Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\smtp.php on line 365 Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Net\SMTP.php on line 450 Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Net\SMTP.php on line 467 and this is the test page I am trying to send from: <?php require_once 'Mail.php'; require_once 'mail/mime.php'; function sendMime($body, $attach, $head, $params ){ $eol = '\n'; $mime = new Mail_mime(array('eol' => $eol)); $mime -> setHTMLBody ($body); $att = implode(',', $attach); $mime -> addAttachment ($att); $body = $mime -> get(); $headers = $mime->headers($head); $mail =& Mail::factory('SMTP', $params); $mail ->send('[email protected]', $headers, $body); return $mail; } function buildHeaders(){ $pHead = array(); $pHead['To'] = '[email protected]'; $pHead['From'] = '[email protected]'; $pHead['Reply-To'] = '[email protected]'; return $pHead; } function buildParams(){ $para = array(); $para['Host'] = 'mail.domain.ext'; $para['port'] = '25'; $para['auth'] = 'true'; $para['username'] = '[email protected]'; $para['password'] = 'ValidPassword'; return $para; } function buildBody(){ $mailBody = "<html><body><br><center><h3>SAMPLE SHEET</h3></center><br>"; $mailBody .="<table border='1'><tr><th>Service Provider Name :</th><td>Test Sender</td><th>Job Number:</th><td>1</td></tr>"; $mailBody .="<tr><th>Contact Name :</th><td>Muddy_Funster</td><th>Customer :</th><td>Sample Company</td></tr>"; $mailBody .="<tr><th>Contact No :</th><td>11111111111</td><th>ID :</th><td>ABCDE</td></tr>"; $mailBody .= "<tr><th>Query Date :</th><td>Today</td><th>Job Date :</th><td>Today</td></tr>"; $mailBody .= "<tr><td colspan='4'>QUERY TYPE :</td></tr>"; $mailBody .= "<tr><th>QUERY INFO :</th><td colspan='3'>Other:Test</td></tr>"; $mailBody .= "<tr><td colspan='4'>DETAILS OF THE ISSUE :</td></tr>"; $mailBody .= "<tr><td colspan='4'>Test Data</td></tr>"; $mailBody .= "</table><p>Please do not reply to this email unless there is a technical issue.</p></body></html>"."\r\n"."\r\n" ; return $mailBody; } function buildXML(){ $xmlBody = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Document title=\"Sample SHEET\"><InternalID>99999</InternalID><JobDate>2012-01-16</JobDate>"; $xmlBody .= "<QueryDate>2012-01-16 13:21:24</QueryDate><ServiceProvider name=\"Test Sender\">"; $xmlBody .= "<Name>Muddy_Funster</Name><TelNo>1111111111</TelNo><FaxNo>22222222</FaxNo></ServiceProvider>"; $xmlBody .= "<Customer name=\"Sample Company\"><ID>ABCDE</ID></Customer>"; $xmlBody .= "<Query ID=\"1\"><Type>Other:Test</Type><Details>Testing the Mail System</Details></Query></Document>"; $at = array(); // build attachment $at['file'] = $xmlBody; //content $at['c_type'] = 'text/xml'; //Content-Type: $at['name'] = '300000001.xml'; //Suggested File Name $at['isfile'] = false; //is attachment a file? $at['encoding'] = 'base64'; //encoding type $at['disposition'] = 'attachment'; //Content-Disposition (choose either attachment or inline) return $at; } echo "starting build of mail message..."; $body = buildBody(); echo "<br>Message body built ok..."; $attachment = buildXML(); echo "<br>Attachment built ok..."; $headers = buildHeaders(); echo "<br>Headers built ok..."; $params = buildParams(); echo "<br>SMTP Paramaters built ok..."; $newMailMessage = sendMime($body, $attachment, $headers, $params); print_r($newMailMessage); ?> I would really appreciate if someone could point out where this is going wrong. I have run the PEAR upgrade-all as there was previously depreciated messages showing and it's now up to date (nothing to upgrade message) and those messages have gone (and at this rate my mind is soon to follow :-\).
  21. you are resetting $check_location every itteration. It's likely never going to match your database string. Unless this is what you want you should move the line "$check_location = "";" outside the while loop, just above it.
  22. the broad answer to your broad question is "A normalised one"
  23. SELECT Foyer, COUNT(Student) as No_Of_Students FROM Formulaire_S GROUP BY Foyer ORDER BY Foyer ASC LIMIT 0, 30
  24. why would you need to retrieve the same piece of information twice?
  25. it's the first line in modue settings on mine: ;;;;;;;;;;;;;;;;;;; ; Module Settings ; ;;;;;;;;;;;;;;;;;;; [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = Europe/London if it is not in the modue settings of your php.ini file you could try adding it.
×
×
  • 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.