I'm storing leads in a database, and each lead has a datetime field with a PST timezone based date & time.
I want my user to be able to display all leads from a certain date (e.g. today, yseterday), and choose the timezone.
E.g. if I want to see all leads that were generated yesterday in EST timezone, I need to first convert (or read) all the datetime values to EST, and then only select those who are in the right range (yesterday).
What would be the best way to do that?
i am trying it get that div displaying 5 in a row and then start a new line and display more
atm all that is happening is the are going under each other.
CODE
< div>Line1< br />Line2< br>Line3< /div>
Thank you
Hi, i was wondering if it was possible to create email forwading accounts on the fly as I have created subdomains for uses profiles i.e. user.profile.com and was wondering if I could create [email protected] to forward to their email account?
Regards,
Phil
I want the user to be able to type in a fraction like:
1/2
2 1/4
3
And convert it into its corresponding decimal, to be saved in MySQL, that way I can order by it and do other comparisons to it.
But I need to be able to convert the decimal back to a fraction when showing to the user
so basically i need a function that will convert fraction string to decimal:
fraction_to_decimal("2 1/4");// return 2.25
and a function that can convert a decimal to a faction string:
decimal_to_fraction(.5); // return "1/2"
How can I do this?
Thanks!
Ok so I have managed to get the format of the date presented in HTML (upon display) to how I want (dd/mm/yyy)...However, the user also can change the date via a form.
So this is how it's setup as present. Firstly, the conversion from YYYY-MM-DD to DD/MM/YYYY and then display in HTML:
$timestamp = strtotime($duedate);
echo date('d/m/Y', $timestamp);
Now when the user selects to update the due date, the value already stored value is drawn up and presented in my text field (using exactly the same code as above).. All good so far.
But when my user runs the update script (clicks submit), the new due date is not being stored, and in my DB its seen as '0000-00-00'. I know I need to convert it back to the correct format that MySQL wants to have it in, in order for it to be saved, but I'm not sure on how to do this. This is what I have so far in my update script (for the due date):
$duedate = $_POST['duedate'];
$timestamp = strtotime($duedate);
date('Y/m/d', $timestamp);
$query = "UPDATE films SET filmname= '".$filmname."', duedate= '".$duedate;
Can somebody please point me in the right direction to have the new date, when processed, converted back to the accepted format by MySQL. I appreciate any help given! Thanks.
Hi All,
Im wanting to organize a series of dates in the following format. As a bit of context, the dates are the dates of upcoming events that can be added by my users. The format:
January 2011
date - event
date - event
date - event
February 2011
date - event
date - event
date - event
with all events in a given month, arranged by the date on which they occur. All of my event dates are stored in my database as unix timestamps. Problem is, i dotn know where id start to develop a function that would order all of my events in this way. Can anyone help me out?
Cheers
I have a multidimensional array. The array itself is fine. My problem is that the script takes up monster amounts of memory, and since I'm running this on my MAMP install on my iBook G4, my computer freezes up. Below is the full script.
$query = "SELECT * FROM posts ORDER BY id DESC LIMIT 10";
$result = mysql_query($query);
$posts = array();
while($row = mysql_fetch_array($result)){
$posts[$row["id"]]['post_id'] = $row["id"];
$posts[$row["id"]]['post_title'] = $row["title"];
$posts[$row["id"]]['post_text'] = $row["text"];
$posts[$row["id"]]['post_tags'] = $row["tags"];
$posts[$row["id"]]['post_category'] = $row["category"];
foreach ($posts as $post) {
echo $post["post_id"];
}
Is there a workaround that still achieves my goal (to export the MySQL query rows to an array)?
-Dylan
My question is about creating a secure log in routine. After comparing the user name and password to the stored values I set a session variable called logged to true. Then as the user surfs around the web page I just check the logged variable for true or false to determine if the user should have access.
This is my first time creating something like this. Is this secure? I feel like there is something else that I should be doing to make sure that users are valid.
Here's a regex that I've cobbled up:
/(.*={76}\s)?\s*(.*?)\s\-\-\s(\d{2}\/\d{2}\-\d{2}\s\d{2}:\d{2})\s\s(.*?)\s(http:\/\/service.*?)\s(\-{76})/is
and here's the text I will be parsing: http://p.linode.com/7015
and here's the replacement for the matched text:
<item>\n\t<title>$2</title>\n\t<pubDate>$pubDate</pubDate>\n\t<description>$4</description>\n\t<link>$5</link>\n</item>\n\n
I have almost come up with a regex needed to parse a block of text into RSS 2.0 XML markup. I've tested it with RegExr and RegexBuddy and it works perfectly except for the last "item" where there is no line breaks after the link (Line 269). In short, the problem is the "iProperty" article in the text is not matched.
Any regex gurus willing to help me troubleshoot what's wrong? I've tried
/(.*={76}\s)?\s*(.*?)\s\-\-\s(\d{2}\/\d{2}\-\d{2}\s\d{2}:\d{2})\s\s(.*?)\s(http:\/\/service.*?)\s*(\-{76})/is
Here's the output that I get: http://p.linode.com/7016
but that didn't work as I expected (i.e. a newline would be optional).
Thanks!
I have the code below . it looks for the case and creates an array of rows and columns.
$pv->results[$row1][1][0] actually is $pv->result->[rownumber][coulmnnumber][0].
Now this is for only 2 columns as you can see. However I want an array like
$myArr = array(0=>1, 1=>7, 2=>8, 3=>9 ) to be added below for column. What it is doing, is adding 4 columns (0,1,2,3) into the code below. So now I will have 4 cases instead of 2 cases as I need to more columns. Also the case value will not be 1 and 2, it will be 1, 7, 8 and 9 respectively. How can I do that? Thanks.
for($i=0;$i<count($pv->rawData); $i++){
SWITCH ($pv->rawData[$i]->my ID){
CASE '1':
$row1++;
$pv->results[$row1][1][0] = $pv->rawData[$i]->data;
break;
CASE '2':
$row2++;
$pv->results[$row2][2][0] = $pv->rawData[$i]->data;
break;
}
By using javascript am trying to cal a webservice.That service return response as follows..
<envelope>
<date_time>
Test', callbackTest Wednesday, March 31, 2010 2:28:55 AM
</date_time>
</envelope>
I am using firefox as browser to execute the application.Thats why after creating the object of XMLHttpRequest try to read as follows
_xmlDoc.responseXML.getElementsByTagName('date_time')[0].firstChild.nodeValue;
But it is showing output like undefined.please help me to solve this problem.What is actual problem ?
I'm trying to use regular expressions (preg_match and preg_replace) to do the following:
Find a string like this:
{%title=append me to the title%}
Then extract out the title part and the append me to the title part. Which I can then use to perform a str_replace(), etc.
Given that I'm terrible at regular expressions, my code is failing...
preg_match('/\{\%title\=(\w+.)\%\}/', $string, $matches);
What pattern do I need? :/
Hi all,
I have have an array as follows:
$row[6]
This section of the array has 4 numbers within it that I can display and use without any problems, what I'd like to be able to do is sum the first two numbers and the last two numbers separately.
Is there any way to do this?
Thanks in advance,
Homer.
Boy, this one is really weird. I expect the following code to print 1990, but it prints 1989!
$val = '$19.9';
$val = preg_replace('/[^\d.]/','',$val);
$val = intval($val * 100);
echo $val;
Why on earth is this happening?
Edit: and this code:
$val = '$19.9';
$val = preg_replace('/[^\d.]/','',$val);
echo $val . "<br>";
$val = $val * 100;
echo $val . "<br>";
$val = intval($val);
echo $val;
Prints:
19.9
1990
1989
Why does intval(1990) equal 1989???
hi
how can i find a word position in google search in my site (e.g there are several tool available which input as keyword and siteurl and display the keyword position in google)
is there any api to fetch the position ?
Thanks
i have $date variable 2009-04-29 which is Y-m-d
anybody can give idea how to extract into $d, $m, $y using simplest method as possible?
regex is preferable.
any more suggestion with simple method will be chosen. :)
I am trying to take a string of text like so:
$string = "This (1) is (2) my (3) example (4) text";
In every instance where there is a positive integer inside of parentheses, I'd like to replace that with simply the integer itself.
The code I'm using now is:
$result = preg_replace("((\d+))", "$0", $string);
But I keep getting a "Delimiter must not be alphanumeric or backslash" error.
Any thoughts? I know there are other questions on here that sort of answer the question, but my knowledge of regex is not enough to switch it over to this example.
I've been using prepared statements for a little while now and I've never had any problems.
Now I'm trying to:
$sql="SELECT PhotoID,Caption FROM Photos WHERE EntityID=? AND TypeID=? LIMIT ?,?";
$iDB = new mysqliDB(); // Extends mysqli
$stmt = $iDB->prepare($sql);
$stmt->bind_param('iiii',$entityID,$typeID,$minRange,$maxRange);
$stmt->execute();
$stmt->bind_result($photoID,$caption);
echo("Affected={$stmt->affected_rows}");
This prints -1. I have triple tested that all 4 values in bindParam are set, and that the sql query works when pasted into myAdmin with the respective values.
Any idea what may be causing this?
Hi,
I want to make a notification system. Shortly.. to compare two dates, the only problem is that i want to compare the months. to see if a month or two have passed from last notification.
i want to use one or two months from an entry in a mysql database.
the client must select when the notification must come, one or two months.
thank you,
Sebastian
hi,
I have asked a question regarding updating a csv file's contents to the db @Question
Now I want to add this functionality, like my db will contain url to images that are stored on a prespecified folder on the server.
The csv files will contain the urls as to where these images reside on the client side.
Now when I click an upload the following should happen
My file must read the location of image on the client side
Must copy the image from the client to the server's prespecified folder
update the corresponding field in the db table with the url of the image
Hello, i want to split the searchrequest into parts, if there's nothing to find.
example: "nelly furtado ft. jimmy jones" - no results - try to find with nelly, furtado, jimmy or jones..
i have an api url.. thats the difficult part.. i show you some of the actually snippets:
$query = urlencode (strip_tags ($_GET[search]));
and
$found = '0';
if ($source == 'all')
{
if (!($res = @get_url ('http://api.example.com/?key=' . $API . '&phrase=' . $query . ' . '&sort=' . $sort)))
{
exit ('<error>Cannot get requested information.</error>');
;
}
how can i put a else request in this snippet, like if nothing found take the first word, or the second word, is this possible? or maybe you can tell me were i can read stuff about this function?
thank you!!
Hi guys,
I am here as a developer of a website. My website got different modules among which one function is to process credit card. In order to process credit card I need to implement SSL layer and process the pages. For rest of modules the SSL is optional.
Now my points are:
1.) Is the location of file for http and https same?
2.) Can the session of http and https be shared? this is required as i need user login information and cart item information.
Does anyone know how to uncompress the contents of a gzip file that i got with curl?
for example: http://torcache.com/torrent/63ABC1435AA5CD48DCD866C6F7D5E80766034391.torrent
responded
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 09 Jun 2010 01:11:26 GMT
Content-Type: application/x-bittorrent
Content-Length: 52712
Last-Modified: Tue, 08 Jun 2010 15:09:58 GMT
Connection: keep-alive
Expires: Fri, 09 Jul 2010 01:11:26 GMT
Cache-Control: max-age=2592000
Content-Encoding: gzip
Accept-Ranges: bytes
then the compressed gzip,
i tried gzdecode but doesn't work , gzeflate as well doesn't they simply don't get any response, and the contents of the files are no more than 2k