Jump to content

jeffrydell

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Everything posted by jeffrydell

  1. The goal is to produce a script which will monitor specified URL's and display a list of links to updated pages. I've been trying to use file() and in_array(), but when I search for specified text, in_array() always returns FALSE. Same thing if I use file_get_contents() and strstr(). This is getting a bit silly as it should be fairly straight forward to search for a specified string within a variable or an array ... but it isn't working. Any thoughts on how I might check web pages (some are dynamic) to see if they have been updated? Thanks in advance for any help you can come up with! Jeff
  2. Thorpe, Thanks for the idea. I'm on a windows server now ... not quite sure how to do those things ... BUT the website will be moving in the next year or so and probably end up on an Apache server for better functionality with all those wonderful .php apps (like Wordpress / Joomla / etc.). At that point I'd probably have to start over - not a good prospect. Other options?
  3. I collect data through my online application for multiple clients. Each client uses their data in one of several PC apps based off Excel, Access, or Filemaker Pro. I'm trying to figure out the most 'fool proof' way for the client to get their data from my db on to their local hard drive (specifically in their db). Up to now I've written a php script which, when given an identifying ID, will query my db and output client-specific info to an .xml file which can then be downloaded. My script then presents the user with a link to that .xml file for downloading. A friend of mine developed a VB script that opens the .xml file from the user's hard drive and maps all the .xml file data in to the appropriate tables & fields in the Access db. This works, but there's too much user interaction (too many opportunities for screw-ups / questions). So I'm looking for a 'better way'. Is it possible for that VB-based program to query my DB directly (with an identifier of some sort so they don't get EVERYBODY's data? OR is there a way to have that VB script start a php script and my script can STREAM the data to their hard drive? Any thoughts or suggestions on where I could learn about 'best practice' for moving data from MySQL to a local PC for use by another app would be greatly appreciated!
  4. Thanks - I ended up using a class that not only retrieves the file (not blob in a table), but it also 'thumbnails' anything wider than 600px down to 600px. Very handy. I appreciate the answer. Jeff
  5. I'm putting together an online test application which can incorporate images in both the questions and the answers. I have to make choice of storing the images in a directory on the server and storing a link in one of the table fields, or storing the images as blobs within an image table in the db. Since the images are small (nothing over 50 - 75k), I figured stashing them in an image table with mime type and a unique name would be the best plan. Upload & store in the db are no problem ... but I'm having a bit of trouble when it comes to rendering these images on the screen after I retrieve them. Before I get yelled at for posting in the wrong place, please read on - this is NOT a coding question! I have been able to retrieve a single image from the db, sent the header info & it came up no problem. I'm not, however, doing very well with displaying multiple images or a combination of text & images. Echo commands after the image don't put anything up on the screen. Before I wail on this too much longer, is it really wise to store images as Blobs in a table when dozens of them will need to be retrieved for any one test, or should I just store paths and let html tags do all the work when it comes time to throw a test up on the screen?
  6. You hit it - It was set to only accept cookies from the original site, not from the 'third party' site. Thanks!
  7. Any guidance on how to make Safari pass session variables? I have a set of php scripts which pass data between themselves. The scripts are accessed through an iframe in pages on other people's websites. These scripts work just fine with every browser EXCEPT Safari (on either Mac OR Windows). Anyone have experience with this? I've Googled without success. Thanks!
  8. Plain & simple (to avoid any confusion), $dt2snd is a string. The string is formatted as 2007-08-25. If I explicitly include a fixed value in a MySQL INSERT statement, the value goes in to the record just fine, but when I reference a variable which is a string formatted exactly the same way, I get 0000-00-00 in the record. The question is, do I need to do anything to a string which is formatted according to the MySQL date 'format' in order to be able to put that variable's value into the record being inserted?
  9. I have a date in a variable - supposedly formatted properly for MySQL's date field type. (YYYY-MM-DD). When I attempt to insert a new record in a table, the date doesn't store properly. $sql = "INSERT INTO `dogs` (`owner_id`, `callname`, `breed`, `sex`, `birthdate`, `height`, `accessid`, `accesstype`) VALUES ($oid, '$nm', '$brd', '$sex', '$dt2snd', '$ht', $aid, '$atyp')"; ... always ends up with the birthdate field reading '0000-00-00', whether I put quotes on the $dt2snd or not. Any suggestions on what to do or where to 'read up'?
  10. Looking for a general (and hopefully unbiased) opinion from y'all... I have been using phpMailer for the past 6 months or so and have been quite happy with it in the simple uses that I've implemented. I'm looking for help on something a little more advanced now and it seems like there has been almost no activity with the project for quite some time. Is phpMailer - in your estimation - worth continuing with, or should I be looking to use a class that is being more actively supported? Thanks freaks! (You know I mean that in the best way possible.)
  11. Thanks - removing the quotes did it. I don't know how many times I've set up that type of scenario and never put those quotes in before ... guess it goes with being human. Here's a similar issue ... the array element $Dog['dog_id'] is null - I know, I tested for that: if ($Dog['dog_id'] !== "") { $sql = mysql_query("SELECT * FROM `dogs` WHERE `dog_id` = " . $Dog['dog_id']) or die(mysql_error()); $row = mysql_fetch_array($sql); // Line 838 $Dog['breed'] = $row['breed']; $Dog['sex'] = $row['sex']; $Dog['birthdate'] = dateconvert($row['birthdate'], 2); } ... as you can see, I already tried the "or die()" method of troubleshooting and got: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 (MySQL's usual 'ever so helpful' error messaging.) Prior to that, the error message from php was: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\...\script.php on line 838 ... which indicates to me that the IF() evaluated true, even though it SHOULD have been false because of !==""; Anyone????
  12. Not quite sure how I'm getting THIS warning message: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in E:\...\script.php on line 796 From THIS code: $sql = @mysql_query("SELECT `owner_id` FROM `owners` WHERE `email` = '" . $Owner['email'] . "' AND `zipcode` = '" . $Owner['zipcode'] . "'"); if (mysql_num_rows($sql) > 0) { $row = mysql_fetch_assoc('$sql'); $Owner['owner_id'] = $row['owner_id']; } In order to 'get in' the IF, doesn't there have to be at least one row matching the query string? And if there IS one row, how can I get a message saying it's not a valid resource? Thanks for whatever help you can offer!
  13. Thanks lemmin - it worked fine in a 'shorty script'.
  14. roopurt18, First ... "I don't mean to be rude, but it sounds like..." A long time ago I learned that everything preceding the word "but" is a lie. Now, as for WHY I didn't just use session_destroy() (which, by the way, I looked it up on the php manual website) the manual states: session_destroy() destroys all of the data associated with the current session. It does not unset any of the global variables associated with the session, or unset the session cookie. That second part is the rub ... I didn't know if there was a better way which would unset the global variables associated with the session and unset the session cookie as well. Yes, it's a fairly complicated project I'm working on. I'm also 'self-taught' (with a little assistance & guidance from helpful people ... some of which use this forum) and I'm learning a lot along the way. I'm sure with your rather extensive knowledge of php you understand that there is a lot to learn and MOST people don't know it 'all' as soon as they start writing code. The single hardest part of learning a language and everything that comes with something like php is finding the correct term for what you need. Without knowing the correct terminology, it's rather difficult to know if you've "looked up" all the possible information relating to what you're doing. Such was the case here. If 'our' questions are annoying or simplistic to you - I suggest that you might consider going out and getting more freelance work so you can show off your "brilliance" for pay ... perhaps creating something worthwhile in the process ... rather than 'dumping' on those of us who are honestly trying to learn and want to use this community for what it was intended. Oh, and by the way - I DID mean to be rude. Have a nice day.
  15. I have written an application which will be used by many websites, each one will 'approach' my php script with a unique identifier allowing me to establish where the site visitor is coming from, and allowing custom content to be presented based on the referring site. (The referring site would have a link to:) www.domain.com/entrypage.php?referrer=45 ...where my site is 'domain.com' and the referring site's id (45) is stored in a MySQL table. So far, so good. When they hit 'entrypage.php', a session is initiated (session_start() ... again no problem) and the id is stored in $_SESSION['referrer'] for access by other scripts throughout my application. Still doing OK up to here. BUT ... what about when a person leaves, then accesses my site through a different referring site? That's where I'm starting to see an issue, because they are looking at my application with the old session still running (apparently). So in the 'entrypage' script, I'd like to kill all previous sessions BEFORE starting the new one. How do I do that? Thanks in advance!
  16. How do I take a date that was entered by a site visitor (format: mm/dd/yyyy) and convert it properly for storing in a MySQL date field? I figured out the MySQL to 'human' function: function dateshow($dbdate) { $m = substr($dbdate,6,2); $d = substr($dbdate,9,2); $y = substr($dbdate,1,4); return date("m/d/Y", mktime(0,0,0,$m,$d,$y)); } but don't understand what I need to do to 'send it back' to the table in a format that MySQL will 'like'. Thank you for your help!
  17. This script didn't work in my 'test' environment, but when I put it in the full project it worked fine ... so whatever it was isn't important right now. Maybe someday I'll pay the price for not figuring it out now ... but for the time being, I'm moving on. Thanks for your help anyway!
  18. Anyone else? Lots of you lookin - still no answer!??!
  19. Never knew that existed. Thanks - solves a lot of issues for this project!
  20. First - this applies to a Windows server ... I know, I know - I don't need the lecture ... it's the last site I'm maintaining on Windows and I just haven't had time to migrate it. Let's say I have a little script which is used to open the MySQL db on my site (which I do) and it 'lives' in the folder called admin under the document root (which it does) and it's called mike.php (which it isn't - so don't go looking for it. I understand how to access 'Mike' from a script in the document root: require_once('admin/mike.php'); ... and I understand how to reference 'Mike' from a script that may be down a directory from the document root: require_once('../admin/mike.php'); BUT what about when I want to reference from a script that is 'included' from another script in a different directory ... and that script could either be 'included' ... or might just be running on its own? I'm running in to a problem with not being able to write that reference to /admin/mike.php correctly because sometimes I'm referring to it from the 'wrong' level. Example (where ScriptB.php calls for mike.php): ScriptA is in the document root and has a line that reads: include('/subscripts/ScriptB.php'); ... because it was 'included' from the document root, the reference to open the db should be: require_once('admin/mike.php'); BUT that won't work if ScriptB.php is called from itself, or from another script in the /subscripts/ folder... now it must use: require_once('../admin/mike.php'); So here's the question ... how can I write the reference to mike.php in such a way that it will work no matter how the script is initiated? Is there a universal way of saying 'look for this file in the the admin folder under the document root'? Thanks in advance for your patience and help!
  21. Foser, Thanks for the tip! I'm not really setting the session with session_register(), I'm 'setting' it with the session_start(); at the top of the script (at least I think that's the way it works). I'm using the session_register('ArrayName') to make those arrays available across scripts ... like the $_SESSION[] array. This is a part of a much larger application that will walk people through an 'interview process' similar to online tax prep services, etc. Each subject area has its own script, sometimes broken out depending on the organizations involved and different business rules requiring different data. Please let me know if there's a better way to make those arrays available for as long as the visitor is in the session.
  22. cooldude832 is correct, you should have a table for each set of like items (teams, fields, etc.) The WHERE can be expanded to accommodate as many table joins as necessary. Example: http://AgilityEvents.net/events.php uses: select clubs.name AS ClubName, clubs.url as ClubURL, clubs.sec_id as ClubSecretaryID, venues.name AS VenueName, events.*, unix_timestamp(events.start_date) as unix_start_date, unix_timestamp(events.end_date) as unix_end_date, unix_timestamp(events.post_date) as unix_post_date, unix_timestamp(events.close_date) as unix_close_date from events, venues, event2venue, clubs where events.club_id = clubs.club_id AND events.event_id = event2venue.event_id AND venues.venue_id = event2venue.venue_id Flexible enough for ya?
  23. $sql = "SELECT * FROM `f2007_divisions`. `f2007_scheduling` WHERE f2007_divisions.division_id = f2007_scheduling.division_id"; $res = mysql_query($sql); ... should join the tables by division_id and give you all the fields included in the two tables. Then if you want to spank that all in to an array named Sched... $Sched = mysql_fetch_array($res); Is that what you were looking for?
  24. Here you go: <? session_start(); if (!isset($_SESSION['action'])) { $_SESSION['action'] = "get"; } else { if (!isset($_GET['action'])) { $junk = "nothing"; } else { $_SESSION['action'] = $_GET['action']; } } switch ($_SESSION['action']) { case "get": session_register("Entry"); session_register("Classes"); session_register("Divisions"); session_register("Levels"); session_register("Trial1"); session_register("Trial2"); session_register("Trial3"); session_register("Trial4"); $count = 1; $Entry['category'] = " "; WHILE ($count <= 10) { $Classes[$count] = " "; $Divisions[$count] = " "; $Levels[$count] = " "; $Trial1[$count] = " "; $Trial2[$count] = " "; $Trial3[$count] = " "; $Trial4[$count] = " "; $count++; } echo "This is from the php script which is 'calling' the form. <br />"; echo " <br />"; $_SESSION['action'] = "show"; include("NADAC_Generic.html"); break;; case "show": echo "<h3>Here are the results from the form:</h3>"; echo "<hr>"; echo "<b>Category:</b> " . $_POST['category'] . "<br />"; echo "<table><tbody>"; echo "<tr><td>" . $_POST['c1'] . ":</td><td>" . $_POST['d1'] . "</td><td>" . $_POST['l1'] . "</td><td>Entered: " . $_POST['t1c1'] . "</td><td>" . $_POST['t2c1'] . "</td><td>" . $_POST['t3c1'] . "</td><td>" . $_POST['t4c1'] . "</td></tr>"; echo "<tr><td>" . $_POST['c2'] . ":</td><td>" . $_POST['d2'] . "</td><td>" . $_POST['l2'] . "</td><td>Entered: " . $_POST['t1c2'] . "</td><td>" . $_POST['t2c2'] . "</td><td>" . $_POST['t3c2'] . "</td><td>" . $_POST['t4c2'] . "</td></tr>"; echo "<tr><td>" . $_POST['c3'] . ":</td><td>" . $_POST['d3'] . "</td><td>" . $_POST['l3'] . "</td><td>Entered: " . $_POST['t1c3'] . "</td><td>" . $_POST['t2c3'] . "</td><td>" . $_POST['t3c3'] . "</td><td>" . $_POST['t4c3'] . "</td></tr>"; echo "<tr><td>" . $_POST['c4'] . ":</td><td>" . $_POST['d4'] . "</td><td>" . $_POST['l4'] . "</td><td>Entered: " . $_POST['t1c4'] . "</td><td>" . $_POST['t2c4'] . "</td><td>" . $_POST['t3c4'] . "</td><td>" . $_POST['t4c4'] . "</td></tr>"; echo "<tr><td>" . $_POST['c5'] . ":</td><td>" . $_POST['d5'] . "</td><td>" . $_POST['l5'] . "</td><td>Entered: " . $_POST['t1c5'] . "</td><td>" . $_POST['t2c5'] . "</td><td>" . $_POST['t3c5'] . "</td><td>" . $_POST['t4c5'] . "</td></tr>"; echo "<tr><td>" . $_POST['c6'] . ":</td><td>" . $_POST['d6'] . "</td><td>" . $_POST['l6'] . "</td><td>Entered: " . $_POST['t1c6'] . "</td><td>" . $_POST['t2c6'] . "</td><td>" . $_POST['t3c6'] . "</td><td>" . $_POST['t4c6'] . "</td></tr>"; echo "<tr><td>" . $_POST['c7'] . ":</td><td>" . $_POST['d7'] . "</td><td>" . $_POST['l7'] . "</td><td>Entered: " . $_POST['t1c7'] . "</td><td>" . $_POST['t2c7'] . "</td><td>" . $_POST['t3c7'] . "</td><td>" . $_POST['t4c7'] . "</td></tr>"; echo "<tr><td>" . $_POST['c8'] . ":</td><td>" . $_POST['d8'] . "</td><td>" . $_POST['l8'] . "</td><td>Entered: " . $_POST['t1c8'] . "</td><td>" . $_POST['t2c8'] . "</td><td>" . $_POST['t3c8'] . "</td><td>" . $_POST['t4c8'] . "</td></tr>"; echo "<tr><td>" . $_POST['c9'] . ":</td><td>" . $_POST['d9'] . "</td><td>" . $_POST['l9'] . "</td><td>Entered: " . $_POST['t1c9'] . "</td><td>" . $_POST['t2c9'] . "</td><td>" . $_POST['t3c9'] . "</td><td>" . $_POST['t4c9'] . "</td></tr>"; echo "<tr><td>" . $_POST['c10'] . ":</td><td>" . $_POST['d10'] . "</td><td>" . $_POST['l10'] . "</td><td>Entered: " . $_POST['t1c10'] . "</td><td>" . $_POST['t2c10'] . "</td><td>" . $_POST['t3c10'] . "</td><td>" . $_POST['t4c10'] . "</td></tr>"; echo "</tbody></table>"; echo "<br />"; echo "<h3>Here are the values as they are stored:</h3>"; echo "<hr>"; // Loadin' up the Arrays... $Entry['category'] = $_POST['category']; $count = 1; echo "<b>Category:</b> " . $Entry['category']; echo "<table><tbody>"; WHILE ($count <= 10) { $ckey = "c" . $count; $dkey = "d" . $count; $lkey = "l" . $count; $t1ky = "t1" . $ckey; $t2ky = "t2" . $ckey; $t3ky = "t3" . $ckey; $t4ky = "t4" . $ckey; $Classes[$count] = $_POST[$ckey]; $Divisions[$count] = $_POST[$dkey]; $Levels[$count] = $_POST[$lkey]; $Trial1[$count] = $_POST[$t1ky]; $Trial2[$count] = $_POST[$t2ky]; $Trial3[$count] = $_POST[$t3ky]; $Trial4[$count] = $_POST[$t4ky]; echo "<tr><td>" . $Classes[$count] . ":</td><td>" . $Divisions[$count] . "</td><td>" . $Levels[$count] . "</td><td>Entered: " . $Trial1[$count] . "</td><td>" . $Trial2[$count] . "</td><td>" . $Trial3[$count] . "</td><td>" . $Trial4[$count] . "</td></tr>"; $count++; } echo "</tbody></table>"; echo "<br />"; echo "<a href='testform.php?action=edit'>Click here to edit the entry</a>"; break;; case "edit": echo "<table><tbody>"; $count = 1; WHILE ($count <= 10) { echo "<tr><td>" . $count . "</td><td>" . $Classes[$count] . ":</td><td>" . $Divisions[$count] . "</td><td>" . $Levels[$count] . "</td><td>Entered: " . $Trial1[$count] . "</td><td>" . $Trial2[$count] . "</td><td>" . $Trial3[$count] . "</td><td>" . $Trial4[$count] . "</td></tr>"; $count++; } echo "</tbody></table>"; include('NADAC_Generic.html'); break;; } ?>
×
×
  • 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.