Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Why Doesn't Strtotime('') Return -1


instead of the warning message:
strtotime(): Called with empty time parameter in ...

Any good reason?




View Complete Forum Thread with Replies

Related Forum Messages:
Odbc_fetch_array Doesnt Return Any Values
My problem is odbc_fetch_array returns no value at all, but the scripts returns no error and all i can see in the page is the html table without any data in it..

the connection to oracle via odbc works, and in my other scripts i used odbc_fetch_row to retrieve data, but this one is kinda slow in getting massive amount of data from oracle. im now testing which is faster, odbc_fetch_row or odbc_fetch_array? but odbc_fetch_array returns no value at all. PHP Code:

View Replies !
Mysql Doesnt Return All Results Of A Query
I have an sql query like this:
SELECT column FROM table WHERE column1="3" AND column2="1"
This query works perfectly if i run it in the command line, to be
exactly it return two results.
But if i run it from php i just get the first of the two results.
Any ideas?

Mysql 4.1.8
php 5.0.3

I have a second problem. But its more of a question.
if i run the foreach loop on an array like this
array("id" => "78"), then it splits 78 up in 7 and 8.
Now you say its stupid to use a foreach for this array. But in the
function there i use it the array could also be two dimensional.
Is this behavior normal? I looked in the php manual but found nothing.

View Replies !
Return 30 Or The Amount Of Actual Rows The Query Would Return If It Wernt For The LIMIT.
i have a query such as:

SELECT * FROM cars WHERE carmake='FORD' LIMIT 0,30

if i run a mysql_num_rows on this, will it return 30 or the amount of actual rows the query would return if it wernt for the LIMIT.

View Replies !
$GET Doesnt Exist
A while back, when I was using PHP4 with IIS, I had a problem getting my PHP scripting to pickup the post data via GET and POST. I solved it by going into the php.ini and setting register_globals to On.

Now Im working on PHP 5 with Apache. I m having the same problem, my scripts are definetley not picking up the posted variables, like $GET and $POST dont exists no matter how many times I submit. I have gone to the php.ini and changed the register_globals value to ON but still nothing is happening, have I missed anything out?

View Replies !
Doesnt Iterate
I'm trying to do write a multiple update routine but its not looping , just runs once and stops.

