I'm experiencing my first mysql INSERT tests and I'm using these tables:
table employees
-> employee_id
-> employee_name
-> employee_surname
-> employee_url
table areas
-> area_id
-> area_city
-> area_address
-> area_country
table agencies
-> agency_id
-> agency_name
-> agency_url
table node_employees
-> node_id
-> employee_id
-> are...
So I have been developing plugins that create interact and delete to a database by using the get_option functions.
I have now seen some tutorials showing how to use the global $wpdb way of getting values from the database.
What is the difference between the two, and is one better than the other?
...
I have a queue (Amazon SQS) of data that needs to be processed, and I would like to do it with multiple processes (in PHP).
I want the child workers to do something like this (pseduoish code):
while(true) {
$array = $queue->fetchNItems(10); // get 10 items
if(!count($array))
killProcess();
foreach($array as $...
I'm trying to create a very simple login for only one or two users, the username and password are stored in "admin.txt" the text file is formatted like:
username
password
__
I cannot seem to have the username and password register... Thanks for the help!!
// username and password sent from form
$myusername=$_POST['userna...
is it possible to redirect an iframe to display the content of the frame after 2 seconds in a full window(same window, not a new one). I hope for a PHP solution.
...
How can you prevent "referral scams"?
For example, in a wordpress-based site of mine, I suddenly noticed that someone clicked a link from some site I had never heard of. When I followed the link, there was obviously not a link to MY site. The site was selling products, in this case books. All comments followed a similar speech pattern, ...
I have a simple 'dimensions' class containing a width/height property and a constructor to set them.
I have a function (to re-size dimensions) that takes two dimensions objects -- one to be re-sized, and one containing the max size. It should reduce the dimensions in the first parameter such that they 'fit into' the second parameter.
T...
Is there a logical (and possible) way to do something like this?
UPDATE $table SET LIKE %_checkbox = '' WHERE id='$id'
I have fields like allowed_checkbox and types_checkbox and they are sent to the database script dynamically. Can you use a wildcard when referring to the column name?
...
Hello all,
I am looping through a list of files in a directory and I want to match a substring that I have with the filename. If the filename contains the substring then return that file name so that I can delete it. I have done the following and its just returning everything:
while ($file = readdir($dir_handle)) {
$extension...
<?
if(isset($_POST['accountUser']) && isset($_POST['accountPassword'])) {
include("dbase.php");
include("settings.php");
if ($_POST['accountType']=="member") {
$database="chatusers";
} else if ($_POST['accountType']=="model") {
$database="chatmodels";
} else if ($_POST['accountType']=="studioop") {
...
Which is better to use when I use _GET['something here'] for a variable to check if it is empty or not
if (isset($_GET['url']) != '') {
//do stuff with it
}
OR
if (isset($_GET['url']) != NULL) {
//do stuff with it
}
'' or null or something else?
Please don't call this over optimizing or micro optimizing, I am simply lookin...
I am trying to make a function in PHP that will allow me to enter basicly any URL and then runs some functions on it just as if a user was uploading on my server. SO I will resize and make some thumbnails but I need help just getting the image in a state that I can run my other codes on it. Another user on this site helped me get start...
In my View (using Zend_View so the the view is an object), I make calls to object properties and methods to populate the template like so:
<?= $this->user->name ?> // Outputs John Doe
<br/>
<?= $this->user->getCompany()->name ?> // Outputs Acme
<br/>
<?= $this->method() ?> // Outputs foobar
If I make it so that all property requests (...
I know that mysql_real_escape_string()
prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a
I know how this protects a query from injection into something like a variable in a where clause. But here's a scenario I am unsure of:
$query = "SELECT * FROM $db WHERE 1";
If $db is taken from a user input, t...
Should have asked someone this a long time ago.
What is the best way to use other classes within another class?
For instance, lets say I have an application class:
class Application
{
public function displayVar() {
echo 'hello world';
}
}
and a database class
class Database
{
// connects to db on construct
p...
PHP: If I have a customer class, and the customer can have a car and an invoice, and I want to have separate car and invoice classes, what is the most efficient way of setting them up?
So, I have three different classes:
customer.class.php
customer_car.class.php
customer_invoice.class.php
What's the best way to set up the relation...
I am trying to see if I can convert a for loop to a foreach loop. Reason: Because I would like to make this code more generic and stay away from magic numbers. Although I know the numbers of column in the dataset, I would prefer to make the code more generic. I have tried using the end() and next() functions to try and detect the last...
This site is built using CakePHP 1.2*
I have an element that needs to be placed in multiple views under multiple controllers. This element is very dynamic, every time a page is loaded it needs to call a function (which is rather large) and then display what was returned.
There are a few options that I have thought of, none of which I ...
Within the code below, how do I set VAR as some variable and then include it within the SimplePie code as the feed URL? The "feed" code is from the Simplepie PHP libary.
<?php
$VAR = "http://website.com/feed/";
$feed1 = new SimplePie();
$feed1->set_feed_url('$VAR');
$feed1->init();
?>
...
Due to an absurd SOAP authentication scheme I need to md5 hash an API key with some other parameters. Unfortunately the only sample code provided is written in PHP and, for reasons I find unfathomable, it requires that the md5 hashing use the optional raw_output flag in PHP (http://php.net/manual/en/function.md5.php) which causes it to ...