
TransmogriBenno
Members-
Posts
61 -
Joined
-
Last visited
Never
Contact Methods
-
AIM
TransmogriBenno
- MSN
Profile Information
-
Gender
Not Telling
TransmogriBenno's Achievements

Newbie (1/5)
0
Reputation
-
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?
-
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?
-
[SOLVED] define value based on form input
TransmogriBenno replied to wkilc's topic in PHP Coding Help
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>'; ?> -
[SOLVED] xml in php how to display range of records????
TransmogriBenno replied to webster's topic in PHP Coding Help
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; } ?> -
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.
-
I'm pretty sure that the name of the field that stores the ID value is not '1'. Check again.
-
[SOLVED] having to double click delete ?
TransmogriBenno replied to sandbudd's topic in PHP Coding Help
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. -
Interesting, although I'd have to see your methods to be convinced that your conclusion is correct. Have you tried changing the buffering settings?
-
Stuff I can return about a distant URl
TransmogriBenno replied to cooldude832's topic in PHP Coding Help
Using cURL gives you a fair chunk of info: http://au.php.net/manual/en/function.curl-getinfo.php -
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...
-
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 ();
-
calculate difference between 2 days without holidays
TransmogriBenno replied to prince198's topic in PHP Coding Help
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. -
Really simple WYSIWYG text editor. Multiple files in one?
TransmogriBenno replied to tibberous's topic in Miscellaneous
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. -
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.
-
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