-1

Hi!

Can somwhone can create for me button that goes back to last picture, and to next picture..Down is download link where you can download ready image upload, but you need to put in button to next picture, and previus picture.Need to do that with all the pictures in database. Please somwhone help me. Here is table what you need to create in database. And then send file to me

CREATE TABLE photoUploadDemo (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
date VARCHAR( 50 ) NOT NULL ,
ip VARCHAR( 50 ) NOT NULL ,
filename VARCHAR( 255 ) NOT NULL
) ENGINE = MYISAM ;

Thanks
File download - http://forum.codecall.net/index.php?app=core&module=attach&section=attach&attach_id=10475

2
Contributors
4
Replies
5
Views
4 Years
Discussion Span
Last Post by sandjuks112
0

All what I need is made link to next image, like if I have a database

|database|

|id|date|filename |
|1 |19 |smile.jpg|
|2 |19 |test.png |
|4 |19 |img.jpg |

and I want to create a link who goes to next id like, if I have a link that goes to next picture
www.domain.com/index.php?img= $id = that picture id. How can I make that??

When I prees button next, it goes from picture smile.jpg to test.png,and when I again press next it goes to img.jpg
Please help me :)

0

I'll try again. Show your code here. I know you pasted a link to an attachment, but you need to login to view it, and I'm not creating an account just for that.

0

