Results 1 to 3 of 3

Thread: problem in update query

  1. #1
    Join Date
    Apr 2007
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default problem in update query

    Hi.

    i am to update the last record of my table. plz help me. i am using subquery for updating the last record.

    This is mysql code i am using:

    I am using the query to update::::

    update paypal set title='Mr', fname='srikanthrrr', sname='ram', phone='34334343333', email='srikanth11@netvisionsolutions.com', dob='2/5/1980/', pd='srikantha', hno='Himayathnager', place='hyd', country='india', pcode='3443443434343333' where sno= (SELECT MAX(sno) FROM paypal);


    This is my table structure:
    CREATE TABLE `paypal` (
    `sno` int(100) NOT NULL auto_increment,
    `title` varchar(100) collate latin1_general_ci NOT NULL,
    `fname` varchar(100) collate latin1_general_ci NOT NULL,
    `sname` varchar(100) collate latin1_general_ci NOT NULL,
    `phone` varchar(100) collate latin1_general_ci NOT NULL,
    `mobile` varchar(200) collate latin1_general_ci NOT NULL,
    `email` varchar(100) collate latin1_general_ci NOT NULL,
    `dob` varchar(100) collate latin1_general_ci NOT NULL,
    `pd` varchar(100) collate latin1_general_ci NOT NULL,
    `hno` varchar(100) collate latin1_general_ci NOT NULL,
    `place` varchar(100) collate latin1_general_ci NOT NULL,
    `country` varchar(100) collate latin1_general_ci NOT NULL,
    `pcode` varchar(100) collate latin1_general_ci NOT NULL,
    `dos` varchar(100) collate latin1_general_ci NOT NULL,
    `status` varchar(100) collate latin1_general_ci NOT NULL,
    PRIMARY KEY (`sno`)
    )



    INSERT INTO `paypal` (`sno`, `title`, `fname`, `sname`, `phone`, `mobile`, `email`, `dob`, `pd`, `hno`, `place`, `country`, `pcode`, `dos`, `status`) VALUES (1, 'netvision', 'purnendu', 'raja', '9845784578', '', 'puru_singh2004@yahoo.co.in', '2007-04-30', 'aaaaaaaa', '3-6-457', 'hyderabad', 'India', '50025', '2007-04-30', 'active'),
    (2, 'Infosis', 'Ranjan', 'ranja', '433444', '', 'a@a.com', '2007-04-30', 'aaaaaaa', '4-5-455', 'hyderabad', 'india', '200025', '2007-04-30', 'active'),
    (8, '1', 'purnendu', '', '34334343', '', 'ranjan@netvision.com', '2/3/1989', '', 'dfdfdfdfd', 'dfdfff', 'dffdfdfd', '3443443434343', '', ''),
    (7, '', '', '', '', '', '', '//', '', '', '', '', '', '', '$'),
    (9, 'Mrs', 'sweeya', 'reddy', '040-45784578', '9845784578', 'sweey@netvisionsolutions.com', '1/1/1979', 'sweeya', 'fgfgggfgfg', 'Hyderabad', 'india', '12541245', '', ''),
    (10, 'Dr', 'purnendu', '', '34334343', '', 'ranjan@netvision.com', '2/3/1989', '', 'Himayathnager', 'Hyderabad', 'India', '12541245', '', ''),
    (11, 'Mrs', 'kavya', '', '34334343', '09347045052', 'kavya@netvisionsolutions.com', '4/5/1968', '', 'Himayathnager', 'Hyderabad', 'india', '12541245', '', ''),
    (12, 'Mr', 'Ram', 'reddy', '34334343', '09347045052', 'rebbap@yahoo.com', '3/3/1988', 'reddy1', 'Himayathnager', 'Hyderabad', 'india', '3443443434343', '', ''),
    (13, 'Mr', 'srikanth', 'reddy', '34334343', '09347045052', 'srikanth@netvisionsolutions.com', '2/5/1980', 'srikanth', 'Himayathnager', 'Hyderabad', 'india', '3443443434343', '', '');


    Please help me. Its urgent.

    Thanks & Regards

    Ranjan

  2. #2
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry don't understand exactly what your saying the issue is... Is none of the info getting inserted into the database? Or is everything getting inputted into the db except for the last record
    PHP Code:
    (13'Mr''srikanth''reddy''34334343''09347045052''srikanth@netvisionsolutions.com''2/5/1980''srikanth''Himayathnager''Hyderabad''india''3443443434343'''''); 
    ?

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Ah, you've made the classic mistake of giving us lots of info, but not actually telling us the problem with it. As much as we enjoy looking at your table structure, we'd be much more productive if you were to let slip some sort of hint as to what exactly is going wrong.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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