Jump to content

birbal

Members
  • Posts

    2,543
  • Joined

  • Last visited

Posts posted by birbal

  1. 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.

  2. 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?

  3. 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.

    • Like 1
  4. 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.

  5. 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.

  6. 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.

  7. 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.

  8. You can, but it would actually look for an array inside the other array, which wouldn't be useful for this purpose.

     

    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

  9. 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.

  10. 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.

×
×
  • Create New...