RE: [PHP-DB] Data not fetching in the textfield.

2007-09-26 Thread Naintara
Try replacing this:


echo '  input name=storename type=text
maxlength=35 id=storename
class=regForm disabled=disabled value=$rows[0]/input' ;


With this:

echo '  input name=storename type=text
maxlength=35 id=storename
class=regForm disabled=disabled value='. $rows[0].'/input' ; 


-Original Message-
From: Chris Carter [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 26, 2007 10:04 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Data not fetching in the textfield.


I am trying to fetch data through this code:

My code:
for($i=0;$imysql_num_rows($results);$i++)
{
$rows = mysql_fetch_array($results);
echo 'div' ;
echo 'div class=fieldrow' ;
echo '  ' ;
echo '  label for=storenameStore
name:/label' ;
echo '  ' ;
echo '  input name=storename type=text
maxlength=35 id=storename
class=regForm disabled=disabled value=$rows[0]/input' ;
echo '/div' ;

The value option in the textfield is not fetching the data, neither is it
throwing errors. However the same code works perfectly as suggested by one
of expert Nabble users:

Nabble code:

for($i=0;$imysql_num_rows($results);$i++)
{
$rows = mysql_fetch_array($results);
echo(input name=\input1\ type=\text\
value=$rows[0]);
}

Please help.

Chris
-- 
View this message in context:
http://www.nabble.com/Data-not-fetching-in-the-textfield.-tf4523451.html#a1
2904665
Sent from the Php - Database mailing list archive at Nabble.com.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] How to capture from session and match database

2007-09-23 Thread Naintara
Hi Chris,

What I had sent earlier were some hints, references and some code.
I had recommended reading up on sessions, because it's good to know and
useful to get a handle on it, you'll be able to do these things easily
then.

If you are pressed for time and unable to do so, here is some code you
could use
Do read my comments after // (slashes)

?
session_start();
$_SESSION['email'] = 'php-db@lists.php.net'; 
//put a real email address here to test with, later remove it and use the
login email id

if( empty($_SESSION[email]) ) {
header(location:store-login.php);
}
//the above checks if you have a value in your email session variable.
?

Naintara

-Original Message-
From: Chris Carter [mailto:[EMAIL PROTECTED] 
Sent: Sunday, September 23, 2007 9:59 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] How to capture from session and match database


Hi Naintara,

thanks for your code could you please advice why is the code giving this
error.

Parse error: syntax error, unexpected T_ISSET in
/path/submit-store-details.php on line 4

This is coming when I am trying to use your code like this:

?
session_start();
$_SESSION['email'] = 'emailAddress';
if(!empty($_SESSION[email]) isset ($_SESSION[email]));
{
header(location:store-login.php);
}
?

and then retrieving it in SQL query:

$query=SELECT * FROM table WHERE email =
'.mysql_real_escape_string($_SESSION['email']).';

Many thanks.

Chris

Chris Carter wrote:
 
 Hi,
 
 I have this session code on each page and this is working fine for
 authentication:
 
 ?
 session_start();
 if(!session_is_registered(email)){
 header(location:store-login.php);
 }
 ?
 
 Now I wish to 
 
 1)capture the value (userName) from session on one of my pages and 
 2)match it with the database and 
 3)display the value in the textfields
 
 This is the code I am using to do this please:
 
 include ../includes/malls_db_conf.php;
 
 $query=SELECT * FROM table WHERE email = '$email';  Here I am
 capturing from the session
 $result=mysql_query($query);
 $num=mysql_numrows($result);
 
 mysql_close();
 {
 
 $shopname=mysql_result($result,$i,shopname);
 $category=mysql_result($result,$i,category);
 
 }
 
 ?
 
 Showing in the textfield from the database is working fine
 
 THE Problem is:
 
 I am getting only the first row of table to show up and not the one with
 the field $userName, meaning the userName is not getting captured from
the
 above or checking with the table and showing me the value. 
 
 It might be a basic one, could you please advice how to achieve that.
 
 Cheers,
 
 Chris
 
Quoted from: 
http://www.nabble.com/How-to-capture-from-session-and-match-database-tf4478
519.html#a12770056


