Results 1 to 7 of 7

Thread: problem with id

  1. #1
    Join Date
    Aug 2009
    Location
    Kuching
    Posts
    19
    Rep Power
    0

    problem with id

    hi semua,

    saya ada masalah dengan macam mana nak tarik id yang dihantar dari form ke database. saya guna php with mysql.

    ok, the situation is like this:
    saya ada 2 table and 1 form.
    after saya isi semua data yang diperlukan including upload image, saya nak kalo boleh insert data2 tu into 2 table.

    dalam form tu da function upload image maximum 4 image.
    after submit form tu senarai image akan masuk dalam table2, and data lain like name and suggestion masuk table1.

    and i use auto_increment id for table1. when i submit the form id table1 untuk data tersebut akan masuk dalam id table2.

    Supaya nanti saya dapat display image menggunakan id yg sama dari table1.

    persoalannya... Boleh ke saya buat macam tu???
    aku bukan di sini...

  2. #2
    Join Date
    Sep 2005
    Location
    in my body lar...
    Posts
    1,325
    Rep Power
    0
    if you are not running under multiuser environment:-
    then you can requery the table1 for the last inserted record id... you can use "SELECT MAX(ID) as "LastID FROM Table1;"

    if you are on a multiuser environment:-
    the you need to generate your own unique id instead of letting it autorun...

    i presume you use php...if so you can use php uniqid function. Get coding from ---> PHP: uniqid - Manual

  3. #3
    Join Date
    Aug 2009
    Location
    Kuching
    Posts
    19
    Rep Power
    0
    thanks imfreelancer..

    Yes, im running om a multiuser environment.

    I've tried using uique id. But the problem is after I submit the form, the id in my table1 and table2 does not same.

    i use this script to create unique id
    PHP Code:
        $prefix 'W'// a universal prefix prefix 
        
    $my_random_id $prefix;
        
    $my_random_id .= chr(rand(65,90));
        
    $my_random_id .= time();
        
    $my_random_id .= uniqid($prefix);
        
        print 
    $my_random_id
    And for upload image i use this

    PHP Code:
      for ($i=0;$i<4;$i++)
    {
     if(
    $_POST['Submit']) 
     {
    //

    Hope to get your attention on this.. Thanks
    aku bukan di sini...

  4. #4
    Join Date
    Sep 2005
    Location
    in my body lar...
    Posts
    1,325
    Rep Power
    0
    you need to turn off the autonumber attri for the id field in your table definition..
    if you don want to modify the record id field... then just create a new field on both table and link them up lor...

    1. generate the unique id first and store inside local variable
    2. save table1 using the unique id var
    3. save table2 using the unique id var

    basically tats all i can offer...

  5. #5
    Join Date
    Aug 2009
    Location
    Kuching
    Posts
    19
    Rep Power
    0
    oke..dah boleh dah.. thanx imfreelancer for your advice...
    aku bukan di sini...

  6. #6
    Join Date
    Jun 2011
    Location
    kuching
    Posts
    12
    Rep Power
    0
    use mysql_insert_id from the 1st query

  7. #7
    Join Date
    Aug 2011
    Location
    UK
    Posts
    9
    Rep Power
    0
    After placing correctly my pdf doc into ID CS5 and exporting it for epub, the exported epub file is generated with only small size. I mean when i opened the epub file with Adobe digital edition, i can not maximums the size of the doc. I think the problem is that ID CS5 is added a page number for only the first page in the right bottom of the first page only. This will makes the doc to be displayed with maximum only by adding an extra blank page to the right of each generated page which contains only a page number, so that I can not change the display size in Adobe digital edition.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Does anyone get the same problem?
    By thousandlingers in forum Website Design
    Replies: 4
    Last Post: 27-03-2008, 02:22 PM
  2. problem with new pc
    By wirfash in forum Mamak Stall
    Replies: 2
    Last Post: 07-12-2005, 11:39 AM
  3. Any way to get around this problem
    By philin in forum Revenue and Monetization
    Replies: 18
    Last Post: 09-10-2004, 11:56 PM
  4. jsp problem la
    By dyda in forum Website Programming
    Replies: 12
    Last Post: 21-02-2004, 09:32 AM
  5. IIS problem
    By kasih in forum Website Programming
    Replies: 1
    Last Post: 01-10-2002, 11:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32