if ($REQUEST_METHOD=="POST")
{
if (isset($num)){
$i=0;
while ($i<=$num){
($result = mysql_query ("UPDATE data SET valid = '$valid' WHERE id = '$id' "));
$i++;
}
echo ("<P><center> Successfully validated<center></P>
");
}
}
else

{.....

BTW, $num is valid and comes from data in other part of the script.

View Replies !
Doesnt Set Cookie?
for some reason, i was switching my system from sessions to cookies, and well, my login will not set the cookie, Code:

View Replies !
Db4 Dba_replace Doesnt Seem To Work For Me
I am trying to write to a dba and the result is creating a database
file, but not writing anything to it. The relevant function is being
called, and my variables are populated, but the database file remains
empty. Am I writing the string arguments wrong, please ?

function addplayer($realname,$pokername){
$dbh=dba_open("../pokeraliases","n","db4") or die ("Couldnt make the
database");
dba_replace("$realname","$pokername",$dbh);
dba_close($dbh);
print ("PERFORMING ADD FUNCTION <br />");
print ("posted variables are $realname and $pokername <br /><br />");
}

if ($addplayer=="add") {
addplayer($name,$alias);
}

View Replies !
Posix_setuid Doesnt Work
I've got problem with posix_setuid().
I've compiled php with --enable-posix.
Everythin like posix_getpwuid() works fine
except posix_setuid and posix_setgid.
Configuration:
php 4+mysql 4+apache 1.3.31.
System - FreeBSD 5.3

View Replies !
If Page Doesnt Exist
I did the mistake of writing my whole website on one index page

The problem is, each page uses
if ($_GET['pg']==page){
#code
}

But if it is not a page, it doesn't execute anything. and the whole site is messed up. Is there anyway to make it so if $_GET['pg'] is not a valid page, then go to a 404 script?

View Replies !
Use A Session It Doesnt Display Anything
I have an index.php page that I have a login form on. I have another page (login.php) that checks to see if the username and password is valid from my database.

The login.php redirects them back to the index.php page. Instead of the login form, i want it to say something like hello <username>.

someone told me to use sessions but every time i try to use a session it doesnt display anything. I dotn know if the variable is beign carried over or if its even possible to be carried over to a different php page.

I have the start_session() thing on top of each of the pages. I define the $_SESSION['user'] variable on the login.php page but when i get redirected back, it doesnt have a value and its not showing up.

View Replies !
Unlink Doesnt Work
i have this image "a.jpg" under directory "image/product/a.jpg". whenever i do unlink("image/product/a.jpg");. it says that permission denied... i dont know why i have done chmod("image/product/a.jpg",0777) before i do unlink. anyone know why?

View Replies !
Set Cookie In IE Doesnt Work In FF
i am facing problem in Firefox which is working fine in IE.

This code doesnt set a Cookie in FF but it does in IE..

$id = $_POST['sendmobID'];
$var = $_POST['vote'];

setcookie ($id+1, $id, $time + 7776000);

header("Location: specs_".$var."_".$id."");

so what could be wrong?

View Replies !
Info That Doesnt Print
I am querying a table and i dont want to print some information if the table doesnt contain any information. my code:

$query="SELECT * FROM items WHERE name='john doe'
$result=mysql_query($query);
$row=mysql_fetch_array($result,MYSQL_BOTH);

if($row{$k}!=""){
echo 'I should only be here if $row{$k} not empty'
echo $row{$k};
}

This will sometimes print even when $row{$k} contains nothing. The table value it is returning should be null or empty and therefore shouldnt print anything? Is it carriage returns or something? When I view the HTML source it will print a new line where the $row{$k} is at.

View Replies !
Data Doesnt Get Updated
I am working on a club software which will allow me to manage players and get a list of all the registerd players, i can add, get list of all of the players, but when i try to modify any one of them i cant .

View Replies !
Script Doesnt Work
if ($AB == 'On') {
if ($line == 'Front Sideline') {
$yc = 204;
}
if ($line == 'Back Sideline') {
$yc = 85;
}
if ($line == 'Front Hash' || $line == 'Back Hash') {
$yc = 206;
}
}

For some reason,this part of my code is causing me problems. I know this,because I tested it over and over and figured out THIS is where the problem is coming from,and nowhere else. the script doesnt work

The problem is this:

IF:
$AB is On
and
$line is Front Hash or Back Hash

View Replies !
Using Strtotime()
Lets say I have a variable $time = 'Apr 30 2007 7:00AM'. Is there a function that I can use or a way of using the strtotime function to see if that variable $time is between the hours of 7am and 7pm?

View Replies !
Strtotime
I am trying to compare 2 dates, so that if a post is older that 90 days the user is not allowed to edit it.

i am storing the post date in mysql in datetime field (2007-04-21 10:53:07). My question is how to user strtotime function to compare the NOW() date&time with the stored one, so if greater that 90 days return true.

View Replies !
A Bug With Strtotime
Something seems to be wrong with the strtotime function in PHP5. I've created a staff resourcing database, which is used to assign staff to projects on a weekly basis. The database stores assignments against a week ending date, which is derived using: PHP Code:

$week = date('Y-m-d',strtotime('Sunday'))

This works fine, $week is set to the current week ending date (Sunday) using this. However, I also create $nextweek and $lastweek using: PHP Code:

$nextweek = date('Y-m-d',strtotime('next sunday',strtotime($week)));
$lastweek = date('Y-m-d',strtotime('last sunday',strtotime($week)));

This has also been working fine, until we got to week ending Sunday 30th October. For some reason, when $week = 2005-10-30, $nextweek becomes 2005-10-05, which is a Saturday. I've tried replacing the 'next Sunday' with '+7 days', but this returns the same date. Is this a bug? Am I missing something?

View Replies !
Strtotime &
I've got a question and was hoping someone could offer some assistance. I've got this simple line in a test file. PHP Code:

echo date("Y-m-d", strtotime("next Monday"));

Here's my results using different versions of PHP:PHP 4.4.7: 2007-11-04PHP 5.1.2: 2007-11-05PHP 5.2.3: 2007-11-05
Todays date is November 03, 2007 (2007-11-03).

View Replies !
Strtotime()
<?php
$current = date ("F", strtotime("now"));

$next = date("F", strtotime("next month")); //or try "+1 month"

echo $current.'...'.$next;
?>

View Replies !
Headers Already Sent - Authentication Doesnt Work ?
I tried ur method but it keeps on telling me headers already sent. Still the authentication doesnt work ?. Does anyone have another method preferably one tailored to the one i displayed or doesnt include a class or function.

View Replies !
Preg And Why [^word) Doesnt Work?
I was trying to write a script to replace some text inside some tags.

Lets say I had <tag stuff=stuff><tag stuff=otherstuff><another>

I wanted it to find all the <tag and remove them.

So I tried to write it so that it would go forward until it reached
[<^another] came. But when I tried that it would respond to another as
single characters and not as the word.

How can I do this with regular expressions, matching up against words using
[^ ] ?

I know I can do what Im trying to do other ways, but when it didnt work with
[^ ], it got me thinking about how to do it that way. Because there might
come other times when I want to 'NOT' against a word, and there has to be a
way of doing this with Regular expressions?

View Replies !
Form Doesnt Show Due To Php Conflict
I decided to load some of my form via php as it was needed to generate a combo box with infomation from a query.. this is what i have yet it doesn't load up on my browser.. Code:

View Replies !
Redirect Different Server Doesnt Work
i am having a problem with redirect. the page which works fine with my localhost, when copied to a different server doesnt work. the code is below:

<?
session_start();
if(!session_is_registered(myusername)){
header("location:template.php");
}
?>

<html>
<body>
<?php
header( 'Location: showrec.php' ) ;
?>
</body>
</html>

when copied to a differnt server it stops redirecting the page and sits there.

View Replies !
Integer Doesnt Subtract Fully
I have a variable set at 10,800 and im trying to subtract it in my query like here:
$Price = 10,800 in this example.

         $subtractMoney = "UPDATE userregistration SET MoneyInHand=MoneyInHand-'$Price' WHERE UserID='{$_SESSION['Current_User']}'";
$result = mysql_query($subtractMoney) or die(mysql_error());
if (mysql_affected_rows() == 0)
{
die('Error ID 0001A, contact admin on the forums immediately about this error!');
}
But the subtraction is only going down by 10. Not 10,800.. although this 10,800 could be any value this was what i used for this example.

View Replies !
Email Validation Doesnt Work?
How come:

if(!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+.[A-Z]{2,6}$", $email)){
echo 'Incorrect';
}
doesnt work? Tried with things like "name", "name@name.com" and it comes back as valid?

View Replies !
Include A Function Doesnt Work
I have this big spaghetti code (my first real PHP project) file and I want to move my functions out of the big ass 12k php file. Well. I moved a function called "listprojects" to listprojects.php

<?php
function listprojects($conn) {
. . . .function stuff
}
?>

. . . and in the main program I put the include statement . . . .

include "listprojects.php";

but when I run the program in the browser nothing happens. The files are in the same directory by the way .

View Replies !
Cookies Doesnt Appear In Cookie List
hi, what's wrong in the next code? The cookies doesnt appear in cookie list, cookies are enabled for sure.

if (blabal) {
...
} else {
$status = "ok";
$newdata2 = "1:5689741";
setcookie ('userdata', $newdata2, $time+604800);header("Location: login.php");
};

This piece of code appears above all html, and I run the script at the localhost at my own computer, there are other cookies set on localhost.

View Replies !
Php5 - Phpmyadmin Doesnt Work
I am useing apache 1.3.x (someing like that) and I Just Installed php 5. And Now phpmyadmin doesnt work. I was reading on php.net and mysql support doesnt com enabled in php 5. How Do I Enable this to allow php and mysql to work together in harmony and not problems.

View Replies !
Comparison Operators Doesnt Work
But here we go: My problem is that the comparison operators fail in some situations.

I've got an input field where the visitors enter a number. I have limited the size of the number to 10 000 by doing the following: Code:

View Replies !
Problem With Strtotime
I am stucked with strtotime to convert date earlier than 1970 into time.
Is there any other way to convert older dates between 1900-1970 into time?

View Replies !
Strtotime 30mins Ago
How can I use strtotime to return the time 30 mins ago, for example:

date("ymd H:i:s",strtotime("-30 minutes"));

View Replies !
StrToTime () Issue
I'm using strtotime to get the timestamp for midnight. I have a statistics
script for my pagecounter that displays hits since midnight.
I also display the number of hours and minutes passed since midnight.

$start = strtotime ('today 00:00');
$timepassed = date ('H:i', time () - $start);

The weird part is at 11.30 AM it says 12 hrs and 30 minutes have passed.
I tried adding GMT+1 like so: $start = strtotime ('today 00:00 GMT+1');
because I suspect the fact I'm in Holland is the reason for the
miscalculation.
But this format is refused by strtotime. (-1)
Does anyone know
a) whether this is indeed the problem, and
b) how to fix it. Preferrably not alone for me here, but in suc a way anyone
around the globe would have a correctly working script if they'd use mine.

The php page for strtotime pointed me to a link at gnu.org where the syntax
for it apparantly is listed, but I get a no such page error.

View Replies !
Strtotime And Cron
I've got a db of events which have dates attached to them which have been created using strtotime().  They don't have any time.. just the date.  I've got a script which gets today's date using strtotime("today").  I use this as a comparison to find events which happen today.  This works fine when I call the script from a URL, however when I called the php file from a cron job... the strtotime("today") creates values which are different each time.

Are there any thoughts on what could be causing this?  Firstly, I was wondering if the cron job was somehow using a different timezone to me (I'm On GMT).  How do I explicitly tell php to use GMT.. .but then again.. this should matter too much, because I jsut want to date not the time!  It also wouldn't account for the changing values of strtotime("today").

Just out of interest, does php4 and php5 handle strtotime("today") differently?  I'm just wondering if cron is using the correct version of php?

View Replies !
Strtotime Question?
I have a string that looks like (a series of them)

1 Sep 2007 21:06:11
2 Sep 2007 13:45:31
2 Sep 2007 13:45:31
3 Sep 2007 01:40:42

and I want to go strto time on it any ideas its return -1 right now so I know somethings wrong.

View Replies !
Date Strtotime
i am trying to right a date into the mysql database but when i get the date from the html form and do strtotime on it it goes to an invalid date (by this i mean it is not the date i entered in the html form so for example 22-06-2007 changes to 28-11-2027).

View Replies !
Remove 0 From Strtotime?
Like every other blog in the world, I have mine displaying the date and time of each entry. Right now this is what I'm using:

echo date('h:ia', strtotime($r[date]));

My latest entry's time is displayed as 07:56pm. How do I remove the 0 when the hour is a single digit?

View Replies !
Strtotime(date('m/d/Y'))
does the following code give the correct time:?strtotime(date('m/d/Y')) or do I need to use : strtotime(date('d/m/Y'))?

I tried to find out which way the month and day work, but can't seem to find anything that will tell me.

View Replies !
Strtotime() Pre-1970
if I code

$birth = strtotime(&#391; April 1950');

then $birth = -1, I guess that this is because time "began" on 1st Jan, 1970. (although I seem to remember a few good times before that). So, what's the easiest way to find out how many days old I am (exactly, please, not just taking 1 April 1970 and adding 20 *365, which does not account for leap years?

View Replies !
Strtotime Failure
I don't know how I should input date + time into a strtotime function (i'm a total noob) so I tested this:

<?
$d=01;
$M=01;
$y=1970;
$h=01;
$m=01;
$s=01;
echo "$d $M $y $h:$m:$s";
echo strtotime("$d $M $y $h:$m:$s");
?>

I get as echo strtotime '-1', wich means the strtotime has a failure. Can anybody explain me why? Or can anybody tell me how I can make a strtotime function that puts a timestamp in the database depending on the date and time inserted in a textbox? (one textbox or one textbox to insert the day, another to insert the year,...) I should be able to change a format like (for example) this : 01-02-1990 00:00:00 (midnight) into a timestamp. so dd-mm-yyyy hh:mm:ss (or something else just to make it work)I'm clueless.

View Replies !
Strtotime With Days
On this - "next Thursday" is that next thursday or the next thursday ie: on wed will it show tomorrows time or the next week? PHP Code:

<?php
echo strtotime("now");
$timestamp = strtotime("now");
echo "  ";
$str = date('l dS of F Y h:i:s A', $timestamp);
echo $str;
?>

<p>

<?php
echo strtotime("next Thursday"), "";
$timestamp = strtotime("next Thursday");
echo "  ";
$str = date('l dS of F Y h:i:s A', $timestamp);
echo $str;

View Replies !
Strtotime Problem
How do I find the number of seconds from a certain date to the current? I have logged in my database a completion date within the past year and I want to figure out how many seconds it has been since the completion date until now. I know the strtotime command is fairly versatile and I have tried the following without the right conclusion: PHP Code:

strtotime("since ".$completion_date);
//and
strtotime("from ".$completion_date);

What do I need to do to fix this?

View Replies !
Strtotime Busted
$thing = "2005-10-01";
$storedDate = date("z",strtotime($thing));
echo $storedDate;

it just alwats returns today's date, ive tried it on a php5 server and it worked fine however on the server I need this one it is PHP4.2.

View Replies !
Return False Or Return True
PHP5. Class, Member function.

"return false;" or "return true;"

When checked in the code invoking the method nothing is returned. If I change to "return(0);" or "return(1);" then it works fine, and the value is returned ok although obviously not technically a boolean. I have tried all sorts, from

if ( memberfunction() ) {
if ( $val = memberfunction() ) {
$val = false;
$val = memberfunction();
......

View Replies !
Wrong Error Line That Doesnt Exist?
I got the wrong Parse error: parse error, unexpected $ in /web/www/frac/users/ultimadark/train.php on line 104. But i counted the rows three times and i have only got exactly 104 rows in the page, and the 104th row is only </html>. Why do i get that wrong message

View Replies !
Form Validate, But User Doesnt Have To Retype
currently i have a form, and when users click on the submit button, the contents get validated, and if there is a mistake, the user is brought back to the form page. What i want is to free the user from having to retype the sections that they got correct, and only retype the sections that are wrong. I am thinking of getting the form to send the content to my validation page, and back to itself $PHP_SELF so that if there is an error, the message will still display. Is this the correct way to do it? Code:

View Replies !
Using Fopen() To Create New File - Works For A Few Then Just Doesnt
I am currently working on a content management system where a user can
fill in a form (title, keywords, link text etc. - all the initial
attibutes), which when submitted, will go onto create a web page.

The code is as follows:

$html = "<html>
<body>
<p>Hello World</p>
</body>
<html>";
$handle = fopen($_SERVER['DOCUMENT_ROOT']."/path/to/folder/".$filename,
"w");
fwrite($handle, $html);
fclose($handle);

Pretty basic, I think. I works for a few and then it just stops. I get
no error to say that 'could not create file' or 'file not found', it
just submits. Any reason for this? I have tried searching the C: drive
for the file but it cannot be found.

At the moment Im trying to figure out when it actually occurs but for
some annoying reason, it seems to be working now. I would prefer to be
assured that it wont occur again so just thought I would still post
something here just encase this problem is a known one.

Is fopen() the best solution for creating files? I was aware that it
was used to open an existing file but create one (?). Is this what it
was intended to do? Im sure it is, but its new to me.

View Replies !
Php Upload Doesnt POST Any Info In Firefox
I am not sure why but I have had this problem for a while and havent really been able to solve it. A really simple php upload script works in IE but not in FF. FF just comes back to the page as if there is no POST information. For example code below will output when landing on the page, it outputs: Code:

View Replies !
Changed To PHP5 Now Script Doesnt Work
I had a dynamic img creation with gdlib and Right Alignment. I 'pinched' this script which worked well until my host upgraded to php5. Any ideas. the following error messages are received.

‰PNG  IHDR&#65533;2ý~Ê
Warning: imagepng() [function.imagepng]: gd-png: fatal libpng error: zlib error in /home/clearcon/public_html/fonts/title.php on line 40

Warning: imagepng() [function.imagepng]: gd-png error: setjmp returns error condition in /home/clearcon/public_html/fonts/title.php on line 40 Code:

View Replies !
Preg_replace? AddSlashes Doesnt Seem To Work Properly
Im accepting user input from a text-box on a webpage. I am then wanting to echo that back into the same box when the page is submitted.

The problem I have is that the input COULD contain multiple quotes and
double-quotes. AddSlashes doesnt seem to work properly, as it turns ' into '
....and " just into (removing everything after)

I thought of using single-quotes for the Value='' and then use preg_replace
to replace all occurances of ' with ' ...but I cant figure-out how to do
it. Code:

View Replies !
Uploading Image Name Doesnt Get Rid Of The Space By Script
I use the below code to upload images:

$target_path = "images/";
$target_path = $target_path . basename( $_FILES['Image1']['name']);
$_FILES['Image1']['tmp_name']; 
$target_path = "images/";
$filename = basename( $_FILES['Image1']['name']);
if (file_exists($target_path . $filename))
{   
$filename = time() . '_' . $filename;
}
$target_path .= $filename;
if(move_uploaded_file($_FILES['Image1']['tmp_name'], $target_path)) {
     echo "Image1: was uploaded successfully!";
 } else{     
     print "Image1: could NOT be uploaded!";}

The above code renames the images too However, when a user uploads images which the name has spaces The code doesnt get rid of the space, and i get trouble displaying them later
What part can i add to to the code to take space from the image name, then rename it.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved