Pagination Without Limit in Query

Reply

Join Date: Sep 2007
Posts: 1,542
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 137
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Posting Virtuoso
 
0
  #21
30 Days Ago
Originally Posted by sam023 View Post
Now it throughing this error..

Unknown column 'id_tariffplan' in 'where clause'
That is a basic mysql error which means mysql has been told to search for a column named id_tariffplan however no such column exists. A common problem for this is mis-spelling the column and not having the column inserted in the first place.
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*`
My favourite PC. - Oopy Doopy Do 2U2!
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 557
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 64
network18 network18 is offline Offline
Posting Pro
 
0
  #22
30 Days Ago
Originally Posted by sam023 View Post
Now it throughing this error..

Unknown column 'id_tariffplan' in 'where clause'
are you passing that variable at the time of calling.
Post it here, how you calling the procedure from php
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 557
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 64
network18 network18 is offline Offline
Posting Pro
 
-1
  #23
30 Days Ago
id_tariffplan is the variable to hold the first parameter value passed to the stored procedure.
So its not a column name.Either the error is "unknown column idtariffplan" , (where idtariffplan is the column name) and id_tariffplan will just assign its value to it in the where clause.
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 121
Reputation: sam023 is an unknown quantity at this point 
Solved Threads: 2
sam023 sam023 is offline Offline
Junior Poster
 
-1
  #24
29 Days Ago
  1. DROP PROCEDURE IF EXISTS `dd`.`view_ratecard`$$
  2.  
  3. CREATE DEFINER=`root`@`localhost` PROCEDURE `view_ratecard`(id_tariffplan INT(11),page_size INT(2),row_start INT(2),country_code CHAR(30))
  4. BEGIN
  5. SET @lim = CONCAT(' LIMIT ', row_start, ',', page_size);
  6.  
  7. if(country_code="") THEN
  8. SET @q = "select dialprefix,destination,rateinitial,initblock,billingblock,id_trunk,grace,idtariffplan,id from
  9. cc_ratecard where idtariffplan=id_tariffplan and rate_version='0' ORDER by destination asc";
  10. ELSE
  11. SET @q = "select dialprefix,destination,rateinitial,initblock,billingblock,id_trunk,grace,idtariffplan,id from
  12. cc_ratecard where idtariffplan=id_tariffplan and rate_version='0' and dialprefix like concat(country_code,'%') ORDER by destination asc";
  13.  
  14. END if ;
  15.  
  16. SET @q = CONCAT(@q, @lim);
  17. PREPARE st FROM @q;
  18. EXECUTE st;
  19. DEALLOCATE PREPARE st;
  20. END$$
  21. DELIMITER ;
  22. END if ;

This is your Store procedure..

i m just calling in database by call function

call view_ratecard_php('1','10','0','')

and it throughing the error
Last edited by sam023; 29 Days Ago at 4:55 am.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 121
Reputation: sam023 is an unknown quantity at this point 
Solved Threads: 2
sam023 sam023 is offline Offline
Junior Poster
 
0
  #25
29 Days Ago
Originally Posted by network18 View Post
id_tariffplan is the variable to hold the first parameter value passed to the stored procedure.
So its not a column name.Either the error is "unknown column idtariffplan" , (where idtariffplan is the column name) and id_tariffplan will just assign its value to it in the where clause.
Exactly...

id_tariffplan is variable and idtraiffplan is column name..!!! but still i m getting this error
  1. Unknown column 'id_tariffplan' in 'where clause'

i think it is because here you are writing query in string format..!! by string format i mean query in double quotes""... then how can u pass variable in it..?

i think for passing variable in string we need '?'

i have already a SP for limit..! but i just to try your SP..!!
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 557
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 64
network18 network18 is offline Offline
Posting Pro
 
0
  #26
16 Days Ago
No.MySQL throws this error , when we try to specify a column name not present in the table structure.
So make sure the table structure is fine
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 121
Reputation: sam023 is an unknown quantity at this point 
Solved Threads: 2
sam023 sam023 is offline Offline
Junior Poster
 
0
  #27
15 Days Ago
Originally Posted by network18 View Post
No.MySQL throws this error , when we try to specify a column name not present in the table structure.
So make sure the table structure is fine
  1. SELECT dialprefix,destination,rateinitial,initblock,billingblock,id_trunk,grace,idtariffplan,id FROM
  2.  
  3. cc_ratecard WHERE idtariffplan=id_tariffplan


Thats what i m saying.. Mysql taking id_tariffplan as column not as variable.. and there is no column name as id_tariffplan...thats why it is throwing that error..!! may be because it in string format..!!!

even if u run above query out of SP(directly).. it will throw same error..!!!
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 121
Reputation: sam023 is an unknown quantity at this point 
Solved Threads: 2
sam023 sam023 is offline Offline
Junior Poster
 
0
  #28
14 Days Ago
i hope now getting me..!
Reply With Quote Quick reply to this message  
Reply

Message:




Views: 954 | Replies: 27
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC