somewhere while studying I juz found out something interesting.. It says something as follows:
$query = sprintf("SELECT firstname, lastname, address, age FROM friends
WHERE firstname='%s' AND lastname='%s'",mysql_real_escape_string($firstname),
mysql_real_escape_string($lastname));
using the query like this instead of
$query="se...
Hi,
I have the following function to create the SQL for an insert query:
function insertQuery($data, $table) {
$key = array_keys($data);
$sql = "INSERT INTO " . $table . " (" . implode(', ', $key) . ") VALUES " ;
$val = array_values($data);
$sql .= "('" . implode("', '", $val) . "');";
return $sql;
}
Normal...
Hi,
my title may not be clear. But basically what I want to do is:
There will be a link in my php form
<a href="somepage.php" target=_blank>Update</a>
when the user clicks on the link, a new browser window opens and allows him to select some options. There will be close button in that window. When he clicks on that 'close' button, t...
Is there any EASY php testing Framework and may be simpler than simpletest and not command line based like PHPUnit ?
...
Hi,
I have a very basic upload script, probably lifted straight off the php.net/move_upload_files function page.
move_uploaded_file() is failed because it cannot find the tmp file in the tmp folder. But I KNOW that it is being put there, but is removed before move_upload_file() can deal with it in my script. I know it is being put ther...
Hi all,
I need to choose a forum component for a new Joomla installation and I'm wondering which one should I use:
JoomlaBoard
Joomla phpBB
Joomla SMF
Any other you might want to suggest
Among the requisites, I will need to dynamically create/delete forums and to add/delete members, so a forum that offers high level API for these ta...
My code was working all fine yesterday and today it suddenly just don't want to connect to my database. I have changed no settings on it or on the code and I haven't updated any software either. All I do is this:
new PDO('mysql:host=localhost;port=3306;dbname=test', 'username', 'password');
And I get a nice exception message saying t...
I have a advertisement website with alot of records stored in a mysql db.
On my main page, I have a form where users may specify their search criteria.
Action is set to myPhp.php file.
myPhp.php contains NO HTML, only php code, and it is basically something like this:
1- get values from FORM and build a SQL query
2- query MYSQL db.
3...
I'm reading The Pragmatic Programmer and I'm on the section where the authors suggest that we learn a new language every year. I'm currently a PHP developer and I'm wondering, what should I learn next?
I'm looking for a language that will help me improve my skills and help me with my daily tasks. Something useful.
Any suggestions?
[Ed...
I realize they have an API but some of
the questions I have wouldn't be
answered by it, and it would be great
to receive feedback from others who
have integrated it before.
I basically am working with a web site where visitors may choose to sell a used item to the site owner.
If the user decides to sell, he can enter in the...
Hi there,
I'm building a Magento store and want to be able to display a list of categories and have each category link to its own page.
I have a 'Brands' category with an ID of 42 and I want to display a list of the sub-categories and ensure that each one links to the designated URL key in the CMS.
Has anyone had experience of doing th...
I am trying to use flot to plot some data that is pulled from a MySQL db. I am log users login visits and I have a SQL function that will retreive the number of visits per day for a given month, getStats($day). I have read some examples online how to properly do this but for some reason when I try and graph the array data in my javascrip...
Hi Guys,
I'm trying to design a program in PHP that would allow me to find files with specific file extensions (example .jpg, .shp etc) in a known directory which consists of multiple folders.
Sample code, documentation or information about what methods I will be required to use will be much appreciated.
...
In perl, I could assign a list to multiple values in a hash, like so:
# define the hash...
my %hash = (
foo => 1,
bar => 2,
baz => 3,
);
# change foo, bar, and baz to 4, 5, and 6 respectively
@hash{ 'foo', 'bar', 'baz' } = ( 4, 5, 6 );
Is there any way to do the same in php? In fact, is there even a way to get a slice of an ass...
So far, I've seen many different naming conventions used for PHP namespaces. Some people use PascalCase\Just\Like\For\Classes, some use underscored\lower_case\names, some even use the Java convention for package names: com\domain\project\package.
The question is very simple -- can any of these (or other) conventions be called well-establ...
I want to be able to make classes which extend the MySQLi class to perform all its SQL queries.
$mysql = new mysqli('localhost', 'root', 'password', 'database') or die('error connecting to the database');
I dont know how to do this without globalising the $mysql object to use in my other methods or classes.
class Blog {
public funct...
So, I've got this big project written in PHP and Javascript. The problem is that it's become so big and unmaintainable that changing some little portion of the code will upset and probably break a whole lot of other portions.
And I know for a fact that I'm really bad at testing my own code (as a matter of fact, others point this out dai...
SELECT * FROM disney;
+++++++NAME+++++++
lion king
cinderella
the little mermaid
+++++++++++++++++++
$string = "i love the movie lion king, it rocks!"
I want to get the NAME from disney where the NAME is inside the given string. It's kinda like:
'SELECT * FROM disney WHERE NAME LIKE "%'.$string.'%";'
only the other way around (but ...
Hi,
CURL can follow header redirects with the use of CURLOPT_FOLLOWLOCATION but is it possible to follow meta refresh redirects?
Thanks
...
Hello,
I am hoping for some advice, imagine if you will will you are on a website and you are greeted solely with navigation menu, on click the navigation menu that is situated within the left hand side of the screen you can add various content to the right side of the screen that is loaded in individual ‘divs’ then collapsed in accordi...