I have afunction to retrieve data and it gives error.
Please correct me!
public function getswachapter($book, $chapter){
//SELECT * FROM table1 INNER JOIN table2 ON table1.id=table2.id;
//remember to sanitize inputs
$sql = mysql_query("SELECT * FROM kiswahili WHERE Chapter = '{$chapter}' AND Book = '{$book}'")or die(mysql_error());
$limit = mysql_num_rows($sql);
$query = "SELECT kiswahili.Chapter, kiswahili.Verse, kiswahili.Scripture, vitabu.Name FROM kiswahili WHERE kiswahili.Chapter = '{$chapter}' AND kiswahili.Book = '{$book}' INNER JOIN vitabu ON kiswahili.Book=vitabu.Book LIMIT {$limit} ";// INNNER JOIN vitabu ON kiswahili.id = vitabu.id
echo $query;
$res = mysql_query($query) or die(mysql_error());
return $res;
}