Chris Carter wrote:
 
 Hi,
 
 I have this session code on each page and this is working fine for
 authentication:
 
 ?
 session_start();
 if(!session_is_registered(email)){
 header(location:store-login.php);
 }
 ?
 
 Now I wish to 
 
 1)capture the value (userName) from session on one of my pages and 
 2)match it with the database and 
 3)display the value in the textfields
 
 This is the code I am using to do this please:
 
 include ../includes/malls_db_conf.php;
 
 $query=SELECT * FROM table WHERE email = '$email';  Here I am
 capturing from the session
 $result=mysql_query($query);
 $num=mysql_numrows($result);
 
 mysql_close();
 {
 
 $shopname=mysql_result($result,$i,shopname);
 $category=mysql_result($result,$i,category);
 
 }
 
 ?
 
 Showing in the textfield from the database is working fine
 
 THE Problem is:
 
 I am getting only the first row of table to show up and not the one with
 the field $userName, meaning the userName is not getting captured from
the
 above or checking with the table and showing me the value. 
 
 It might be a basic one, could you please advice how to achieve that.
 
 Cheers,
 
 Chris
 

-- 
View this message in context:
http://www.nabble.com/How-to-capture-from-session-and-match-database-tf4478
519.html#a12847962
Sent from the Php - Database mailing list archive at Nabble.com.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Notice: A non well formed numeric value encountered

2007-09-22 Thread Naintara
I don't see the NOTICE message.
Perhaps a timezone notice?

Lookup the date() function in the php manual.
The time parameter should be a unix timestamp value, so $CTS should contain
an integer value.
You can also find ways to convert the time value you have to unix
timestamp, in the manual.

-Original Message-
From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 7:48 PM
To: 'PHP-DB Mailing List'
Subject: [PHP-DB] Notice: A non well formed numeric value encountered

I'm getting the above NOTICE with the following statement:
Echo date('d/m/y',$CTS);

Where $CTS = 2007-09-22 10:09:31

And 31/12/69 is being echoed.


PHP 5.2.1
MYSQL 5.0.37-community-nt via tcp/ip

Thanks in advance for any insight.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Pages not fully loading

2007-09-22 Thread Naintara
Perhaps a faulty mod_rewrite rule or pages/folder setup.
You'll need someone to look at your setup and mod_rewrite rules or if you
want to read up on it 
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html


