I have a query that is run 1000s of times which I'm trying to optimize using prepared statements:
$query = "SELECT day, ticker, SUM(score*mod) as shares FROM indicators, modifiers WHERE indicators.dex=modifiers.dex AND ticker='$t' GROUP BY day, ticker HAVING shares>=$s";
When I run the query normally:
$transactions = $dbm->query($que...
I have the following table:
CREATE TABLE IF NOT EXISTS `notes` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL DEFAULT '0',
`note` text,
PRIMARY KEY (`id`)
)
INSERT INTO `notes` (`id`, `uid`, `note`) VALUES
(1, 1, 'noteteeext'),
(2, 1, 'notenotenotenote');
As you can see i have 2 rows with uid=1 but i...
I am trying to find a way to save the hash portion of a url and as a PHP variable. This idea is a bit kooky, but bear with me...
I'd like to extract the "location" fragment from the following URL and save it as a PHP variable.
http://www.example.com/#location
However, discussion at this link indicates that the fragment of a URL is o...
The radio buttons in Zend Framework are displayed in a column (one option per line). How can I remove the br tag from the markup so that all radio options stay in one line?
My decorators are:
private $radioDecorators = array(
'Label',
'ViewHelper',
array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'radio'))...
I have $_GET['tags'] = "apples, oranges, bananas, grapes, cherries"
I need to place the data into an array ($tags).
What is a quick way to trim each item and perform security functions (stripping html, special chars)?
...
I am trying to scrape img src's with php, I can get the src fine, but if the src does not include the full path then I can't really reuse it. Is there a way to grab the full path of the image using php (browsers can get it if you use the right click menu).
ie. How do I get a FULL path including the domain in one of the following tw...
For an online project I'm working on, I am looking for a open source grammar checker. I have searched Google, with some good results (http://www.link.cs.cmu.edu/link/, etc), but I am wondering what all of you think about this topic.
I need this to be able to be used online, versus desktop based, but this is the only real specification ...
I have two arrays of attributes that describe products in the database:
$sizes = array(
'Shirt Size' => array('Small', 'Medium', 'Large'),
'Sleeve Size' => array('Short', 'Long')
); // Level 1
$colors = array(
'Shirt Color' => array('Black', 'Red'),
'Slee...
Hi All,
I am using php with code igniter. I am designing a website with php. I have a requirement in brief described as below:
I have a view page with table in it. I load this view from many different controller .php files. Now i want one of the item in the table to appear with different colors when loaded from different .php controll...
I have a method in a class that will append an item to an array member of the class. When the array member is empty (but previously had two items in it at index 1 and index 2) and I call the method, the item is inserted at index 2. Why is that? If anyone doesn't know right off the bat, I can provide MANY more details.
...
I have the following which i use in a traditional onclick event for a DIV tag
How would I go about implementing this using jquery?
$parameter = "onClick=\"selprice('" .
$price_options_array[$price_counter]['price'] . "','" .
$price_counter . "')" . "\"";
I use the above and just add it to my div like so:
<div class="price_row" <...
Well I'm having some really weird trouble, this is what happens:
This is the environment:
I have a modal panel that has to be able to hold several "steps", first you have to upload a file, then the file is processed and from this processing result, I have to generate some html to fill the next step.
This is what I do:
I'm uploading a ...
I'd like to have a function behaving as mysql_real_escape_string without connecting to database as at times I need to do dry testing without DB connection. mysql_escape_string is deprecated and therefore is undesirable. Some of my findings:
http://www.gamedev.net/community/forums/topic.asp?topic_id=448909
http://w3schools.invisionzone....
Should be a simple enough question:
If I am using mysqli prepared statements, do I still need to use mysqli_real_escape_string() as well?
Is this necessary, or a good idea?
Thanks, Nico
...
I have a page that displays a row depending on the id given in the browser bar (page.php?id=1). I am trying to use forward and back buttons to display the corresponding next or previous row on the page. So essentially the prev and next buttons will just be links to page.php, with the id being the next in the list. It isn't a sequential l...
I have a php page that calls and runs a method called pagestart() in a class called construct. Later in that same page I call a different method in a different class. If that different method errors for any reason I would like to have it call the error() function in the construct class.
My question is is there a way to call the error() ...
I've created the a class and tested, and getting the error
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /usr/local/apache/htdocs/MiniBlog/user/user_class.php on line 96
The line 96 is in the function of class User:
class User{
var $reg_time;
functioin set_regtime($regtime){
$this...
Hi I have the following problem. I'm updating my mysql database using LSL. There is a corresponding table in the database and there is update.php with appropriate settings (have tested it with html form and php). Problem is that the record is added but with no values in the appropriate fields.
string time;
string address;
string mess...
Say I want a php script the run the function itstime() every hour. Other than setting up a cron job on the server how can I do this?
Or is this not possible because php scripts need to be opened to be ran?
Thanks.
EDIT: I want to write some information to a log file and depending on some variables send it in an email.
...
How do I go about implementing a secure password reset function without sending the user an e-mail? There is another secure bit of information that I store and only the user should know, but it seems insecure to just let the user update a password just because they know a 9 digit number.
Note that user data is stored in a simple SQL tab...