Jump to content

birbal

Members
  • Posts

    2,543
  • Joined

  • Last visited

Everything posted by birbal

  1. this does not make file doc. it tells the browser about the content type of it so that it can handle properly. but if the content itself does not encoded in correct format. how can browser handle it? the page break you are referring is not possible in html file like those doc or pdf file. but you can create it visually in using css http://www.w3schools.com/cssref/pr_print_pageba.asp.the reason i told to output it to xml that there is many libraries and application which can handle xml file to produce doc file or pdf file. as far i am aware docx (multiplatform extension for doc file) can take xml file. as xml file is meant to be portable and readable be human so it has advantages to use it in such reports. you can use same file to generate different format easily for pdf generation there is php library http://php.net/pdf or third party library written on php http://fpdf.org to do that. it can handle xml file also.
  2. Why not just serving the script file only the requested user has privilages?
  3. what is happening when you run that code? any errors?
  4. There is almost no difference of using function and using straight codes to do certain work. function gives modularity where each function does specific jobs. and using many functions we divide the problem in small reusable part and we solve bigger problem. I cant see you calling the function. i just see here declaring it. if you want to execute the function you need to call it seprately.http://php.net/language.function. as already said DOC is binary file so you have to write it like so. just specifying the .doc extension in last of file name won't make it doc file. I am not sure what problem you are facing to create html file with that. html file uses <br> as lin break. if it is just a report which is meant to be saved to client it will be better to save as format other than html like xml (if doc option is unavailable)
  5. birbal

    outer inner loop

    lfirst oop untill it reaches the total rows and prints <div class='pane'></div>then loop through the result resource to get the city name iwith <div class='row>....You dont need to nest while loop inside for loop
  6. doing order by in id column also is fine if it is PK autoincremented.
  7. birbal

    REST JSON tutorial

    you dont need build a different server for REST. REST will simply work same as web page.in this case apache will handle the requests. where as in web pages people outputs html markups you will generate and output JSON data which will be use by clients. which JSON data will be manipulated will be depending upon the Request URI which will cause it generate JSON data dynamically.What clients will do is just get the URI using fopen() or file_get_contents() or Curl library and use it. the example is showing in that site is showing how the client will get the URI.
  8. yes,in any case It is always good not to pull the data which you are not going to use anyway.It will be waste of resource.
  9. birbal

    REST JSON tutorial

    that links had all information you need to start use REST. it is process the URI of resource and manupulate data depending upon that, it works like same way as other http based application works. clients need to just open the URI and they can get and use the resource.php imlementetion http://rest.elkstein...est-in-php.htmlgeneral guides http://rest.elkstein...guidelines.html
  10. you need to use either COM http://php.net/com to manupulat word document but it will only work in windows enviourment, or http://phpword.codeplex.com/ to create doc file natively with phphere is one article http://www.joelonsoftware.com/items/2008/02/19.html
  11. you need to set a column for join time as unix timestamp. and you need to select users with descending order(ORDER BY jointime DESC) on that timestamp column. if you want to get only one last user use LIMIT.
  12. template engine is a system which uses templates (in this case html template) to generate pages. templates makes an outline of the document and the changing data is inserted into placeholders. Framework is some sort of library build around some well worked design patterns maintaining some sort of relation on each components to get done certain jobs efficiently. common development works is moved to framework to enhance speed of development process. eg an template engine could be a part of framework. (an MVC framework may use template engines for Views)
  13. yes smarty is template engine.
  14. http://www.google.co.in/url?sa=t&rct=j&q=google+mp+api&source=web&cd=1&cad=rja&ved=0CC8QFjAA&url=https%3A%2F%2Fdevelopers.google.com%2Fmaps%2F&ei=Ujc3UJDpKsbHrQekjYGADQ&usg=AFQjCNGZA3DiCUz9bOP-BC4Mp5bvmfgA8w
  15. birbal

    session start

    It is the maximum buffer size for outputbufferhttp://php.net/manual/en/outcontrol.configuration.php
  16. what you did not understand? did you read the link #16 post about strings ?
  17. also you can find here https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/constructor too
  18. birbal

    session start

    it should be above all, above DOCTYPE declaration. yes you should get an error. (assuming you have enable display_error and error_reporting to E_ALL) if you still can use session and your code works properly it is the "output_buffering" which is doing this. you can check your php.ini for this directive and if it is enabled.it could be enabled previously.
  19. there is several template engines. popular is smarty. if you see this i am sure you will get the idea of templates. though i don't like template engines as php itself is template engine and in some points it feels like they are creating another language based on php which adds a processing layer too.
  20. it is short hand syntax of object in js.
  21. birbal

    session start

    session cookie is also a cookie. every cookie goes with header so once header sent when output started in browser there is no way to send back the cookie on the same request. this rules applies to every cookie , session cookie even ordinary cookie. The reason you are not getting any error could be you are using output buffering or your php.ini setting is set to implicitly enable output buffering.
  22. check this http://w3schools.invisionzone.com/index.php?showtopic=44106
  23. I would not use a function just to print something. It will make it harder to maintain if you mix codes with visual representation and logics.also it makes it little messy when you look. You can just make a template file of header for authenticated user and inject them (include()) if user are logged in. you can also make another template for unregister user and inject them same way when user is not logged in.
  24. $result = mysqli_query($dbcon, $query) or die(mysqli_error()); it means query is failing. use mysqli_error() to see why does it failing.http://php.net/mysqli_error check how dos mysqli_query() works. http://php.net/mysqli_query
×
×
  • Create New...