Jump to content

priyank

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

priyank's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I want to make image gallery with next and previous button and i have to use php and mysql How can i make this. Currently I am displaying all images using following code. But I want to make use of next and previous button and I think it will be more better. mysql_select_db('a3452924_tImages') or die('Could not select database'); // Performing SQL query $query = 'SELECT Image FROM tableImages where imageID = "'.$_GET['dropdown'].'"' ; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Printing results in HTML while($row = mysql_fetch_array($result)) { $img = $row['Image']; echo"<img src='$img' />"; } // Free resultset mysql_free_result($result); // Closing connection mysql_close($link); ?>
  2. so if I combine php and html both i dont have to use action="showPictures.php" in <form>
  3. Here is a php file that is called. $selectedImage = $_GET['dropdown']; // Performing SQL query $query = 'SELECT Image FROM tableImages where imageID = "'.$_GET['dropdown'].'"' ; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Printing results in HTML while($row = mysql_fetch_array($result)) { $img = $row['Image']; echo "<img src='$img' />"; } // Free resultset mysql_free_result($result); // Closing connection mysql_close($link); ?> html code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <form action="showPictures.php" method="get"> <fieldset> <select size="1" name="dropdown"> <option value="nothing" selected="selected"> </option> <option value="1">Image1</option> <option value="2">Image2</option> <option value="3">Image3</option> </select> <input type="submit" value="Show" name="Submit" /> </fieldset> </form> </body> </html> I search in google it says to use <object> instead of <iframe> but <object> does not have attribute called method,action
  4. showPictures.php uses mysql database.
  5. Following is my code for displaying image. I can see images which uses php file ,but it open in new window. Since i have to use xhtml strict i cant use frame or iframe How can i display image in same window, so when i change option from dropdown i can view image and dropdownbox. thanks <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <form action="showPictures.php" method="get"> <fieldset> <select size="1" name="dropdown"> <option value="nothing" selected="selected"> </option> <option value="1">Image1</option> <option value="2">Image2</option> <option value="3">Image3</option> </select> <input type="submit" value="Show" name="Submit" /> </fieldset> </form> </body> </html>
  6. <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <body> <form action="showPictures.php" method="GET" target="imageFrame"> <select name="dropdown" onchange="this.form.submit()"> <option value="" selected> </option> <option value="1">Image1</option> <option value="2">Image2</option> <option value="3">Image3</option> </select> </form> <iframe name="imageFrame" align="middle" height="600px" width="500px" border="1"> </iframe> </body> I can display and see the images from php file but image is displayed in new window. I want to display image in the iframe name="imageFrame". Do i need to use javascript
  7. This is hmtl page it has button and iframe when button is clicked it activate showImages.php which shows images <p><form action="showImages.php" method=GET target="imageFrame" name="show_Image"> <input type="submit" name=sammount value="Next" size="1"> </form> <iframe name="imageFrame" align="middle" height="600px" width="500px" border="1"> </iframe> showImage.php has $query = 'SELECT Image FROM tableImages'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Printing results in HTML list($Image) = mysql_fetch_array($result); echo $Image; //print or return image mysql Field Type Function Null Value imageID int(100) Image blob Binary - do not edit (0 B) (Max: 65,536B) ImageDescription varchar(200)
  8. So instead of blob data type what data type should i use
  9. i can see characters instead of image using below code. i used blob data type for storing images in mysql. // Performing SQL query $query = 'SELECT Image FROM tableImages'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Printing results in HTML list($Image) = mysql_fetch_array($result); echo $Image; //print or return image
  10. i can see characters instead of image using below code. i used blob data type for storing images in mysql. // Performing SQL query $query = 'SELECT Image FROM tableImages'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Printing results in HTML list($Image) = mysql_fetch_array($result); echo $Image; //print or return image
×
×
  • 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.