Jump to content

birbal

Members
  • Posts

    2,543
  • Joined

  • Last visited

Posts posted by birbal

  1. $imagedata = imagecreatefromstring($imagedata) ;

     

    here, $imagedata is an array. you would like to pass the binary data (specify the cloumn of the image data) as param which probably is $imagedata['image']

    also that particular function returns a image resource. echoing it will not show up the picture. you need to use http://in3.php.net/manual/en/function.imagejpeg.php or any variant of image*() which is dependent on image type.

     

    If your scripts generates any error before the image get displayed it would send the default header already. as header can be sent only once so next time if you try to send header again it wont send it. You may like to read this for header related problem http://w3schools.invisionzone.com/index.php?showtopic=44106#entry245750

     

    Even if you pass the correct header when you display a image there should not be any data other than the binary data, otherwise image will be corrupted.

  2. There is many way to persist data. You can use database,flat files. there is APC,memcached like extension which can store data in memory to share data between request. which one will be better is depend upon what you need to do actually.

  3. I guess what I'm confused about is whether the submission of a form truly forces a page load. What if the server accepts the form but does not send a response?

     

    Server will always response in regular HTTP response. Like HTTP code 200,404...etc. Whether a 200 response will have data or not (like confirmation message or any other data) is depend upon the developer. But no matter it returns data or not the HTTP request from ajax form would change the data in server already.

     

    Ajax does not forces page load. In regular HTTP request browser parses the response to render it. so it get restructured (page load). Even a blank page will have HTPP response. Where as in AJAX browser does not parses the reponse to display it. instead it resides on a memory to be handled by developer. You can use any HTTP debugger to see the data going back and forth in server-client.

  4. I guess you have to use Ajax if you don't want to reload the page, even if you don't expect any response data. I don't think you can submit a form without an action and even if action is set to the current page it would then reload the current page.

    You can override default behaviour of a form using JS. Form field will have the data , It is reponosibility of coder to collect the data and send it to server and block default bhevaiour of form. Other than that ajax is like reguler HTTP request, except it does it in background so it dont reload the page.

  5. '@' is used to declare variable and ':=' for assignment. as '=' is already used as comparison operator in SQL and alpha numeric identifier is used for database scheme like table name,database name,column name they needed to be identified differently.

    • Like 1
  6. When i started PHP i have not gone through it in formal way and started quite random. I , myself learn fast by doing things rather than just reading. So i picked up a project that was far more complicated than i have skill to do that in that time. I stucked and I learned. That project was semi complete after giving several hours (in other word you can say it was failed) but i dont think it could be replaced by anything else that i learnt from it. I read some free ebooks and resources in net at srtarting time . But I had familiarity with general programming as i do study in formal computer science and I knew what i was doing. Later i got some ebooks (some of orielly) on php and that was very helpful. When any question arises i reasearch on net and read. I frequently check php.net site. That site is a book itself. Even i have downloaded copy of the php Doc which i read frequently. Being involved in programming forum is also helpful for learning. even helping other problems and reading other's codes sometimes can be learning experience. Also there is possibility to get corrected by senior programmer if you have post any wrong information which is also learning experience.

    • Like 1
  7. I dont know how that specific appliction internally works but You could store the those data in config file. Config file can be in any format like ini,json,xml,yaml.

    You need to just catch the data submite by user and manipulate the config file with simple form handling. When you will need the data for connecting database you will consult to the config file to get appropiate data.

    I would not directly edit php file for configuration.

    There is php.ini setting for storing database credential though that should not be used because it can expose the credential via phpinfo(). Also your config file should not be publicalyy accessible and should be kept on outside web root for security reason

  8. $this->name tells to get 'name' property of current object. You neither have any class defined nor it have any property. You need to define a class first. Only class methods can resolve $this, functions can not.

  9. What error message are you getting? How is your table is structured? If your table have primary key or unique key in any columns. InSerting duplicate entry to those column will throw mysql error. You can use mysqli_error() to know the actual mysql message

  10. Php date() will use timezone set up in the server when displaying date. You need override the timestamp to show time for other timezone. Where as the right bottom corner shows local time set in your machine.

  11. [] it is used to declare character class. Character inside it will be used to compare individually. ^ is negate character if used inside character class. Means [^f] will try to match any character other than 'f'. [^\]] it tells to match any charcter other than ']' as ']' character itself used in charcter class so it needs to be escaped. Hence '\]' used. + is quantifier which tells to match for 1 or more characters.

  12. Sounds perfect. though 3rd and 4th point could be interchanged depending upon the priority (frontend or backend). Adding any leading framework of any server side language to your list will make it more complete. Apart from languages general programming techniques like OOP design,algorithms,datastructure will be helpful. Your CS classes probably has included these all. Photoshop is not essential for web development. it is possible to develop full featured site without photoshop. Best of luck for your journey!

    • Like 1
×
×
  • Create New...