I have a function in my Comic Model as such:
<?php
class Comic extends AppModel
{
var $name = "Comic";
// Methods for retriving information.
function testFunc(){
$mr = $this->find('all');
return $mr;
}
}
?>
And I am calling it in my controller as such:
<?php
class ComicController extends AppController...
So if today was April 12, 2010
it should return October 1, 2009
Some possible solutions I've googled seem overly complex, any suggestions?
...
Hi, I am creating a map using the new(ish) v3 of the Google Maps API
I have managed to get a map displaying using code as below:
var myLatlng = new google.maps.LatLng(50.8194000,-0.1363000);
var myOptions = {
zoom: 14,
center: myLatlng,
mapTypeControl: false,
scrollwheel: false,
mapTypeId: g...
User writes a series of tags (, separated) and posts the form.
I build an array containing the tags and delete dupes with array_unique() php function.
I'm thinking of doing:
go through the array with foreach($newarray as $item) { ... }
check each $item for existence in the tags mySQL table
if item does not exists, insert into ...
I'm creating a CMS using jQuery and AJAX. When I click, my "Add Campaign" buttom, it creates a unique client ID in the DB and on a hard reload, the new client shows up in its container. I am trying to use ajax to reload the container on the fly and I'm not having the exact luck i am hoping for. I can get it to reload, but it's like it'...
Hi,
I'm trying to preg_replace charset=blablabla; and charset=blablabla" with charset=utf-8; and charset=utf-8". Please see ; = and " characters, and of course searched string can be lower/uppercase.
Can you help me?
...
I'm building a simple time tool (php, mysql, js) that takes the current date and time (both formatted and raw unix timecode) and provides sliders that allow people to add time to an event. There are three units, days, hours and minutes. Clicking on up or down arrows is adding the appropriate time to a hidden "timecode" field.
The field...
I added a couple new attribute to my products(a boolean "yes/no" fields). They are variables to enable/disable the price from displaying on the product detail page, and grid view.
I managed to get it work on the product info page. But on product grid page I cant seem to access those variable. Specifically, the template i am working with...
I've got several div id's, each containing a different client. I want to be able to click the delete button and using ajax and jquery delete the specific div from the database. I'm getting success in AJAX but it's not deleting anything from the DB. And then obviously, upon deletion, I would like the container to reload dynamically. help...
If you know XHTML, CSS and Basic PHP, can you get a job with those skills and what type of jobs should i be looking for? Thanks
...
Im making a gaming community and i wanna be able to grab any info of the user on any page without so instead of having much of queries on all pages i made this function. Is it better to do this? Will this slow down the site?
/**
* Возьмем значение из любой области authed пользователей.
*/
function UserData($f)
{
global $_SESSION;
...
I have generally always used some sort of Hungarian Notation for my field names in my tables e.g.
#Table Users
u_id, u_name, u_email etc...
#Posts
p_id, p_u_id, p_title, p_content etc...
But I have recently been told that this isn't best practice. Is there a more standard way of doing this? I haven't really liked just using the field...
Is it possible for a web page using Javascript to get data from another website? In my case I want to get it for calculations and graphing a chart. But I'm not sure if this is possible or not due to security concerns. If it is considered a no no but there is a work around I would appreciate being told the work around. I don't want to...
I need help converting eregi_replace to preg_replace (since in PHP5 it's depreciated):
function makeClickableLinks($text)
{
$text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'<a href="\\1">\\1</a>', $text);
$text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
...
Hi guys
Is there a way to check the data sent by a form to a PHP page return to the form page WITHOUT resetting the data sent and show a error?
The form has 20 fields and I need to check one of them on a bd. If it fails the user may be redirected to the form page with the form populated and displaying a error message on the field which...
I am looking to find a why to calculate a suitable background colour and a colour for the text that would go over the top, obviously I need to take into account readability and accessibility.
I would need to pick the two colours from the array, the colours are stored in their hex representations.
#CC9966
#996633
#FFCC99
#CCCC99
#000000...
I am trying use a Java Uploader in a ROR app (for its ease of uploading entire directories). The selected uploader comes with some PHP code that saves the files to the server. I am trying to translate this code to Ruby, but am stumped on this point:
PHP has a very convenient superglobal – $_FILES – that contains a hash of all files up...
$s = explode (" ", microtime());
$s = $s[0]+$s[1];
$con = mysqli_connect ('localhost', 'test', 'pass', 'db') or die('Err');
for ($i=0; $i<1000; $i++) {
$stmt = $con -> prepare( " SELECT MAX(id) AS max_id , MIN(id) AS min_id FROM tb ");
$stmt -> execute();
$stmt->bind_result($M,$m);
$stmt->free_result();
$rand = mt_rand( $m , ...
I'm looking to setup a custom route which supplies implicit parameter names to a Zend_Application. Essentially, I have an incoming URL which looks like this:
/StandardSystems/Dell/LatitudeE6500
I'd like that to be mapped to the StandardsystemsController, and I'd like that controller to be passed parameters "make" => "Dell" and "model"...
I am currently looking into color manipulation / selection etc and have come across the following piece of code. I was wondering of someone could tell me what the following piece of code is doing and break it down for me thanks!
$newVal = round(round(($rgb['red'] / 0x33)) * 0x33);
In particluar what is the 0x33
Thanks in adavnce
...