Hello guys I'm stucked in a point and I need your help. I want to change SQL QUERY for each $_GET parameters. I'm using this:
<?
if (isset($_GET['page']) ) {
$pageno = $_GET['page'];
} else {
$pageno = 1;
} // if
$query = mysql_query("SELECT count(id) FROM m3_music_mp3");
$query_data = mysql_fetch_row($query);
$numrows = $query_data[0];
$rows_per_page = 30;
$lastpage = ceil($numrows/$rows_per_page);
$pageno = (int)$pageno;
if ($pageno > $lastpage) {
$pageno = $lastpage;
} // if
if ($pageno < 1) {
$pageno = 1;
} // if
$limit = 'ORDER BY id DESC LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page;
$query = mysql_query("SELECT * FROM m3_music_mp3 $limit");
?>
This does IF music.php?page=1 is set $query = "SELECT * FROM m3_music_mp3 ORDER BY id DESC LIMIT X,X" but I want to do is IF music.php?word=A&page=1 set $query = "SELECT * FROM m3_music_mp3 WHERE title LIKE '$word%' ORDER BY id DESC LIMIT X,X"
I tried
if(isset($_GET['word']) && isset($_GET['page'])) {
$limit .= 'WHERE....'
}
something like but does not works. thank you. and sorry for bad english & poor php knowledge of me