Jump to content

NEED HELP WITH ADDING A NUMBER TO A IMAGE...


Techmate

Recommended Posts

You could select the highest number, then increase it by one.

 

$sql="SELECT position FROM table ORDER BY position DESC LIMIT 0, 1";
if ($query=@mysql_query($sql)) {
   $position = 1;
   if (mysql_num_rows($query) > 0) {
      $position = mysql_result($query, 0, 0) + 1;
  }
}
else {
   echo "Error: ".mysql_error();
}

 

You could select the highest number, then increase it by one.

 

$sql="SELECT position FROM table ORDER BY position DESC LIMIT 0, 1";
if ($query=@mysql_query($sql)) {
   $position = 1;
   if (mysql_num_rows($query) > 0) {
      $position = mysql_result($query, 0, 0) + 1;
  }
}
else {
   echo "Error: ".mysql_error();
}

 

Your awesome, but. As soon as I posted that I figured it out...lol.

I ended up going with:

 

//Querys the last postion in the colum

$result = mysql_query ("SELECT column FROM table ORDER BY column DESC LIMIT 0,1");

// 
while($row = mysql_fetch_array($result)){

$column = $row['column'];

}

echo ++$name; 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.