Re: increment by one

From: Date: Mon, 10 Jul 2000 20:13:54 +0000
Subject: Re: increment by one
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-5833@lists.php.net to get a copy of this message
| What I need to do is make the $ReceiptID increment by one I assume you mean just the value in the program and not in the database. | | $queryReceiptID="SELECT ReceiptID FROM Items ORDER BY ReceiptID DESC | LIMIT 1"; SELECT ReceiptID+1 FROM Items ORDER BY ReceiptID DESC LIMIT 1 Thats one way. | $resultReceiptID=MYSQL_QUERY($queryReceiptID); | while($row = mysql_fetch_array($resultReceiptID)) { | $ReceiptID=$row[ReceiptID]; I don't think PHP likes non-quoted literals. So, what you probably want is $ReceiptID = $row [ "ReceiptID" ] + 1; But since its a single row, you could use: list ( $ID ) = mysql_fetch_row ( $resultReceiptID ); $ID++; Enjoy! Faisal _____NetZero Free Internet Access and Email______ http://www.netzero.net/download/index.html

« previous php.general (#5833) next »