putpictures in 4 <td>'s and 4 <tr>'s

-5
down vote
favorite
i can do the database displaying 6 random pictures i am just having trouble picking 6 random pictures out of a database and display them in different html table data in different table rows

like this

 [php]echo "<br /> <br/> <br/>";
 echo "<tr>";
 echo "<td>&nbsp</td><td>&nbsp</td><td>pic1</td><td>&nbsp</td></tr>";
 echo "<td>&nbsp</td><td>pic2</td><td>&nbsp</td><td>pic3</td></tr>";
 echo "<td>&nbsp</td><td>pic4</td><td>&nbsp</td><td>pic5</td></tr>";
 echo "<td>&nbsp</td><td>&nbsp</td><td>pic6</td><td>&nbsp</td></tr>";
 echo "</tr>";[/php]

if the images in the database have an unique ID you call call the rand() function to fetch a ramdon ID from the given starting number to the max number

like this
[php]
echo rand(1,20);//will output any number from 1-20. if keep pressing f5 u will see it changing
[/php]

right that is correct but is there a way to put them in different parts of that code when you call six pictures to be randomly selected at 1 time in different parts of this code that i put

echo "


"; echo ""; echo "&nbsp &nbsp pic1 &nbsp "; echo "&nbsp pic2 &nbsp pic3"; echo "&nbsp pic4 &nbsp pic5"; echo "&nbsp &nbsp pic6 &nbsp"; echo "";

I don’t quite understand what you want to do

there are 6 pictures and i want them to be in like a design not just in a line down or across

but it needs to be from the database not from an array()

unless an array can be a where clause in a mysql select i have tried maybe i am doing it wrong

I still don’t get it. can you show an example. like a do an sketch on paint or photshop

i can do it with an array

http://shuffle.ezewh.com/sh5.php

this is from a database but i have to make it an array() with variables to equal each array that is made

i just cant make the variable to display the same image on another part of the page with the name of it from the database

is there a way to display the same variable after its has been shuffled and put into an array

shuffle = Shuffle an array, which means it will change index orders. if you want to display an array on the first original order before shuffle, just back it up on another array.

[php]
$mybackup = $arraytobeshuffle(1,1,1,45,45,45,4,4,);

shuffle($arraytobeshuffle);
[/php]

will that work for each shuffle

it will always be shuffling

i dont know try making backup variable before every shuffle.

i will try that tomorrow
thanks wilson

well i had to make a workaround as in the where clause for each line of the second piece of the echo page
it works right i guess i was just frusterated that day i got it to work

and that movie night breed if you like b movies of horror it is a good film for you wilson

[php]
@$c1 = $cards[0];

<? $sql2 = "select * from card where tpic='$c1'"; $result2 = mysql_query($sql2); while($row2 = mysql_fetch_array($result2)) { ?>
		<tr> <td width="450" colspan="2">&nbsp;</td> </tr> <tr> <td colspan="2" width="450"><h3><?echo $row2['tcard'];?></h3></td> </tr> 
		<tr> <td width="17%"><img border="0" src="<?echo $row2['tpic'];?>" width="60" height="110" > <br>&nbsp;</td> <td width="40%">       
		<p>. </p> &nbsp;</td> </tr> 
		<?}?>

[/php]

and so on 6 times which isnt bad just thought there was an easier way but it works thats the main thing

nice and i will watch the movie

Sponsor our Newsletter | Privacy Policy | Terms of Service