Jump to content

TransmogriBenno

Members
  • Posts

    61
  • Joined

  • Last visited

    Never

Everything posted by TransmogriBenno

  1. You can do that with my solution with a JOIN. If you really want to store the two columns in the same table, then vikramjeet.singla already gave you the answer, eh?
  2. Do you know what part of the code is the problem? Have you checked that the result from file() is what you want, and that $parts_array[$i] = explode($delimiter,$data_array[$i]); is doing what you expect it to?
  3. You just remove the else wrapper: <?php // If the form has been submitted... if(isset($_POST['submit'])) { // Set $name as the value of the name field in your form ($_POST just references the form) $name = $_POST['name']; } // Display the form echo '<form name="form" method="post"> <input type="text" name="name" size="27" value=$name" /> <input type="submit" name="submit" value="Go"> </form>'; ?>
  4. Please use code tags when inserting code. Something like the following modifications should do the trick: <?php $doc = new DOMDocument(); $doc->load( 'books.xml' ); /* MOD */ $book_num = 1; /* MOD */ $start = 11; /* MOD */ $end = 20; $books = $doc->getElementsByTagName( "book" ); foreach( $books as $book ) { $authors = $book->getElementsByTagName( "author" ); $author = $authors->item(0)->nodeValue; $publishers = $book->getElementsByTagName( "publisher" ); $publisher = $publishers->item(0)->nodeValue; $titles = $book->getElementsByTagName( "title" ); $title = $titles->item(0)->nodeValue; /* MOD */ if ($book_num >= $start) echo "$title - $author - $publisher\n"; /* MOD */ if (++$book_num > $end) break; } ?>
  5. Why do you want to do that? I think a better solution would be to store the short (e.g. NY) and long (e.g. New York) names in, say, a 'States' table the database, and then reference them using a key. You could use the short name as the key.
  6. I'm pretty sure that the name of the field that stores the ID value is not '1'. Check again.
  7. Move this if(isset($_GET['id'])) { $query = "DELETE FROM ae_gallery WHERE id=".$_GET['id']." LIMIT 1"; mysql_query($query) or die("Could not delete the entry!"); } before the SELECT query is executed, for obvious reasons.
  8. Interesting, although I'd have to see your methods to be convinced that your conclusion is correct. Have you tried changing the buffering settings?
  9. Using cURL gives you a fair chunk of info: http://au.php.net/manual/en/function.curl-getinfo.php
  10. I think that's a really bad idea, especially with no reason given. Nevertheless, you can parse PHP source using the PHP tokenizer: http://www.php.net/manual/en/book.tokenizer.php Good luck...
  11. I'm guessing it has something to do with: $mail->WordWarp This is invalid syntax, and (not being familiar with the class), I'm not sure of the point of it. Is is meant to be WordWrap? I'm assuming that's a function. So perhaps: $mail->WordWrap ();
  12. I would suggest instead of doing a loop through all the days to work out how many sundays have passed, you just get the number of weeks passed by dividing the number of days passed by 7 (round down), and then since you know what day of the week the starting day was, you can work out if another sunday has passed during the remainder of days. Presumably this would be faster, as you essentially only have 2 calculations per row. There's obviously a significant amount of code missing, and judging by the foreign language (French?) comments, I'm assuming you've changed variable names to make the script readable (I guess $jourSemaine1 should be $dayweek, otherwise the code doesn't make a lot of sense). I get the feeling that you're counting the number of days in each week that has transpired in $nbrdays, though I'm not sure why. You initialise it with 52 values, all zero, so I'm assuming later in the code you're expecting it to have only 52 elements, which is not the case if the total number of weeks you cycle through is > 52.
  13. TinyMCE lets you do that (at least, on the client side, as it is JavaScript). If you want hardcore validation on the server side, you'd have to do some pretty awful regex work, or load the whole thing into a DOMDocument and pick off the tags you don't allow.
  14. What I'm saying is that it's good practice, otherwise you can end up in a situation like this: <?php if (!$logged_in) { header ('Location: login.php'); } ?> Hello, logged in user. Here's the secret/private stuff you are accessing. In this case, the secret/private stuff is sent to the client along with the location header, which means that anyone using a net debugger or special browser will see it, before their client sends the request for login.php. Or another case, like this: if ($condition_a) { header ('Location: a.php'); } if ($condition_b) { header ('Location: b.php'); } Suppose $condition_a and $condition_b are true, this won't do at all what you might expect by looking at the code.
  15. Don't forget, there are many other characters that are allowed before the @. ' is a common source of error, and surely frustrates all of the Irish folk out there. Likewise, there are top level domain names that contain more than 4 characters, e.g. .museum -- http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
  16. That code assumes that you're after a string, 'html', which isn't the case, or you wouldn't be using strip_tags. Your best bet is probably a regular expression hack, like this: $strCart = preg_replace ('/<[^>]*>/', ':', $strCart); You might need to escape the < and > in the regex, I can't remember.
  17. 1. You should check that the file has actually been uploaded first before you try to move it, e.g. is_uploaded_file. 2. The above is failing because you are sending through a plain text form with no files attached, try: <form enctype="multipart/form-data" ...> 3. You need to be sure that the user that the script runs as (quite often 'nobody', depending on the server's configuration) has permissions for the directory you're trying to store the file in.
  18. HTML e-mail is best created and sent with the Mail_Mime PEAR package: http://pear.php.net/package/Mail_Mime
  19. For sure, or update the existing record straight away: http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html
  20. Sorry if I wasn't clear, that's what I meant by:
  21. If you don't answer questions like this, it's unlikely that you'll get help.
  22. If you want further help, you'll need to specify what you mean by "still isn't working" - how much debugging have you done?
  23. The script should exit as soon as you set the Location header, and you need to use session_start before you attempt to get or set any session variables.
  24. If the image won't open as the type that its extension suggests, you could try loading it using the functions for the other types, just in case the extension is wrong. You should probably do some kind of sanity check to see that the URL isn't a 404, unless you're 100% certain it's there.
  25. Not related to the issue, but, for performance reasons, you should store the friends list in the database too. On the same note, you should use something other than Access to look after your database.
×
×
  • 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.