-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
[SOLVED] update the selected existing records of database
Adam replied to nehrav's topic in PHP Coding Help
Perhaps this will help... foreach ($_GET['ids'] as $key => $id) { echo $_GET['new_locations'][$key]; } Remember though you need to send the "new_location" as an array. To match the example above: <input type='text' name='new_locations[]' value='$location' size='45' maxlength='50'> -
You say "compare", but the in_array function is used to check if a string exists within an array. Can you be a little more specific with what you're trying to do?
-
[SOLVED] update the selected existing records of database
Adam replied to nehrav's topic in PHP Coding Help
By the way you'll want to look into the foreach $key / $k value in order select the same index from the other input arrays. -
[SOLVED] update the selected existing records of database
Adam replied to nehrav's topic in PHP Coding Help
That's because you have the same problem with the other inputs, the last value selected is over-writing the input value. You need to send all the other inputs as arrays too... -
[SOLVED] update the selected existing records of database
Adam replied to nehrav's topic in PHP Coding Help
It's not $_GET['ids[]'], it's just $_GET['ids']. Have you given thought to the other inputs though? Yes that's because the value of $_GET['id'] was the last record to be selected, as each time you looped through a result you were over-writing the input. -
I really can't see this being a quicker solution. The time in which it would take to load up the page, enter the data, copy and paste the results and then indent it all to the right point; surely it's quicker to just to type it yourself? Not to mention however much time you've spent making this thing. Never the less, as sKunKbad said the form isn't very intuitive. Although obviously sometimes it may be the case, as a rule I don't aim to have my field names exactly as my PHP variable names. There's no SELECT code? Probably the most commonly used type of query. Being as there's not really a great deal of functionality I can't really think of much else to say - without of course getting all nitty gritty about securing variables, using proper error handling, etc. Sorry. May be useful to you but I really can't see the point in it...
-
Sorry fella, that don't make sense!
-
I'm guessing he wants the source, probably not all that unlikely to get it either seen as he's willing to pay... Unfortunately I don't know any though!
-
[SOLVED] update the selected existing records of database
Adam replied to nehrav's topic in PHP Coding Help
My guess is that you're not providing the correct data, probably at the input stage. For example: <input type='hidden' name='id' value='$id'> With each iteration of the loop you'll just be over-writing the value of "id"; therefore only passing a single string to the 'update page' instead of an array ( $idarray=$_GET['id'] ). Try a var_dump on $idarray and see what you get. A possible solution is to pass the data as an array like this: <input type='hidden' name='ids[]' value='$id'> Obviously you have several inputs though so you may need to play around a bit. Perhaps use a fixed index instead to prevent getting any miss-matched/aligned data. -
[SOLVED] remove [square brackets and contents] from string
Adam replied to andyd34's topic in Regex Help
Darn it! #\[.*?\]# -
Can't speculate as to how they got it in there, but if you decode all that there's a script tag trying to include "http://mobydickrock.ru/hope/yandex_66a7973f6eaf9ba9.php". My Russian isn't exactly fluent but from visiting mobydickrock.ru just looks like some kind of normal rock music website.. Can't see them wanting to/intentionally doing this to you. Perhaps run your site through some security tools and seeing if they pick up on any vulnerabilities so you could prevent this from happening again.
-
[SOLVED] update the selected existing records of database
Adam replied to nehrav's topic in PHP Coding Help
...And how can we help you based on that? -
Perhaps easiest to use reg exp: <?php $word = 'James Bond'; preg_match('/[a-z]+ [a-z]{1}/i', $word, $match); print $match[0]; ?> Of course, this will only work with strictly a-z characters.
-
How do we implement a search function into our website?
Adam replied to resting's topic in PHP Coding Help
How about.. http://www.phpfreaks.com/tutorial/simple-sql-search -
It's possible not including the 'from' header made it look suspicious, and so was filtered out before it even reached his inbox. Can't say for sure of course, have to see what happens now!
-
Should be: $headers = "From:" .$email."\r\n"; $headers .= "CC: $tf\r\n"; $message = "thank you!"; $message .= "Name: " . $thename; Notice ".=" instead of just "=", this basically means to append to the end of the string rather than over write.
-
LOUUUUUUUD NOISESSS!
-
... and what about the other questions?
-
[SOLVED] remove [square brackets and contents] from string
Adam replied to andyd34's topic in Regex Help
Or even.. #\[.*\]# -
If you have bash, you could use "sed" .. This might be of use: http://www.cyberciti.biz/faq/unix-linux-replace-string-words-in-many-files/
-
Unread since last visit...How can I limit to ONE forum?
Adam replied to mrherman's topic in PHPFreaks.com Website Feedback
You can view unread posts from the "PHP Coding" category by clicking the 'unread posts' link on the right of the title, but not sure about individual boards. -
Orr... advertise?
-
when to use ob_start() and ob_flush example only.
Adam replied to redarrow's topic in PHP Coding Help
What does it change the numbers too? What result does it give? You have a syntax error on the last two echo statements, a pound sign not wrapped in quotes. Is English your primary language? -
Editors and Dev Tools...
Adam replied to jeff_valken's topic in Editor Help (PhpStorm, VS Code, etc)
I don't think there's any need to go spending money to be honest! Eclipse I've started using recently for a few smaller things and found it pretty good - though I don't think it would run perfect on a slower machine. Notepad++ is a popular one as well, but a bit feature lacking I find. There's literally tonnes out there, perhaps best just trying a few and going with the one you like the most. I don't know what kind of setup they/you have, but if they have SSH access to the server I would definitely use bash for all or most of your activities (including uploading files to the server, modifying, moving, searching, changing permissions, committing to a repository, etc. etc. etc. etc.) - you can do everything that way all from within one terminal if you so wish (but it's easier to have several open). It's a steep learning curve but definitely worth it! -
Aha! I know that was sarcastic but.. have you seen the post about the cats ?!