Jump to content

WHERE Statement Variable?


dmschenk

Recommended Posts

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

Link to comment
Share on other sites

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 ";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.