hi friends
i am having a problem with mysql stored procedure, am trying to call procedure from php but i only get errors... any help will be greatly appreciated.. below is my code and errors am getting
CODE I UDE IN CREATING PROCEDURE
DELIMITER //
CREATE PROCEDURE TrackAlbumAndArtist (IN TheAlbumID INT(11), IN TheCategory VARCHAR(50))
BEGIN
SELECT `upload2`.`id`, `upload2`.`name` , `upload2`.`type` , `upload2`.`size` , `upload2`.`path` , `upload2`.`category` , `upload2`.`description` , `upload2`.`number_of_downloads` , `upload2`. `Title` , `upload2`. `artist_icon` , `upload2`. `Votes` , `upload2`. `albumID` , `upload2`.`date` , `upload2`.`artist_id`, `albums`.`id` ,`albums`.`album_name`,`albums`.`date_realeased`,`albums`.`artistID`,`albums`.`total_songs_in_album` ,`albums`.`description`,`albums`.`artwork` , `artists`.`id` , `artists`.`name` , `artists`.`country` , `artists`.`music_type` , `artists`.`birth_day` , `artists`.`spouse_name` , `artists`.`started_singing_since` , `artists`.`sex` , `artists`.`brief_description` , `artists`.`stage_name` , `artists`.`marital_status` , `artists`.`aka` , `artists`.`image`FROM `upload2`
INNER JOIN `albums` ON `upload2`.`albumID` = `albums`.`id`
INNER JOIN `artists` ON `albums`.`artistID` = `artists`.`id`
where `upload2`.`category` = TheCategory and `upload2`. `albumID` = TheAlbumID ORDER BY `upload2`.`id` DESC;
END
it create the procedure succesfully..
CODE TO CALL STORED PROCEDURE
........................
<?php
include('/includes/scConfig.php');
$page = (int) (!isset($_GET['p'])) ? 1 : $_GET['p'];
# sql query
$thealbumID ='3';
$MusicCategory ='Audios';
$tr = mysql_query("call TrackAlbumAndArtist('".$thealbumID."','".$MusicCategory."')", $db);
$sql = "call TrackAlbumAndArtist('".$thealbumID."','".$MusicCategory."')";
# find out query stat point
$start = ($page * $limit) - $limit;
# query for page navigation
if( mysql_num_rows(mysql_query ($sql)) > ($page * $limit) ){
$next = ++$page;
}
$query = mysql_query($sql . " LIMIT {$start}, {$limit}");
if (mysql_num_rows($query) < 1) {
header('HTTP/1.0 404 Not Found');
echo 'oops.. Page not found!';
exit();
}
?>
my scConfig File
<?php
define('DB_HOST', 'localhost');
define('DB_USER', 'west');
define('DB_PASS', 'west@53');
define('DB_NAME', 'westMusic');
$limit = 10; #item per page
# db connect
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die('Could not connect to MySQL DB ') . mysql_error();
$db = mysql_select_db(DB_NAME, $link);
?>
what am i doing wrong when i execute it it gives me these errors
Warning: mysql_query() expects parameter 2 to be resource, boolean given in C:\xampp\htdocs\53Africa\music.php on line 10
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\53Africa\music.php on line 16
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\53Africa\music.php on line 20
oops.. Page not found!
please am i doing something wrong here....
Thanks in advance