help for array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kkshansid
    New Member
    • Oct 2008
    • 232

    help for array

    my code is not working is there any error?????????? ? i want whenever pid repeats it will escape that record help........... ...........
    Code:
    while($row = mssql_fetch_array($result))
    {
    $pidarray=array();
    $pidarray[j]=$row["pid"];
    echo $pidarray[j];
    
    $ctr=0;
    $p=$j;
    while($p!=0)
    {
    
    
     if($row["pid"]==$pidarray[p])
    {
    $ctr=1;
    break;
    } 
    $p--;
    } 
    if($ctr==1)
    continue;
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    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.

    Comment

    • chelvan
      New Member
      • Aug 2008
      • 90

      #3
      Originally posted by kkshansid
      my code is not working is there any error?????????? ? i want whenever pid repeats it will escape that record help........... ...........
      Code:
      while($row = mssql_fetch_array($result))
      {
      $pidarray=array();
      $pidarray[j]=$row["pid"];
      echo $pidarray[j];
      
      $ctr=0;
      $p=$j;
      while($p!=0)
      {
      
      
       if($row["pid"]==$pidarray[p])
      {
      $ctr=1;
      break;
      } 
      $p--;
      } 
      if($ctr==1)
      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

      Comment

      • nathj
        Recognized Expert Contributor
        • May 2007
        • 937

        #4
        Originally posted by chelvan
        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

        Comment

        Working...