Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Thanks.. so each time you see a DTM, do you need to start collecting data for one row of your output? And the lines between each DTM line are the data for that output row? If that's the case, your final loop could look something like this: $cur_item = null; $items = array(); foreach ($cleanEDIAry as $dtm) { $ediLine = parseEDI($dtm, $segSep); if ($ediLine[0] == 'DTM') { # New item. Check if we need to store the old one if ($cur_item !== null) { $items[] = $cur_item; } $cur_item['DTM'] = $ediLine[2]; # Or similar .. actually it looks like you don't use the DTM value in the output } elseif ($ediLine[0] == 'SLN') { $cur_item['SLN'] = $ediLine[3]; # An RK.... thingy } } if ($cur_item !== null) { $items[] = $cur_item; } You can add more "elseif" to handle each data point you want to collect. The final check is to catch the last item in the list, which won't be terminated by a DTM line, and would otherwise be missed.
  2. Do you have a fixed list of files to process, or do you need to process all files found in a specific location?
  3. You can try removing the "literal pasv" and see if that works. It's normal for the port to change - ftp opens a new connection on a new port number for every file transferred.
  4. Oops, thankyou for correcting that pikachu
  5. You're using quotes to mark the start and end of the string, but you're also using quotes inside the string. And the syntax for interpolating the variable is a bit off. Try this: $amessage ='<a href="freindacept?username={$info['username']}.php">Has sent you a freind request </a>'; BTW it is "friend", not "freind". Also you might be wanting this: $amessage ='<a href="freindacept.php?username={$info['username']}">Has sent you a freind request </a>';
  6. Like this: $url = "id"; $stream=ssh2_exec($connection,$url); stream_set_blocking( $stream, true ); $cmd=fread($stream,4096); fclose($stream); print "Output from server: $cmd\n";
  7. Probably. The best way to find out is to try.
  8. What happens if you do a simple 1 line command like "id"?
  9. Can you put this in your final loop: print "<pre>"; var_dump($ediLine);exit; and post the output. After that you can remove the added line.
  10. Can you give a bit more detail about how you're going to display the tree?
  11. Have you decided how you will display it in the table? Will you be using td elements to get the right spacing?
  12. Here's the usual processing I use (more or less, I actually use Smarty for the HTML and Postgres for my database) User data => trim => validate character set => Internal data Internal data => mysql_real_escape_string => A mysql query Internal data => htmlspecialchars => An HTML page "Internal data" is the form I store the data in internally. If it goes into mysql it gets mysql escaped, and if it goes into HTML it gets HTML escaped. And if it goes to some other destination like XML then it gets XML escaped, etc etc.
  13. function check_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } trim() is fine, assuming you don't want whitespace at the start and end. stripslashes() is only required if your server has the magic quotes option on. htmlspecialchars() should not be used here - it should be used just before outputting data in an HTML page. mysql_real_escape_string() should be used, as the final step before the data goes into a MySQL query. If you already have existing passwords in your database that use that processing then you may have trouble changing it, as the passwords may not match afterwards. That's something to consider.
  14. Are you displaying it on text or some kind of markup like HTML, or some other method?
  15. Yep, fgroup will be fine. Congratulations on getting it working I still have no idea why the original code didn't work.. I agree with your php friends, the original code you posted should have worked.
  16. Do you have much experience with php and MySQL? What's the most complicated task you've done with them? The reason I ask is that what you are asking is a very general question, and I don't want to give an unhelpful answer.
  17. The first mysql query is causing an error - you'll need to print out mysql_error() to see why it's failing. For example: $result = mysql_query("SELECT password FROM members WHERE username='$username' and password = '".md5($password)."'") or die("Query failed: " . mysql_error()); Even better is if you can put the query into a variable first, and print out the query itself when displaying the error.
  18. Just looking at ischild() for now - a child C is a child of node N iff: 1. C is a the left child or right of N (you have implemented this already), or 2. C is a child (recursively) of the left child or the right child of N (you have the calls here, but don't handle the return value) So your recursive calls to ischild() need to handle the return value to implement that second rule. There's a number of ways to do it. The simplest is probably like this: elseif (!empty($array['lchild'])) { $ischild = ischild($array['lchild'],$child); if ($ischild == "Yes") return "Yes"; } And make the same change to the right child check. That will make it so the return value of the recursive calls, which was being ignored before, are passed back to the caller of the initial call to ischild().
  19. Yay, you have now fixed the first error Previously the error was that $db was not available inside contents(). But now $db is available, and you are getting a new error from a query going through $db. "group" appears in list.php as an argument to contents(). The problem is that "group" is a reserved word for MySQL. If you really are using "group" as a table name, you will need to put it in backticks I believe. So your query should be: $db->query("SELECT * FROM `$table`"); I'm not a regular MySQL user so I could be wrong there. If that doesn't work, try this: $db->query("SELECT * FROM \"$table\"");
  20. What happens to the return value of the recursive calls? And is the final result "yes" if either of the recursive calls returns "yes"?
  21. Ok, can you please make the following changes function tablestart($a = '1') { global $db; to function tablestart($db, $a = '1') { And also change every call to tablestart() as follows: tablestart() replace with tablestart($db) tablestart('0') replace with tablestart($db, '0') I don't know what you did when I asked you to make $db an argument to those functions, but this is what I was wanting you to do. It's got nothing to do the db config file or where $db is set to a new class instance.
  22. Assuming you have a user id column in wp_usermeta to identify the user: $custom = 'SELECT * FROM wp_usermeta WHERE meta_key = "wp_1_s2member_custom_fields" AND user_id IN (SELECT user_id FROM wp_usermeta WHERE meta_value LIKE "%s2member_level%")'; $c_results = mysql_query($custom); The idea is for MySQL to check which users are subscribers and make a list of their user ids, and then restrict the custom_fields query by that list of user ids.
  23. CK9, can you please post the full code. Snippets are not useful, because the important thing here is the order in which code is executed. Can you please post the full code of any file modified since you originally posted, along with the errors that code currently gives. The db config file looks innocent enough.
  24. Can you please post the code that gave you that error. Also please post the third file, the one you haven't posted yet. You can edit the username and password first, but please leave everything else identical.
  25. Well, that is strange. What happens if you pass $db as an argument to the function instead of using it as a global?
×
×
  • 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.