PDA

View Full Version : Auto-Increment Value as a string


kochier
08-01-2008, 07:02 AM
Alright I'm trying to create a pathname with the auto increment value as part of the pathname. mysql_select_db('comic') or die('Cannot select database');
{
$insert = ("INSERT INTO comics (Text, Title, Src)
VALUES ('$Text', '$Name', '$Src')") or die('Failure to Insert data');
mysql_query($insert) or die(mysql_error());
$Number = $row['Number'];
echo $Number;
}
mysql_select_db('comic') or die('Cannot select database');
echo 'hello' .$Number;
$Created = date('Y-m-d');
$Pathname = "absurd" .($Number) .".php";
$Map = 3;
mysql_select_db('sitemap') or die('Cannot select database');
{
if ($Map == null or $Pathname == null or $Name ==null or $Created ==null or $Text ==null)
{
die ('No Data value added');


Ok so I have two tables, comic and sitemap. In my comic table I have a row called number that auto-increments, now I'd like the pathname to be absurd1.php, absurd2.php etc as I add a comic it would create that page, however right now every page I create is simply absurd.php, the $Number is empty. So how do I do this the right way?

kochier
08-01-2008, 07:13 AM
Hmm maybe it's time I go to sleep

$result = mysql_query("SELECT Number FROM comics");
while($row = mysql_fetch_array($result)){


Was all I needed, forgot to select the database.