begeiste Posted August 4, 2006 Share Posted August 4, 2006 HiIt took me ages to making directories which contain photos, user can click on the specific name of directory link to view their photos.Basically there is a [b]table called 'category' [/b] which has [b]id,name, thumb,dir [/b] four field. I have put the dir in the page as hidden element. But it almost makes that worked, it turns out the error which don't know how to fix, can someone in this forum help me out, thanks so much.[b]Parse error: parse error in c:\program files\easyphp1-8\www\gardenclub\admin\newdir.php on line 81[/b][code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><body><ul><?php if(isset($_POST['name'])){//database name$db="gardenclub";//connect to the database server$dbcnx =@mysql_connect('localhost', 'root', '');if(!$dbcnx){exit('<p>Unable to connect to the database'.'server at the time.</p>');}//select the gallery databaseif(!@mysql_select_db('gardenclub')){exit('<p>Unable to locate the gardenclub'.'database at the time.</p>');}//adding record if($_FILES['thumb']['name']!="")$_POST[thumb]=$_FILES['thumb']['name'];//choose wether to update or create new rowif(mysql_query("SELECT id, name FROM category WHERE id='$id'", $dbcnx)){ $remove=array('id','save','dir'); update("$db.category","id='$id'"); $dir=$_POST[dir]; }else{//image directory name$dir=$name.rand(1,100);$dir=str_replace("","_",$dir); $_POST[dir]=$dir;//creates artist directorymkdir("../media/".$dir,0777);$_POST[dir]=$dir;//selecting all added directories, querying the statement$directory = @mysql_query("SELECT id, name FROM category WHERE id='$id'");if (!$directory){exit('<p>Error performing query:'. mysql_error(). '</p>');}//displaying the name of directories in the listwhile($dir = mysql_fetch_array($directory)){$id = $dir['id'];$name = htmlspecialchars($dir['name']);echo"<li><a href='detail_directory.php?id=$id'>$name</a></li>";}//uploads thumbailif($_FILES['thumb']['name']!=""){//check is image is uploaded and move it to the images folderif(!move_uploaded_file($_FILES['thumb']['tmp_name'],"../media/$dir/Thumb.jpg"))$message="Couldn't upload image";//choose the image height$scale="-geometry '118x135>'";//image save path$newThum="../media/$dir/Thumb.jpg ../media/$dir/Thumb.jpg";//imagemagick command format$command = "/usr/local/bin/convert $scale $newThum";//execute command'$command';}}}?></ul><p><a href="<?php echo $_SERVER['../PHP_SELF']; ?>">Add anthor directory</a></p><p><a href="../directory.php">Return to directory list</a></p><?php else:// allow the user to enter a new directory ?><form method="post" name="form1"><input type="hidden" name="dir" value="<?php echo $directory[dir]; ?>"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Name:</td> <td><input type="text" name="name" value="" size="32"></td> </tr> <tr><td>Thumb:</td><td><input type="file" name="thumb" value="" size="9" /></td></tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="save"></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1"></form><?php endif;?></body></html>[/code] Quote Link to comment Share on other sites More sharing options...
ronverdonk Posted August 4, 2006 Share Posted August 4, 2006 Do I have to count up to line 81, or are you going to tell me? Quote Link to comment Share on other sites More sharing options...
redarrow Posted August 4, 2006 Share Posted August 4, 2006 show line 81 please cheers. Quote Link to comment Share on other sites More sharing options...
redarrow Posted August 4, 2006 Share Posted August 4, 2006 Theres a open { brace missing on one of your if statement ok. Quote Link to comment Share on other sites More sharing options...
begeiste Posted August 5, 2006 Author Share Posted August 5, 2006 I have fixed the error on Line 81, it runs but it is still not working. Please would you help me.[B]Notice: Undefined index: thumb in c:\program files\easyphp1-8\www\gardenclub\admin\newdir.php on line 24Notice: Undefined variable: id in c:\program files\easyphp1-8\www\gardenclub\admin\newdir.php on line 28Notice: Use of undefined constant dir - assumed 'dir' in c:\program files\easyphp1-8\www\gardenclub\admin\newdir.php on line 31[/B][code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><body><ul><?php if(isset($_POST['name'])): //database name $db="gardenclub"; //connect to the database server $dbcnx =@mysql_connect('localhost', 'root', ''); if(!$dbcnx){ exit('<p>Unable to connect to the database'.'server at the time.</p>'); } //select the gallery database if(!@mysql_select_db('gardenclub')){ exit('<p>Unable to locate the gardenclub'.'database at the time.</p>'); } //adding record if($_FILES['thumb']['name']!="") $_POST[thumb]=$_FILES['thumb']['name']; //choose wether to update or create new row if(mysql_query("SELECT id, name, thumb FROM category WHERE id='$id'", $dbcnx)) { $dir=$_POST[dir]; } else { //image directory name $dir=$name.rand(1,100); $dir=str_replace("","_",$dir); $_POST[dir]=$dir; //creates artist directory mkdir("../media/".$dir,0777); $_POST[dir]=$dir; //selecting all added directories, querying the statement $directory = @mysql_query("SELECT id, name, thumb FROM category WHERE id='$id'"); if (!$directory){ exit('<p>Error performing query:'. mysql_error(). '</p>'); } //displaying the name of directories in the list while($dir = mysql_fetch_array($directory)){ $id = $dir['id']; $name = htmlspecialchars($dir['name']); echo"<li><a href='detail_directory.php?id=$id'>$name</a></li>"; } //uploads thumbail if($_FILES['thumb']['name']!="") { //check is image is uploaded and move it to the images folder if(!move_uploaded_file($_FILES['thumb']['tmp_name'],"../media/$dir/Thumb.jpg")) $message="Couldn't upload image"; //choose the image height $scale="-geometry '118x135>'"; //image save path $newThum="../media/$dir/Thumb.jpg ../media/$dir/Thumb.jpg"; //imagemagick command format $command = "/usr/local/bin/convert $scale $newThum"; //execute command '$command'; } } ?> </ul> <p><a href="<?php echo $_SERVER['../PHP_SELF']; ?>">Add anthor directory</a></p> <p><a href="../directory.php">Return to directory list</a></p><?php else:// allow the user to enter a new directory ?> <form method="post" name="form1"><input type="hidden" name="dir" value="<?php echo $directory[dir]; ?>"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Name:</td> <td><input type="text" name="name" value="" size="32"></td> </tr> <tr> <td>Thumb:</td> <td><input type="file" name="thumb" value="" size="9" /></td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="save"></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1"></form><?php endif;?></body></html>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.