I have this: 2010-04-08T01:01:00Z
I want to remove the 'T' and everything behind it as well.
Also I would like to rewrite the date into this format: 08-04-2010
How can I do this the easiest way?
Thanks
Hey
I have some code that downloads an image from a remote server
$data = file_get_contents("$rURL");
I want to then change the quality of this image, but do not want to save it out to a file first, how do I convert $data into an image that I can then use in imagecopyresampled?
Thanks
What does the below query explain?
SELECT * FROM `jos_menu` WHERE (id = 69 OR id = 72)
I know its very silly question, but sometimes easy things creates mess in my skulls interpreter.. Pls help
EDIT
Its giving me record for both IDs, why is it doing so? It should five me the record for either 69 or 72....
Hi
Is it possible to create a form that only displays if the user hasn't ever complted it?
Once it has been completed the form should never display again?
Thanks
I want to group my data by Age and by gender: like this sample data:
Age: 1
Male: 2
Female: 3
Age 1 Total: 5
Age: 2
Male: 6
Female: 3
Age 2 Total: 9
How can I group the data according to age and count all the male and females in that age from mysql database?
Hello, I have set up an array of censored words and I want to check that a user submitted comment doesn't contain any of these words. What is the most efficient way of doing this? All I've come up with so far is splitting the string into an array of words and checking it against the array of censored words, but I've a feeling there's a neater way of doing this.
This may be a silly question, but how do I save variables that are not specific to a particular session. An simple example of why you might want to do this would be a visitor counter - a number that increases by one each time someone visits a web page (note - I'm not actually doing that, my application is different, but that is the functionality I need). The only ways I can think of doing this are either writing the variables to a file, or putting the variables into a database. Both seem a bit inelegant. Is there a better way to to this kind of thing?
I converted all mysql tables to utf-8_unicode and started using mysql_set_charset('utf8'); function.
But after this, some characters like S, Ö started looking like Ö , Åž
How can i replace this kinda letters in mysql with UTF-8 format ?
shortly, can i find a list of all these kinda characters to replace ?
EDIT:
He is explaining about this issue in this article actually but i cannot understand it properly acutally lol
http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html
I'm playing around with an idea, and I'm stuck at this one part. I want to read an external HTML page and then extract the data held within two <dd> tags. I've been using file_get_contents with good results, but I'm at a loss as to how to accomplish that last part. The two tags I want to extract the value from are always enclosed within a particular <div>, was wondering if that might help?
In my mind it reads the entire html file into a string, then dumps all the data up until this one particular <div>, and dumps all the data after the closing </div>. Is that possible? I think this needs regex syntax which I've never used yet. So any tips, links, or examples would be great! I can provide more info as necessary.
Currently anybody can access the solr admin page by going to my_ip:8983/solr
I can't have it like that, so how can I make it prompt for password or something?
I have setup my servers apache2.conf file to prompt for password whenever my site is accessed by www.mydomain.com.
But when using another port, the "require password" wont show up.
Any ideas how to secure this?
Don't point me to the SolrSecurity wiki because it's simply too outdated. I have tried it without luck.
Thanks
Hi Guys,
I'm building a part of a system where the user can define "views" from a mysql database.
I want some way of generating simple HTML tables/reports from the data, but not just plain output of sql queries- simple joins probably isn't enough.
Any ideas?
I'm using a form where the user can edit an entry. Everything is populating and all is well with the exception that I can't get the drop down to show the project that they've already assigned the image to.
$project_qry = "SELECT * from projects ORDER BY title ASC";
$project_res = mysql_query($project_qry);
$project_drop = "<select name=\"project_id\">\n";
while ($row = mysql_fetch_array($project_res))
{
if ($project_id == $row[title])
{
$project_drop .= "<option value=\"$row[id]\" selected>$row[title]</option>\n";
}
else
{
$project_drop .= "<option value=\"$row[id]\">$row[title]</option>\n";
}
}
$project_drop .= "</select>\n";
I'm sure it's something devilishly simple but I'm stumped.
while($row=mysql_fetch_array($result))
{
$output .= "<Reports>";
$output .= "<ProjectName>";
$output .= $row['ProjectName'];
$output .= "</ProjectName>";
$output .= "<ProjectCount>";
$output .= $row=mysql_fetch_array($result)
$output .= "</ProjectCount>";
$output .= "</Reports>";
}
Can i return the number of rows in table like this, i am getting XML markup error.
Im trying to reset $i to 0 and print the word margin...is this doable the way im trying to pull it off?
class="customGal'.($i == '2' ? $i = '0' && 'margin' : NULL).'"
Thanks in advance.
I want to synchronize two directories. And I use
file_get_content($source) === file_get_content($dest)
to compare two files. Is there any problem to do this?
The following code will add the categories selector widget to the WordPress Page editor interface...
add_action('admin_menu', 'my_post_categories_meta_box');
function my_post_categories_meta_box() {
add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'page', 'side', 'core');
}
What I would like to do is to figure out how to modify the resulting category listing so that it only contains a predefined list of hard coded categories that I define.
Since I'm adding this via my custom theme, it will only appear on the page editor when my theme is active on the site. And I have some specific "handler" categories that my theme installs into the site and later uses to determine layout elements.
This code repeats itself. How can I make it shorter? Maybe by using anonymous function or something?
foreach ($value as $wrong) {
if (starts_with($wrong, '%') and ends_with($wrong, '%')) {
$wrong = trim($wrong, '%');
if (contains($address, $wrong)) {
$corrected_address = str_replace($wrong, $key, $address);
break;
}
}
else {
$wrong = trim($wrong, '%');
if (ends_with($address, $wrong)) {
$corrected_address = str_replace($wrong, $key, $address);
break;
}
}
}
Thanks.
I have rather long entries being submitted to a database.
How can I create a function to see if this entry has a link within it? Can someone get me started?
Pretty much, I want the function to find any
I'd prefer not to throw the entry into an array. Are there any other ways to accomplish this?
I've never really thought about this, but it helps with some security of something I'm currently working on. Is it possible to submit GET data without an actual input field, and instead just getting it from the URL?
If so, how would I go about doing this? It kind of makes sense that it should be possible, but at the same time it makes no sense at all.
Perhaps I've been awake too long and need some rest. But I'd like to finish this project a bit more first, so any help you can offer would be appreciated. Thanks
var page = 'data/appointments/<? echo $_SESSION['name']; ?><? echo $_SESSION['last']; ?>App.html';
var lM;
function checkModified(){
$.get(page, function(a,a,x){
var mod = x.getResponseHeader('last-modified');
alert (lM);
alert ("page" +mod);
});
}
when i alert the last-modified from my page, it outputs the same value, even when when i deleted all my cookies and cache , deleted the file from the server and replace it.
it still outputs one value
Tue , Oct 23, 2012 3:37:41 GMT
So apparently i've stumbled upon a coding error when trying to select the time from my database.
SELECT * FROM `videos` WHERE `added_time` > AddTime( CurTime(), '14400 hour' )
is the code, i'm trying to select all the videos posted 10 days (14400 hours) ago using the "added_time" format, because it worked for my previous coding but in this one it work work.
Shown below is a link to the image showing how my database structure for videos are shown.
http://i.imm.io/NURT.png
Edit: Previously i had this problem for retrieving and deleting bulletins posted 10 days ago, and this code worked, however this code apparently won't work when trying to retrieve the videos :/ I don't know why, they're using the same format.
See: http://i.imm.io/NUSW.png
Hi,
is it possible to use date_sub like this ?
$dt = date("Y-m-d h:i:s");
$query = "INSERT INTO `table` (`date`) VALUES ('DATE_SUB('$dt', INTERVAL 15 DAY)')";
$result = MYSQL_QUERY($query);
Thanks