Jump to content

birbal

Members
  • Posts

    2,543
  • Joined

  • Last visited

Everything posted by birbal

  1. If you are using php 5.4 and up you can use http://php.net/SessionHandlerInterface in conjugation with http://php.net/session_set_save_handler (one of its version takes callback style parameter which are used prior to php 5.4
  2. birbal

    php if else

    & is not special character in context of string literal. It will be treated as character inside double and single quotes.
  3. You can still help people and answer their question without being mod
  4. Check what does $_POST['sort'] returns. Use var_dump()
  5. you can use union SELECT * FROM tran WHERE aid IN('1','2') AND tr_type NOT IN ('SALES','PURCHASE'))UNIONSELECT * FROM tran WHERE aid NOT IN('1','2')
  6. I am not sure from where you get the error message. if page does not exist it would show error 404. currently it will try to redirect to file named chkactivasion.php on same directory as login.php. make sure file URI is correct.
  7. SELECT * FROM tran WHERE NOT IN(SELECT aid FROM tran WHERE aid IN ('1','2') AND tr_type IN ('SALES','PURCHASE'))
  8. Well, I forgot header() does return void. I recalled it would return boolean (on success/failure) and thought different thing. NVM. Back to your problem. "This page can't be displayed" does it show error 404?
  9. Is it the all code? I cant see anything in this code which can do like it.
  10. header() should not be inside die(). you can use header() to redirect and the may call die()
  11. birbal

    php and mysql

    You can export and import database and tables. phpmyadmin has option for doing so.
  12. I believe he meant t http://php.net/list
  13. birbal

    empty mysql table

    using TRUNCATE will set AI to 0 as well as empty the table. http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CCkQFjAA&url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.0%2Fen%2Ftruncate-table.html&ei=x4NbU9reJsSXrAe94IDgDg&usg=AFQjCNGl0K-EgA3InY7R303XP6MwoNTFOw&bvm=bv.65397613,d.bmk
  14. birbal

    php and mysql

    please Dont be confused. you can go either way with pdo or mysqli. if code with one of them is not working dont switch it to another. it wont help anything. as you are starting stick with any one of them. as already told, phpmyadmin is nothing but a php application which interacts with mysql server. so if you can work with phpmyadmin, it is obvious that you have mysql,apache and php is up and running. after that if something in your code is not working dont assume and try to debug things. $dbconn = new PDO(mysql:host = $db_server; $db_name; charset = utf8, $db_user, $db_password); $dbconn->setAttribute(PDO::ATTR_ERRORMODE,PDO::ERRORMODE_EXCEPTION); //It will throw exception when an error occurs. it will also show the reason of error with error message unless it is for educational purpose table creation (or any other DDL part) usually does not happen in php scripts. you set up the table in phpmyadmin. and mostly use Database Query Language(DQL) or DML from your php script.
  15. birbal

    duplicate entry

    It is for placeholder where you will insert data to database. As for original post, you can also just insert query as usual and catch the exception on error. Every error has certain codes, so thus duplicate entry has one. just check the codes and do whatever you need to do. You have to make sure though to enable Exception mode of error reporting on PDO. Even further you can parse the error message to find which key is being violated for duplicate entry. Error message have certain fixed format so you can catch the names of the keys too.
  16. birbal

    http function

    I dont think facebook have registration API. It would be a security issue. They wont let anyone handle passwords other than the facebook itself. Best you can do is ask for FB authentication in case they dont have id , user will register themselves in facebook popup. if they have id already and already logged in they would use your service as regisetred user of fb. you can do things behalf of them according to the application permission. If they are not already logged in they need to just log in FB pop up and then rest of the thing will work as usual.
  17. You can find pre compiled dll of sqlite which matches your php installation. At first google it "download php_sqlite3.dll for [compiler version] [TS or NTS]". you can get compiler and php version by seeing the phpinfo(). it would be something like php 5.4 VC9 threadsafe. Most probably you will find it pre compiled. When you found it put it in 'ext' folder of your php instllation dir. Then open the php.ini and uncomment extension="php_sqlite3.dll". restart your server. If you cant find the pre compiled dll then you have to compile it on your own from the source code.
  18. you can add form field name like <input name="foo[]" ........./><input name="bar[]" ........./> so when you add dynamcially forms and submit them each field will be available in $_POST['foo'], $_POST['bar'] which is an array. You can then get those fields and use them.
  19. birbal

    PHP Str_replace

    Yes. it looks like you are right Another way could be use array_intersect() with 'stop words' and 'word set'. check its return value if its empty match not found. if it matches anything it would return the array with element which have matched. Even it would be possible to track what it matched. http://php.net/array_intersect
  20. birbal

    PHP Str_replace

    If you check the link of in_array() manual you can see that you can even pass an array in first param.
  21. birbal

    sessions

    When you develop always make sure to enable 'error_display' and 'error_reporting' to show all kind of error in php.ini . It tells you exactly why and where it is going wrong without need of guessing.
  22. birbal

    PHP Str_replace

    you can also use explode() to take out the sentence in seperate word splited by space. Make another array of your stop words and then you can sue in_array() to check if stop words exist in exploded words or not. if it is in array dont execute the sql. http://php.net/expldoe http://php.net/in_array
  23. Root | | --project | | | |--Abstracts | |--Models | |--Controllers | |--Templates | | | | | |--defaultTheme | | |--Theme1 | |--Interfaces | |--DB | |--Exception | |--Traits | |--settings | |--config | |--Storages | |--Locale | |--Util | |--test | |--HTDOCS | | | | | |--JS | | |--CSS | | |--image | | |--sitemap | | |--index.php | |--Data | | | |-Cache | |-Image Using this. Problem with it is Model number is getting higher and it is now troublesome to maintain. I thought All Abstracts,Exception,Interfaces,traits are used almost on every request. So it could be bulk included and other models could be included hardcoded where needed. At first i thought autoloading will have signficant performance penalty so i avoided it on current project. Previously i was using namespaces to parse to directory strucutre something like on the GIT link you posted. I thought it would take once to hardcode a file but autoload will be ran several times in an application lifetime. I belive i was pretty wrong. Found some benchmark on autoload and it seems good to use. Not to mention the convenience of autoloader. Currently I am willing to use namespaces and autloading in the current project. But this moment introducing it will have to make major changes in the application. Untill that i have to go with this. I am glad you take out the topic because I was looking for same kind of thing. I would need some specification or somethinglike that for file management (I am worst at managing anything. I get overwhelmed when things gets bigger). I even thought seperating by domain. but I was confused what to put where. because some Domain model uses other domain model too. I think there is many more things to consider before i conclude anything.
  24. Where is your checkbox code? Just put checkbox and get the value in PHP side and check the value and set the url depending upon the check box data
  25. You need to use any PDF library to do that. You can not automatically change html to PDF. There is php pecl internal library 'PDF' and another third party solution written in PHP 'FPDF'
×
×
  • Create New...