Post by Austen on Jan 30, 2010 5:50:05 GMT -8
$theurl = file_get_contents('box.txt');
$sql = mysql_query("SELECT * FROM `shouts`");
while($data = mysql_fetch_array($sql)){
//counts every row
$counting = $counting + 1;
} //end while
// if the count comes back greater than 10, then we select the last
// 10 shouts for display.
if($counting > 10){
$countlessten = $counting - 9;
$sql = mysql_query("SELECT * FROM `shouts` ORDER BY `shouts`.`id` ASC LIMIT $countlessten,10");
}else{
//else it doesn't matter, there's less than 10!
$sql = mysql_query("SELECT * FROM `shouts` ORDER BY `shouts`.`id` ASC LIMIT 10");
}
while($data = mysql_fetch_array($sql)){
//my timestamp field in the database is basically useless to me unless
//I parse it. The following code parses the timestamp into things I
//can use.
$timestamp = $data['timestamp'];
$postedyear=substr($timestamp,0,4);
$postedmonth=substr($timestamp,5,2);
$postedday=substr($timestamp,8,2);
$postedtime=substr($timestamp,11,5);
$newpostedtime = "";
$nomilitary=substr($postedtime,0,2);
I want to change
if($counting > 10){
$countlessten = $counting - 9;
$sql = mysql_query("SELECT * FROM `shouts` ORDER BY `shouts`.`id` ASC LIMIT $countlessten,10");
}else{
//else it doesn't matter, there's less than 10!
$sql = mysql_query("SELECT * FROM `shouts` ORDER BY `shouts`.`id` ASC LIMIT 10");
}
to
if($counting > 10){
$countlessten = $counting - 9;
$sql = mysql_query("SELECT * FROM `shouts` ORDER BY `shouts`.`id` WHERE theurl = $theurl ASC LIMIT $countlessten,10");
}else{
//else it doesn't matter, there's less than 10!
$sql = mysql_query("SELECT * FROM `shouts` ORDER BY `shouts`.`id` WHERE theurl = $theurl ASC LIMIT 10");
}
I've even added '' marks between $theurl but still not luck.
All I get is an error.