Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by JamesB

  1. Change this,value to this.value in all these: <input type="button" name="no" value="1" onClick="NUMBERS(this,value)"> <input type="button" name="no" value="2" onClick="NUMBERS(this,value)"> <input type="button" name="no" value="3" onClick="NUMBERS(this,value)"> <input type="button" name="no" value="4" onClick="NUMBERS(this,value)"> <input type="button" name="no" value="5" onClick="NUMBERS(this,value)"> <input type="button" name="no" value="6" onClick="NUMBERS(this,value)"> <input type="button" name="no" value="7" onClick="NUMBERS(this,value)"> <input type="button" name="no" value="8" onClick="NUMBERS(this,value)"> <input type="button" name="no" value="9" onClick="NUMBERS(this,value)"> <input type="button" name="no" value="0" onClick="NUMBERS(this,value)"> And if txt variable is supposed to be a number, then change: txt = txt + num; to txt = parseInt(txt) + parseInt(num);
  2. You don't need to use LIKE for those int checks, just do a = comparison. This untested code goes beyond your spec requirements, eg. allowing text filter at same time as district_id filter Edit: Just realized this thread isn't in the PHP section lol.. <?php$hospitalName = 'abcde';$cityId = 0;$districtId = -1;$stateId = 0; $where_ands = array();if($cityId != -1){$where_ands[] = 'city_id = '.$cityId;}if($districtId != -1){$where_ands[] = 'district_id = '.$districtId;}if($stateId != -1){$where_ands[] = 'state_id = '.$stateId;}if($hospitalName != ''){$where_ands[] = 'name LIKE %'.escape_for_like($hospitalName).'%';} $query = 'SELECT * FROM hospitals'.(count($where_ands) > 0 ? ' WHERE '.implode(' AND ', $where_ands) : '');
  3. You still can use the html inline with php, but as Ingolme said you need the .php extension.
  4. A quick google search gave this: https://www.siteground.com/tutorials/magento/import-products.htm I haven't tried it but it talks about an export template or something, I guess you could use this method and convert all your product data to the template format.
  5. JamesB

    Let join issue

    This project tracker is hosted here for <?php htmlspecialchars($project->external_project_username); ?>. So the query was fine, turns out I'd forgotten the word echo lol.
  6. JamesB

    Let join issue

    Hey I can't seem to get this left join to work to retrieve the username from the users table. projects.external_project_user can be 0, with no users.user_id being 0. SELECTprojects.*,users.username AS external_project_username,(SELECT COUNT(*) FROM todo_entries WHERE todo_entries.project_id = projects.project_id AND status = 1) AS entry_count_open,(SELECT COUNT(*) FROM todo_entries WHERE todo_entries.project_id = projects.project_id AND status = 2) AS entry_count_pending_testing,(SELECT COUNT(*) FROM todo_entries WHERE todo_entries.project_id = projects.project_id AND status = 3) AS entry_count_resolved,(SELECT COUNT(*) FROM todo_entries WHERE todo_entries.project_id = projects.project_id AND status = 4) AS entry_count_skippedFROM projectsLEFT JOIN usersON users.user_id = projects.external_project_userWHERE projects.todo_listed = 1ORDER BY `order` DESC
  7. Fixed it. All I needed was Recaptcha.reload(); $('#register_form').ajaxForm({url: base_url+'member/register',type: 'post',success: function(responseText, statusText, xhr, form){$('#register_ajax_container').hide(0);$('#register_form_errors').html(responseText);$('.form_errors').show();Recaptcha.reload();}});
  8. So thanks to this link I now realize the captcha needs to be reloaded for a second attempt. http://stackoverflow.com/questions/21768129/recaptcha-always-failing-on-the-second-time I'm using AJAX for my form, so I've decided to create the script tag in JS and append it to the element upon ajax response, but it's not working. Here's my code: $('#register_form').ajaxForm({ url: base_url+'member/register', type: 'post', success: function(responseText, statusText, xhr, form){ $('#register_ajax_container').hide(0); $('#register_form_errors').html(responseText); $('.form_errors').show(); // reload the captcha $.get(base_url+'member/register_new_captcha', '', function(data){ // this URL retrieves the public key for the captcha var script=document.createElement('script'); script.type='text/javascript'; script.src='http://www.google.com/recaptcha/api/challenge?k='+data; $('#register_captcha_container').html(''); // clear existing captcha (<script> and <noscript>) $('#register_captcha_container').append(script); // add new captcha (<script>) todo: <noscript> too //$('#register_captcha_container').html(data); }); }}); I'm simply not seeing the captcha after a register attempt. Link: http://www.ukscifi.net/uks2/ If you click on Register at top right, then click Register at bottom, the captcha will disappear but not reappear.
  9. Hey I have a recaptcha on a site I'm making for a friend. If I enter the correct words first time, it works. If I enter incorrect words first time, then press reload via the captcha button, then enter correct words, it works. But if I enter incorrect words first time, then enter correct words after, it won't work. Any idea why this is? $privatekey = "my 40 byte private key is here";$resp = recaptcha_check_answer( $privatekey, $_SERVER["REMOTE_ADDR"], $this->input->post("recaptcha_challenge_field"), $this->input->post("recaptcha_response_field"));
  10. JamesB

    Ajax call

    Yeh in AJAX you can use asynchronous or synchronous. Asynchronous: <input type=button onclick='blah()'>function blah(){ sendAjaxRequest();}function onAjaxResponse(ajax){ document.getElementById("message").innerHTML = ajax.reponseText;} Synchronous: <input type=button onclick='blah()'>function blah(){ document.getElementById("message").innerHTML = getSynchronousAJAX().responseText;} It's better to use async than sync. You can also use jQuery to avoid ajax code. <input type=button id=somebutton>$(document).ready(function(){ $('#somebutton').click(function(){ $.get('someurl.php', function(data,status){ document.getElementById("message").innerHTML = data; }); });});
  11. Oh wow it's suddenly working lol. I think the fix came from adding C:php to my environment settings Path and restarting the computer. Thanks anyway
  12. Also, this file exists: C:PHPextphp_curl.dll And my extension_dir property is set correctly too. extension_dir = "C:PHPext" Other extensions seem to work like mysql, as phpmyadmin works.
  13. PHP 5.6.3 32 bit TS VC11 Apache 2.4.10 32 bit The OS is Windows 7 64 bit.
  14. Hey I'm trying to enable curl in PHP so that I can install Magento CMS which is what the company is using tomorrow at my interview So i'm hoping to install it by then and have a play around with it. I am modifying the correct PHP.ini, phpinfo() tells me C:PHPPHP.ini which is the one I am editing. I have removed the semi colon and saved the file: extension=php_curl.dll I have restarted the web server. I have put libeay32.dll and ssleay32.dll into my Windows/System32 and Windows/SysWOW64 folders and have restarted my computer. And still no luck with curl being enabled. I don't get the curl block in phpinfo() and Magento is still saying curl is required. Any ideas?
  15. JamesB

    Force float left

    Fixed the other server issue, it was actually a PHP property extension_dir I hadn't set correctly. Anyway back to CSS. I've attempt to set "min-width: 200px;" on .project_container but .project_column2 still goes beneath .project_column1 I will target the issue of this not being ideal for smaller screens by wrapping the text and moving .project_column2 more to the left later on.
  16. JamesB

    Force float left

    Thanks I'll test this as soon as possible. I just updated Apache and PHP and now having issues with my CodeIgniter projects.
  17. JamesB

    Force float left

    Hi there The problem is with the projects page on my site: http://mvec.io/projects It works fine on 1920 x 1080 with browser maximized. When I horizontally resize the browser, .project_column2 goes underneath .project_column1 How can i keep the .project_column2 box to the right of .project_column1?
  18. http://php.net/manual/en/mysqli.insert-id.php
  19. toggledFunctions = {};function toggleFunc(name, fn1, fn2){ if(toggledFunctions[name]) { fn1.call(fn1); toggledFunctions[name] = false; } else { fn2.call(fn2); toggledFunctions[name] = true; }} // toggleFunc('test1', func1, func2);
  20. Well I'm using this htaccess code at the moment which works. RewriteEngine onRewriteCond $1 !^(index.php|public|forum|robots.txt)RewriteRule ^(.*)$ /ukscifi/index.php/$1 [L] The code which doesn't work came from this code, as I was playing around with it trying to get anything else working.
  21. Hi there I'm getting a 500 Internal Server Error when using this .htaccess file: RewriteEngine onRewriteCond $1 !^(index.php|public|forum|robots.txt)RewriteRule ^(.*)$ /ukscifi/test.php [L] Any idea why this is happening?
  22. JamesB

    My site

    Yo Let me know what you think of my site, or if you have any suggestions or ideas! http://mvec.io
  23. JamesB

    CodeIgniter URL

    Got it working! There were 4 .conf files in /etc/apache2/sites-available/ I tried editing default.conf and ukscifi.conf but in fact I needed to edit 000-default.conf. Thanks a lot, learned quite a bit on this.
  24. JamesB

    CodeIgniter URL

    Ok I have put this in the htaccess file: 0943IM,E54341.e4htdrs8gh76ti6/$%Y&I85&^86%^34%4353w5345r23RewriteEngine onRewriteRule ^(.*)$ /uks2/public/css/core.css [L] And when I visit http://www.ukscifi.net/uks2/ the page still works and gives me a 200, no 500 anywhere.
  • Create New...