nik_jain
Members-
Posts
60 -
Joined
-
Last visited
-
Days Won
1
nik_jain last won the day on April 27 2015
nik_jain had the most liked content!
Recent Profile Visitors
3,664 profile views
nik_jain's Achievements
Member (2/5)
2
Reputation
-
PDO. How to pass quote literal as part of query?
nik_jain replied to nik_jain's topic in PHP Coding Help
This is late. SOrry my question wasn't clear. But I found that in this instance prepared statements cannot be used. The SQLITE syntax required literal that PDO driver could not just pass and there was no way of escaping. Note I could escape the parameter passing it from PHP to PDO . But could not escape it from PDO to sqlite. -
SQLITE has syntax like ' WHERE MATCH ( 'colname : "one two" )' //My pdo sql query $sql .= MATCH 'colname : "?" )'; $pdo->bindValue(1,$text);` But Pdo placeholders can't have quotes around them. So this does not work. I tried a million variations of the placeholder syntax "?" "" ? "" """ ? """ \" ? \" . But nothing works. Errors I get : General error: 1 near "?" | 25 column index out of range . Also for this query : MATCH ( names: ? AND categoryids: ? ) , the error is: `General error: 1 unrecognized token: ":"` Would really love some help here.. Thanks
-
Use a DOM parser like querypath to parse the XML http://www.ibm.com/developerworks/library/os-php-querypath/
-
Not tested, but in the last three lines in coded section $d should ( could ) be $fulo . for($fulo=$d;$fulo>0;$fulo--){ if($_POST['outcome'.$fulo] !==""){ $out=$_POST['outcome'.$fulo];break; }else{continue;} } $act=$_POST['activity'.$d]; $ind=$_POST['indicator'.$d]; $tar=$_POST['target'.$d]; and the else{continue;) is most probably not needed.
-
Nope, I was kind of wrong about this one... lets hope I am able to get symfony..
-
Agreed. I was quite hesitant to call it a framework, hence the word structure (some code that I can reuse) . It was obviously never meant for use by anyone other than me.. Well in my defense is the complete code of the site, not the actual 'structure' . Although I admit it doesn't even have a any kind of DB class Thanks a lot for your response. I have tried symphony in the past, will give it another shot. Though through another forum I discovered that its quite easy to get rid of blade in laravel, so I might give it a shot too! Thanks again
-
I am PHP developer developing for the past 3-4 years, but except for CI I had always kind of struggled with any type of framework.. So I ended up not using most and just rolling my own frameworkish 'structure' . That ended up as a FANTASTIC learning experience, as I really got to understand what and how a real framework does/works. My complete source of the site wowpictures.link (which was made as a learning thing) is here: https://bitbucket.org/nikhil_jain/complete-wowpictures.link-source/src . Can someone take a quick look please . and offer suggestions / improvements / completely wrong things I did ? Secondly now I am hunting for a real framework, but I just find them too restriucitve / imposing. For instance yii seems too tied up with bootstrap, laravel like blade too much. Yii also seems to have a very specific class / method naming structure, that I find a chore to remember..etc etc. So what should I do? Learn any proper framework OR try to improve my own thingy ? I am strongly leaning towards th former option, but can't find a framework that doesn't forces random stuff no me .... Thanks
-
two things. - Variables don't work inside single quoted strings - Since we are alreeady inside <?php tags the <?php echo $directory; ?> part doesn't require <?php and ?> . Also since we just want to join (concatenate) text , the echo is also not required. So Change $output = shell_exec('tar -czvf {$directory} <?php echo $directory; ?>'); to $output = shell_exec("tar -czvf {$directory}.tar.gz {$directory} " ) ;
-
Learning about Multithreading in PHP (pthreads) ?
nik_jain replied to nik_jain's topic in PHP Coding Help
Thanks for attempting to help, but .... let me try and explain my question a bit more clearly. I am looking to learn pThreads as described here: https://gist.github.com/krakjoe/6437782 The above article talks a lot about synchronization / mutex / waiting / sharing / context and other unknown concepts.. These are the concepts and generally learning pthreads is the help I am looking for. Taking a real world example: class WebRequest extends Thread { public function run() { for_doc() ; echo 'Running Thread : ' . $this->getCurrentThreadId() ."\n"; } } Here the for_doc() is a factory function that creates a Object of type A class, but all calls to $this return null ( I know I didn't explain the issue well, ut I am just trying to give an idea about what confuses me about multithreading) -
Hello Where should I go If I know nothing about multi-threading and want to learn about pthreads . Googling for multithreading tutorials only shows non-PHP, language specific tutorials.. PS: I would really prefer a video lecture or tutorial
-
Thanks. I have thought of this before, but having heard several times that coming up with your own cms is a bad idea, and not knowing how to build my own CMS I didn't follow through with it. Nah, both of these change for too rapidly for my slow mind. I also had a talk with a cousin of mine, he suggested that whatever framework I choose, I should spend a LOT of time with it, so I guess I'll try spending a couple of months with yii and see how it goes..
-
Thank you! actually I struggle in the same manner with frameworks as well . Recently I tried learning zend and yii 2 Site Features: 1. Basic Search 2. Post page 3. 'browse/filter' page . Basically narrow down posts using category / date etc. Regular stuff.. Wordpress way: create post, post_type using csv row, import and use existing search, comments functionality. Core PHP way: Create database structure -> import csv implement every goddamn feature myself. be it comments to post, post_page , search functionality etc. The issue with frameworks/CMS: the trouble starts when implementing something not in the book/docs means googling too much... Say in wordpress I had to implement a form that anybody could post to, this proved tiresome. Not difficult, but trying to figure out how to implement required googling..
-
One option might be to add a boolean column - 'is_guest' ? Set default value to false and work from there..
-
Basically everytime I try to code a site in an existing CMS I find out that I spend 99% time trying to google out how the CMS works, how a particular thing is done and less time coding. I end up not using any CMS at all and just code my site in Core php. Now I have an idea for a site that whose development I think will really be speeded up if I use an exisiting CMS, instead of trying to implement every goddamn feature myself. I feel I am doing something wrong in the way I try to learn a CMS. or maybe I am just not using the right CMS. I have tried reading books / video tutorials / online tutorials etc Can anyone relate? Any tips / suggestions to offer ? I am most familiar with wordpress btw Thanks
-
POST variables are returned as String afaik, so they needs to be converted into integer for integer comparison So this should do the job: if ((int)$value >= 0.0 && (int)$value <= 10.0) {