I know this may not be the place to ask about php but I thought people may have 
came across a similar problem. Basically the data for my app is stored in a 
mysql database table and what I need to do is get the auto increment value of 
this table into my app via a http request. I'm trying to make a php file which 
gets this value and outputs this value as xml but I am awful at creating php to 
do such things and just get constant errors. Can anyone take a look at this and 
help me out to tweak it so it does what I want please? The table in question is 
called links and the field/row/column in the table I'm after is called linkid. 
It's the next autoincrement value of that row outputted as xml is what I want. 
Here's the php so far:-

<?php 

header("Content-type: text/xml"); 

$host = ""; 
$user = ""; 
$pass = ""; 
$database = ""; 

$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to 
host."); 
mysql_select_db($database, $linkID) or die("Could not find database."); 

$tablename              = "links";
$next_increment         = 0;
$qShowStatus            = "SHOW TABLE STATUS LIKE '$tablename'";
$qShowStatusResult      = mysql_query($qShowStatus) or die ( "Query failed: " . 
mysql_error() . "<br/>" . $qShowStatus );

$row = mysql_fetch_assoc($qShowStatusResult);
$next_increment = $row['Auto_increment'];

echo "next increment number: [$next_increment]"; 

?> 

Reply via email to