Thursday, 15 March 2012

jquery - Add mysql query item to php code -



jquery - Add mysql query item to php code -

i using below code run lightbox function. works fine need alter lastly line of - lightbox_display('properties/593/', 'lightbox[gallery]'); utilize $propertyimagefolder instead of 593. tried lightbox_display('properties/$propertyimagefolder/', 'lightbox[gallery]'); no luck. can help this?

$propertyimagefolder = $row['reference_no']; function lightbox_display($dir_to_search, $rel){ $image_dir = $dir_to_search; $dir_to_search = scandir($dir_to_search); $image_exts = array('gif', 'jpg', 'jpeg', 'png'); $excluded_filename = '_t'; foreach ($dir_to_search $image_file){ $dot = strrpos($image_file, '.'); $filename = substr($image_file, 0, $dot); $filetype = substr($image_file, $dot+1); $thumbnail_file = strrpos($filename, $excluded_filename); if ((!$thumbnail_file) , array_search($filetype, $image_exts) !== false){ echo "<a href='../../".$image_dir.$image_file."' rel='".$rel."'><img src='../../".$image_dir.$filename.".".$filetype."' alt='".$filename."' width='100' height='80' title=''/></a>"."\n"; } } } lightbox_display('properties/593/', 'lightbox[gallery]');

php not process strings in single quotes variables. replace double quotes:

lightbox_display("properties/$propertyimagefolder/", 'lightbox[gallery]');

or concatenate variable , strings:

lightbox_display('properties/' . $propertyimagefolder . '/', 'lightbox[gallery]');

php jquery mysql

No comments:

Post a Comment