numbers

Discussion in 'PHP' started by baris22, Jul 22, 2009.

  1. #1
    hello,

    I need some help on numbers. I need to get the number for next
    <?=$row['id'];?>
    PHP:
    and insert into
    <?=$row['reference'];?>
    PHP:
    this is not a problem. i can do this

    but

    <?=$row['reference'];?> 
    PHP:
    number can not be higher than 999. so when
    <?=$row['id'];?>
    PHP:
    reaches 1000
    <?=$row['reference'];?>
    PHP:
    should go back to 1.

    When
    <?=$row['id'];?>
    PHP:
    reaches 2000
    <?=$row['reference'];?>
    PHP:
    should go back to 1. and so on....


    Can anybody help me please.

    Thanks
     
    baris22, Jul 22, 2009 IP
  2. baris22

    baris22 Active Member

    Messages:
    543
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #2
    any help?

    Thanks
     
    baris22, Jul 22, 2009 IP
  3. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Please explain your problem in more detail, here:
    <?=$row['id'];?>
    <?=$row['reference'];?>

    You are just echoing out the id an the reference i don't see how you are getting or inserting anything
     
    wd_2k6, Jul 22, 2009 IP
  4. astrazone

    astrazone Member

    Messages:
    358
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    33
    #4
    you need something like
    if (reference > 999){ id = 1 }

    or the other way around...?
    from what I understood you need something like this.?!
    explain some more please.
     
    astrazone, Jul 22, 2009 IP
  5. ezprint2008

    ezprint2008 Well-Known Member

    Messages:
    611
    Likes Received:
    15
    Best Answers:
    2
    Trophy Points:
    140
    Digital Goods:
    1
    #5
    but if he changes it to 1 .. then if he ever has to use it again, it will be labeled wrong in the database.
    Better to at least something strange like
    if ($row['reference'] > 999){ id = "1b" }

    then if you ever recall the data you'd have to unwrap it back to a integer.
     
    ezprint2008, Jul 22, 2009 IP