index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Basic Ajax and PHP tutorial</title>
<style type="text/css">
<!--
body,td,th {
    font-family: Georgia,"Times New Roman",Times,serif;;
    font-size: 12px;
    color: #333;
}
body {
    margin-left: 0px;
    margin-top: 30px;
    margin-right: 0px;
    margin-bottom: 0px;
}
.maindiv{ width:640px; margin:0 auto; padding:20px; background:#CCC;}
.innerbg{ padding:6px; background:#FFF;}
.result{ border:solid 1px #CCC; margin:10px 2px; padding:4px 2px;}
.title a{ font-weight:bold; color:#c24f00; text-decoration:none; font-size:14px;}
.discptn a{ text-decoration:none; color:#999;}
.link a{ color:#008000; text-decoration:none;}
-->
</style>
</head>
<body>
<div style="text-align:center;">
<div style="display:none;"><img src="ajax-loader.gif"  /></div>
  <h1 style="color:#CCC;"><a href="http://www.webinfopedia.com/php-upload-immage-to-database.html" style="color:#EEDDCA; text-decoration:none; font-size:18px;"></a></h1></div>
<div class="maindiv">
<div class="innerbg">
<form method="post" enctype="multipart/form-data" action="uploadPhoto.php"><table width="100%" border="0" cellpadding="2" cellspacing="2">
  <tr>
    <td colspan="3" align="left" valign="middle" bgcolor="#008000"><div style="margin:0px 10px; font-weight:bold; color:#FFF; font-size:16px;">Ajax PHP image upload to database</div></td>
    </tr>
  <tr>
  <td width="26%" ><strong>Image</strong></td>
  <td width="2%" >:</td>
  <td width="72%" ><label>
    <input type="file" name="image" id="image" />
  </label></td>
  </tr>
  <tr>
  <td width="26%" >&nbsp;</td>
  <td width="2%" >&nbsp;</td>
  <td width="72%" ><label>
    <input type="submit" name="button" id="button" value="Upload" />
  </label></td>
  </tr>
  <tr>
  <td colspan="3" >
  <?php
  if(@$_REQUEST['img']!='')
  {
  require_once("connect/config.php");
  $imgtest="SELECT * FROM photouploaddemo WHERE filename='".base64_decode($_REQUEST['img'])."'";
  $showphoto=mysql_query($imgtest);
  $shownum=mysql_num_rows($showphoto);




  if($shownum>=1)
  {
    $show=mysql_fetch_array($showphoto);  
    ?>
    <img src="images/<?php echo $show['filename']; ?>" />
    <?php
  }
  }
  if(@$_REQUEST['mgs']=='error')
  {
      ?>
      <span style="color:#F00;"> Some Error !!!</span>
      <?php
  }
  ?>
  </td>
  </tr>
</table></form>
</div>
</div>
<a href="index.php?id=<?php echo $nextid; ?> ">Next</a>
<div style="padding:4px; text-align:right;"><h1><a href="http://www.webinfopedia.com/php-upload-immage-to-database.html" style="font-weight:bold; color:#FFF; padding:4px 8px; background:#333; text-decoration:none;">Go back to tutorial</a></h1></div></body>
</html>

connect/config.php

<?php
mysql_connect("localhost","root","")or die(mysql_error());
mysql_select_db ("database")or die (mysql_error());
?>

and just new folder images

uploadPhoto.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Basic Ajax and PHP tutorial</title>
<style type="text/css">
<!--
body,td,th {
    font-family: Georgia,"Times New Roman",Times,serif;;
    font-size: 12px;
    color: #333;
}
body {
    margin-left: 0px;
    margin-top: 30px;
    margin-right: 0px;
    margin-bottom: 0px;
}
.maindiv{ width:640px; margin:0 auto; padding:20px; background:#CCC;}
.innerbg{ padding:6px; background:#FFF;}
.result{ border:solid 1px #CCC; margin:10px 2px; padding:4px 2px;}
.title a{ font-weight:bold; color:#c24f00; text-decoration:none; font-size:14px;}
.discptn a{ text-decoration:none; color:#999;}
.link a{ color:#008000; text-decoration:none;}
-->
</style>
</head>
<body>
<div style="text-align:center;">
<div style="display:none;"><img src="ajax-loader.gif"  /></div>
  <h1 style="color:#CCC;"><a href="http://www.webinfopedia.com/php-upload-immage-to-database.html" style="color:#EEDDCA; text-decoration:none; font-size:18px;"></a></h1></div>
<div class="maindiv">
<div class="innerbg">
<form method="post" enctype="multipart/form-data" action="uploadPhoto.php"><table width="100%" border="0" cellpadding="2" cellspacing="2">
  <tr>
    <td colspan="3" align="left" valign="middle" bgcolor="#008000"><div style="margin:0px 10px; font-weight:bold; color:#FFF; font-size:16px;">Ajax PHP image upload to database</div></td>
    </tr>
  <tr>
  <td width="26%" ><strong>Image</strong></td>
  <td width="2%" >:</td>
  <td width="72%" ><label>
    <input type="file" name="image" id="image" />
  </label></td>
  </tr>
  <tr>
  <td width="26%" >&nbsp;</td>
  <td width="2%" >&nbsp;</td>
  <td width="72%" ><label>
    <input type="submit" name="button" id="button" value="Upload" />
  </label></td>
  </tr>
  <tr>
  <td colspan="3" >
  <?php
  if(@$_REQUEST['img']!='')
  {
  require_once("connect/config.php");
  $imgtest="SELECT * FROM photouploaddemo WHERE filename='".base64_decode($_REQUEST['img'])."'";
  $showphoto=mysql_query($imgtest);
  $shownum=mysql_num_rows($showphoto);




  if($shownum>=1)
  {
    $show=mysql_fetch_array($showphoto);  
    ?>
    <img src="images/<?php echo $show['filename']; ?>" />
    <?php
  }
  }
  if(@$_REQUEST['mgs']=='error')
  {
      ?>
      <span style="color:#F00;"> Some Error !!!</span>
      <?php
  }
  ?>
  </td>
  </tr>
</table></form>
</div>
</div>
<a href="index.php?id=<?php echo $nextid; ?> ">Next</a>
<div style="padding:4px; text-align:right;"><h1><a href="http://www.webinfopedia.com/php-upload-immage-to-database.html" style="font-weight:bold; color:#FFF; padding:4px 8px; background:#333; text-decoration:none;">Go back to tutorial</a></h1></div></body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.