This works:
$rs= $this-conn-GetAll(SELECT title FROM content WHERE
page_id= ?,
$id);
You can't iterate through an array like you are trying to do. Using the
GetAll() function returns an array, you have to use the Execute()
function to be able to iterate through $rs like you are trying to
thanks :)
that helps
g
On May 24, 2006, at 3:19 PM, Brady Mitchell wrote:
This works:
$rs= $this-conn-GetAll(SELECT title FROM content WHERE
page_id= ?,
$id);
You can't iterate through an array like you are trying to do.
Using the
GetAll() function returns an array, you have to use the
2006/5/2, Richard Lynch [EMAIL PROTECTED]:
Does anybody have a rational explanation for what purpose in life the
following syntax is considered acceptable?
?php
$query = UPDATE whatever SET x = 1;
$query;
?
Note that the line with just $query; on it doesn't, like, do anything.
I suppose
Hmmm. The only time I ever use anything remotely like that is in a loop or
other code are where I don't want anything to happen ie
for ($foo=0;$foo=10;$foo++) {
On 02/05/06, Martin Alterisio [EMAIL PROTECTED] wrote:
2006/5/2, Richard Lynch [EMAIL PROTECTED]:
Does anybody have a rational
Bing Du wrote:
Jay Blanchard wrote:
[snip]
How should PHP syntax be checked before execution? Anything similar
to what option -c does in Perl?
% perl -c test.pl
[/snip]
from the command line
/usr/local/bin/php -i myScript.php
[/snip]
Ooops, sorry, should be an ell l
/usr/local/bin/php
[snip]
Even with error_reporting set to E_ALL in php.ini, I still get 'Errors
parsing file.php' using the php command with the -l option. Anyway to
see more than that?
[/snip]
Here are some command line options http://us2.php.net/features.commandline
You could run it in a browser to get line
Jay Blanchard wrote:
[snip]
Even with error_reporting set to E_ALL in php.ini, I still get 'Errors
parsing file.php' using the php command with the -l option. Anyway to
see more than that?
[/snip]
Here are some command line options http://us2.php.net/features.commandline
You could run it
[snip]
Just found out this web based PHP syntax checking tool
http://www.meandeviation.com/tutorials/learnphp/php-syntax-check/, it
helped me find the problem. Pretty nice.
[/snip]
Nice find. Tried it and it works pretty well.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe,
Jay Blanchard wrote:
[snip]
Just found out this web based PHP syntax checking tool
http://www.meandeviation.com/tutorials/learnphp/php-syntax-check/, it
helped me find the problem. Pretty nice.
[/snip]
Nice find. Tried it and it works pretty well.
I get this when I try to check a php
[snip]
How should PHP syntax be checked before execution? Anything similar to
what option -c does in Perl?
% perl -c test.pl
[/snip]
from the command line
/usr/local/bin/php -i myScript.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[snip]
How should PHP syntax be checked before execution? Anything similar to
what option -c does in Perl?
% perl -c test.pl
[/snip]
from the command line
/usr/local/bin/php -i myScript.php
[/snip]
Ooops, sorry, should be an ell l
/usr/local/bin/php -l myScript.php
--
PHP General Mailing
Jay Blanchard wrote:
[snip]
How should PHP syntax be checked before execution? Anything similar to
what option -c does in Perl?
% perl -c test.pl
[/snip]
from the command line
/usr/local/bin/php -i myScript.php
[/snip]
Ooops, sorry, should be an ell l
/usr/local/bin/php -l myScript.php
You could write what your code does now like this.
if (empty ($fname) || empty ($sname) || empty ($address))
{
// do something
}
If you want your first condition to be met and one of your second two
conditions to be met you can do it like this:
if (empty ($fname) (empty ($sname) || empty
On Wed, August 24, 2005 6:10 pm, Jordan Miller wrote:
Is there a technical reason why PHP does not allow comparison
operator expressions like the following:
if (2 $x = 4) {}
2 $x = 4 is a valid expression already.
2 $x is evaluated first, and returns true/false
true/false is compared
Good to know about expression evaluation. Writing the expression(s)
like that (left-to-right and right-to-left) solves my dilemma... thanks!
Jordan
On Aug 25, 2005, at 2:44 AM, Richard Lynch wrote:
I personally would use:
((2 $x) ($x = 4))
--
PHP General Mailing List
Is there a technical reason why PHP does not allow comparison operator
expressions like the following:
if (2 $x = 4) {}
I prefer this concise way as it is common for mathematics expressions, and
much easier to grasp physically on first glance. From what I can tell, this
expression can
[snip]
Is there a class or some code out there which enables you to print your
PHP code to a web page and make it appear with syntax highlighting?
As an example of what I am after, have a look here;
http://www.phpfreaks.com/phpmanual/page/function.ldap-add.html
Please note this is just an
* George B [EMAIL PROTECTED] :
Jim Moseby wrote:
I am trying to connect to a datbase:
mysql_select_db ('database')
or die (couldnt connect to databse)
What is wrong here?
This is the error:
Parse error: syntax error, unexpected T_STRING in file name on line 12
Thanks JM!
It was another one of my usual mistakes :P
Forgot the semicolon. I don't underestand why you have to put
in so many
semicolons... Hmm.. Is it a thing from C or something?
When I see that T_STRING error, missing semicolon is the first thing I look
for. I don't know the history
I am trying to connect to a datbase:
mysql_select_db ('database')
or die (couldnt connect to databse)
What is wrong here?
This is the error:
Parse error: syntax error, unexpected T_STRING in file name on line 12
--
PHP General Mailing List (http://www.php.net/)
To
George B wrote:
I am trying to connect to a datbase:
mysql_select_db ('database')
or die (couldnt connect to databse)
What is wrong here?
This is the error:
Parse error: syntax error, unexpected T_STRING in file name on line 12
Are either one of those lines, line 12?
--
John C.
Jim Moseby wrote:
I am trying to connect to a datbase:
mysql_select_db ('database')
or die (couldnt connect to databse)
What is wrong here?
This is the error:
Parse error: syntax error, unexpected T_STRING in file name on line 12
--
PHP General Mailing List (http://www.php.net/)
To
hima wrote:
Hi all,
I am trying to apply syntax coloring to my source code
as I type it in unix shell. I work on a mac machine.
How do I achieve this.
In the php.ini file I see these following lines
commented out.
; Colors for Syntax Highlighting mode. Anything
that's acceptable in
; font
Tom Whitbread wrote:
Can anyone explain why this is happening.
I am using the following code For giving code examples on my website
with syntax highlighting
$text = 'lt;?php \$my_code = echo 'text text text text'; \$foo =
'bar';; example_function(\$my_code); ?gt';
This is not a valid PHP
M. Sokolewicz wrote:
Now, the problem with such a solution is the following. Imagine you
have the following keywords:
include
require
in
of
typof
now, when you replace include with span
class=highlightedinclude/span, it'll go on, and also replace all
instances of in, so you'll end up with
Hi all,
Just to let everyone know - I've reported this as a bug.
http://bugs.php.net/bug.php?id=30716
Fingers crossed :)
Yours Sincerely
Jake Press
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
You've just hijacked this thread.
Please start a new message instead of replying to a message and
changing the subject to talk about something else.
Curt
--
Quoth the Raven, Nevermore.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
* Thus wrote Jake Press:
Oops, sorry :(
I accidentally hi-jacked another thread.
Thanks for taking notice :)
Here are the relevant posts for anyone thats reading:
- http://news.php.net/php.general/201395
- http://news.php.net/php.general/201403
- http://news.php.net/php.general/201405
Aaron,
why don't you use a very simle sintax like this one:
$code = 'function what() { do oddname; %oddsyntax }';
function highlight_code($code)
{
$oddsyntax = array('oddsyntax','oddsyntax2','oddsyntax3');
for($i = 0; $i = count($oddsyntax)-1; $i++)
{
$highlighted_code =
Bruno B B Magalhães wrote:
$code = 'function what() { do oddname; %oddsyntax }';
function highlight_code($code)
{
$oddsyntax = array('oddsyntax','oddsyntax2','oddsyntax3');
for($i = 0; $i = count($oddsyntax)-1; $i++)
{
$highlighted_code = eregi_replace($oddsyntax[$i],'spam
Aaron Gould wrote:
Bruno B B Magalhães wrote:
$code = 'function what() { do oddname; %oddsyntax }';
function highlight_code($code)
{
$oddsyntax = array('oddsyntax','oddsyntax2','oddsyntax3');
for($i = 0; $i = count($oddsyntax)-1; $i++)
{
$highlighted_code =
[snip]
$Msg .= Test is complete
I'm thinking it means concatenate $Msg with Test is complete and then
store the new string into $Msg
Am I right?
[/snip]
Yes. You might see $Msg = (no concatenator) somewhere above it in the
code...we code long SQL statements and things like e-mail bodies using
$Msg .= Test is complete
I'm thinking it means concatenate $Msg with Test is complete and then
store the new string into $Msg
Am I right?
you are correct, same as:
$Msg = $Msg.Test is complete
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Victor C. wrote:
Hi,
I just started with PHP. (I used to work on ASP a lot)
What does the syntax .= do?
i see a line of code that says
$Msg .= Test is complete
I'm thinking it means concatenate $Msg with Test is complete and then
store the new string into $Msg
Am I right?
Thanks.
It does
I've forgotten how to assign something like this...
$someStr = EOF
bunch of raw non-echo'd html
EOF;
But can't seem to get the right syntax. Tried looking in the
manual, but
don't even know what I'm looking for!
You're looking for a heredoc.
In a message dated 6/15/2004 10:20:59 AM Pacific Daylight Time,
[EMAIL PROTECTED] writes:
I've forgotten how to assign something like this...
$someStr = EOF
bunch of raw non-echo'd html
EOF;
But can't seem to get the right syntax. Tried looking in the manual, but
don't even know what
On Tue, 15 Jun 2004 13:20:24 -0400, Steve Douville [EMAIL PROTECTED] wrote:
I've forgotten how to assign something like this...
$someStr = EOF
bunch of raw non-echo'd html
EOF;
But can't seem to get the right syntax. Tried looking in the manual, but
don't even know what I'm
* Thus wrote AgfTech Lists ([EMAIL PROTECTED]):
Hi All
Following is the INSERT statement I am executing,
snip
INSERT INTO customer (email, password, handle, fname, lname, company,
tax_id, addr1, addr2, city, state, zipcode, country, dayphone, evephone,
fax, paymethod, cardname,
This answers it all: http://sk.php.net/addslashes#28429
AgfTech Lists wrote:
Hi All
Following is the INSERT statement I am executing,
snip
INSERT INTO customer (email, password, handle, fname, lname, company,
tax_id, addr1, addr2, city, state, zipcode, country, dayphone, evephone,
fax,
Got it from there!
Thanks!
Regards
Aman
On Thu, 2004-04-15 at 18:27, Marek Kilimajer wrote:
This answers it all: http://sk.php.net/addslashes#28429
AgfTech Lists wrote:
Hi All
Following is the INSERT statement I am executing,
snip
INSERT INTO customer (email, password,
Hi,
Tuesday, March 23, 2004, 8:03:05 PM, you wrote:
BP Hi all
BP I am having problems printing members of an array that has two
BP dimensions and am wondering if someone can help me with the syntax
BP required to do this.
BP If i have the follwing code:
BP ?php
BP
Hello bob,
Friday, February 13, 2004, 12:10:06 PM, you wrote:
bp $array=array(Flyer,Email,Phone);
bp $array_len=count($array);
bp for($i=0;$i$array_len;$i++){
bp $query=select count(score) from test_table
bp where source = '$array[$i]';
bp $result=mssql_query($query,$numero);
bp
PETCOL wrote:
snip
This line is whats causing me all the greif:
echo option
value=$_POST[Country];selected\n$_POST[Country];/option\n;
Parse error: parse error, expecting `','' or `';''
Suggestions or tutorials please ;-)
Col
You're wrapping the whole string in double quotes (), not
On Monday 26 January 2004 07:37, John Taylor-Johnston wrote:
Obviously, I'm screwing up my syntax trying to add 2003.php to the end. How
should I express this line please :) ?
?php include
(/home/users/q/qx04t9mu/www/glq2-test/calendars/+strtolower(date(F))+200
3.htm); ?
replace the + symbols
Thanks. Duh :)
replace the + symbols with . and also date(F) should be date('F').
Sleepy time.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
* and then Dagfinn Reiersøl declared
Yes your right, that?s exactly the problem. I didn?t even realize he was
doing that.
By including the PHP file via HTTP, you are including the OUTPUT of the PHP
file, not the actual PHP file itself.
e.g.
by including a file with the following
Hello Nick,
Friday, January 16, 2004, 2:16:43 PM, you wrote:
NW if a script calls antohter like
NW 'include('http://site.com/index.php');
NW Why would I get a syntax error on line 1 of index.php when it looks like
NW this:
NW ?php
NW // line one above this one
NW What's the deal there?
Say
* and then Richard Davey declared
Hello Nick,
Friday, January 16, 2004, 2:16:43 PM, you wrote:
NW if a script calls antohter like
NW 'include('http://site.com/index.php');
NW Why would I get a syntax error on line 1 of index.php when it looks like
NW this:
NW ?php
NW // line
Did the script accidently get saved in MS-DOS text format?
-Original Message-
From: Donald Tyler [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 8:53 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Syntax Error - This is WEIRD!
There could be something you're not seeing and assuming
Nick Wilson wrote:
if a script calls antohter like 'include('http://site.com/index.php');
Why would I get a syntax error on line 1 of index.php when it looks like
this:
?php
// line one above this one
What's the deal there?
Many thanks for any insight ;-)
I've never tried to do an include
be including the word Hello as PHP code, which is obviously
going to cause a syntax error.
-Original Message-
From: Dagfinn Reiersøl [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 10:18 AM
To: PHP General
Subject: Re: [PHP] Syntax Error - This is WEIRD!
Nick Wilson wrote
:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 10:18 AM
To: PHP General
Subject: Re: [PHP] Syntax Error - This is WEIRD!
Nick Wilson wrote:
if a script calls antohter like 'include('http://site.com/index.php');
Why would I get a syntax error on line 1 of index.php when it looks like
On Saturday 17 January 2004 01:50, Dagfinn Reiersl wrote:
Yes. I read the manual which provides no clear explanation (I suspect
that whoever wrote it didn't actually know how it works). So I decided
to test it. It does exactly what you say it does. I made an include file
like this:
In
: Dagfinn Reiersøl [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 11:50 AM
To: PHP General
Subject: Re: [PHP] Syntax Error - This is WEIRD!
Donald Tyler wrote:
Yes your right, thats exactly the problem. I didnt even realize he was
doing that.
By including the PHP file via HTTP, you
Jason Wong wrote:
On Saturday 17 January 2004 01:50, Dagfinn Reiersl wrote:
Yes. I read the manual which provides no clear explanation (I suspect
that whoever wrote it didn't actually know how it works). So I decided
to test it. It does exactly what you say it does. I made an include file
Donald Tyler wrote:
Yes that is true. But I would strongly recommend against doing that.
You should never include anything over HTTP. Its extremely messy, 100%
insecure and just a very very bad idea.
My spontaneous reaction is to agree with you. On the other hand, are
SOAP or XML-RPC over
Adam i Agnieszka Gasiorowski FNORD wrote:
How do you insert a constant into a quoted
string, do I need to use concatenation operator
like this
quoted string . CONSTANT . quoted string,
Yes
or there is some way to insert it inline, like
normal variables?
No
--
PHP
bob pilly wrote:
Hi all
Can someone tell me what the correct syntax is to pass
a Session ID via the header redirect is? Im trying:
header( Location: page2.php??echo strip_tags
(SID)? )
but it isnt working for me and all the docs i can find
just deal with tagging it to the end of a hyperlink.
At 18:33 4-9-03, you wrote:
Hi all
Can someone tell me what the correct syntax is to pass
a Session ID via the header redirect is? Im trying:
header( Location: page2.php??echo strip_tags
(SID)? )
You are making a row of mistakes that suggest it is a good idea to read a
bit on PHP syntax and how
On Thu, 2003-09-04 at 09:33, bob pilly wrote:
Hi all
Can someone tell me what the correct syntax is to pass
a Session ID via the header redirect is? Im trying:
header( Location: page2.php??echo strip_tags
(SID)? )
header( Location: page2.php?. strip_tags( SID ) );
the problem you are
At 13:38 09.03.2003, Nik Makepeace said:
[snip]
Can anyone tell me why this doesn't work:
$db_object = pg_fetch_object($this-getLastResult());
In imaginary interactive mode, it works like this:
ME echo $this-getLastResult();
PHP Resource id #67
ME echo
On Mon, 2003-03-10 at 03:01, Ernest E Vogelsinger wrote:
At 13:38 09.03.2003, Nik Makepeace said:
[snip]
Can anyone tell me why this doesn't work:
$db_object = pg_fetch_object($this-getLastResult());
pg_fetch_object() returns an object with
It's fairly simple. The code you posted could also be written:
if(strpos($a,'-')){
$a = explode('-',$a,2);
}else{
$a = array($a);
}
It's called the ternary conditional operator. Unfortunatley, it's
buried in the PHP manual.
http://us2.php.net/manual/en/language.expressions.php
Jimmy wrote:
Where is $line coming from? The function won't output what you don't input.
Other than that I don't see anything wrong.
- Kevin
- Original Message -
From: John Taylor-Johnston [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 04, 2003 4:33 PM
Subject: [PHP] syntax error
Thanks Keven. Didn't see that.
?php
$line = AU: Tomlinson,-Brian;
$AU = filter_strings(AU: ,$line);
function filter_strings($tofilter,$line){
if(eregi('^'.$tofilter.' (.*)$',$line,$m)) {
$filtered=$m[1];
return $filtered;
}
}
?
--
PHP General Mailing List
At 18:06 19.02.2003, Anthony Ritter spoke out and said:
[snip]
The question:
Is the reasoning that a comma *must* be added since this is _within_ a loop?
As in:
CREATE TABLE chairs (
id INT(5),
item VARCHAR(50),
desc TEXT ,
price FLOAT , // common should
This is what I was getting at.
The following is correct mysql syntax in which a comma must be added after
each field - except for the last field - in this case price:
i.e.,
.
CREATE TABLE chairs(
id int(5),
item varchar(50),
desc text,
price float
);
.
Anthony -
The column list is a comma seperated list, the last column cannot have a
comma after it or the SQL server will expect another column to be listed.
However in that code segment it is not trying to determine if there is
or is not a column, it is simply attempting to add the (length)
Many thanks Jason.
TR
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thanks for the vote of confidence. I ended up getting it working with this:
import_request_variables('p', 'p_');
function check_banlist($banlist, $p_email) {
This is what I had been trying to accomplish but was writing it this way:
function check_banlist($banlist, $_POST['email']) {
Maybe you
You don't need to import the request variables for that to work. The
variable names in the function definition have no relationship to
variables outside of it. Most likely, you're calling with something like:
check_banlist($banlist,$p_email);
but you could also call it with:
This is a very important point to understand, I tried (and
failed) to explain it. I think Leif made it pretty
clear though, here's another :)
// $a can be anything when you call the function
function bar ($a) {
print $a;
}
bar ('Hello World');
bar ($_POST['something']);
Regards,
Philip
First, read this:
http://www.php.net/variables.external
Second, assuming you have a PHP version equal to
or greater than 4.1.0 and the method of the form
is POST, you'd do something like this:
$banlist = array('[EMAIL PROTECTED]');
echo check_banlist($banlist, $_POST['email']);
Your
On Thursday 14 November 2002 17:22, conbud wrote:
Whats wrong here ?? The variables are getting the correct information from
the form but for some reason as soon as I put the variables into the $sql
they dont post the proper data to the database, its connecting to the
database ok but just not
What do you mean by dont post proper data?
Have you added slashes to the variables?
(use addslashes() and then stripslashes() when reading the contents from
the db)
On Thu, 2002-11-14 at 11:22, conbud wrote:
Whats wrong here ?? The variables are getting the correct information from
the form but
Jason thanks,
I completely forgot about trying echo $sql by using that I found where it
was messing up. Thanks again.
Lee
Jason Wong [EMAIL PROTECTED] wrote in message
news:200211141725.47510.php-general;gremlins.biz...
On Thursday 14 November 2002 17:22, conbud wrote:
Whats wrong here ?? The
There are typically called a 'heredoc' or 'here document'. basically it
changes the double quotation mark() to
'content' (in this case). To start, do this content
and to end it just type content;
on a line by itself.
The example you showed does echo the stuff out. It sets all the internal
html
Hello
Kelly Meeks [EMAIL PROTECTED] wrote:
I saw this used in a script, but after a couple of searches didn't come up
with anything on php.net.
I think you're looking for this:
http://www.php.net/manual/en/language.types.string.php#language.types.string
.syntax.heredoc
- E
...[snip]...
--
ORDER BY and LIMIT go at the end...after WHERE.
---John Holmes...
-Original Message-
From: Pablo Oliva [mailto:[EMAIL PROTECTED]]
Sent: Sunday, October 13, 2002 12:13 AM
To: [EMAIL PROTECTED]
Subject: [PHP] syntax error on mysql select statement
Can anyone see any problems with
Yes, the LIMIT clause must be at the end of the line. Take a look at the
documentation:
http://www.mysql.com/doc/en/SELECT.html
On Sun, 2002-10-13 at 00:12, Pablo Oliva wrote:
Can anyone see any problems with the following:
SELECT * FROM ad AS t1, ad_location AS t2 ORDER BY t1.ad_ts_update
on 30/09/02 2:44 PM, Jeff Bluemel ([EMAIL PROTECTED]) wrote:
if there a command that will give me the name of the fields
in the result set?
mysql_field_name() might help... but generally I know what fields I want to
grab, so I don't need this... I found this answer on http://php.net/mysql.
Justin French wrote:
on 30/09/02 2:44 PM, Jeff Bluemel ([EMAIL PROTECTED]) wrote:
how to I test for a null value?
empty()? isset()? if($var == )? if($var == NULL)?? have a look in
the php manual for string functions, and comparison operators
I think he maybe meant testing for
PROTECTED]
Subject: Re: [PHP] syntax question
Justin French wrote:
on 30/09/02 2:44 PM, Jeff Bluemel ([EMAIL PROTECTED]) wrote:
how to I test for a null value?
empty()? isset()? if($var == )? if($var == NULL)?? have a look in
the php manual for string functions, and comparison
mysql_field_name() might help... but generally I know what fields I want
to
grab, so I don't need this... I found this answer on
http://php.net/mysql.
just as you could :)
I've been coding in other languages for about 6 years now, and I have looked
through a lot of the mysql stuff, and the
let me be more specific...
if a field value is null how do I test for it in the result set, or the
array?
here's a real live example... I'm working with prepaid phone cards, and if
a card has not expired yet then the field zombie_date will be null.
so - when I do the mysql_fetch_assoc ($sql)
Convert to date/time variable and perform arithmetic.
Otherwise, if these dates are from mysql, let mysql do it
-Original Message-
From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 11:12 AM
To: [EMAIL PROTECTED]
Subject: [PHP] syntax for date math
Warren Vail
Tools, Metrics Quality Processes
(415) 667-7814
Pager (877) 774-9891
215 Fremont 02-658
-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 11:02 AM
To: 'ROBERT MCPEAK'; [EMAIL PROTECTED]
Subject: RE: [PHP] syntax for date math
On Wed, 3 Apr 2002, Rick Emery wrote:
Convert to date/time variable and perform arithmetic.
Otherwise, if these dates are from mysql, let mysql do it
Even if you don't happen to be getting the date out of MySQL, it can
occasionally be easier to let MySQL do your date math since it has some
On Wednesday, April 3, 2002, at 03:58 PM, Miguel Cruz wrote:
On Wed, 3 Apr 2002, Rick Emery wrote:
Convert to date/time variable and perform arithmetic.
Otherwise, if these dates are from mysql, let mysql do it
Even if you don't happen to be getting the date out of MySQL, it can
I'd actually like to use MySQL's builtin date formats, but I like the
timestamp that PHP uses (and I like what I can do with a timestamp in
the date() function) so I have been using VARCHAR(20) to hold the date
as a string. MySQL's TIMESTAMP is not the same thing as PHP's.
But you can
On Wed, 3 Apr 2002, Erik Price wrote:
On Wednesday, April 3, 2002, at 03:58 PM, Miguel Cruz wrote:
Even if you don't happen to be getting the date out of MySQL,
it can occasionally be easier to let MySQL do your date math since
it has some nice functions for it (DATE_ADD, DATE_SUB, etc.).
On Wednesday, April 3, 2002, at 04:14 PM, Rasmus Lerdorf wrote:
But you can simply call MySQL's UNIX_TIMESTAMP() function on the mysql
field when you select it if you want it into unix timestamp format.
For SELECTs, this is fine, but what happens when I want to insert a new
date? I
date()
On Wed, 3 Apr 2002, Erik Price wrote:
On Wednesday, April 3, 2002, at 04:14 PM, Rasmus Lerdorf wrote:
But you can simply call MySQL's UNIX_TIMESTAMP() function on the mysql
field when you select it if you want it into unix timestamp format.
For SELECTs, this is fine, but what
as a string. MySQL's TIMESTAMP is not the same thing as PHP's.
Let me be the devil's layer here, Erik.
In order to achieve the best portability and to gain the best
performance you'd better use mySQL date field types to store the dates.
If you need the PHP timestamps you can simply use
PROTECTED]]
Sent: Wednesday, April 03, 2002 11:27 PM
To: Rasmus Lerdorf
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] syntax for date math expressions
On Wednesday, April 3, 2002, at 04:14 PM, Rasmus Lerdorf wrote:
But you can simply call MySQL's UNIX_TIMESTAMP() function on the
mysql
field
-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 11:27 PM
To: Rasmus Lerdorf
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] syntax for date math expressions
On Wednesday, April 3, 2002, at 04:14 PM, Rasmus Lerdorf wrote:
But you can simply call MySQL's
Good day.
I believe that one would have to use the eval() statement to construct that
syntax.
You probably would be much better off using an array to store this
information. If you are trying to read form data, then construct your form
names so that the results will be put into an array by
Sorry I think I've badly explained this !
I'm getting results from mysql in a while loop
but I need the results outside of the loops
and so what I want to do is take the first variable from the db
and rename it as variable 1
and then before the end of the while loop have a $i++;
so i want
On Wed, 27 Mar 2002, John Fishworld wrote:
so i want
$newvar_$i = result 1
$newvar_$i = result 2
so I can use them outside the loops as
$newvar_1 and $newvar_2
Why don't you use an array? That's what they're for.
Nevertheless,
$i = 1;
$varname = newvar$i;
$$varname = result 1;
Make it this way:
Looping first. I will loop with while:
$i = 0;
$array = Array();
while (list($value) = mysql_fetch_array($result)) {
$array[$i] = $value;
$i++;
}
Arrays are easier :-) Each $i will be a key.
--
Julio Nobrega.
Um dia eu chego lá:
101 - 200 of 226 matches
Mail list logo