Jump to content


  • Posts

  • Joined

  • Last visited


Everything posted by phporcaffeine

  1. Script sends out text/plain email using php's mail() construct .... all working fine. However, I had a user use Novell GroupWise to receive an email and it chops the formatting up pretty hard. Specifically, any \r\n characters are translated into =09=0D=0A and carriage returns are replaced with =5F=5F Right now, I am setting UTF-8 in the mail header, anyone know of a better, more universally accepted charset?
  2. A registy class in PHP is a design pattern. http://develturk.com/2009/04/18/php5-object-registry-implementation-a-registry-design-pattern/ All about PHP sessions: http://php.net/manual/en/features.sessions.php
  3. Wrong forum but, window.open(), alert() .... ?
  4. All HTML option tags, like most other HTML tags, must be closed (i.e <option value=''></option>)
  5. Well, your code says that if mysql_affected_rows() != (does not equal) 1, then it will use the header url of the one you specified. So that indicates mysql_affected_rows() is not equaling 1, when you think it should be. Ask yourself why that is? TIP: mysql_query($sql) or die(mysql_error());
  6. Not the right forum however, you'll need a combination of mod_rewrite and mod_alias http://httpd.apache.org/docs/current/mod/mod_rewrite.html http://httpd.apache.org/docs/2.0/mod/mod_alias.html
  7. Although I will tell you that reading any sort of manual in 5 seconds is utterly preposterous and that I think your statement about no one ever having tried this before is rude and absurd (considering the heavyweight attention your post has got from some seriously sick LAMP (that's, Linux, Apache, MySQL and PHP) pros); I'll give you the answer (to your specific question, not that it is the best way to do it) just to satisfy myself. $sql2="SELECT attrb2 fromt table2 where attrb3=".$sql[attrb1]; You had a period, at the end, right before the semi-colon. I knew that because I have tried this before, thousands of times perhaps.
  8. Firstly, $sql2="SELECT attrb2 fromt table2 where attrb3=" . $sql['attrb1']; Here is the part of the manual that deals with quoting: http://php.net/manual/en/language.types.string.php
  9. Sure, that works too. I always try to stick to the OP's logic as much as possible - unless it's a blatant syntax violation or they have specifically asked for alternatives. Your suggestion implements the solution in more of a PHP way of doing things while the double loop scenario is more of a language agnostic way of doing things. Admittedly, this is a PHP forum, so one should expect answers to be language biased. Either way, both solutions would work just fine.
  10. It is not possible to extend multiple classes; a class can only inherit from one base class. So in your illustration, you're trying to get the root class to extend the properties of both a and b? You could do it this way: Base Class | Class A | Class B | Root Class Perhaps you could use some conditional logic to determine which class (a or b) to load? If the methods are similar, could you combine them or use logic to change the behaviors of the methods and eliminate the need for one of the classes altogether.
  11. I would have expected you to replicate the database that your trying to connect to into another database and put me in that one; I wouldn't let anyone in my LIVE database either.
  12. Admittedly, not sure why you would want to ... but here you go: <?php for ($row = 10; $row > 0; $row--) { for ($cnt = 0; $cnt < $row; $cnt++) { $star .= "*"; } echo $star . "<br />"; $star = NULL; } ?> Now, if you want the stars to go the other direction (1-10 instead of 10-1), just flip the direction in which the variables are evaluated.
  13. I appreciate that. Everything that I have is in this thread, the code, and screen shots of the db. If you're asking for credentials to log in to the db, that, I cannot do. Look, I understand about security ... etc - personally I don't care about what is in your database. Regardless, 'everything' that you have, that is posted here, obviously isn't working - so, you try something different. Maybe there is something that you think is irrelevant but is actually the reason it isn't working .... that's what I am getting at. The definition of insanity is doing the same thing, over and over, expecting different results each time. Hope it works out for you.
  14. Purely because I am curious why this wouldn't be working; if you want to PM me some credentials, I have some time to take a look personally.
  15. While I do agree that you need to filter your request down a lot, I'll give you a little shove in the right direction. Start with the area that is echoing out TBA instead of what you think it should be. Why is that variable set to TBA instead of what it should be? Where is that variable set at? Most (if not all) diagnosticians think this way; reverse engineering. Start with the end (albeit undesired) result and work your way all the back to the beginning if needed. Its like doing a maze in reverse. Start with the answer and use it to figure out what the question is.
  16. Is the database you are connecting to ( with mysql_select_db() ) the correct database? Do you perhaps have a 'test' database that you're connecting to and not realizing?
  17. You can attack that challenge from a number of ways; you could use client logic and organize the data with html, css and javascript, you could run a join query (depending on your table structure) and return everything in an associative array ... etc ... the list goes on. Generally, on this forum, you'll find a ready supply of folks (like myself and ManiacDan), highly skilled in LAMP technologies and web development; that are ready to donate their time and troubleshoot/diagnose problematic code or misinformed developers (the latter seeming to be the more common encounter). However, posts that seem to solicit someone designing a solution for you, will usually get little to no attention. So, try a come up with a solution on your own; when/if it doesn't work or you can't figure out the code that you have written, post it here and we'll be more than happy to help. The goal is to teach and learn; you don't learn by having it done for you.
  18. We need to see more of the code; is the value of $_POST['password'] what you expect it to be?
  19. I would use yahoo babblefish to translate your native language to English, before posting. The quick answer is no, PHP won't 'stream' MP3's, because PHP would have to have access to the user's sound hardware - that violates that nature of the client/server environment that PHP operates in. You can do things like that with Flash or Java however. Now, if you just simply want to make a textual playlist in XML, start here: http://php.net/manual/en/book.xml.php
  20. 1.) Make sure that the database field is large enough to hold the serialized array. Serialized data is very space-inefficient in PHP, and many DBs (like MySQL) will silently truncate field values that are too long. 2.) Make sure that you are not serializing a resource id / object (because they can't be serialized) 3.) When saving serialized data, don't try and do anything to it other than escaping ( mysql_real_escape_string() )
  21. Yeah, I had hoped to get OP through some of the logic of the loop, before addressing the include in the loop. It wouldn't work anyway, unless include_once was used .... regardless, not needed either way. I figured, once I got OP to figure out how to fix the loop then he/she would 'discover' that including the same class, over and over, in a loop wouldn't work, once it started throwing errors.
  22. http://www.phpfreaks.com/forums/index.php?topic=347969.msg1642112#msg1642112
  23. According to your snippet; In order to see "No results found", $expiration_date has to be LESS THAN $today - because anything else would fire the logic in the construct. So, is $expiration_date GREATER THAN $today? Are you sure you know what the values are that you are comparing? Have you dumped the variables to see what they are? Do you see "No results found" on every iteration of the loop (because the condition is evaluated with each iteration)? Also, it seems that you are only incrementing the loop limiter ($i) inside the construct, when $expiration_date is GREATER THAN $today, so when $expiration_date is not GREATER THAN $today, the loop limiter is not incremented. That could cause an endless loop, if $i never gets incremented to be GREATER THAN $num_results (which is what will stop the loop).
  24. Here is how the most basic of basic login scripts would look, using sessions: We'll call this index.html: <html> <head><title>Test</title></head> <body> <form name="loginFrm" id="loginFrm" action="login.php" method="post"> Enter the secret code: <input type='password' name='code' id='code'> <input type='submit' name='send' id='send' value='Login'> </form> </body> </html> We'll call this login.php: <?php session_start(); //GOOD HABIT SAYS ALWAYS PUT THIS AT THE TOP, BEFORE ANYTHING ELSE if (isset($_POST['password'])) { if ( strtolower( trim( stripslashes($_POST['password']) ) ) === 'test') { $_SESSION['login'] = 'John Doe User'; } else { die(session_destroy()); } } if (isset($_SESSION['login'])) { print_r($_SESSION['login']); } ?> If you type in 'test' (no quotes) as the secret code, you'll see 'John Doe User' from login.php, anything else and you won't see anything. *NOTE* The above html page and php script is a DEMO, to help you understand the basics. It is not suited to use in an actual production system, but will suffice for getting your head around the basics. To answer your other question: index.php?action=home As far as PHP is concerned; the above is part of a url, everything to the right of '?' are key/value pairs in the GET namespace. So, if the page 'index.php' were reached with this URL, the array element $_GET['action'] would hold the value 'home'.
  25. Here is the issue: while($Row = mysql_fetch_array($Result,MYSQL_ASSOC)){ /////This is the start of the part that does not seem to work properly. $MemberId = $row["MemberId"]; Your result set is assigned to $Row, and your trying to echo out the elements of $row (notice the casing of the letter R).
  • 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.