liquidmind Posted April 3, 2008 Share Posted April 3, 2008 Here is a quick graphic display of what I want code to do. Right now what the code is doing is giving me the correct preg_matches results for the last item in the list only. If I have one item in the list it will give me the results for that one item. If the list is two items then it will give me the correct results for item 2 while showing null results (0) for 1. If the list is three items, it will give me the results for item 3 while showing null results for 1 and 2...etc. Null results = 0 as directed by $count_matches=0; in code. Please ignore the following lines: ("xxxx" is just in place of actual code I don't want to display). $link="xxxx" preg_match "xxxx" <? if (!isset($_POST['itemlist'])) { ?> <form name="form" method="post"> <textarea rows=5 cols=20 name="itemlist" value="<?=$_POST['itemlist']?>" </textarea> <input type="submit" name="formsubmit" value="Submit!" class="button_style"><br /> </form> <? } else { $itemlist = explode("\n",$_POST['itemlist']); $count = 0; foreach ($itemlist AS $item) { $ab=curl_init(); $link="xxxx" curl_setopt($ab,CURLOPT_URL,$link); curl_setopt($ab, CURLOPT_HEADER, 0); ob_start(); curl_exec($ab); curl_close($ab); $item_results=ob_get_contents(); ob_end_clean(); preg_match "xxxx" $count_matches=$match[1]; if($count_matches=="") $count_matches=0; echo "<br/>".$item." ".$count_matches.""; $count++; } } ?> Quote Link to comment Share on other sites More sharing options...
liquidmind Posted April 3, 2008 Author Share Posted April 3, 2008 ..mistakenly reposted within thread. Quote Link to comment Share on other sites More sharing options...
stuffradio Posted April 3, 2008 Share Posted April 3, 2008 Here is a quick graphic display of what I want code to do. Right now what the code is doing is giving me the correct preg_matches results for the last item in the list only. If I have one item in the list it will give me the results for that one item. If the list is two items then it will give me the correct results for item 2 while showing null results (0) for 1. If the list is three items, it will give me the results for item 3 while showing null results for 1 and 2...etc. Null results = 0 as directed by $count_matches=0; in code. Please ignore the following lines: ("xxxx" is just in place of actual code I don't want to display). $link="xxxx" preg_match "xxxx" <? if (!isset($_POST['itemlist'])) { ?> <form name="form" method="post"> <textarea rows=5 cols=20 name="itemlist" value="<?=$_POST['itemlist']?>" </textarea> <input type="submit" name="formsubmit" value="Submit!" class="button_style"><br /> </form> <? } else { $itemlist = explode("\n",$_POST['itemlist']); $count = 0; foreach ($itemlist AS $item) { $ab=curl_init(); $link="xxxx" curl_setopt($ab,CURLOPT_URL,$link); curl_setopt($ab, CURLOPT_HEADER, 0); ob_start(); curl_exec($ab); curl_close($ab); $item_results=ob_get_contents(); ob_end_clean(); preg_match "xxxx" $count_matches=$match[1]; if($count_matches=="") $count_matches=0; echo "<br/>".$item." ".$count_matches.""; $count++; } } ?> I'm not going to look through all your code, fix it and if it still doesn't work come back. I see several spots that are missing semi-colons. preg_match "xxxx" That's not even correct. $link="xxxx" Not correct Replace with $link="xxxx"; <textarea rows=5 cols=20 name="itemlist" value="<?=$_POST['itemlist']?>" </textarea> Not correct. Replace: <textarea rows=5 cols=20 name="itemlist" value="<?=$_POST['itemlist'];?>" </textarea> etc. etc. Go through your code! Quote Link to comment Share on other sites More sharing options...
liquidmind Posted April 4, 2008 Author Share Posted April 4, 2008 My op asks to ignore preg_match "xxxx" and $link="xxxx". I added ; to the other but no difference. The problem is with the looping. Quote Link to comment Share on other sites More sharing options...
liquidmind Posted April 5, 2008 Author Share Posted April 5, 2008 ....looking for someone to read my op completely before responding Quote Link to comment Share on other sites More sharing options...
liquidmind Posted April 7, 2008 Author Share Posted April 7, 2008 ....still looking for someone to read my op completely before responding Quote Link to comment Share on other sites More sharing options...
liquidmind Posted April 8, 2008 Author Share Posted April 8, 2008 ....can I pay for help in this forum or would I have to post this in freelancing ? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 8, 2008 Share Posted April 8, 2008 You would have to post in the freelancing area if you want to pay someone to do your work. Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.