Jump to content

SpeedBird

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

About SpeedBird

  • Birthday 05/08/1979

Profile Information

  • Gender
    Male
  • Location
    Birmingham, England

SpeedBird's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a rather annoying problem trying to connect to an Access database. Here's what happens when I try to execute a script using CLI (php -a -e -f "c:\file.php"): 1. Command-line shows 'Interactive mode enabled' 2. Slight pause and then a pop-up error displays 'Application popup: php.exe - Application Error : The instruction at "0x1b29fd3d" referenced memory at "0x0a6e0000". The memory could not be "written". Click on OK to terminate the program Click on CANCEL to debug the program' 3. After clicking on OK I get another pop-up: Application popup: php.exe - Application Error : The instruction at "0x07070707" referenced memory at "0x07070707". The memory could not be "read". Click on OK to terminate the program. 4. In the application log there are three consecutive errors, all similar to 'Faulting application php.exe, version 5.2.1.1, faulting module msrd3x40.dll, version 4.0.6508.0, fault address 0x0002fd3d.' (only the fault address is different in each error). Is this likely to be a problem with the script, MS ODBC or PHP itself? Or is there another way to connect to an Access database from PHP other than ODBC that I could try?
  2. The database I'm querying is MS Access, the database I'm inserting to is MySQL. I don't actually need to worry about datatype conversions (text is fine).
  3. *BUMP* In case I wasn't clear, the blank table already exists in the other database and doesn't need to be created. Using INSERT...ON DUPLICATE KEY UPDATE means that any new rows will be copied to the new table and existing rows (where an indexed id field exists) will be updated. My only problem is figuring out how to loop through each element in the array and insert the data as a new row.
  4. I'm assuming you just want the PHP. Something like this would do it: <?php /* Assuming a MySQL database */ mysql_connect('127.0.0.1:3306', 'user', 'pass') or die('Could not connect: ' . mysql_error()); mysql_select_db('database'); /* You'll have a variable ($search_query here) with the value of the query string */ $result = mysql_query("SELECT clientid, field1, field2, field3 FROM table_name WHERE clientid LIKE '$search_query' "); ?>
  5. I'm having difficulty working out how to do a query/insert between databases. What I need to do is query all rows from a table in one database, and insert them into an (identical) blank table in another, separate database. This needs to be done on-the-fly rather than via an automated script or database utility. I'm sure I need to use foreach for this. Here's what I've got so far: <?php /* Open an ODBC connection to the first database: */ $odbc = odbc_connect('dsn','user','pass'); if (!$odbc) {exit("Connect failed: " . $odbc);} /* SQL query (results stored in array) */ $cust_query = "SELECT customerid, name, surname FROM tblcustomer ORDER BY customerid"; $cust_data[] = odbc_exec($odbc,$cust_query); if (!$cust_data) {exit("SQL error retrieving customer data!");} /* close odbc connection */ odbc_close($odbc); /* open mysql connection */ mysql_connect('127.0.0.1:3306', 'user', 'pass') or die('Could not connect: ' . mysql_error()); mysql_select_db('database'); ?> I know I need to do an INSERT...ON DUPLICATE KEY UPDATE but how do I loop it so that each row is entered as a new record?
  6. If I remember correctly, the .exe is just a self extractor. You should have two files which need to be kept in the same location (i.e. c:\windows\rewrite); a .dll file and a .ini file. The .dll is an ISAPI filter and needs to be loaded by IIS, the .ini is a configuration file and it is where you will create your rewrite rules using PCRE syntax. PCRE can be quite difficult to get used to, but a good cheat sheet can be found [url=http://www.phpguru.org/downloads/PCRE%20Cheat%20Sheet/PHP%20PCRE%20Cheat%20Sheet.pdf]here[/url].
  7. You can use [url=http://www.isapirewrite.com/]this[/url]. It was the only rewriter I could get working for IIS. I don't think you can do that sort of rewriting from PHP (but I could be wrong).
  8. The headers aren't the problem: [code=php] <?php # # Send mail abstract function # $from - from/reply-to address # function func_send_mail($to, $subject_template, $body_template, $from, $to_admin, $crypted=false) {         global $mail_smarty, $sql_tbl;         global $config, $customer_language, $admin_language; global $current_language, $store_language;         if ($to_admin or !$customer_language) { if ($current_language) $charset = array_pop(func_query_first ("SELECT charset FROM $sql_tbl[countries] WHERE code='$current_language'")); else $charset = array_pop(func_query_first ("SELECT charset FROM $sql_tbl[countries] WHERE code='".$config["default_admin_language"]."'"));                 $mail_smarty->assign ("lng", $admin_language); }         else { $charset = array_pop(func_query_first ("SELECT charset FROM $sql_tbl[countries] WHERE code='$store_language'"));                 $mail_smarty->assign ("lng", $customer_language); }         $mail_smarty->assign ("config", $config);     $mail_message = $mail_smarty->fetch("$body_template");     $mail_subject = chop($mail_smarty->fetch("$subject_template"));         if (($config["PGP"]["enable_pgp"]=="Y") and ($crypted)) {                 $mail_message = func_pgp_encrypt ($mail_message);         }         if (stristr(PHP_OS, "win")) {             $mail_message=str_replace("\n","\r\n",$mail_message);             $lend = "\r\n";         }         else             $lend = "\n"; $headers = "From: $from".$lend."Reply-to: $from".$lend."X-Mailer: PHP/".phpversion().$lend."MIME-Version: 1.0".$lend; if ($config["Email"]["html_mail"] == "Y") $headers .= "Content-Type: text/html; charset: ".$charset.$lend; else $headers .= "Content-Type: text/plain; charset: ".$charset.$lend; if (preg_match('/([^ @,;<>]+@[^ @,;<>]+)/S', $from, $m)) mail($to,$mail_subject,$mail_message,$headers, "-f".$m[1]); else mail($to,$mail_subject,$mail_message,$headers); } function func_send_simple_mail($to, $subject, $body, $from) { global  $config; global $current_language;         if (stristr(PHP_OS, "win")) {             $body=str_replace("\n","\r\n",$body);             $lend = "\r\n";         }         else             $lend = "\n"; if (!empty($current_language)) $charset = array_pop(func_query_first ("SELECT charset FROM $sql_tbl[countries] WHERE code='$current_language'")); if (empty($charset)) $charset = array_pop(func_query_first ("SELECT charset FROM $sql_tbl[countries] WHERE code='".$config["default_admin_language"]."'")); $headers = "From: $from".$lend."Reply-to: $from".$lend."X-Mailer: PHP/".phpversion().$lend; if ($config["Email"]["html_mail"] == "Y") $headers .= "Content-Type: text/html; charset: ".$charset.$lend; else $headers .= "Content-Type: text/plain; charset: ".$charset.$lend; if (preg_match('/([^ @,;<>]+@[^ @,;<>]+)/S', $from, $m)) mail($to,$subject,$body,$headers, "-f".$m[1]); else mail($to,$subject,$body,$headers); } ?> [/code] I need to send the host information. It would be something like the [i]fromhost[/i] function in Xpertmailer.
  9. Here are some good starting places: The PHP manual: [url=http://www.php.net/manual/en/]http://www.php.net/manual/en/[/url] The MySQL manual (assuming you will be storing the information in a database): [url=http://dev.mysql.com/doc/refman/5.0/en/index.html]http://dev.mysql.com/doc/refman/5.0/en/index.html[/url] A quick tutorial on using [url=http://www.freewebmasterhelp.com/tutorials/phpmysql]PHP & MySQL[/url] together And if you want a book, [url=http://www.amazon.com/MySQL-Dummies-CDROM-Janet-Valade/dp/0764516507]PHP & MySQL For Dummies.[/url] That's pretty much what I use.
  10. Is this correct: 1. You have a message board hosted with InvisionFree.com? 2. You want to update something on your message board from your home computer? 3. You want this done automatically at certain time periods?
  11. Probably a very newbie question, but is there any way to add host (mail exchanger) information to an outgoing message when using mail()? I have a script that sends an order confirmation to customers, but some email providers and ISP's seem to drop the email. We get inundated with calls from people worried because they never received an order confirmation. I placed a couple of dummy orders to see if I would receive the confirmation. I received it on my company account but I never receive confirmations on my Hotmail account, they don't even make it to the 'junk mail' folder. After a bit of Googling I found out that if you generate emails with a script it should include the host, but I couldn't find a way to add host information in the PHP documentation at php.net and found nothing useful Googling. Just FYI we are using a fairly old version of X-Cart. Because of modifications we have asked them to do and modifications I have made myself it is going to be quite expensive to upgrade. That said we have another website using the current version of X-Cart and that suffers from the same problem. Because of this I can't (or rather, lack the competence to) integrate a third-party mailer like PHPMailer. What I really need to know is how to include the host in a mail() type function (I already know the hostname and IP address). I am running PHP 5.1.4 on Windows 2003 Server Web Edition. 
×
×
  • 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.