chomedey Posted February 4, 2010 Share Posted February 4, 2010 Hello all, This is my first posting to this forum. Can anyone tell me what is wrong with this code and how to make it right. echo '<p><a href="my_deepshares.php?ln=$limit_number+10>Next 10</a></p>'; I am wanting to get 10 more entries from an SQL table each time the user hits "more" and have set up a variable called $limit_number that is then used in the SQL query. But when I try to pass the $limit_number variable plus 10 in the URL to the same page it won't substitute the variable number for the variable name. So I end up with my_deepshares.php?ln=$limit_number in the sent URL instead of ln=10 (say). I have tried every kind of bracketing and quote permutation I can think of - and still no luck. Any help much appreciated. Cheers. Link to comment https://forums.phpfreaks.com/topic/190961-using-variables-in/ Share on other sites More sharing options...
RussellReal Posted February 4, 2010 Share Posted February 4, 2010 its quite simple really, you're using single quotes, which DO NOT evaluate variables.. use double quotes (") Link to comment https://forums.phpfreaks.com/topic/190961-using-variables-in/#findComment-1006998 Share on other sites More sharing options...
chomedey Posted February 4, 2010 Author Share Posted February 4, 2010 its quite simple really, you're using single quotes, which DO NOT evaluate variables.. use double quotes (") OK, thanks, that works for the variable. Now is there any way of adding 10 to the variable within the href or do I have to change the variable before I use it? Thanks again. Julian Link to comment https://forums.phpfreaks.com/topic/190961-using-variables-in/#findComment-1007004 Share on other sites More sharing options...
RussellReal Posted February 4, 2010 Share Posted February 4, 2010 ".($variable + 10)." Link to comment https://forums.phpfreaks.com/topic/190961-using-variables-in/#findComment-1007006 Share on other sites More sharing options...
chomedey Posted February 4, 2010 Author Share Posted February 4, 2010 Awesome. Thanks so much. J Link to comment https://forums.phpfreaks.com/topic/190961-using-variables-in/#findComment-1007007 Share on other sites More sharing options...
MadTechie Posted February 4, 2010 Share Posted February 4, 2010 Solved ? if so please "Mark Solved" bottom left Link to comment https://forums.phpfreaks.com/topic/190961-using-variables-in/#findComment-1007030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.