By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,216 Members | 1,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,216 IT Pros & Developers. It's quick & easy.

help for array

100+
P: 232
my code is not working is there any error??????????? i want whenever pid repeats it will escape that record help......................
Expand|Select|Wrap|Line Numbers
  1. while($row = mssql_fetch_array($result))
  2. {
  3. $pidarray=array();
  4. $pidarray[j]=$row["pid"];
  5. echo $pidarray[j];
  6.  
  7. $ctr=0;
  8. $p=$j;
  9. while($p!=0)
  10. {
  11.  
  12.  
  13.  if($row["pid"]==$pidarray[p])
  14. {
  15. $ctr=1;
  16. break;
  17. $p--;
  18. if($ctr==1)
  19. continue;
Oct 22 '08 #1
Share this Question
Share on Google+
3 Replies


Markus
Expert 5K+
P: 6,050
You have previously been warned by a moderator to read the posting guidelines. As you have not used [code] tags you are receiving an official warning. Read the posting guidelines before you post again so you don't receive any more warnings.

Markus.
Oct 22 '08 #2

chelvan
P: 90
my code is not working is there any error??????????? i want whenever pid repeats it will escape that record help......................
Expand|Select|Wrap|Line Numbers
  1. while($row = mssql_fetch_array($result))
  2. {
  3. $pidarray=array();
  4. $pidarray[j]=$row["pid"];
  5. echo $pidarray[j];
  6.  
  7. $ctr=0;
  8. $p=$j;
  9. while($p!=0)
  10. {
  11.  
  12.  
  13.  if($row["pid"]==$pidarray[p])
  14. {
  15. $ctr=1;
  16. break;
  17. $p--;
  18. if($ctr==1)
  19. continue;

hi
can you explain more.

here i found the following,
1> missed $ sign @ $pidarray[$j]
2>your counter $j does not increase.
3> missed $ sign @ ........if($row["pid"]==$pidarray[$p])


change the above. & try it

regards
chel-1
Oct 23 '08 #3

nathj
Expert 100+
P: 938
hi
can you explain more.

here i found the following,
1> missed $ sign @ $pidarray[$j]
2>your counter $j does not increase.
3> missed $ sign @ ........if($row["pid"]==$pidarray[$p])


change the above. & try it

regards
chel-1
This is the second thread I've read from you with basically the same problems.

It would be beneficial for you (and others) if you simply turned on error messages then you would see what was wrong.
Error Messages

Eventually you start to recognise what the error messages mean and be able to track them down and fix them.

The forum is here to help but you do have to help yourself!

Cheers
nathj
Oct 23 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.