Forum Moderators: coopster

Message Too Old, No Replies

getting 2 webcam images next to eachother.

webcam table..

         

john1000

12:35 am on Aug 28, 2006 (gmt 0)

10+ Year Member



Hello,

I didnt fully made this,i had some help...
this is a simple webcam script and like to extend it a bit..
at this moment it pulls the stored cams/images from the db but in 1 line,vertical.

so how or what should i change to put 2 images side by side like :

cam1 cam2
cam3 cam4
cam5 cam6

etc......?

include("include/config.php");
$result = mysql_query("SELECT * FROM rocam") or die(mysql_error());
while( $row = mysql_fetch_array( $result ) ) {
$image = $row['cam'];
$image1 = "<a href=\"#\" onClick=\"chw=window.open('$image','NewWindow','resizable=no,scrollbars=yes,status=no,width=320,height=240'); if (chw!= null) chw.focus(); return false\"><img src=\"$image\" border=\"0\" width=\"200\" height=\"150\"><a/>";
echo "<center>";
echo $image1;
echo "<br>";
echo "<b>Description: ".$row['des'];
echo "</b>";
echo "</center>";
}

/////////////

Table sample....

CREATE TABLE `rocam` (
`number` int(11) NOT NULL auto_increment,
`name` text NOT NULL,
`website` text NOT NULL,
`cam` longtext NOT NULL,
`des` longtext NOT NULL,
PRIMARY KEY (`number`)
) TYPE=MyISAM AUTO_INCREMENT=1;

jatar_k

4:12 pm on Aug 28, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



this is just an html issue

build your images into a table and that will fix it

you could try some of this code, it will work, but you will have to weave it into your loop

Create a Dynamic Table from mysql result [webmasterworld.com] msg#1300710

john1000

6:21 pm on Aug 28, 2006 (gmt 0)

10+ Year Member



thank you...
that looks promissing...

thank you.

john

Psychopsia

12:14 am on Aug 29, 2006 (gmt 0)

10+ Year Member



echo '<table>';

$col = 0;
while ($row = ...)
{
if (!$col)
{
echo '<tr>';
}

echo '<td>show all info here</td>';

if (!$col)
{
echo '</tr>';
}

$col = ($col == 1)? 0 : $col + 1;
}

echo '</table>';