-
Posts
28 -
Joined
-
Last visited
Never
Posts posted by love_bug
-
-
Hi, yea similar to : http://stackoverflow.com/questions/842956/php-foreach-loop-through-multidimensional-array
but the solution he provided doesn't apply to my problem i guess.., only thing I want to do is get array of "m_name[] and m_name[]" and insert them in db with loop.
Array ( [0] => someone [1] => Array ( [email] => someone@gmail.com ) [2] => sometwo [3] => Array ( [email] => sometwo@gmail.com ) [4] => somethree [5] => Array ( [email] => somethree@gmail.com ) )
-
hi thanks for reply.. yea i thought about that too, but i want to put those values together in db..
while (each $val1, $val2) { $sql = "INSERT INTO table name (name,email)($val1,$val2); }
It will be great if i could combine 2 array like below so i can put them in sql db with while loop.. just tell me it cant be done in php lol .. thankx
Array ( [0] => $val1, $val2 [1] => $val1, $val2 [2] => $val1, $val2 )
-
Hi again ,
I am stuck with simplest problem of array .. i searched all forums and couldn't find similar problem..
Iam collecting array post data "data m_name[]" from a form, but I don't know how to get 2 array variables at the same time, here's what I tried :
<form action="" method="post" name="myForm"> <div> <input type="text" name="m_name[]" /> <input type="text" name="m_name[][email]" /> </div> <div> <input type="text" name="m_name[]" /> <input type="text" name="m_name[][email]" /> </div> <div> <input type="text" name="m_name[]" /> <input type="text" name="m_name[][email]" /> </div> <input type="submit" name="button" id="button" value="Submit" /> </form>
other page where I want to receive above array
<?php if($_POST) { print_r($_POST['m_name']); // Output is : Array ( [0] => someone [1] => Array ( [email] => 3 ) [2] => someone two [3] => Array ( [email] => 4 ) [4] => someone three [5] => Array ( [email] => 5 ) ) while (list ($key,$val) = @each ( $_POST['m_name'])) { echo $val.val2 ???"<br/>"; // here I want to get both value $_POST['m_name'] and $_POST['m_name'] ['email'] since I am putting them in db << } } ?>
-
i meant .. removing the Slash ( / ) at the end.. if you are receiving "No such file or directory" error.. that only comes up when path is wrong. I faced same problem while ago, removing slash at the end worked great for me
-
wow.. a single mistake lol.. thankx for reply, I am using ez_mysql_warper.. i didn't pay attention to that part "$db->get_row"..
just changed it to "$db->get_results(" and worked like charm.. thanks for help.. "==" part isn't that important cos i probably double typed that when I posted. thankx again.
-
try modifying folder path to "./images/$gender"; ?
-
If you are storing treasure, wealth, gold information with your project you should worry, but for average website like phpfreaks md5 is more than enough i guess.
-
he he he he
-
Hi guys, I am creating a quiz system for my personal site, I am done with all the quiz questions creating part, but I am stuck with something like... user taking a random sql generated quiz and submitting it..
Here's randomly generated sql quiz, even the answers are in random order:
<form method="post"> <b>1. What is color or sky</b> <ol> <li><input name="question_3_answer" type="radio" value="6" /> sky</li> <li><input name="question_3_answer" type="radio" value="8" />blue</li> <-- true <li><input name="question_3_answer" type="radio" value="3" />red</li> </ol> <b>2. What is name of my cat</b> <ol> <li><input name="question_6_answer" type="radio" value="9" />brat</li> <--true <li><input name="question_6_answer" type="radio" value="7" />rat</li> </ol> <b>3. What is name of my pet</b> <ol> <li><input name="question_18_answer" type="radio" value="9" />cat</li> <--true <li><input name="question_18_answer" type="radio" value="7" />dog</li> </ol> </form>
Now this is tricky part for me is.. receiving these data in another page.. since it's randomly generated questions, how do I know which question it is?
here's example I've tried :
$list_all_quiz_questions = $db->get_row("SELECT question_id, its_true_ans_id FROM question_table WHERE quiz_group = 'ef23fsdfers3e' "); $i = 1; foreach ($list_all_quiz_questions as $myquestion) { $answer.$i == $_POST["question_".$myquestion->question_id."_answer"]; //?????????? not working lol ;(( $i++ }
-
thanks 4 help..
-
Hi,
This is an unusual problem I have..
I have a field named "recipient_userids" where I store ids of users in a comma separated form,
sucha as "3323,5543,53,3235,23"
Now I want to select records from db, which matches a particular userid in "recipient_userids".
such as.. If I want to retrieve a record that has 53 in "recipient_userids" how do I do it?
I tried LIKE, IN syntax, but not doing the job.
OR is there a way to do it please share.
-
No such errors for now.. I'll let you know about it.. thanks darkwater..
-
Wait!!... it worked.. thanks BlueSkyIS.. I can not believe it.. I copied your code and uploaded it into my web server and it worked... (it is still showing error in my computer.. like i least care).. what the hell..!!
Thank you so much for your help.. no doubt.. the best php support forum in the world!!
-
in my web server, host has turned off error reporting.. all i could see is a blank screen.
but in local host i am still getting this :
Parse error: syntax error, unexpected $end in D:\Web_Projects\link_suggest.php on line 1085
-
your code is kinda sloppy
thanks.. that's because i am somewhat self-taught on this area!! anyways please do comeback and have a look at this file.. :'(
-
humm.. well it's good for you that you are on mac! they don't have anything for windows.!!! :-\
-
I am using dreamweaver.. is there any features like that in it?
-
thank you guys, i am looking really hard to find that error... ,
it worked fine.. just before I added few codes in it!! Now it's not working..it's really strange!!! uploading file in binary mode could do this? I uploaded on the server and re-downloaded it.. after that it's not working.. I am testing it in localhost and in my web server.
-
didn't do a thing!! removed all @s and included files too!! :'(
-
Yes sir, I looked at it and couldn't find the error....it doesn't say where is the error... it is really getting into my nerves!
-
Hi i have a file attached in this post. I am fedup with this error "Parse error: syntax error, unexpected $end"
I spent hours figuring out the error.. no luck!! so can anyone just look at the file and tell me where the error is?
thanks..
[attachment deleted by admin]
-
the goal is to keep first <img tag and remove all other <img tags..... ???
-
Thanks.. wish i could write the code..
the code seem to be working.. but it can not find image tags with different values..
can you show me how can i use it with perg_replace?
<?php $URLSearchString = "a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'"; $str = preg_replace("(\<img src=([$URLSearchString]*)\](.+?)\</a>)", '$2', $str ); ?>
-
Hi thanks for the solution but...
I want to find all image tags in the string, keep the first image (img tag) and remove all others. basically to show just one image..if string contains 2 or more images..
Array values to insert in db
in PHP Coding Help
Posted
Ahh.. thank everyone for the help, especially sasa, his solution works like charm.. thankx