PDA

View Full Version : script problem


0810
10-17-2002, 07:32 PM
hi how are you doing? I woud like to run this code but it is not working

Do you have any idea to help my script??


Thanks
my php is 4.22
Here is my code


<?php
$con=mysql_connect("localhost","itohideo",1234) or die("couldn't connect'");
$db=mysql_select_db("itohideo",$con) or die("couldn't select'");
$num_displayed=3;
$sql="select * from myimage limit $num_displayed";
$result=mysql_query($sql,$con)or die("couldn't excute");
while($row=mysql_fetch_array($result)){

$images[]=array("link"=>$row['link'],"mypic"=>$row['mypic']);
}
$count=$_POST["count"];
$pick=$_POST["pick"];

$count=count($images);
$pick=rand(0,$count);

echo "<a href=\"". $images[$pick]["link"]. "\"><img src=\"".$images[$pick]["mypic"]."\" border=0 alt=\"\"><br>";

?>

Spookster
10-17-2002, 10:03 PM
DO NOT CROSSPOST YOUR QUESTION!

You already have this discussion open here:

http://codingforums.com/showthread.php?s=&threadid=8180

Closing thread...