Forum Moderators: coopster
This is what is did, but it is not working
<?php
$c=connect();
$query="select img_name from styles";
$sql=mysql_query($query);
$result=mysql_num_rows($sql);
$nrow=ceil($result/3);
echo '<table border="5" align="center" width="55%" height="50%" BORDERCOLOR="#C6C6C6" >';
for($r=1;$r<=$nrow;$r++)
{
echo '<tr>';
for($d=1;$d<=3;$d++)
{
$obj=mysql_fetch_object($sql);
echo '<td border="1" width="33%"><img width="70%" height="70%" src=\images\"".$obj->img_name. "\"> </td>';
}
echo '</tr>';
}
echo '</table>';
?>
Please help me
thanks in advance
PHP Variables will not work within single quotes, so this line won't work
echo '<td border="1" width="33%">
<img width="70%" height="70%" src=\images\"".$obj->img_name. "\">
</td>';
Try this
echo '<td border="1" width="33%">
<img width="70%" height="70%" src="/images/'.$obj->img_name.'">
</td>';
[edited by: Anyango at 8:12 am (utc) on Sep. 5, 2008]
can you tell me how to do this
I clicked on a image now i need this image to be shown in the next url with width "590px" and height "270px"
In the first page think they are 9 images
when i click on any one image it should show in the next page with with width "590px" and height "270px"
here is what i did in the first url (first page)
<form method='POST' action='img.php'>
<?php
$c=connect();
$query="select img_name from styles";
$sql=mysql_query($query);
$result=mysql_num_rows($sql);
$nrow=ceil($result/3);
echo '<table border="5" align="center" width="55%" height="50%" BORDERCOLOR="#C6C6C6" >';
for($r=1;$r<=$nrow;$r++)
{
echo '<tr>';
for($d=1;$d<=3;$d++)
{
$obj=mysql_fetch_object($sql);
$cimage="images/".$obj->img_name;
echo '<td border="1" width="25px" height="25px" name="img1"><a href="img.php"><img width="190px" height="82px" src='.$cimage.'></a></td>';
}
echo '</tr>';
}
echo '</table>';
?>
</form>
here is the second url ( second page)
<form action='POST'>
<table border="5" align="center" width="55%" height="50%" BORDERCOLOR="#C6C6C6" >
<tr>
<td><img src="<?php $_POST['img1'] ?>" width="590px" height="270px"></td>
</tr>
</table>
</form>
thanks
Page 1
---------
<?php
$c=connect();
$query="select img_name from styles";
$sql=mysql_query($query);
$result=mysql_num_rows($sql);
$nrow=ceil($result/3);
echo '<table border="5" align="center" width="55%" height="50%" BORDERCOLOR="#C6C6C6" >';
for($r=1;$r<=$nrow;$r++)
{
echo '<tr>';
for($d=1;$d<=3;$d++)
{
$obj=mysql_fetch_object($sql);
$imageSrc=$obj->img_name;
$cimage="images/".$obj->img_name;
echo '<td border="1" width="25px" height="25px" name="img1"><a href="img.php?src=$imageSrc"><img width="190px" height="82px" src='.$cimage.'></a></td>';
}
echo '</tr>';
}
echo '</table>';
?>
Page 2
------
<table border="5" align="center" width="55%" height="50%" BORDERCOLOR="#C6C6C6" >
<tr>
<td><img src="images/<?php echo $_GET['src']; ?>" width="590px" height="270px"></td>
</tr>
</table>
can you please in paging part
i need the 9 images in each page when 9 images filled in a table then it show the next images in the nexe page like this
[Previous] ..4 5 6 7 8 .[next]
here is my code
<?php
function connect()
{
$dbhost='localhost';
$dbuser='';
$dbpass='';
$conn= mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'.mysql_error());
$dbname='hakman';
mysql_select_db($dbname);
return $conn;
}
?>
<form method='GET' action='img.php'>
<?php
$c=connect();
$query="select img_name from styles";
$sql=mysql_query($query);
$result=mysql_num_rows($sql);
$nrow=ceil($result/3);
echo '<table border="5" align="center" width="55%" height="60%" BORDERCOLOR="#C6C6C6" >';
for($r=1;$r<=$nrow;$r++)
{
echo '<tr>';
for($d=1;$d<=3;$d++)
{
$obj=mysql_fetch_object($sql);
$imageSrc=$obj->img_name;
$cimage="images/".$obj->img_name;
echo '<td border="1" width="25px" height="25px" name="img1"><a href="img.php?src='.$imageSrc.'"><img width="187px" height="109px" src='.$cimage.'></a></td>';
}
echo '</tr>';
}
echo '</table>';
?>
</form>
iam waiting for ur reply please
thanks in advance
[edited by: eelixduppy at 12:32 pm (utc) on Sep. 9, 2008]
[edit reason] removed credentials [/edit]
here is my code
<?php
function connect()
{
$dbhost='localhost';
$dbuser='';
$dbpass='';
$conn= mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'.mysql_error());
$dbname='hakman';
mysql_select_db($dbname);
return $conn;
}
?>
<form method='GET' action='img.php'>
<?php
$c=connect();
$query="select img_name from styles";
$sql=mysql_query($query);
$result=mysql_num_rows($sql);
$nrow=ceil($result/3);
echo '<table border="5" align="center" width="55%" height="60%" BORDERCOLOR="#C6C6C6" >';
for($r=1;$r<=$nrow;$r++)
{
echo '<tr>';
for($d=1;$d<=3;$d++)
{
$obj=mysql_fetch_object($sql);
$imageSrc=$obj->img_name;
$cimage="images/".$obj->img_name;
echo '<td border="1" width="25px" height="25px" name="img1"><a href="img.php?src='.$imageSrc.'"><img width="187px" height="109px" src='.$cimage.'></a></td>';
}
echo '</tr>';
}
echo '</table>';
?>
</form>
thanks in advance
this what i did i am getting all the images in one page it self
i need only 9 images in one page and at the bottom i need the navigation bar
please help me out
here is my code
<html>
<title> Fox Innovas </title>
<body bgcolor="black">
<table BORDERCOLOR="#C6C6C6" width="100%" bgcolor='darkblue'>
<tr width="60%"><td bgcolor="DarkBlue"><font size="30" face="Monotype Corsiva" color="CadetBlue">Hakman & Co </font></td>
<td>
<tr></tr>
<tr>
<td width="65%"></td>
<td width="10%" align="Right"><font face="Garamond" color="CadetBlue"><a href="hakman3.php"><b>Login Page ¦</b></a></font></td>
<td width="15%" align="Right"><font face="Garamond" color="CadetBlue"><a href="about.php"><b>About FoxInnovas ¦</b></a></font></td>
<td width="11%" align="Left" ><font face="Garamond" color="CadetBlue"><a href="contact.php"><b>Contact Us</b></a></font></td>
</tr>
</td>
</tr>
<!--<img src="C:\apache2_2\htdocs\fox.jpg" width="60" height="50">-->
</table>
</br>
<?php
function connect()
{
$dbhost='localhost';
$dbuser='';
$dbpass='';
$conn= mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'.mysql_error());
$dbname='hakman';
mysql_select_db($dbname);
return $conn;
}
?>
<form method='GET' action='img.php'>
<?php
$c=connect();
$query="select img_name from styles";
$sql=mysql_query($query);
$result=mysql_num_rows($sql);
$limit=9;
$nrow=ceil($result/3);
$query=mysql_query("select img_name from styles".($page-1)*$limit.",$limit");
echo '<table border="5" align="center" width="55%" height="60%" BORDERCOLOR="#C6C6C6" >';
for($r=1;$r<=$nrow;$r++)
{
echo '<tr>';
for($d=1;$d<=3;$d++)
{
$obj=mysql_fetch_object($sql);
$imageSrc=$obj->img_name;
$cimage="images/".$obj->img_name;
echo '<td border="1" width="25px" height="25px" name="img1"><a href="img.php?src='.$imageSrc.'"><img width="187px" height="109px" src='.$cimage.'></a></td>';
}
echo '</tr>';
}
echo '</table>';
$Nav="";
For($i = 1 ; $i <= $NumberOfPages ; $i++) {
If($i == $page) {
$Nav .= "<B>$i</B>";
}Else{
$Nav .= "<A HREF=\"Search.php?page=" . $i . "&SearchString=" .urlencode($SearchString) . "\">$i</A>";
}
}
Echo "<BR><BR>" . $Nav;
?>
</form>
<a href="hakman3.php"><font color= "Blue">Back to login Page</font></a>
</body>
</html>
[edited by: eelixduppy at 1:23 pm (utc) on Sep. 10, 2008]
[edit reason] removed credentials [/edit]