dmschenk Posted January 24, 2008 Share Posted January 24, 2008 I hope I can explain this correctly. I want to create a form for a photo gallery that can change the WHERE statement in the MySQL Statement. The WHERE statement in this case is specifically for the $displayImageURL variable which will be the image displayed in the gallery before any choices are made by the user. My goal is to create a form that the owner can select from the images in his gallery the particular image to display first. The output of the php file will be XML similar to the xml below. Question 1. How can I have a field ($displayImageURL) that only one row is "true" and the rest revert to "false" everytime a change is made? Question 2. If that's not possible what would be the best way to accomplish this? echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<imagegallery>\n"; echo "<settings basePath=\"gallery/\" />\n"; echo ("<directory name=\"Image Gallery\" >\n"); $fvGallery = ''; while($row_rsFVPhotoGallery = mysql_fetch_assoc($rsFVPhotoGallery)) { if ($fvGallery != $row_rsFVPhotoGallery["pgCategoryName"]) { if ($fvGallery != ''){ echo ("</directory>\n"); } echo ("<directory name=" . "\"" . $row_rsFVPhotoGallery['categoryName'] . "\" thumbUrl=\"" . $row_rsFVPhotoGallery['thmURL'] . "\" >\n"); $fvGallery = $row_rsFVPhotoGallery['pgCategoryName']; } echo ("<image name=" . "\"" . $row_rsFVPhotoGallery['imageName'] . "\" imageUrl=\"" . $row_rsFVPhotoGallery['imageURL'] . "\" thumbUrl=\"" . $row_rsFVPhotoGallery['thmURL'] . "\" />\n"); } echo "</directory>\n"; echo ("<image imageURL=imageUrl=\"" . $row_rsFVFirstPhoto['displayImageURL'] . "\" />\n"); echo "</directory>\n"; echo "</imagegallery>\n"; This XML is ONLY a guide for the php output: <?xml version="1.0" encoding="UTF-8" ?> <imagegallery> <settings basePath="gallery/" /> <directory name="directory/Image Gallery"> <directory name="$categoryName" thumbUrl="$thmURL"> <image name="$imageName" imageUrl="$imageURL" thumbUrl="$thmURL" /> </directory> <image imageUrl="$displayImageURL" /> </directory> </imagegallery> Thanks Dave Quote Link to comment https://forums.phpfreaks.com/topic/87592-where-statement-variable/ Share on other sites More sharing options...
dmschenk Posted January 29, 2008 Author Share Posted January 29, 2008 anyone? Quote Link to comment https://forums.phpfreaks.com/topic/87592-where-statement-variable/#findComment-452646 Share on other sites More sharing options...
revraz Posted January 29, 2008 Share Posted January 29, 2008 Create a link on the page that displays the image, have the link reference the image name or URL you want to display, use a $_GET to get that variable and do a WHERE function on it. Quote Link to comment https://forums.phpfreaks.com/topic/87592-where-statement-variable/#findComment-452650 Share on other sites More sharing options...
dmschenk Posted January 29, 2008 Author Share Posted January 29, 2008 Thanks for your reply What I'm building is a sudo XML file that will populate a flash gallery. There is already a reference link for the image in the code echo ("<image imageURL=imageUrl=\"" . $row_rsFVFirstPhoto['imageURL'] . "\" />\n"); Now what you said at the end sounds like something I might be able to use... use a $_GET to get that variable and do a WHERE function on it. Do you have an example of how that would work? so right now the sql statement is something like $query_rsFVFirstPhoto = "SELECT imageID, imageURL FROM photogallery WHERE imageID = 13 "; Quote Link to comment https://forums.phpfreaks.com/topic/87592-where-statement-variable/#findComment-452955 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.