-Original Message-
From: ioannes [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 3:43 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Pages not fully loading

Thanks to all who replied.  There is a lot of undefined index and 
undefined variables when I turn on error reporting.

The error logs show 'file not found' errors in the last 24 hours for 
files that I am sure were never called from any script on my site.  I do 
not understand 'mod_rewrite: maximum number of internal redirects 
reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' 
to increase the limit if neccessary. '

*MAIN error_log:*

[Sat Sep 22 03:21:35 2007] [error] [client 80.78.74.168] File does not 
exist: /usr/local/apache/htdocs/images/header.gif
[Sat Sep 22 03:21:38 2007] [error] [client 80.78.74.168] File does not 
exist: /usr/local/apache/htdocs/images/cat_bullet.gif
[Sat Sep 22 03:21:38 2007] [error] [client 203.220.217.63] mod_rewrite: 
maximum number of internal redirects reached. Assuming configuration 
error. Use 'RewriteOptions MaxRedirects' to increase the limit if 
neccessary.
[Sat Sep 22 03:21:38 2007] [error] [client 203.220.217.63] mod_rewrite: 
maximum number of internal redirects reached. Assuming configuration 
error. Use 'RewriteOptions MaxRedirects' to increase the limit if 
neccessary.
[Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not 
exist: /usr/local/apache/htdocs/images/back_pdf.jpg
[Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not 
exist: /usr/local/apache/htdocs/panorama-pdf.jpg
[Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not 
exist: /usr/local/apache/htdocs/panorama-sport.jpg
[Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not 
exist: /usr/local/apache/htdocs/panorama-plus.jpg
[Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not 
exist: /usr/local/apache/htdocs/unegruaja.jpg
[Sat Sep 22 03:21:43 2007] [error] [client 80.78.74.168] File does not 
exist: /usr/local/apache/htdocs/reklama/panoramasport.jpg
[Sat Sep 22 03:21:43 2007] [error] [client 80.78.74.168] File does not 
exist: /usr/local/apache/htdocs/reklama/economist.jpg
[Sat Sep 22 03:21:44 2007] [error] [client 203.220.217.63] mod_rewrite: 
maximum number of internal redirects reached. Assuming configuration 
error. Use 'RewriteOptions MaxRedirects' to increase the limit if 
neccessary.
[Sat Sep 22 03:21:44 2007] [error] [client 203.220.217.63] mod_rewrite: 
maximum number of internal redirects reached. Assuming configuration 
error. Use 'RewriteOptions MaxRedirects' to increase the limit if 
neccessary.

Does the above mean a segmentation fault as mentioned by Andres?

John

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Notice: A non well formed numeric value encountered

2007-09-22 Thread Naintara
That's a good question. 

I'm really not sure about which way is better, but yes, you could use
UNIX_TIMESTAMP() to query a datetime value from a MySQL field, convert it
to the UNIX timestamp value within the query, and then retrieve it in your
record set. 
UNIX_TIMESTAMP() [MySQL function]

Or you could use php to convert a datetime value to UNIX timestamp.
mktime() [php function]

You could store the timestamp value in the database itself, and convert at
will in the program.
So many choices... I really wouldn't know which to recommend, a lot depends
on usage. The datetime column takes more storage than an integer column,
but it's human-readable.

If you mean storing an timestamp integer value in a particular database
field, that should also be fine. 

There are a whole lot of issues with datetime related functions, like DST
(daylight savings time) or timezones, if all that is critical, you may look
into it.
There is a TIMESTAMP field type in MySQL, the usage has changed in MySQL
4.1 and up.
This is useful for recording time/date of db updates.

For usual work, I find that a datetime data type column works for me.
Then, if I know what I will be using the datetime value for, I sometimes
format the date within the query itself using DATE_FORMAT() as I like to
get the results that way rather than change it, of course, if you may be
presenting the datetime value in different ways, or if you want the
flexibility, then use php.

I hope this helps somewhat.

-Original Message-
From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 9:24 PM
To: 'Naintara'; 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

Thank you for your response.

The notice is in the Subject Line of the email:
Notice: A non well formed numeric value encountered

So you are saying I have to convert the current -mm-dd:HH:MM:SS  date
format, to UNIX timestamp value then call Date() to format the UNIX
timestamp as Month, Day, Year?

If so, is it recommended to do that at the database level or the program
level.

I guess it would make sense to convert all dates to UNIX timestamp for
database storage then convert at necessary.

Any insight would be helpful.

Thanks!

-Original Message-
From: Naintara [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 11:13 AM
To: 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

I don't see the NOTICE message.
Perhaps a timezone notice?

Lookup the date() function in the php manual.
The time parameter should be a unix timestamp value, so $CTS should contain
an integer value.
You can also find ways to convert the time value you have to unix
timestamp, in the manual.

-Original Message-
From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 7:48 PM
To: 'PHP-DB Mailing List'
Subject: [PHP-DB] Notice: A non well formed numeric value encountered

I'm getting the above NOTICE with the following statement:
Echo date('d/m/y',$CTS);

Where $CTS = 2007-09-22 10:09:31

And 31/12/69 is being echoed.


PHP 5.2.1
MYSQL 5.0.37-community-nt via tcp/ip

Thanks in advance for any insight.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



FW: [PHP-DB] Notice: A non well formed numeric value encountered

2007-09-22 Thread Naintara
Hi again Stephen,

Further on my previous post, if you do store the UNIX timestamp as an
integer value, it should be very efficient, database storage and query
speed, plus giving you ease and flexibility in formatting via php.

-Original Message-
From: Naintara [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 10:19 PM
To: 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

That's a good question. 

I'm really not sure about which way is better, but yes, you could use
UNIX_TIMESTAMP() to query a datetime value from a MySQL field, convert it
to the UNIX timestamp value within the query, and then retrieve it in your
record set. 
UNIX_TIMESTAMP() [MySQL function]

Or you could use php to convert a datetime value to UNIX timestamp.
mktime() [php function]

You could store the timestamp value in the database itself, and convert at
will in the program.
So many choices... I really wouldn't know which to recommend, a lot depends
on usage. The datetime column takes more storage than an integer column,
but it's human-readable.

If you mean storing an timestamp integer value in a particular database
field, that should also be fine. 

There are a whole lot of issues with datetime related functions, like DST
(daylight savings time) or timezones, if all that is critical, you may look
into it.
There is a TIMESTAMP field type in MySQL, the usage has changed in MySQL
4.1 and up.
This is useful for recording time/date of db updates.

For usual work, I find that a datetime data type column works for me.
Then, if I know what I will be using the datetime value for, I sometimes
format the date within the query itself using DATE_FORMAT() as I like to
get the results that way rather than change it, of course, if you may be
presenting the datetime value in different ways, or if you want the
flexibility, then use php.

I hope this helps somewhat.

-Original Message-
From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 9:24 PM
To: 'Naintara'; 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

Thank you for your response.

The notice is in the Subject Line of the email:
Notice: A non well formed numeric value encountered

So you are saying I have to convert the current -mm-dd:HH:MM:SS  date
format, to UNIX timestamp value then call Date() to format the UNIX
timestamp as Month, Day, Year?

If so, is it recommended to do that at the database level or the program
level.

I guess it would make sense to convert all dates to UNIX timestamp for
database storage then convert at necessary.

Any insight would be helpful.

Thanks!

-Original Message-
From: Naintara [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 11:13 AM
To: 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

I don't see the NOTICE message.
Perhaps a timezone notice?

Lookup the date() function in the php manual.
The time parameter should be a unix timestamp value, so $CTS should contain
an integer value.
You can also find ways to convert the time value you have to unix
timestamp, in the manual.

-Original Message-
From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 7:48 PM
To: 'PHP-DB Mailing List'
Subject: [PHP-DB] Notice: A non well formed numeric value encountered

I'm getting the above NOTICE with the following statement:
Echo date('d/m/y',$CTS);

Where $CTS = 2007-09-22 10:09:31

And 31/12/69 is being echoed.


PHP 5.2.1
MYSQL 5.0.37-community-nt via tcp/ip

Thanks in advance for any insight.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Notice: A non well formed numeric value encountered

2007-09-22 Thread Naintara
I think for now you can use the MySQL function DATE_FORMAT()
This would work well for your columns. Look it up in the MySQL reference,
it's very easy to use.

You'll have something like contact_created_date
If a contact was created today, it'll be something like
SELECT DATE_FORMAT(contact_created_date, '%M %d, %Y');

=September 22, 2007

Where contact_created_date is your field.

-Original Message-
From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 10:38 PM
To: 'Naintara'; 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

I have 3 Timestamp fields in a contact manager that record Edit date,
Create
Date and Merge Date.  Doesn't matter to me how it is stored at this point
however when I tried to call it up as just Month, Day, Year (with out the
timestamp) in  php I got the A non well formed numeric value encountered
NOTICE.  

You say I can convert a mysql timestamp value at will in the program (which
I think I am trying to do) and it is not working.  Must I convert it with a
MYSQL function or a PHP function.

Any other ideas?

-Original Message-
From: Naintara [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 12:49 PM
To: 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

That's a good question. 

I'm really not sure about which way is better, but yes, you could use
UNIX_TIMESTAMP() to query a datetime value from a MySQL field, convert it
to the UNIX timestamp value within the query, and then retrieve it in your
record set. 
UNIX_TIMESTAMP() [MySQL function]

Or you could use php to convert a datetime value to UNIX timestamp.
mktime() [php function]

You could store the timestamp value in the database itself, and convert at
will in the program.
So many choices... I really wouldn't know which to recommend, a lot depends
on usage. The datetime column takes more storage than an integer column,
but it's human-readable.

If you mean storing an timestamp integer value in a particular database
field, that should also be fine. 

There are a whole lot of issues with datetime related functions, like DST
(daylight savings time) or timezones, if all that is critical, you may look
into it.
There is a TIMESTAMP field type in MySQL, the usage has changed in MySQL
4.1 and up.
This is useful for recording time/date of db updates.

For usual work, I find that a datetime data type column works for me.
Then, if I know what I will be using the datetime value for, I sometimes
format the date within the query itself using DATE_FORMAT() as I like to
get the results that way rather than change it, of course, if you may be
presenting the datetime value in different ways, or if you want the
flexibility, then use php.

I hope this helps somewhat.

-Original Message-
From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 9:24 PM
To: 'Naintara'; 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

Thank you for your response.

The notice is in the Subject Line of the email:
Notice: A non well formed numeric value encountered

So you are saying I have to convert the current -mm-dd:HH:MM:SS  date
format, to UNIX timestamp value then call Date() to format the UNIX
timestamp as Month, Day, Year?

If so, is it recommended to do that at the database level or the program
level.

I guess it would make sense to convert all dates to UNIX timestamp for
database storage then convert at necessary.

Any insight would be helpful.

Thanks!

-Original Message-
From: Naintara [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 11:13 AM
To: 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

I don't see the NOTICE message.
Perhaps a timezone notice?

Lookup the date() function in the php manual.
The time parameter should be a unix timestamp value, so $CTS should contain
an integer value.
You can also find ways to convert the time value you have to unix
timestamp, in the manual.

-Original Message-
From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 7:48 PM
To: 'PHP-DB Mailing List'
Subject: [PHP-DB] Notice: A non well formed numeric value encountered

I'm getting the above NOTICE with the following statement:
Echo date('d/m/y',$CTS);

Where $CTS = 2007-09-22 10:09:31

And 31/12/69 is being echoed.


PHP 5.2.1
MYSQL 5.0.37-community-nt via tcp/ip

Thanks in advance for any insight.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Notice: A non well formed numeric value encountered

2007-09-22 Thread Naintara
Glad I could help.

The problem you faced earlier could happen if you tried to use the
timestamp column values directly in the php date() function. If you see the
database your timestamp columns would have values in the following format
for its timestamp columns:

'1970-01-01 00:00:01'  

This isn't the same as the unix timestamp integer value.

-Original Message-
From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 11:27 PM
To: 'Naintara'
Cc: 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

Naintara,

That worked!

I must have made a syntax error.

Thank you!

-Original Message-
From: Naintara [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 1:34 PM
To: 'Stephen Sunderlin'
Cc: 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

I think for now you can use the MySQL function DATE_FORMAT()
This would work well for your columns. Look it up in the MySQL reference,
it's very easy to use.

You'll have something like contact_created_date
If a contact was created today, it'll be something like
SELECT DATE_FORMAT(contact_created_date, '%M %d, %Y');

=September 22, 2007

Where contact_created_date is your field.

-Original Message-
From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 10:38 PM
To: 'Naintara'; 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

I have 3 Timestamp fields in a contact manager that record Edit date,
Create
Date and Merge Date.  Doesn't matter to me how it is stored at this point
however when I tried to call it up as just Month, Day, Year (with out the
timestamp) in  php I got the A non well formed numeric value encountered
NOTICE.  

You say I can convert a mysql timestamp value at will in the program (which
I think I am trying to do) and it is not working.  Must I convert it with a
MYSQL function or a PHP function.

Any other ideas?

-Original Message-
From: Naintara [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 12:49 PM
To: 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

That's a good question. 

I'm really not sure about which way is better, but yes, you could use
UNIX_TIMESTAMP() to query a datetime value from a MySQL field, convert it
to the UNIX timestamp value within the query, and then retrieve it in your
record set. 
UNIX_TIMESTAMP() [MySQL function]

Or you could use php to convert a datetime value to UNIX timestamp.
mktime() [php function]

You could store the timestamp value in the database itself, and convert at
will in the program.
So many choices... I really wouldn't know which to recommend, a lot depends
on usage. The datetime column takes more storage than an integer column,
but it's human-readable.

If you mean storing an timestamp integer value in a particular database
field, that should also be fine. 

There are a whole lot of issues with datetime related functions, like DST
(daylight savings time) or timezones, if all that is critical, you may look
into it.
There is a TIMESTAMP field type in MySQL, the usage has changed in MySQL
4.1 and up.
This is useful for recording time/date of db updates.

For usual work, I find that a datetime data type column works for me.
Then, if I know what I will be using the datetime value for, I sometimes
format the date within the query itself using DATE_FORMAT() as I like to
get the results that way rather than change it, of course, if you may be
presenting the datetime value in different ways, or if you want the
flexibility, then use php.

I hope this helps somewhat.

-Original Message-
From: Stephen Sunderlin [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 9:24 PM
To: 'Naintara'; 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

Thank you for your response.

The notice is in the Subject Line of the email:
Notice: A non well formed numeric value encountered

So you are saying I have to convert the current -mm-dd:HH:MM:SS  date
format, to UNIX timestamp value then call Date() to format the UNIX
timestamp as Month, Day, Year?

If so, is it recommended to do that at the database level or the program
level.

I guess it would make sense to convert all dates to UNIX timestamp for
database storage then convert at necessary.

Any insight would be helpful.

Thanks!

-Original Message-
From: Naintara [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 22, 2007 11:13 AM
To: 'PHP-DB Mailing List'
Subject: RE: [PHP-DB] Notice: A non well formed numeric value encountered

I don't see the NOTICE message.
Perhaps a timezone notice?

Lookup the date() function in the php manual.
The time parameter should be a unix timestamp value, so $CTS should contain
an integer value.
You can also find ways to convert the time value you have to unix
timestamp, in the manual

RE: [PHP-DB] How to capture from session and match database

2007-09-19 Thread Naintara
Hi,

First of all, where you are storing the session variable, it should be
specified as:
$_SESSION['email'] = 'email value' //PHP 4.1.0 onwards

This is preferred to registering global variables. There's a whole lot of
discussion on why.

On the pages you are authenticating, you would correspondingly check for a
value in $_SESSION['email']

!empty($_SESSION['email']) isset($_SESSION['email']) etc, depending on you.

When you code for the session logout, you need to look up the php manual
for session_destroy().

When you would like to retrieve data for a user, you can get the details by
using code like this:
$query=SELECT * FROM table WHERE email = '.
mysql_real_escape_string($_SESSION['email']). '; 

I would suggest you read up a good tutorial on php + mysql

I am not sure why there are curly braces after mysql_close(); or where you
are setting values to $i

mysql_close();
{

$shopname=mysql_result($result,$i,shopname);
$category=mysql_result($result,$i,category);

}

The best thing would be to first understand sessions, set variables, echo
values, destroy variables, and then test the sql. 

-Original Message-
From: Chris Carter [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 19, 2007 8:34 AM
To: php-db@lists.php.net
Subject: [PHP-DB] How to capture from session and match database


Hi,

I have this session code on each page and this is working fine for
authentication:

?
session_start();
if(!session_is_registered(email)){
header(location:store-login.php);
}
?

Now I wish to 

1)capture the value (userName) from session on one of my pages and 
2)match it with the database and 
3)display the value in the textfields

This is the code I am using to do this please:

include ../includes/malls_db_conf.php;

$query=SELECT * FROM table WHERE email = '$email';  Here I am
capturing from the session
$result=mysql_query($query);
$num=mysql_numrows($result);

mysql_close();
{

$shopname=mysql_result($result,$i,shopname);
$category=mysql_result($result,$i,category);

}

?

Showing in the textfield from the database is working fine

THE Problem is:

I am getting only the first row of table to show up and not the one with
the
field $userName, meaning the userName is not getting captured from the
above
or checking with the table and showing me the value. 

It might be a basic one, could you please advice how to achieve that.

Cheers,

Chris
-- 
View this message in context:
http://www.nabble.com/How-to-capture-from-session-and-match-database-tf4478
519.html#a12770056
Sent from the Php - Database mailing list archive at Nabble.com.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Form processing

2007-09-13 Thread Naintara
You could look up the PHP function get_magic_quotes_gpc()

When a form is posted, you could do a check like this:

if ( get_magic_quotes_gpc() ) {
//where $subject contains the subject string and $newsubject is
what you use for the mail
$newsubject = stripslashes ($subject);  
}

This will remove the escape slashes added by the server php settings.
Read magic_quotes_gpc in php reference.

-Original Message-
From: ron.php [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 12, 2007 7:03 AM
To: php-db@lists.php.net
Subject: [PHP-DB] Form processing

I am trying to set up a form which will send e-mails for late breaking
news 
and urgent e-mailings.  

If I have Today's news in the subject line on the e-mail it comes out 
with Today\'s news --- how can I prevent this from happening?  

Ron  

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Order By [blank]

2006-12-21 Thread Naintara
Depending on your MySQL version you could use a subquery by combining the
two queries you mentioned, for a fairly straight-forward query.

http://dev.mysql.com/tech-resources/articles/4.1/subqueries.html
http://mysqld.active-venture.com/Subqueries.html

You could read about optimizing subqueries for optimum queries.

-Original Message-
From: Kevin Murphy [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 21, 2006 10:49 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Order By [blank]

I have this column in mysql:

A
F
D
[ empty ]
A
C

If I do an order by on that column, this is what I get:

[ empty ]
A
A
C
D
F

What I would like is this:

A
A
C
D
F
[ empty ]

Is there any way to achieve this in a single MySQL query? Using DESC in this
case doesn't work, because while it puts the empty row in the last place, it
does the rest as well. I could also do 2 queries where it calls it once in
order WHERE  !='', and then do another query to get the empty ones, but that
seems a bit cumbersome.

--
Kevin Murphy
Webmaster: Information and Marketing Services Western Nevada Community
College www.wncc.edu
775-445-3326




-- 
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Direct Access to an Array Item?

2006-09-03 Thread Naintara
Perhaps you could elaborate on the exact motive
Say, why would you be checking against the 4th element of an array.

I could understand why you would want to check every element of an array
against a particular value, but why just the 4th element, just for interest.

In response to your question, there wasn't a way to access the index of an
array using the square bracket, but you could explore the various array
functions available in php. If you have a dynamic variable/counter, you
could instead use each() or next()

For instance, 
You can get this to work
$str = 123#456#789;
123 == current(explode('#', $str)) 

The result will be true.

Not sure if this helps you, but worth a shot.

-Original Message-
From: J R [mailto:[EMAIL PROTECTED] 
Sent: 10 August 2006 4:54 AM
To: php-db@lists.php.net
Subject: [PHP-DB] Direct Access to an Array Item?

On 8/9/06, Peter Beckman [EMAIL PROTECTED] wrote:

 I want to access a variable within a function-returned array without 
 setting the array to a variable first.  Example -- test for equal to 
 string 'foo' on the 4th element of a returned fetch row:

  if (($row = mysql_fetch_row($result))[3] == 'foo') {
  $user = $row;
  }

 or

  $bar = explode('#', $str)[2];


i don't think it is possible to do such syntax. nor theres a work around on
to make it way you want it. (i'm not an expert. just IMHO)

I know I can do this in perl, but can it be done in PHP?  Obviously this is
 pseudo code, it doesn't actually work, but I wonder if there is a way 
 that escapes me currently?

 I know I can assign the result to a variable and then test the 
 element; I am addicted to trying to cut down the amount and complexity 
 of code.  Even

 if you disagree with my goal as good computing practices,


i agree, its not a good programming practice and its makes your code less
readable. :)

I simply want to
 know if what I ask is possible, and if so, how. :-)

 Beckman


---
 Peter Beckman  Internet
 Guy
 [EMAIL PROTECTED]
 http://www.purplecow.com/
 --
 -


 --
 PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: 
 http://www.php.net/unsub.php




--
GMail Rocks!!!


-- 
GMail Rocks!!!

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.8/413 - Release Date: 08/08/2006
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] storing unicode characters in mysql database

2006-01-30 Thread Naintara
Hi,

I'd like to know what would be the best way to store Unicode text in a
database. I am using MySQL 4.1.
I am trying to create a multi-lingual CMS and the browser charset is set to
utf-8 and the database and tables are set to UTF8 and utf8_bin for charset
and collation.

While displaying in the browser, Thai text is displayed correctly but it is
stored as html code in the database.
Is this correct behaviour or is there a better way?

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 27-Jan-06
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php