am making function to count rows using “WHERE”, but i get a mysql error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:AppServwwwtesttestindex.php on line 9 Unknown column ‘1’ in ‘where clause’ here is my function i’ve created t…
Tag: php
Non-testable base class extending PHPUnit_Framework_TestCase
Summary How can I create a base class that extends PHPUnit_Framework_TestCase and use that for subclassing actual test cases, without having the base class itself tested by PHPUnit? Further …
Convert latin1 characters on a UTF8 table into UTF8
Only today I realized that I was missing this in my PHP scripts: All my tables are InnoDB, collation “utf8_unicode_ci”, and all my VARCHAR columns are “utf8_unicode_ci” as well. I have mb_internal_encoding(‘UTF-8’); on my PHP scripts, and all my PHP files are encoded as UTF…
PHP not working in XAMPP
I have a problem running PHP in XAMPP 1.7.7 for windows. I’ve installed XAMPP in a local server with IIS (changed the port to 81 in httpd.conf as well as other configuration) so far it works and I could connect to the xampp/index.php but coulnd’t run any .php files in my htdocs (shows blank except…
Jquery ajax get request
I am new to jquery and php, I have two input fields, zip and city, the city shall output a value based from the zip that the user input. The jquery script shall call a URL: http://domain.com/city?zip.php=”zip; so that zip.php will return an echo value that will output to the city input field. I tried us…
Filter array to retain rows with smallest element count and unique first and last elements
I want to remove rows from my array so that my result is an array that contains rows with unique first and last elements. If two (or more) rows have the same first and last value, I want to preserve the row with the lowest element count. Say I have the following array: What I want is to remove all
PHP: Concatenate classes on each other
How can I concatenate a class onto another class in this manner? Keep in mind that I will always know everything in the class that needs to be concatenated ahead of time, so generalization is not an issue. Answer This will concatenate two objects together assuming they’re the same type
How to display php errors in a more readable format
I’ve recently switched from WAMP/XAMPP to LAMP and one thing I found useful was the clean, formatted error reporting. On my current server it just displays errors as plain text, and it can be hard to …
Codeigniter empty $_POST & $_FILES
I’m using Plupload to manage file uploads for my site. When I configure Plupload to post to the following test file, the records are shown correctly, however when I post to a CI controller, both $…
keep track of user page view using cookie php
I have this code here: What I’m trying to do is keeping track of the page views the current viewer using cookie. I’m a bit confused with this code because when the web visitor views the webpage for the first time, the result came back saying “Number of views: 0”, when it should be R…