Jump to content

lmaster

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Everything posted by lmaster

  1. Fellow Freaks: I'm trying to run this script PHP script to retrieve results from a mySQL database using MDB2. (THIS WORKS WITH mysqli, SO IT IS NOT THE DB, access issues, etc!). The problem is that it is hanging trying to call the method MDB2_Error::query(). I should note that I had to manually move the MDB2.php to the c:\php directory becasue it was hanging prior on not being able to find that file as specified in the require_once directive in the script below. I already did a install mdb2 and install mdb2_driver_mysql. ***************START SCRIPT****************** <html> <head> <title>Book-O-Rama Search Results</title> </head> <body> <h1>Book-O-Rama Search Results</h1> <?php // set up for using PEAR MDB2 require_once('MDB2.php'); $user = 'root'; $pass = 'sesame'; $host = 'localhost'; $db_name = 'books'; // set up universal connection string or DSN $dsn = "mysqli://".$user.":".$pass."@".$host."/".$db_name; // connect to database $db = &MDB2::connect($dsn); // check if connection worked if (MDB2::isError($db)) { echo $db->getMessage(); } // perform query $query = "select * from books where ".$searchtype." like '%".$searchterm."%'"; $result = $db->query($query); // check that result was ok /* if (MDB2::isError($result)) { echo $db->getMessage(); exit; } */ // get number of returned rows $num_results = $result->numRows(); // display each returned row for ($i=0; $i <$num_results; $i++) { $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC); echo "<p><strong>".($i+1).". Title: "; echo htmlspecialchars(stripslashes($row['title'])); echo "</strong><br />Author: "; echo stripslashes($row['author']); echo "<br />ISBN: "; echo stripslashes($row['isbn']); echo "<br />Price: "; echo stripslashes($row['price']); echo "</p>"; } // disconnect from database $db->disconnect(); ?> </body> </html> **********************END SCRIPT************************ ************RESULT OF RUNNING THE SCRIPT*************************** C:\php>php results_generic.php <html> <head> <title>Book-O-Rama Search Results</title> </head> <body> <h1>Book-O-Rama Search Results</h1> MDB2 Error: not foundPHP Notice: Undefined variable: searchtype in C:\php\resul ts_generic.php on line 29 PHP Notice: Undefined variable: searchterm in C:\php\results_generic.php on lin e 29 PHP Fatal error: Call to undefined method MDB2_Error::query() in C:\php\results _generic.php on line 31
  2. Fellow Freaks: I am using this standard HTML form and script found on w3schools and I just get a blank for the output, any ideas: <html> <body> <form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </body> </html> --------------------------------PHP Script------------ <?php if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["file"]["tmp_name"]; } ?>
  3. All, its fixed... It ended up being a bad install of PHP... I simply got the latest binaries and extracted into the PHP folder, and put back my php.ini file and it works like a charm now... I guess the distribution I got off a book had dll's that were corrupted and mismatched. Thank you everybody that tried to help!!
  4. It doesn't look like it, what's the correct procedure? PHP Version 5.1.4 System Windows NT 6RTUWESQ 5.1 build 2600 Build Date May 4 2006 10:30:29 Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared" Server API Apache 2.0 Handler Virtual Directory Support enabled Configuration File (php.ini) Path C:\php\php.ini PHP API 20041225 PHP Extension 20050922 Zend Extension 220051025 Debug Build no Thread Safety enabled Zend Memory Manager enabled IPv6 Support enabled Registered PHP Streams php, file, http, ftp, compress.zlib Registered Stream Socket Transports tcp, udp Registered Stream Filters convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.* Zend logo This program makes use of the Zend Scripting Language Engine: Zend Engine v2.1.0, Copyright © 1998-2006 Zend Technologies
  5. MAKING PROGRESS, Yes it was a file/directory placement issue, I'm past that, BUT NOW I AM HAVING PROBLEMS WITH SSL, I followed the advice on this page, but it still does not work: http://forum.uniformserver.com/index.php?showtopic=1378 C:\php\PEAR>php mailer1.php PHP Warning: PHP Startup: openssl: Unable to initialize module Module compiled with module API=20060613, debug=0, thread-safety=1 PHP compiled with module API=20050922, debug=0, thread-safety=1 These options need to match in Unknown on line 0 <p>Failed to connect to ssl://smtp.gmail.com:465 [sMTP: Failed to connect socket : Unable to find the socket transport "ssl" - did you forget to enable it when y ou configured PHP? (code: -1, response: )]</p> C:\php\PEAR>
  6. btherl, Thanks for your help. Unfortunately, adding that those three lines simply shifted where it hangs by three lines further down, here is my complete script with your addition and the output: <?php require_once "Mail.php"; $from = "Lawrence Master <taxandaccountingassoc@gmail.com>"; $to = "Lawrence Master <taxandaccountingassoc@gmail.com>"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; $host = "ssl://smtp.gmail.com"; $username = "taxandaccountingassoc@gmail.com"; $password = "XXXX"; $port = "465"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); if (PEAR::isError($smtp)) { echo("<p>" . $smtp->getMessage() . "</p>"); } $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } ?> C:\php>php mailer1.php <p>Unable to find class for driver smtp</p>PHP Fatal error: Call to undefined m ethod PEAR_Error::send() in C:\php\mailer1.php on line 27
  7. BlueSoul and Blade280891, unfortunately the code you referenced does not help me becasue Google uses SMTP-AUTH and TLS. With the Telnet Script that BlueSoul posted here is the response from Google's SMTP server C:\php>php mailer2.php Opening Connection to Mail server...<br>>>220 mx.google.com ESMTP 6sm13367791yxg .6 <br>AUTH LOGIN<br>>>503 5.5.1 EHLO/HELO first. 6sm13367791yxg.6 <br>dGF4YW5kYWNjb3VudGluZ2Fzc29jQGdtYWlsLmNvbQ==<br>>>502 5.5.1 Unrecognized com mand. 6sm13367791yxg.6 <br>dGF4YTY3ODk=<br>>>502 5.5.1 Unrecognized command. 6sm13367791yxg.6 <br>HELO localhost<br>>>250 mx.google.com at your service <br>MAIL FROM: taxandaccountingassoc@gmail.com<br>>>530 5.7.0 Must issue a START TLS command first. 6sm13367791yxg.6 <br>RCPT TO: taxandaccountingassoc@gmail.com<br>>>530 5.7.0 Must issue a STARTTL S command first. 6sm13367791yxg.6
  8. Sending Email with PHP All, I'm following this article to a tea, but getting the following error message: http://www.developer.com/open/article.php/10930_3782831_1 after I install the packages and run my script! C:\php>php mailer1.php PHP Fatal error: Call to undefined method PEAR_Error::send() in C:\php\mailer1. php on line 24 If ANYBODY knows of a better tutorial on how to use this, please respond, unfortunately, this article is very high on the Google results page and many folks are referring to it... All I am trying to do is use Google's SMTP server, port 465 with SSL etc, I understand that the stock mail() function within PHP does not work with encryption/authentication. Any body has a better idea???
  9. Hi, thanks for trying to help, I am still getting the same error, I though I already had that code snippet at the end? Any other ideas? Thanks, Lawrence
  10. Hello all I installed the mail and net_smtp PEAR modules though i am getting the following error when I type c:\php mailer1.php PHP Fatal error: Call to undefined method PEAR_Error::send() in C:\php\mailer1. php on line 24 This is my script: <?php require_once "Mail.php"; $from = "Lawrence Master <taxandaccountingassoc@gmail.com>"; $to = "Lawrence Master <taxandaccountingassoc@gmail.com>"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; $host = "ssl://smtp.gmail.com"; $username = "taxandaccountingassoc@gmail.com"; $password = "XXXXX"; $port = "465"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } ?> I would appreciate any help Thanks
×
×
  • 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.