Marsha Posted April 25, 2010 Share Posted April 25, 2010 Can anybody spot any big mistakes that would lead to my code not working? Have a good look please echo '<a href="' . $scripturl . '?action=downloads;sa=downfile&id=', $context['downloads_file']['ID_FILE'], '">', ($context['downloads_file']['fileurl'] == '' ? $context['downloads_file']['orginalfilename'] : $txt['downloads_app_download']), mysql_query("UPDATE smf_members SET karmaGood = karmaGood + 1 WHERE ID_MEMBER = $context[downloads_file][iD_MEMBER]"), '</a>'; Link to comment https://forums.phpfreaks.com/topic/199680-mysql-and-php-together-im-kinda-new-to-php/ Share on other sites More sharing options...
cags Posted April 25, 2010 Share Posted April 25, 2010 Firstly that is one stupidly long line of code. Secondly care to define doesn't work? The combination of concatenation and using the comma to pass extra parameters to echo is a little confusing, but should work. Having mysql_query in the middle of the line will output a 1 on success, but nothing otherwise. If ID_MEMBER is not an integer it will require quotes around it, but I'm guessing it is. The two dimensional array will not be accessed correctly in the string I don't believe. mysql_query("UPDATE smf_members SET karmaGood = karmaGood + 1 WHERE ID_MEMBER = $context[downloads_file][iD_MEMBER]") // should probably be mysql_query("UPDATE smf_members SET karmaGood = karmaGood + 1 WHERE ID_MEMBER = {$context['downloads_file']['ID_MEMBER']}") Link to comment https://forums.phpfreaks.com/topic/199680-mysql-and-php-together-im-kinda-new-to-php/#findComment-1048025 Share on other sites More sharing options...
Marsha Posted April 25, 2010 Author Share Posted April 25, 2010 Thats exactly why I didnt explain because you just sorted the problem straight away hehe. I knew it would be obvious. Thank you very much Link to comment https://forums.phpfreaks.com/topic/199680-mysql-and-php-together-im-kinda-new-to-php/#findComment-1048026 Share on other sites More sharing options...
cags Posted April 25, 2010 Share Posted April 25, 2010 Excellent. Can you please mark the topic as solved using the 'Mark Solved' button, which is located at the bottom left of the threads that you started. Link to comment https://forums.phpfreaks.com/topic/199680-mysql-and-php-together-im-kinda-new-to-php/#findComment-1048028 Share on other sites More sharing options...
Marsha Posted April 25, 2010 Author Share Posted April 25, 2010 I can indeed. Thanks again Link to comment https://forums.phpfreaks.com/topic/199680-mysql-and-php-together-im-kinda-new-to-php/#findComment-1048030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.