Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Not much luck with max() function - increasing ID # manually by 1

lvictorlvictor Member Posts: 3
PHP newbie, trying my hand at altering a web form to display the highest ID # +1, as recommended to me elsewhere (sorry, but autoincrement is set to 10, no exceptions, by my database admin, so this is the only way I can auto-number my reports!)

I'm looking to have the ID # display as 1 higher than the highest value for the ID field, which will of course be submitted by the form & recorded by the database. So far, I'm trying it and getting nothing to display. this code works great as a query in phpadmin, but put it into the form and it won't work... any suggestions as to how I can rephrase this syntax to make the highest # +1 appear? Thanks!

********************


<?
$mode=$_GET["mode"];
if($mode=="add") {
include("conn.php");

?>
ADD
- NEW ISSUE
ID: ' size=20>
Region:
Global
Americas
United Kingdom
Tokyo
Hong Kong
India
Singapore
Sydney
Status:
Location:

Office:


Title:

Domain/Silo:

Devices:

Risk:

1 - Critical
2 - High
3 - Medium

Business Line:

Originator:

Issue Owner:

Group:

Original Target Date (mm/dd/yyyy):

Current Target Date: (mm/dd/yyyy):

Milestone:

Last Update (mm/dd/yyyy):

Description:

Start Date:
" size="35">
Issue Details:


<?
} else {
include("conn.php");
$id=$_GET["id"];
$sql="select id,region,status,location,office,title,domain,devices,risk,line,originator,owner,segment,origtarget,currtarget,milestone,lastupdate,details,date,description from $branch where id='$id'";

$result=mysql_query($sql,$connection) or die(mysql_error());
while($row=mysql_fetch_array($result)) {
$id=$row['id'];
$region=$row['region'];
$status=$row['status'];
$location=$row['location'];
$office=$row['office'];
$title=$row['title'];
$domain=$row['domain'];
$devices=$row['devices'];
$risk=$row['risk'];
$line=$row['line'];
$originator=$row['originator'];
$owner=$row['owner'];
$segment=$row['segment'];
$origtarget=$row['origtarget'];
$currtarget=$row['currtarget'];
$milestone=$row['milestone'];
$lastupdate=$row['lastupdate'];
$details=$row['details'];
$date=$row['date'];
$description=$row['description'];
}
?>
UPDATE
ISSUE #<? echo $id; ?>

">
 
Region: ">
Status:
">Current Status: <? echo $status; ?>
Open
Active

Location:
">
Office:

">
Title:
<? echo $title; ?>
Domain/Silo:
">
Devices:
">
Risk:
">
Business Line:
">
Originator:
">

Issue Owner:
">
Group:
">
Original Target Date (mm/dd/yyyy):
">
Current Target Date: (mm/dd/yyyy):
">
Milestone:
">
Last Update (mm/dd/yyyy):
">
Description:
<? echo $details; ?>
Start Date:
">
Issue Details:
<? echo $description; ?>


<?

}
?>




Comments

Sign In or Register to comment.