Hi,
I have done a random script which works perfectly fine. The problem that i'm having with is the picture.
Below is the script
[PHP]include("connec t.php");
mySQL_Select_DB ("db220854136") ; //..to DB
$potms = MySQL_Query("SE LECT * FROM listings"); //now we get all from our table and store it
MySQL_Close($li nk); //there`s no need for connection, so we should close it
$potm_array = ''; //sets variables to "zero" values
$i = 0;
while ($entry = MySQL_Fetch_Arr ay($potms)) //now we go through our DB
{
$potm_array[$i] = $entry; //our temporary array from which we will random pick a field key
$i++; //now we increment our field key
}
$potm_id = array_rand($pot m_array); //picks a random key from array
$potm = $potm_array[$potm_id][address]; //now we have stored our Post Of The Moment in $potm
$potm2 = $potm_array[$potm_id][description]; //now we have stored our Post Of The Moment in $potm
$potm3 = $potm_array[$potm_id][thumb];
$potm4 = $potm_array[$potm_id][v_id];
$img_chk = "SELECT name FROM thumb WHERE v_id = $potm4";
$img_chk_result = mysql_query($im g_chk, $link) or die ("Couldn't execute query");
$row5 = mysql_fetch_arr ay($img_chk_res ult);
$name = $row5["name"];
$imgName = "$thumb_path"." $name";
$getsize = getimagesize($i mgName);
$size = $getsize[3];
$alt = "";
if ($getsize[2] == 2) {
if(($sold_over_ images == 1)&&(freetype( ) == 1)){
if($status != "A"){
$item_thumb = "<img src=\"thumb_sol d.php?v_id=$pot m4&status=$stat us\" alt = \"$alt\" $size border=0>";
}else{
$item_thumb = "<img src=\"$thumb_ur l$name\" alt = \"$alt\" $size border=0>";
}
}else{
$item_thumb = "<img src=\"$thumb_ur l$name\" alt = \"$alt\" $size border=0>";
}
} else {
$item_thumb = "<img src=\"$thumb_ur l$name\" alt = \"$alt\" width=\"$maxThu mbWidth\" border=0>";
}
if ($count != 1) {
$bar = "<tr><td colspan=\"6\">< hr></td></tr>";
} else {
$bar = "";
}
echo "$potm <br>";
echo "$potm2<br> ";
echo "$item_thum b;"[/PHP]
Cheers :-)
I have done a random script which works perfectly fine. The problem that i'm having with is the picture.
Below is the script
[PHP]include("connec t.php");
mySQL_Select_DB ("db220854136") ; //..to DB
$potms = MySQL_Query("SE LECT * FROM listings"); //now we get all from our table and store it
MySQL_Close($li nk); //there`s no need for connection, so we should close it
$potm_array = ''; //sets variables to "zero" values
$i = 0;
while ($entry = MySQL_Fetch_Arr ay($potms)) //now we go through our DB
{
$potm_array[$i] = $entry; //our temporary array from which we will random pick a field key
$i++; //now we increment our field key
}
$potm_id = array_rand($pot m_array); //picks a random key from array
$potm = $potm_array[$potm_id][address]; //now we have stored our Post Of The Moment in $potm
$potm2 = $potm_array[$potm_id][description]; //now we have stored our Post Of The Moment in $potm
$potm3 = $potm_array[$potm_id][thumb];
$potm4 = $potm_array[$potm_id][v_id];
$img_chk = "SELECT name FROM thumb WHERE v_id = $potm4";
$img_chk_result = mysql_query($im g_chk, $link) or die ("Couldn't execute query");
$row5 = mysql_fetch_arr ay($img_chk_res ult);
$name = $row5["name"];
$imgName = "$thumb_path"." $name";
$getsize = getimagesize($i mgName);
$size = $getsize[3];
$alt = "";
if ($getsize[2] == 2) {
if(($sold_over_ images == 1)&&(freetype( ) == 1)){
if($status != "A"){
$item_thumb = "<img src=\"thumb_sol d.php?v_id=$pot m4&status=$stat us\" alt = \"$alt\" $size border=0>";
}else{
$item_thumb = "<img src=\"$thumb_ur l$name\" alt = \"$alt\" $size border=0>";
}
}else{
$item_thumb = "<img src=\"$thumb_ur l$name\" alt = \"$alt\" $size border=0>";
}
} else {
$item_thumb = "<img src=\"$thumb_ur l$name\" alt = \"$alt\" width=\"$maxThu mbWidth\" border=0>";
}
if ($count != 1) {
$bar = "<tr><td colspan=\"6\">< hr></td></tr>";
} else {
$bar = "";
}
echo "$potm <br>";
echo "$potm2<br> ";
echo "$item_thum b;"[/PHP]
Cheers :-)
Comment