How can i check the result of my query? I try this, but when the result is empty – error doesn’t shows. Answer Note that sqlite_fetch_array() returns a result handle, not the number of rows, so you should not compare it against zero: This function will return a result handle or FALSE on failure. U…
Obtain first line of a string in PHP
In PHP 5.3 there is a nice function that seems to do what I want: Unfortunately, the server runs PHP 5.2.17 and the optional third parameter of strstr is not available. Is there a way to achieve this in previous versions in one line? Answer For the relatively short texts, where lines could be delimited by eit…
Generating next sequence value manually in Doctrine 2
What would be the easiest way to generate nextval for some particular sequence with given name? The annotation solution with specifying doesn’t satisfy me, as long as there is some more complex logic involved: in some cases I need to retrieve nextval, in other – I would go with the value retrieved…
PHP commenting standards
I need to comment massive amounts of information in only a handful of files, and when I look around Google and here at Stack Overflow, I continue to find results matching coding standards, when I need commenting standards. My coding matches most coding standards, except when it comes to commenting. What would…
Sanitize $_SERVER[‘HTTP_USER_AGENT’] & $_SERVER[‘HTTP_REFERER’] before saving to DB?
I have a feedback form which will take a couple of user inputted fields along with a few fields generated by PHP functions like ‘user-agent’ and ‘referer.’ My question is should these strings be sanitized before being inputted? I realize one could easily alter the user-agent and the re…
How can I change PHP constants? [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago. Improve this question I am working on making my own custom CMS in PHP by hand and I have a few c…
Google Analytics – Can I put script in footer?
I want to add google analytics to our website and have read some conflicting info about where to put the script tag. Google says to put it before the closing tag: http://code.google….
ZendFramework – How to add ->HeadScript() from Controllers?
I have a case where i need to add the Javascript from controller to the Layout where it has already HeadScript(); How to do that from controller? e.g: $this->view->HeadScript()->appendScript(); This is controller: Both does not apply. This is the view file: index.phtml If i uncomment in view it works…
Headers downloading actual page content, not the csv file I’ve constructed
My goal here is to have the browser download a csv file using headers to do it. For some reason yet to be determined, the browser seems to be downloading the HTML content of the current page (and not the contents of the array I’ve given it). Here is the code I’ve been using: I’ve followed th…
Fatal error: Call to undefined function getsqlvaluestring()
Hey guys I get this error when I try to login with a default Dreamweaver Login Module, please help me – this is a though one, I’m just an html designer trying to make a simple login script for a small site I’m working one. It’s be great if you can help Sorry guys, the error is Fatal er…