Jump to content

HuntsvilleMan

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Everything posted by HuntsvilleMan

  1. That was a very helpful suggestion for keeping results from ending up in the output stream. Still, I don't see how you came up with the suggestion to use True as an argument. I'm using the documentation (version 5.3.6) of debug_backtrace() at: http://php.net/manual/en/function.debug-backtrace.php Is there a better documentation I should have used? What I'm getting now is understandable but all in one long unformatted string. Is there an option to format it with some structure when sending the string to a text file? Thanks Mike
  2. Can't see how var_export does anything for me. If I know a variable's name I can just write it to a file. I started out thinking something like vr_dump(debug_backtrace()) might be what I needed. Just can't figure out how to get that data written to a file without mesing with the output stream.
  3. Here is what I tried $a = 1; $b = 2; $c = 3; $snapshot = var_export(); echo $snapshot; // will write to file rather than echo when it works I assumed I would see a list of variables ($a, $b and $c) and their values in $snapshot but saw nothing displayed. Keep in mind I may also need the previous program to know how the program got to the point of failure. Thanks
  4. Unfortunately var_dump goes stright to the output stream. What I need is a function that does the same thing by storing to a variable I can then write to a file.
  5. I need to debug a php program. I've tried to use something like: $debuginfo = var_dump(debug_backtrace()); and then write $debuginfo to a text file for later review. The problem I have is that this approach uses the output stream and my program also wants to write to the output stream. Unfortunately, other programs are using the output stream and dumping dignostic data to the outputstream mesess with the state of the program. Is there a way to get a snapshot of variables and calls without interfering with the output stream? Thanks Mike
  6. Thanks for helping this novice get pointed in the right direction. The INTERVAL key word sounds like what I needed. This will be the third query I've written in mySQL. No doubt the nuances of mySQL versions are a big part of what separates experts from a newbee like me. Next time I'll include the mySQL version I'm using - assuming I can find it. Any other rules I violated? Really appreciate the suggestion.
  7. Perhaps someone with more experience can help this novice understand how to write a mySQL query to delete records older than a given day. The table I have been given has has a field named LogDate with dates stored in a 19 character field format as: yyyy-mm-dd hh:mm:ss What I need to do is delete all records older a given archival day which is also in the character format: yyyy-mm-dd No doubt this would be simpler if the dates were in a normal mySQL date field but alas that's not what life handed me. Thanks for suggestions on how to write this query. Mike
  8. I need help getting global persistence variables in a set of php programs that interact like the ones shown below: |------ -----| \ / | Start.php --->Callback.php----> message.php --> | / \ \ / | Remote vendor service---| At present I pass all parameters to startcall.php and it in turn it passes the values as URL parameters to other programs. The problem I have is that the remote vendor request I make truncates long URLs before they come back. They tell me it has something to do with the way URLs get encoded (a chunking issue) and they can’t fix it. To shorten up the URLs I need to find a way to make all parameters I send to start.php become persistent for about 3 minutes and be avaiable to all PHP programs. Session variables don’t seem to be quite what I need so far as I understand. For example, they would be fine to let start.php remember but then the other programs don’t have the values needed. So far the only solution I know of would be for start.php to store all values in a database table and then have the other programs recall the data as needed. Is there a simpler way to get the kind of global persistent variables I need in this php application? Thanks
  9. I am using a Yahoo server to host a php program tha makes http request to a company called Twilio.com. The problem is that Twilio can't accept chunked encoding and so far as I can tell Yahoo doesn't document a way that I can turn of Chunked Encoding off. Is there a php utility that can turn off Chunked Encoding? Thanks
  10. I need help with an INSERT statement. Had it working but then missed some point about how to do it right. The problem is the statement below. $query_status = mysql_query("INSERT INTO nneighbors (kp, pid, aid, mt, vt, ct, cid) VALUES ($kp, $pid, $aid, $mt, $vt, Now(), NULL)"); The test code I'm working with to focus on the problems is below. Really appreciate a suggestion about what I'm messing up. Thanks Mike <?php //this is a short test program that fails $kp = "1"; // key pressed $pid = 2; // person id $aid = 3; // appointment id $mt = "V"; // message type $vt = "D"; // visit type $myD = "rem"; //database $myT = "nne"; //table $myU = "off"; //username $myP = "dat"; //password /* save call completion information*/ $link_status = mysql_connect("mysql", $myU, $myP); if (!$link_status) echo "failed mysql_connect" . "<br />"; /* Insert the values into the table where cid is an AutoIncrement field*/ $database_status = mysql_select_db($myD); if (!$database_status) echo "failed mysql_select_db" . "<br />"; $query_status = mysql_query("INSERT INTO " . $myT . " (kp, pid, aid, mt, vt, ct, cid) VALUES ($kp, $pid, $aid, $mt, $vt, Now(), NULL)"); if (!$query_status) echo "failed mysql_query" . "<br />"; echo "finished"; ?> echo values: kp = 1 pid = 2 aid = 3 mt = V vt = D myD = rem myT = nne myU = off myP = dat failed mysql_query finished Table structure: kp char(1) pid int(11) aid int(11) mt char(1) vt char(1) ct char(19) (note - intentionally stored in charcter format to accomodate other programs that expect charcater data) cid int(11) auto increment
  11. What I am doing with this code is making a request for data from a mySQL database hosted by my ISP (Yahoo Small Business). The result is Microsoft Access fields being appended by the requested data in the mySQL rows. So far as I can tell Yahoo doesn't support an ODBC interface and since it isn't my server I'll need some pointers on how I might do this myself or possibly get Yahoo to offer this service. Maybe I need a better ISP. This ineed to send data back and forth between Microsoft Access and a distant servers is all quite new to me. On a local Firebird server I do have an ODBC interface that makes data access a bit easier. So, what I'm looking for are better solutions to use with applications that exchange data between Microsoft Access and mySQL databases not on my local area network.
  12. Is there a better way to request mySQL data from a Microsoft Access application. The code I've cobbled together with much help is below. My server is Yahoo Small Business. Thanks for any suggestion about better way to do this kind of data request or ideas for making it more secure. It's all new to me. Mike 'Microsoft Access program to call PHP program Set rs_result = MyDB.OpenRecordset("result", dbOpenTable) baseurl = "something.com/php/mydirectory/" CurrentDb.Execute ("DELETE FROM result") 'Remove results from the temporary table url = "https://" + baseurl + "result.php?" _ & "date=" & URLEncode(txtYearFirstDate) _ & "&myDATABASE=" & URLEncode(myDATABASE) _ & "&myTABLE=" & Trim(myTABLE) _ & "&myUSERNAME=" & URLEncode(myUSERNAME) _ & "&myPASSWORD=" & URLEncode(myPASSWORD) Call Application.ImportXML(url, acAppendData) ******************************************************** <?php $myDATABASE = $_REQUEST['myDATABASE']; $myTABLE = $_REQUEST['myTABLE']; $myUSERNAME = $_REQUEST['myUSERNAME']; $myPASSWORD = $_REQUEST['myPASSWORD']; $query = "SELECT * FROM " . $myTABLE; $query .= " WHERE substring(confirm_time,1,10) = " . "'" . $thisdate . "'"; $result = mysql_query($query); /*send back requested data in XML format */ echo '<?xml version="1.0"?>'; echo '<results>'; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo '<result>'; echo '<person_id>' . $row['person_id'] . '</person_id>'; echo '<appointment_id>' . $row['appointment_id'] . '</appointment_id>'; echo '<confirm_time>' . $row['confirm_time'] . '</confirm_time>'; echo '</result>'; } echo '</results>'; ?> Use CODE tags in the future, thank you.
  13. Wow! thanks for getting me back on the right track. My minor variation on your great suggestion was: $thisdate = "2011-05-29"; $query = "SELECT * FROM " . $myTABLE; $query .= " WHERE substring(confirm_time,1,10) = " . "'" . $thisdate . "'"; As it happened, time was stored as char(19) data so I had to do a character comparison. No way to express how much I appreciate your helpful suggestion. This mystery bogged me down all day. Is a utility that helps cook up these mySQL/PHP expressions once you have the mySQL query worked out. Thanks Mike
  14. I'm trying to figure out how to write a query and something in the WHERE part is my problem. Without the WHERE part the code runs ok. The field "confirm_time" is text values that look like "2001-04-09 12:14:54" Since I only want values back that match all days like "2001-04-09" I tried the substring function Really appreciate suggestion. This has stumpted me all day. Most likely I need to find atutorial on the correct way to use PHP variables in mySQL queries. All suggestions appreciated? Thanks Mike ... $thisdate = "2011-05-29"; $query = "SELECT * FROM " . $myTABLE; $query .= " WHERE substring(confirm_time,1,10) = " . $thisdate; $result = mysql_query($query); ...
  15. Sounds like the best suggestion is to find a more accomodating web hosting service. Till recently all I wrote were desktop applications and now it seem I'm finding more interesting uses for web applications almost every day. Guess I need a web hosting service that gives me more opportunity to explore and try new things. Anyone have experience with a web hosting service that meets that goal? Thanks Mike
  16. Sure appreciate the heads up about what to look for to schedule task. Looks like Yahoo Small Business does not offer cron or cpanel. They probably don't have anything else for task management that I can have access to. At least I haven't found anyone on their help line with answers. Guess I'll have to see if sleep() can be made to do what I need. The application I have in mind is one that fills the role of a traditional answering service for a doctor taking after hour calls that in essence tracks down the doc when needed by calling various phones and building a call logic that at intervals based on what is learned from people answering the phones and punching in what they know figures out the best way to find the person. Sometime the person being hunted can be at any one 5 or more locations, out of cell phone and beeper contant and maybe even dead asleep. Dozing off is common for emergency workers at 3am on slow mornings (think air trafic controllers at lonely airports). So it also becomes the alarm clock in some cases. Well, that's what docs pay answering services to do and seemed like it could be automated using some PHP and cute services at twilio.com. By the way, all that Yahoo Small Business offers by way of PHP functions is listed below. Array functions BCMath Arbitrary Precision Mathematics functions Calendar functions Character type functions Class/Object functions CURL, Client URL Library functions Database (dbm-style) abstraction layer functions Date and Time functions Directory functions DOM functions DOM XML functions Error Handling and Logging functions Exif functions Filesystem functions Function Handling functions HTTP functions iconv functions Image functions JSON functions Mail functions Mathematical functions Mcrypt Encryption functions Mhash functions Mimetype functions Ming functions for Flash Miscellaneous functions Multibyte String functions MySQL functions Network functions (fsockopen and pfsockopen are disabled) Object property and method call overloading OpenSSL functions Output Control functions PHP options & information Pspell functions Regular Expression functions (Perl-compatible) Regular Expression functions (POSIX Extended) Session handling functions Stream functions String functions Tokenizer functions URL functions Variable handling functions WDDX functions XML parser functions XML-RPC functions XSLT functions Zip File functions (read-only access) Zlib Compression functions
  17. Are there any practical limits to how long the sleep() function can be set to halt an application? I’m using Yahoo Small Business as for web hosting and would like to set some applications to sleep for as long as 12 hours. Is this likely to be a resource problem Yahoo will ding me for? Thanks Mike
  18. Do you have a feel for how reliable the ODBC interface is when implemented over an Internet connection. It would be helpful to know what other users have experienced when using the configuration below with writes to a mySQL database. Microsoft Access on a desktop PC/ODBC <------ Internet ------> mySQL on a remotely hosted server The internet does drop out from time to time. I'm wondering if it's possible to write an ODBC dependent application based on an internet connection that will only be interrupted and recover safely but only very very rarely be corrupted by drop outs. Any experience with this? Mike
  19. Thanks for the tips. Looks like I should have used CHAR(1) rather than TEXT(1). The time value is from a PHP script where I save the value of Now(). Later I use XML to send selected rows back to a Microsoft Access PC on my desk. Keeping data in "text" fields is the only way I have figured out to send data back to Microsoft Access. It would be nice if there was something like an ODBC interface between my web hosting account mySQL database and my desktop Microsoft Access database. Anything like that you know of? Thanks Mike
  20. I'm confused about what row length and row size mean in the mySQL table structure display. Below is a table structure I created that shows a row length of 40 and row size of 2088 B. When I create a second table with the identical structure it shows a row length of 40 and a row size of 222 B. Why do seemingly identical tables have diferent row sizes - one table showing 222 B and one table showing 2088 B? My server is provided through Yahoo web hosting and is "Server version: 4.1.14" While the tables seem to work fine and do what I expect, I'm wondering what's going on. Thanks - Mike Field Type Collation Null Default Extra ============================================= is_confirmed Tinytext latin1_swedish_ci No person_id int(11) No 0 confirm_time Text latin1_swedish_ci No message_type Tinytext latin1_swedish_ci No uniqe_id int(11) No Auto increment In my table structure, the fields is_confirmed and message_type are single character fields. Is there a better type than "Tinytext" for for single character fields? It seems that when I enter a maximum field length of "1" it ignores that length specification. When I redisplay the structure it never show the maximum text field length.
  21. I'm unsure what to put in the path statement below. My attemps so far end up in an error message. Here is what I know: The company that host my files has me at a web address like: mycompany6.com In that root directory I have a subdirectory named: php In that subdirectory I have a file named: testfile.mp3 Getting the path statement right seems to be my problem. Below is my last failed try. $file = "testfile.mp3"; $path = $_SERVER['mycompany6.com']."/php/"; $file = $path.$filename; $file_size = filesize($file); echo $file_size; Do I have enough information to complete the path statement or do I need another piece of information from my web hosting service? Thanks for an explanation of how to get the path statement right. Mike
  22. I'm need a way to send mp3 files attached to emails as part of a voice mail application. My most recent failed attempt at sending email attachements was a script (shown below) I found at: http://www.webcheatsheet.com/php/send_email_text_html_attachment.php#attachment Best I can tell my server doesn't recognize the code below. ob_start(); $message = ob_get_clean(); Where do I get these two functions? The server I'm running on is Yahoo Small Business which support PHP's mail() function but alas without sufficient documentation to make using it with email attachments a useable solution for me at my current level of understanding. I was able to get mail() to work without email attachments. If the script below isn't likely to be a solution, perhaps someone can recommend a PHP email script that worked for them? Thanks for suggestions [attachment deleted by admin]
  23. My first objective is to launch (if that's the right word) one PHP script from another without using an include. My first objective is to first do it on the same server. After understanding that I would like to try it across servers. Essentially, I would like to have a PHP script do what my browser does when it sends a url to a PHP script. No doubt there is more going on in this interaction than I appreciate.
  24. Thanks for the sugestion although understanding it is a bit beyond me for now. I'll read the curl description a few more times. Hope to get it. What I would like to do is launch another PHP script and exit while sending some parameters along in a url. Guess I never thought about what's involved since I always launched the first PHP script with a url from my browser. As I read over the curl library it looks like they have what I'm trying to do but for lack of a simple example I can play with, it's quite mystifying. Do you have a simple example in which one PHP script starts another PHP script in the same directory. The idea of using includes looks nice except for potential variable or function conflicts. Thanks for an example. Mike
  25. I have an application which runs on more than one server and need to launch one PHP script from another PHP script. Since this is different than a function call I'm not sure how it's done. I plan to include parameters in the URL I send and use GETs to pick up parameters in the "called" PHP script. Thanks for sugestions
×
×
  • 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.