php,codeigniter,jquery-select2Related issues-Collection of common programming errors
Taimoor
php parse-error mybb
I’m inserting this code in the <head> </head> for a mybb forum:<?php if(isset($_REQUEST[‘url’])): // <– only include jQuery if url set ?> <link rel=”stylesheet” href=”http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css” /> <script src=”http://code.jquery.com/jquery-1.8.3.js”></script> <script src=”http://code.jquery.com/ui/1.9.2/jquery-ui.js”></script> <script>$(function() {$( “#dialog-modal” ).dialog({height: 140,modal: true});});
lethalMango
php
Just a quick question – and I’m sure really basic!I have the following code:function checkThings($foo, $bar) {…if ($valid) {return $results;} else {return false;} }On the other end of this I am currently doing$check = checkThings($foo, $bar); if ($check === false) {echo “Error”; } else {echo $check; }Is writing the following the same?$check = checkThings($foo, $bar); if (!$check) {echo “Error”; } else {echo $check; }Which method is the preferred method if both are correct?Thanks 🙂
Nashi
php soapui esb wso2esb wsf
few days ago I started to work on my own WebServices. I decided to use WSO2 WSF/PHP framework and according to http://wso2.org/project/wsf/php/2.0.0/docs/manual.html created my first helloService. Here’s code:function greet($message) {$responsePayloadString = <<<XML<greetResponse>Hello Client!</greetResponse>XML;$returnMessage = new WSMessage($responsePayloadString);return $returnMessage; } $service = new WSService(array(“operations” => array(“greet”))); $service->repl
Hubert
php header echo alert
I have a system for users to apply for permit…when they select their permits they wish to retire, my system should be able to check if the meet the criteria or if they have applied for that permit before to prevent spam.However, i have a very big problem.If i put header(‘Location:s_success.php’); the alert wouldn’t appear. For example, because user can choose 1 or 2 or more permits, .ScenarioLets say the choose one permit which they are eligible to apply for and another permit which they are n
Darryl Hein
php class object variable-variables
Is something like the following possible in PHP?$blah = ‘foo1’;class foo2 extends $blah {//… }class foo1 {//… }This gives an error.I want to dynamically set $blah so I can extend whatever class I want.Edit: The reason for wanting to do this because I wanted to use a function out of another class in a related class. In the end it would have been something like:Final extends foo1 extends foo2 extends foo3 extends foo4 extends parent { … }In the end I decided to instantiate the other class wi
AME
php rets
Am a trying to create a PHP (PHrets) script that downloads all real estate listing information from a specific area and saves all of the listings data (CSV file and photos) on my web server. Note: A single listing may have up to 20 photos.I am using PHrets to retrieve MLS listing data and it works great for creating a CSV of data. However, I would like to modify this code to loop through each listing’s photos and download them onto my web server with the following name convention: MLSID-PHOTOID.
KoolKabin
php class static member
I am trying to access static member of a class.my class is:class A {public static $strName = ‘A is my name’public function xyz(){..}.. } //Since i have bunch of classes stored in an array $x = array(‘A’); echo $x::$strName;I am getting error while printing. How can i print ‘A is my name’
Michael Moussa
php zend-framework phpunit zend-session
I am getting numerous errors exactly like this one:Zend_Session_Exception: Session must be started before any output has been sent to the browser; output started in /usr/local/zend/share/pear/PHPUnit/Util/Printer.php/173When running my application’s test suite. This is with PHPUnit 3.5.10 and PHP 5.3.5.There is no mysterious, unexpected whitespace output that is causing this. I’ve determined that the “output being sent to the browser” is the actual output from the PHPUnit tests being executed.
PHPst
java php regex pcre
In PHP and Java, I applied /^[^\pL]*|[^\pL]*$/ to ???-A- and I got *A**. I applied a symmetric pattern and got an asymmetric result! Why? I wonder why its output is not *A*?Pattern says that every thing except letter in the end of string should be replaced by *, it’s also greedy and should replace all non-letter stuff together.Alos note in RegexBuddy I get *A* that is what I expect.Update: I simplified the question to focus my main concern.
Gordon
php oop class
I want to make a PHP class, lets say Myclass.php. Now inside that class I want to define just the class itself and some instance variables. But all the methods must come from a Myclass_methods.php file. Can I just include that file into the class body?I have good reasons why I want to seperate this. In short, I’ll have a backend in which I can change the business logic of a class, while all other things must remain untouched. The system maintains all the ORM and other stuff for me.But if this is
OrangeRind
codeigniter sql-injection
Some doubts regarding Codeigniter and its Input handling capabilities. Some may be a little weird but they are doubts none-the-less.If I use the Active Record Class functions in CodeIgniter, is my input prevented against SQL injection? I read somewhere that it does, but I don’t understand it how? or why? Also does xssclean deal with SQL injection in any way?
Thorpe Obazee
php codeigniter syntax-error gchart
I followed the wiki artichle (http://codeigniter.com/wiki/gchart/revision/5312/) to practice google chart in my CI 2.0. But it doesn’t work.controller file: ci\application\helpers\mytest.php$this->load->helper( ‘gchart’ ); $this->load->view(‘my_test’);view file: ci\application\helpers\my_test.php$encoded_data = extendedencode(array(0, 1, 2, 3, 4, 5, 6) &maxvalue;); echo <<< EOS<img src=”http://chart.apis.google.com/chart?cht=lc&chs=250×250&chd;:e{$encoded}”al
Alejandro del Río
php codeigniter
This question already has an answer here:Parse error: syntax error, unexpected [ in line 169 [duplicate]4 answersThis issue is driving me crazy, could someone please tell whats going wrong with this!? (NOTE: Chances are that it is something really stupid but I can’t seem to figure out.)On a CodeIgniter framework I have a language key like this:$lang[‘android’] = array (‘title’ => ‘Android apps’,’image_id’ => 5,’description’ => ‘Learn how to create your own Android app’,’level’ => ‘Be
hakre
codeigniter php
public function register() {if(!file_exists(‘application/views/forum/register_view.php’)){ show_404();}$member_data=array(‘name’=>”<?=’$_POST[‘register_name’]’?>”,’email’=>”<?=’$_POST[‘register_email’]’?>”,’pass’=>”<?=’$_POST[‘password’]’>”,’activation’=>”<?=md5(uniqid(rand(),true))?>”);$this->load->view(‘forums/register_view’); }this is my register function which is called after the user clicks the Signup button activation key is used to act
ahmad
codeigniter
I have this function to edit all fields that come from the form and its works fine ..function editRow($tableName,$id){$fieldsData = $this->db->field_data($tableName);$data = array();foreach ($fieldsData as $key => $field){$data[ $field->name ] = $this->input->post($field->name);}$this->db->where(‘id’, $id);$this->db->update($tableName, $data);}now I want to add a condition for Password field , if the field is empty keep the old password , I did some thing like th
teresko
php codeigniter http-status-code-500
ANSWERED! IT WAS A TYPO OMG. Always check EVERY CHARACTERI have three controllers, Site, Login and Admin. Site and Login work perfectly. I know I am logging in correctly, because I set the “incorrect username” blah blah error message, which shows up if I have incorrect login details. When I log in successfully however, I get a 500 Internal Server Error:HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.Here’s the
user837032
javascript jquery codeigniter jquery-plugins jquery-ajax
What is the reason for this error? How do I fix? error with Google Chrome :An error has occured: [object Object] parsererror SyntaxError:Unexpected token ILLEGALerror with opera:An error has occured: [object Object] parsererror SyntaxError:JSON.parse: Unable to parse value:error with ie9:An error has occured: [object Object] parsererror SyntaxError:Invalid characterand …js code:$(‘#hotel’).keypress(function () {var dataObj = $(this).closest(‘form’).serializeArray();$.ajax({url: ‘http://l
xaddict
php codeigniter amazon-web-services phar
I’m creating a web application, using the Amazon SDK 2.5.2. It uses the modular HMVC approach with codeigniter.I’ve successfully used the SDK 1.x up to this point but really want to switch to the newest version.The site says you could install via composer (a complete nightmare in itself; curl doesn’t work correctly on the server, running commandline php doesn’t either. I’ve tried everything!), via zip ( After I upload all the files I have no idea what to do next), PEAR (I don’t want to go there)
Anna_MediaGirl
php codeigniter expressionengine
I am currently developing a module for ExpressionEngine and have a quick questions regarding outputting database queries into the table class.The only way I have managed to do this is via the following:$this->EE=& get_instance(); $this->EE->load->library(‘table’);$data = $this->EE->db->query(“SELECT * FROM my_table”);echo $this->EE->table->generate($data);This is great, but I would like to input some additional options in the table such as “Duplicate” and “Delet
AnmSaiful
php database email codeigniter newsletter
I am facing an unexpected problem regarding sending email using CodeIgniter. I am picking my newsletter subscribers from database, and to send email I am using the following script. But the problem is email sends to only one subscriber (the first one). I also tried with SMTP protocol and also kept the initialize() function outside the loop, but the result is same. To track the email sending errors I have used a trick. The emails could not sent successfully will be listed in the $failure array. B
zvisofer
c# jsonp jquery-select2 webmethod
I have this WebMethod in C#:[WebMethod] [System.Web.Script.Services.ScriptMethod(UseHttpGet = true, ResponseFormat = System.Web.Script.Services.ResponseFormat.Json)] [System.Web.Http.Cors.EnableCors(“*”, headers: “*”, methods: “*”)] public List<DatoMaestro> ObtieneEspecialidades() {List<DatoMaestro> especialidades = new List<DatoMaestro>();especialidades.Add(new DatoMaestro(1, “Dermatología”));especialidades.Add(new DatoMaestro(2, “Medicina General”));return especialidades;//va
Gupta Anirudha
css twitter-bootstrap jquery-select2
I recently started to use bootstrap RC2 and jquery select2, but if I use it with bootstrap form-control class I get unexpected margins and looks weird.Could someone please give me a hint on this?html<div class=”form-group”><div class=”col-lg-6 sepereate-group”><select name=”gender” id=”gender” data-placeholder=”Select gender” class=”form-control select2″><option></option><option value=”1″>Male</option><option value=”2″>Female</option></se
amit_pandey
jquery-chosen jquery-select2
Using any of these jQuery plugins, I am showing tag selection in a list box. Now when I am using Optgroup, it is possible that a particular value is common – say “Yes” in the following Manner -RelationshipYesNo Senior CitizenYesNoThe list should display as it is, but when selected instead of showing “Yes”, in the select box, it should show the followingRelationship : Yes Senior Citizen : NoHow can I change the tags display at runtime?
JJD
ruby-on-rails ruby-on-rails-3 simple-form jquery-select2 select2-rails
This select2 jquery library looks awesome. There is a Rails gem but it is very light on the documentation. I would like to generate a simple multiple drop-down menu, using autocomplete. How do I do that?This is my simple_form_for call:<%= f.input_field :neighborhood_names, url: autocomplete_neighborhood_name_searches_path, as: :autocomplete, data: { delimiter: ‘,’, placeholder: “Where do you want to live?”}, multiple: true, id: “selectWhereToLive”, class: “span8” %>I have successfully inst
Shruthi Ramesh
jquery ruby-on-rails twitter-bootstrap jquery-select2
In rails 4.0, I am using select2(bootstrap) plugin. I want to generate dynamic data in auto-completion list but data is not loading in the list. If i used below code, i will get an error like “Uncaught TypeError: Cannot call method ‘toUpperCase’ of undefined”. $(‘#DIV_NAME’).select2({placeholder: “Search for a names”,multiple: true,minimumInputLength: 1,ajax: { url: “autocomplete/names”,dataType: ‘json’,data: function (term) {return { q: term };},results: function (data) {return {results: data};
j0k
jquery jquery-select2
I’m trying to programmatically clear a drop down using the fantastic Select2 library. The drop down is dynamically filled with a remote ajax call using the Select2 query option.HTML:<input id=”remote” type=”hidden” data-placeholder=”Choose Something” />Javascript:var $remote = $(‘#remote’);$remote.select2({allowClear: true,minimumInputLength: 2,query: function(options){$.ajax({dataType: ‘json’,url: myURL + options.term,error: function(jqXHR, textStatus, errorThrown){smoke.alert(textStatus
oliboon
javascript jquery jquery-select2
I’m trying to use the Select2 library to display a list of categories. I have a working regular <select> at the moment.I added jquery, the stylesheet, the .js file and the function in my html.<link href=”/select2/select2.css” rel=”stylesheet”/> <script src=”//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js” ></script> <script src=”/select2/select2.js”></script> <script>$(document).ready(function() { $(“#listCategorie”).select2(); }); </scrip
Jorge Sampayo
jquery jquery-select2
I’m trying to read a collection from the html5 data-attribute of the input that is converted to select2 to create tags.This is working when I have one input:$(“.tags”).select2(width: ‘220px’tags: $(“.tags”).data(‘collection’) )But I will like to do it more safe using the data of the element itself, I tried this:$(“.tags”).select2(width: ‘220px’tags: $(this).data(‘collection’) )But it fails with the error:Uncaught query function not defined for Select2 investigador_aplicacionesDo you know if it i
Anto
html5 backbone.js backbone.marionette jquery-select2 bootstrapping
I load values for select2 like the following way.Declare the Type var AdjustmentType = Backbone.Model.extend({url : Hexgen.getContextPath(“/referencedata/adjustmenttype”)});create instance for the Typevar adjustmentTypes = new AdjustmentType();load the values to select2 boxadjustmentTypes.fetch({success : function() {for(var count in adjustmentTypes.attributes) {$(“#adjustment-type”).append(“<option>” + adjustmentTypes.attributes[count] + “</option>”);}}}); $(“#adjustment-type”).s
JanR
javascript arrays jquery-select2 backgrid
I am trying to integrate select2 in backgrid.js. Backgridjs has extension support for select2 and the code for that is {name: “gender”,cell: Backgrid.SelectCell.extend({optionValues: [[“Male”, “m”], [“Female”, “f”]]}),label: “Gender (SelectCell)”}so based on this i tried something like the below since i have to load values to select2 box from the servervar FetchSecurities = Backbone.Model.extend({url : Hexgen.getContextPath(“/referencedata/securities”) }); var fetchSecurities = new FetchSecuriti
Web site is in building