Jump to content

Display Records By Newly Added Or Updated How?


lovephp

Recommended Posts

i do this

 

mysql_query("SELECT id, randid, center, customer_name, home_phone, time, approval * FROM table ORDER BY DESC");

 

and i get lank page why?

 

Jesi asked for your table structure, which would help us solve your problem. You will need to supply that information before we can really help you. If you have a unique column that is auto_increment, you can order the results by that column descending. As to why you are seeing a blank page, in your query you are not descending by a column and you are misusing the * asterisk symbol, therefore the SQL syntax is invalid and an error is being triggered. You should have error_handling set to -1 and display_errors set to on.

Link to comment
Share on other sites

here you go

 

--
-- Table structure for table `table`
--

CREATE TABLE IF NOT EXISTS `table` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `customer_name` varchar(150) NOT NULL,
 `address` varchar(150) NOT NULL,
 `home_phone` varchar(12) NOT NULL,
 `alt_phone` varchar(12) NOT NULL,
 `email` varchar(100) NOT NULL,
 `sex` varchar(10) NOT NULL,
 `mortgagetype` varchar(50) NOT NULL,
 `propertyvalue` varchar(50) NOT NULL,
 `mortgagebalance` varchar(50) NOT NULL,
 `secondmortgage` varchar(50) NOT NULL,
 `monthlypayments` varchar(50) NOT NULL,
 `monthlypaymentstype` varchar(50) NOT NULL,
 `secondmortgagepayments` varchar(50) NOT NULL,
 `secondmortgagepaymentstype` varchar(50) NOT NULL,
 `interestrate` varchar(50) NOT NULL,
 `secondinterest` varchar(50) NOT NULL,
 `ltv` varchar(50) NOT NULL,
 `creditrating` varchar(50) NOT NULL,
 `misspayments` varchar(10) NOT NULL,
 `additionaldebts` varchar(500) NOT NULL,
 `penalty` varchar(50) NOT NULL,
 `refinanced` varchar(10) NOT NULL,
 `maturity` varchar(10) NOT NULL,
 `lender` varchar(150) NOT NULL,
 `employment` varchar(150) NOT NULL,
 `ahi` varchar(150) NOT NULL,
 `maritialstatus` varchar(50) NOT NULL,
 `bankruptcy` varchar(10) NOT NULL,
 `bankruptcydischarged` varchar(50) NOT NULL,
 `proposal` varchar(10) NOT NULL,
 `proposalbalance` varchar(50) NOT NULL,
 `ip` varchar(50) NOT NULL,
 `center` varchar(50) NOT NULL,
 `approval` varchar(50) NOT NULL,
 `comments` text NOT NULL,
 `time` int(100) NOT NULL,
 `status_comment` text NOT NULL,
 `randid` varchar(10) NOT NULL,
 PRIMARY KEY (`id`),
 UNIQUE KEY `home_phone` (`home_phone`,`email`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `table`
--

Link to comment
Share on other sites

how do i do it here?

 

mysql_query("UPDATE table SET customer_name ='$cusname',  address = '$address', home_phone = '$phone', alt_phone = '$altphone', email = '$email',
			    sex = '$sex', mortgagetype = '$mortgagetype', propertyvalue ='$propertyvalue', mortgagebalance = '$mortgagebalance', secondmortgage = '$secondmortgage',
			    monthlypayments = '$monthlypayments', monthlypaymentstype = '$monthlypaymentstype', secondmortgagepayments = '$secondmortgagepayments', secondmortgagepaymentstype = '$secondmortgagepaymentstype', interestrate = '$interest', secondinterest = '$secondinterest',
			    ltv = '$ltv', creditrating = '$credit', misspayments = '$misspayments', additionaldebts = '$debts', penalty = '$penalty', refinanced = '$refinanced',
			    maturity = '$maturity', lender = '$lender', employment = '$employment', ahi = '$ahi', maritialstatus = '$maritialstatus', bankruptcy = '$bankruptcy',
			    bankruptcydischarged = '$bankruptcydischarged', proposal = '$proposal', proposalbalance = '$proposalbalance', center = '$center', comments = '$comments',
			    approval = '$approval', status_comment = '$stcomment' WHERE id = '$id'")
               or die(mysql_error());   

Link to comment
Share on other sites

Also there's no such thing as a timespamp, so...

 

Yes, there is..

In this particular case I would recommend using it, since it carries nice automatic initialization and update properties with it.

To add these properties to a TIMESTAMP data type field, you will need to add the CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP attributes to the field's definition.

Edited by AyKay47
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.