SitePoint Sponsor

User Tag List

Page 30 of 31 FirstFirst ... 20262728293031 LastLast
Results 726 to 750 of 767
  1. #726
    David
    SitePoint Community Guest
    Hi, wondered if anyone can help I have followed the tutorial and built the basic gallery thing, works fine. But I am basically trying to get the add new category to work and I can't work out a way to implement it and get it working with the snippet given:

    function add_category( $category_name )
    {
    mysql_query( "INSERT INTO gallery_category(`category_name`) VALUES('".addslashes( $category_name )."' )" );
    }

    Call: add_category( “Category Name” );

    Can anyone explain how I would implement this?

  2. #727
    SitePoint Member
    Join Date
    Mar 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    first i like to say a big thanks for the tut and the provided files.
    i have this album integrated into one of my sites and it works fine. i use the modified upload php for resizing the original image and viewgallery php which includes the previews thumbs for a gallery. u also use the modified preupload to choose how many uploadfields would be created.
    but i have a little problem with this one. if i say (by example) i want 10 uploadfields, it creates the number of fields and i can put my files there. but after uploading there are only 6 images uploaded. i couldn't find out why.
    if someone need code to help me, just tell me. i will post them here.
    and sorry for my poor english.
    home somebody can help me.

  3. #728
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Hi sisko and welcome to SitePoint

    This thread is very old and messy so I suggest you start a new one and post your code as you have it. That way we can see what you are using rather than referring to code which has been changed.

    Cheers

    Spike
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  4. #729
    SitePoint Member
    Join Date
    Mar 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok and thx for this warm welcome.
    i made a new thread and called them 'i can only upload 6 images at once for gallery'

  5. #730
    SitePoint Member
    Join Date
    May 2009
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Great tut, thanks. I have used the script posted and added some pagination and all works great. Does anyone know how to make the larger image open in a new window, using something similar to lightbox/thickbox etc?

    Any help would be greatly appreciated as I am new to php

  6. #731
    SitePoint Wizard spence_noodle's Avatar
    Join Date
    Jan 2004
    Location
    uk, Leeds (area)
    Posts
    1,264
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by maddesign2005 View Post
    Hi,

    Great tut, thanks. I have used the script posted and added some pagination and all works great. Does anyone know how to make the larger image open in a new window, using something similar to lightbox/thickbox etc?

    Any help would be greatly appreciated as I am new to php
    Hi maddesign, and welcome to the forum.

    What you need to do is use target="_blank" to open a new window within the link as follows:
    Code:
    <a href="images/imagelarger.jpg" target="_blank"><img src="images/imagethumbnail.jpg"></a>
    Make sure you point the link to the larger image.

  7. #732
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    hello i know this is an old thread but i have only just come across it so sorry
    is it possable not to have catergarys just 1 static and no coments
    cheers
    Doug
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  8. #733
    SitePoint Wizard spence_noodle's Avatar
    Join Date
    Jan 2004
    Location
    uk, Leeds (area)
    Posts
    1,264
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by dougvcd View Post
    hello i know this is an old thread but i have only just come across it so sorry
    is it possable not to have catergarys just 1 static and no coments
    cheers
    Doug
    Yes you can Doug, just let the database do the id number as it will increment it itself (you will need to set it to auto_increment) and then have a field for the image/photo (do it with a link).

    When you call up the database each photo/image will be in order.

  9. #734
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how can i include the WHERE clause in this LEFT JOIN used by mayank.
    because i want to add another admin user in my gallery so how i`m i going use it.
    for example WHERE user='$admin';
    Code:
    $result = mysql_query( "SELECT c.category_id,c.category_name,photo_filename,COUNT(photo_id)
    						FROM gallery_category  as c 
    						LEFT JOIN gallery_photos as p ON p.photo_category = c.category_id 
    						GROUP BY c.category_id" );
    Any help will be appreciated

  10. #735
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i succeeded))thankx.

  11. #736
    Joe
    SitePoint Community Guest
    brilliant tutorial

    I was just wondering how I could use a script to resize full sized image and where abouts in the current script I could implement it? Thanks!

  12. #737
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @joe you can use this script below..for me its working as u suggested above.Try it.
    Code:
    <? php session_start();
    $user=$_SESSION['user'];
           include("configa.inc.php");
           // include("design.inc.php");
    	   // include("config.php");
            // initialization
    		
    		
            $result_final = "";
            $counter = 0;
            // List of our known photo types
            $known_photo_types = array( 
               'image/pjpeg' => 'jpg',
               'image/jpeg' => 'jpg',
               'image/bmp' => 'bmp',
               'image/x-png' => 'png');
            
            // GD Function Suffix List
            $gd_function_suffix = array( 
               'image/pjpeg' => 'JPEG',
               'image/jpeg' => 'JPEG',
               'image/bmp' => 'WBMP',
               'image/x-png' => 'PNG');
            // Fetch the photo array sent by preupload.php
            $photos_uploaded = $_FILES['photo_filename'];
            $photoFileName= $_FILES['photo_filename'];
            
            // Fetch the photo caption array
            $photo_caption = $_POST['photo_caption'];
            while( $counter <= count($photos_uploaded) )
            {
                    if($photos_uploaded['size'][$counter] > 0)
                    {
                            if(!array_key_exists($photos_uploaded['type'][$counter], $known_photo_types))
                            {
                                    $result_final .= "File ".($counter+1)." is not a photo!<br />";
                            }else{
                            
                                    @mysql_query( "INSERT INTO gallery_photos(`photo_filename`, `photo_caption`, `photo_category`,`user`,`date`) VALUES('0', '".addslashes($photo_caption[$counter])."', '".addslashes($_POST['category'])."','$user',CURDATE())" );
                                    $new_id = mysql_insert_id();
                                    $filetype = $photos_uploaded['type'][$counter];
                                    $extention = $known_photo_types[$filetype];
                                    $filename = $new_id.".".$extention;
    								
                                    @mysql_query( "UPDATE gallery_photos SET photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" );
                                    // Store the orignal file
                                    copy($photos_uploaded['tmp_name'][$counter], $images_dir."/".$filename);
    // Let's get the original image size
                                    
    $size = GetImageSize($images_dir."/".$filename );
    // First Create Thumbnail!
    // Thumbnail Settings
            $Config_tbwidth_wide = 100; // width of wide image
            $Config_tbheight_wide = 75; // height of wide image
            $Config_tbwidth_tall = 75; // width of tall image
            $Config_tbheight_tall = 100; // height of tall image
    // The Code
            if($size[0] > $size[1]){
                $thumbnail_width = $Config_tbwidth_wide;
                $thumbnail_height = (int)($Config_tbwidth_wide * $size[1] / $size[0]);
                if($thumbnail_height > $Config_tbheight_wide){
                    $thumbnail_height = $Config_tbheight_wide;
                    $thumbnail_width = (int)($Config_tbheight_wide * $size[0] / $size[1]);
                }
            }else{
                $thumbnail_width = (int)($Config_tbheight_tall * $size[0] / $size[1]);
                $thumbnail_height = $Config_tbheight_tall;
                if($thumbnail_width > $Config_tbwidth_tall){
                    $thumbnail_width = $Config_tbwidth_tall;
                    $thumbnail_height = (int)($Config_tbwidth_tall * $size[1] / $size[0]);
                }
            }
    
    // Build Thumbnail with GD 2.x.x, you can use the other described methods too
    $function_suffix = $gd_function_suffix[$filetype];
    $function_to_read = "ImageCreateFrom".$function_suffix;
    $function_to_write = "Image".$function_suffix;
    // Read the source file
    $source_handle = $function_to_read ( $images_dir."/".$filename );
    if($source_handle){
    // Let's create a blank image for the thumbnail
    $destination_handle = ImageCreateTrueColor ( $thumbnail_width, $thumbnail_height );
    // Now we resize it
    ImageCopyResampled( $destination_handle, $source_handle, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $size[0], $size[1] );
    }
    // Let's save the thumbnail
    $function_to_write( $destination_handle, $images_dir."/tb_".$filename );
    ImageDestroy($destination_handle );
    // .................................................................................
    // This is the new code that checks for width and solves our problems
    // .................................................................................
    // Lets resize the image if its width is greater than 500 pixels
    // Resized image settings
    if ($size[0] > '500'){
            $Config_width_wide = 600; // width of wide image
            $Config_height_wide = 575; // height of wide image
            $Config_width_tall = 575; // width of tall image
            $Config_height_tall = 600; // height of tall image
    // The Code
            if($size[0] > $size[1]){
                $image_width = $Config_width_wide;
                $image_height = (int)($Config_width_wide * $size[1] / $size[0]);
                if($image_height > $Config_height_wide){
                    $image_height = $Config_height_wide;
                    $image_width = (int)($Config_height_wide * $size[0] / $size[1]);
                }
            }else{
                $image_width = (int)($Config_height_tall * $size[0] / $size[1]);
                $image_height = $Config_height_tall;
                if($image_width > $Config_width_tall){
                    $image_width = $Config_width_tall;
                    $image_height = (int)($Config_width_tall * $size[1] / $size[0]);
                }
            }
    
    // Build image with GD 2.x.x, you can use the other described methods too
    $function_suffix = $gd_function_suffix[$filetype];
    $function_to_read = "ImageCreateFrom".$function_suffix;
    $function_to_write = "Image".$function_suffix;
    // Read the source file
    $source_handle = $function_to_read ( $images_dir."/".$filename );
    if($source_handle){
    // Let's create a blank image for the image
    $destination_handle = ImageCreateTrueColor ( $image_width, $image_height );
    // Now we resize it
    ImageCopyResampled( $destination_handle, $source_handle, 0, 0, 0, 0, $image_width, $image_height, $size[0], $size[1] );
    }
    // Let's save the image
    
    $function_to_write( $destination_handle, $images_dir."/".$filename );
    ImageDestroy($destination_handle );
    }
    $result_final .= "<img src='".$images_dir. "/tb_".$filename."' /><br />Photo ".($counter+1)." Added Successfully!<br /><br />";
    }
    }
    $counter++;
    }
    // Print Result
    echo <<<__HTML_END

  13. #738
    joe
    SitePoint Community Guest
    thanks a bunch mrniceguy, i'll try it out

  14. #739
    Fred
    SitePoint Community Guest
    I am wondering how one could add pagination to this gallery for the thumbnail images? I've tried various scripts and so far no luck. Any advice?

  15. #740
    SitePoint Wizard spence_noodle's Avatar
    Join Date
    Jan 2004
    Location
    uk, Leeds (area)
    Posts
    1,264
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    What you need to do is choose how many thumbnails you wish to display per page.

    Now after that you will need to count all the thumbnails (in a category only or not) then divide it by how many thumbnails you wish to display. A script of this is some pages back on this thread which will give you an idea how to go about it.

  16. #741
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @fred,try to go through the whole Thread,because most of the answers have been provided here.
    this thread started Apr 2001.

  17. #742
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i can't get the pagination to work =(

    i've tried used the code animal777 posted years back, which is as follows:

    Code:
    if(!isset($start)) $start = 0;
    
    $result = mysql_query( "SELECT photo_id,photo_caption,photo_filename FROM gallery_photos
    
    WHERE photo_category='".addslashes($cid)."' LIMIT " . $start . ", 10");
    Code:
    $query = "SELECT count(*) as count FROM gallery_photos 
    
    WHERE photo_category=".addslashes($cid); 
    
    
    
    $count_result = mysql_query($query);
    
    $row = mysql_fetch_array($count_result);
    
    $numrows = $row['count'];
    
                
    
    if($start > 0){
    
    
    
    $result_final .= "<tr>\n<td>\n";
    
    $result_final .= "<a href=\"" . $PHP_SELF . "?cid=".$cid."
    
         &start=" . ($start - 10) ."\">Previous</a>\n</td>\n</tr>";
    
    }
    
    if ($numrows > ($start + 10)){
    
    
    
    $result_final .= "<tr>\n<td>\n";
    
    $result_final .= "<a href=\"" . $PHP_SELF . "?cid=".$cid."
    
         &start=" . ($start + 10) ."\">Next</a>\n</td>\n</tr>";
    
    }
    all i get is the link to the next set, but when i click on it nothing happens...if anyone knows or has the updated code then it would be much appreciated if you display it here

    thanks!

  18. #743
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    he it's sorted, just need to declare start variable

    $start=$_GET['start'];

  19. #744
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @staples27 here is the thumbnail pagination.it working.
    Code:
    // Thumbnail Listing
    else if( $cid && empty( $pid ) )
    {
      $number_of_thumbs_in_row = 4;
    // If current page number, use it 
      // if not, set one! 
      if(!isset($_GET['page'])){ 
          $page = 1; 
      } else { 
          $page = $_GET['page']; 
      } 
    // Define the number of results per page 
      $max_results = 12; 
    
      // Figure out the limit for the query based 
      // on the current page number. 
      $from = (($page * $max_results) - $max_results); 
      $result = mysql_query( "SELECT photo_id,photo_caption,photo_filename FROM gallery_photos WHERE 
    photo_category='".addslashes($cid)."' LIMIT $from, $max_results"); 
      $nr = mysql_num_rows( $result );
      if( empty( $nr ) )
      {
       $result_final = "\t<tr><td>No Photos found</td></tr>\n";
      }
      else
      {
       while( $row = mysql_fetch_array( $result ) )
       {
        $result_array[]= "<a href='viewgallery.php?cid=$cid&pid=".$row[0]."'><img 
    src='".$images_dir."/tb_".$row[2]."' border='0' alt='".$row[1]."' class='img'/></a>";
       }
       mysql_free_result( $result ); 
       $result_final = "<tr>\n";
    "<a href='viewgallery.php?cid=$cid'>$category_name</a></td>\n</tr>\n";
    
       foreach($result_array as $thumbnail_link)
       {
        if($counter == $number_of_thumbs_in_row)
        { 
         $counter = 1;
         $result_final .= "\n</tr>\n<tr>\n";
        }
        else
        $counter++;
        $result_final .= "\t<td>".$thumbnail_link."</td>\n";
    
       }
    
       if($counter)
       {
        if($number_of_photos_in_row-$counter)
       $result_final .= "\t<td colspan='".($number_of_photos_in_row-$counter)."'>&nbsp;</td>\n";
        $result_final .= "</tr>";
    
    
    
    
    // Figure out the total number of results in DB: 
    $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM gallery_photos WHERE photo_category=".addslashes
    ($cid).""),0); 
    // Figure out the total number of pages. Always round up using ceil() 
    $total_pages = ceil($total_results / $max_results); 
    if ($total_pages >1)
    {  // build links if more than one page
    
    // Build Page Number Hyperlinks 
    $result_final .=  "<tr><td colspan='".$number_of_thumbs_in_row."' class='tcat'>\nThere&nbsp;(".$total_pages.")Pages:&nbsp;"; 
    
    // Build Previous Link 
    if($page > 1){ 
        $prev = ($page - 1); 
        $result_final .=  "\n<a href=\"".$_SERVER['PHP_SELF']."?cid=$cid&page=$prev\" title='Previous Page'>&lt;&lt;</a>"; 
    } 
    for($i = 1; $i <= $total_pages; $i++){ 
        if(($page) == $i){ 
            $result_final .= "&nbsp;[$i]"; 
            } else { 
                $result_final .=  "\n<a href=\"".$_SERVER['PHP_SELF']."?cid=$cid&page=$i\" title='Page ".$i."'>$i</a>"; 
        } 
    } 
    // Build Next Link 
    if($page < $total_pages){ 
        $next = ($page + 1); 
        $result_final .=  "\n<a href=\"".$_SERVER['PHP_SELF']."?cid=$cid&page=$next\" title='Next Page'>&gt;&gt;</a>"; 
    } 
    $result_final .=  "\n</td></tr>"; 
    }
    else
    {
    $result_final .=  "\n";
    }      
    
    
       }
      }
    }

  20. #745
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks mrniceguy that works a treat, now just need to tweak things around a bit

  21. #746
    SitePoint Member
    Join Date
    Nov 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Still no answer to sicko post above "i can only upload 6 images at once for gallery".

    I've run into the same issue in that the upload portion of the script will only allow 6 images to be uploaded even if you have it set higher. That means no matter what the size the image, it only uploads 6 if you try to upload 10. Images could be 1kb each and it'll only upload 6. The setting for file size have all been set to high (even in the php.ini) and still the issue exists.

    Any help or resolution would be appreciated.

    Thanks,

    M-

  22. #747
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone how to add a next and previous link so that users can browse through the images?

    eg.

    I've clicked on a thumbnail of an image and want to see what the next image is or the previous one but don't want to go back to thumbnail view, instead I'd rather click on either or next or previous respectively to view the image.

  23. #748
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @stples27 down is the code i` using for prev and Next link.
    just that i added possibily of deleting and commet a photo,if u dont want then u can simply remove.

    Code:
     // display previous and next links if more than one photo 
     else if( $pid ) 
        { 
            $result = mysql_query( "SELECT photo_caption,photo_filename FROM gallery_photos WHERE photo_id='".addslashes($pid)."'" ); 
            list($photo_caption, $photo_filename) = mysql_fetch_array( $result ); 
            $nr = mysql_num_rows( $result ); 
            mysql_free_result( $result );     
    
            //fill pid_array with sorted pids in current category 
            $result = mysql_query( "SELECT photo_id FROM gallery_photos WHERE photo_category='".addslashes($cid)."' ORDER BY photo_id" ); 
            $ct = mysql_num_rows( $result );     
            while ($row = mysql_fetch_array($result)) { 
                $pid_array[] = $row[0]; 
                 } 
            mysql_free_result( $result ); 
    
            if( empty($nr ) ) 
            { 
                $result_final = "\t<tr><td>No Photo found</td></tr>\n"; 
            } 
            else 
            { 
                $result = mysql_query( "SELECT category_name FROM gallery_category WHERE category_id='".addslashes($cid)."'" ); 
                list($category_name) = mysql_fetch_array( $result ); 
                mysql_free_result( $result );     
    
                $result_final .= "<tr>\n\t<td> 
                            <a href=viewgallery.php><font size=4>Albums</font></a> &gt;&gt; 
                            <a href=viewgallery.php?cid=$cid><font size=4>$category_name</font></a><br><br></td>\n</tr>\n"; 
                 
                // display previous and next links if more than one photo 
                if ($ct > 1) { 
                      $key = array_search($pid, $pid_array); 
                      $prev = $key - 1; 
                      if ($prev < 0) $prev = $ct - 1; 
                      $next = $key + 1; 
                      if ($next == $ct) $next = 0; 
                      $result_final .= "<tr><td colspan='10'><center>"; 
                      $result_final .= "<a href=viewgallery.php?cid=$cid&pid=".$pid_array[$prev]."><img src=images/prevlabel.gif  border=0 ></a>&nbsp;&nbsp;&nbsp;"; 
                     $result_final .= "(".($key+1)." / ".$ct.")&nbsp;&nbsp;&nbsp;"; 
                      $result_final .= "<a href=viewgallery.php?cid=$cid&pid=".$pid_array[$next]."><img src=images/nextlabel.gif  border=0 ></a>"; 
                     $result_final .= "</center></td></tr>"; 
                } 
    			
    			    $comment.="<form name='comment' action='gallerycomment.php' method='post'><input type='hidden' value='$pid' name='photo_id' />
    				  <input type='hidden' value='$user' name='user'/><textarea rows=5 cols=40 name='comment'></textarea><br/><input type='submit' value='comment' name='submit'/>
    				 </form> ";
    				 
    			
    
                }
    	
    	        
    			
                   $deletephoto.="<form name='photo_delete' action='edit_photo.php' method='post'>
    <input type='hidden' value='$pid' name='photo_id' /><input type='submit' value='Delete This Photo?' name='action'/></form>";         
                
    			$result_final .= "<tr>\n\t<td align='center' bordercolor=blue border=1> 
                        <a href=viewgallery.php?cid=$cid&pid=".$pid_array[$next]."><img src='".$images_dir."/".$photo_filename."' border='0' alt='".$photo_caption."' class='img'/></a> 
                        <br /> 
                        $photo_caption 
                        </td> 
                        </tr><tr align=right><td>$deletephoto</td></tr>
    					<tr><td><font color=#ffffff></font></td></tr>"; 
    				
    		 //photo comment from this line
    	          $photocomm=mysql_query("SELECT id,sender,comment,date,photo_id FROM photo_comment  WHERE photo_id='$pid'");
    			  $hes=mysql_num_rows($photocomm);
    			 
    			  
    			        while($raw=mysql_fetch_array($photocomm))
    		        {
    	                $comment_sender=$raw['sender'];
    					$comment_id=$raw['id'];
    					$comment_date=$raw['date'];
    					  $dates1=date("F j, Y,g:i a", strtotime($comment_date)); 
    					$photocomment=$raw['comment'];
    				include"config.php";
    				
    				$query11="SELECT  photos,id FROM profile WHERE users='$comment_sender'";
                    $result11=mysql_query($query11);
                    $rew=mysql_fetch_array($result11);
                    $photo=$rew['photos'];
                    $sentid=$rew['id'];
    				$photcommdel="<a href=commentgallery.php?comid=$comment_id>delete</a>";
                     if($user==$comment_sender)
    			{
        
              if($photo){
    	   $imgdisp="<a href=myprofile.php><img src=thumb/$photo  width=40 height=50 border=0></a>";
    					  }
    					  else{
    					  $imgdisp="<a href=myprofile.php><img src=thumb/805755615.JPG width=40 height=50 border=0></a>";
    					  
    					  }
                }else{
    
    			if($photo){
    			
    			$imgdisp="<a href=profile.php?wewe=$sentid><img src=thumb/$photo  width=40 height=50 border=0></a>";
    					  }
    					  else{
    					$imgdisp="<a href=profile.php?wewe=$sentid><img src=thumb/805755615.JPG width=40 height=50 border=0></a>";
    					  
    					  }
    					  
    					  }
    					
    					 if($user==$comment_sender)
                   { 
    			        $nmdisp="<a href=myprofile.php><font size=2>$comment_sender</font></a>"; 
    
                     }else{ 
                     $nmdisp="<a href=profile.php?wewe=$sentid><font size=2>$comment_sender</font></a>";
                  }
    
    
    
    				
    				
    				$comme_array[]="<tr valign=top><td><table align=center width=600 class=forumdisplay><tr valign=top><td rowspan=2 width=100 align=left>$imgdisp</td><td width=500 align=left>$nmdisp<br/>$dates1  \t$photcommdel </td></tr><tr valign=top><td align=left>$photocomment</td></tr></table></td></tr>";
    					
    					
    	                 
    					 
    	            }
               mysql_free_result($photocomm); 
    
    		    if($hes!=0){
    			  
    			    
    			  
    			  
    		   
    		   foreach($comme_array as $mycomments)
    		   {
       
               $result_final .= "<tr><td>$mycomments</td></tr>";
       
    
                }
    			
    		}			
          $result_final.="<tr align=left><td>$comment</td></tr>";
    		
    		}

  24. #749
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks! you really are a nice guy

    learning quite a bit from this forum!

  25. #750
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not exactly a php mysql vet, trying to use a simple delete of photos and there db information i tried using this from the threads. Maybe I have not set it up properly. But it appears to run itself, anyway no luck with this. Any suggestions would be great. Thanks

    <?php
    function delete_photo($photo_id, $images_dir) {
    $result = mysql_query("
    SELECT
    ***photo_filename
    FROM
    ***gallery_photos
    WHERE
    ***photo_id = $photo_id
    ") or die(mysql_error());
    $row = mysql_fetch_array($result);
    mysql_free_result($result);
    unlink($images_dir . '/' . $row['photo_filename']);
    mysql_query("
    **DELETE
    **FROM
    ****gallery_photos
    **WHERE
    ****photo_id = $photo_id") or die(mysql_error());
    }
    //If a photo has been deleted,
    //remove it from the database.
    if($_GET['deletephoto'] != "" && isset($_GET['deletephoto'])) {
    **delete_photo($_GET['deletephoto'], $images_dir);
    }
    echo "<p>Here are all the photos in our database: " . "</p>";
    //Display all photos with a "Delete this photo" link next to each.
    $query = "SELECT * FROM gallery_photos";
    $result1 = mysql_query($query);
    while ($row = mysql_fetch_array($result1) ) {
    **$photo_id = $row["photo_id"];
    **$photo_filename = $row["photo_filename"];

    **echo '<p><img src="' . $images_dir . '/' . tb_.$row[1]. '" border="0"**/><br /><a href="' . $_SERVER['PHP_SELF'] . '?deletephoto=' . $photo_id .'">Delete this photo</a></p>';**
    }
    ?>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •