I want to create a folder based on the last tutorial submitted to my site, this is close but I need it to select the LAST tutorial instead of the first one.
The tutorialid field is an autoincrement number I assume I need to throw ORDER BY DSC in there somewhere but when I insert it after FROM tutorialtemp I get an error message...
<?
include("connect.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM tutorialtemp";
$result=mysql_query($query);
$num=mysql_num_rows($result);
mysql_close();
$i=0;
while ($i < 1) {
$tutorialid=mysql_result($result,$i,"tutorialid");
?>
<? echo "$tutorialid" ?><br>
<?
mkdir ("../tutorials/$tutorialid/", 0777); ?>
<?
++$i;
}
?>