Re: [PHP-DB] Re: UPDATE command

2005-06-20 Thread Dwight Altman
"This is kind of interesting ...

$query="SELECT * FROM quiettimequotation WHERE used = 0 ORDER BY RAND()
LIMIT 1";

works;

$query="SELECT * FROM bibleverses WHERE 'used' = 0 ORDER BY RAND() LIMIT
1";

doesn't!  Having the ' around used makes that select command fail ---
but
the UPDATE command requires it!"

Use the "`" mark around table names and field names.
Use the "'" mark around values.
Although sometimes you may get away without them.

$query="SELECT * FROM `bibleverses` WHERE `used` = '0' ORDER BY RAND()
LIMIT 1";

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



Re: [PHP-DB] Re: UPDATE command

2005-06-20 Thread -{ Rene Brehmer }-
Documented research indicate that on Mon, 20 Jun 2005 12:47:56 +0100,
[EMAIL PROTECTED] wrote:

> The trick is your using the wrong ' instead you need ` ...
>  
> go away from kl;->' and go to `->123 ;)
> The key above the (Tab) key, or the key next to the number 1 above the q.  

I hope you realise those directions only work for US keyboards (might work
for UK too, never seen those), but just about every other keyboard layout
it's in a different place (like on DK keyboards it's next to the backspace
key, and you have to first hit, then hit space, to make it show up alone,
because it's actually an accent aigu)... not sure where Ron is from, but it
is something worth considering when giving keyboard directions ...


Rene

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



[PHP-DB] Re: UPDATE command

2005-06-20 Thread ron . php
This is kind of interesting ...

$query="SELECT * FROM quiettimequotation WHERE used = 0 ORDER BY RAND()
LIMIT 1";

works;

$query="SELECT * FROM bibleverses WHERE 'used' = 0 ORDER BY RAND() LIMIT 1";

doesn't!  Having the ' around used makes that select command fail --- but
the UPDATE command requires it!

Thanks for those of you who responded to my question below.  I am creating a
mailing list for my web site that I am wanting each entry which is randomly
selected from the database to only be used once and not be available again
until the entire list has been used.  I needed the UPDATE command to change
the used column all back to 0 again once the last entry had been selected
from the database.  I think I like programming mySQL stuff :)  Ron

---

>Does the UPDATE command only change one row or each occurance if the the
>criteria repeat itself through the table?

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




**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


<<<>>>AdmID:7EFDB58CC6D11227EE45BEC0BF84E6A2



**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


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

RE: [PHP-DB] Re: UPDATE command

2005-06-20 Thread bastien_k
used is a column name, if you need to surround it use the back ticks (beow 
the esc key, same button as the tilde (~). That is why it fails...it 
shouldn't be req'd for the update, though the value may need to be quoted 
depending on the col data type

Bastien

>From: "Ron Piggott" <[EMAIL PROTECTED]>
>Reply-To: "Ron Piggott" <[EMAIL PROTECTED]>
>To: "Webmaster" <[EMAIL PROTECTED]>
>CC: "PHP DB" 
>Subject: [PHP-DB] Re: UPDATE command
>Date: Fri, 17 Jun 2005 23:47:31 -0400
>
>This is kind of interesting ...
>
>$query="SELECT * FROM quiettimequotation WHERE used = 0 ORDER BY RAND()
>LIMIT 1";
>
>works;
>
>$query="SELECT * FROM bibleverses WHERE 'used' = 0 ORDER BY RAND() LIMIT 
>1";
>
>doesn't!  Having the ' around used makes that select command fail --- but
>the UPDATE command requires it!
>
>Thanks for those of you who responded to my question below.  I am creating 
>a
>mailing list for my web site that I am wanting each entry which is randomly
>selected from the database to only be used once and not be available again
>until the entire list has been used.  I needed the UPDATE command to change
>the used column all back to 0 again once the last entry had been selected
>from the database.  I think I like programming mySQL stuff :)  Ron
>
>---
>
> >Does the UPDATE command only change one row or each occurance if the the
> >criteria repeat itself through the table?
>
>--
>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




**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


<<<>>>AdmID:2D9388A3F9FA0C7BE52690ABC7B22408



**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


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

RE: [PHP-DB] Re: UPDATE command

2005-06-20 Thread jusa_98
The trick is your using the wrong ' instead you need ` ...
 
go away from kl;->' and go to `->123 ;)
The key above the (Tab) key, or the key next to the number 1 above the q.  
 
so ...
 
$query="SELECT * FROM bibleverses WHERE `used` = 0 ORDER BY RAND() 
LIMIT 1";
 
When I first learned this also I was fooled and used ' instead of `.  But in 
some cases you don't need to use it also.
 
I hope this covers it!  Sorry if someone else has responded before me.  I might 
of been a bit slow! ;)

Jerry

 


>From: "Ron Piggott" <[EMAIL PROTECTED]>
>Reply-To: "Ron Piggott" <[EMAIL PROTECTED]>
>To: "Webmaster" <[EMAIL PROTECTED]>
>CC: "PHP DB" 
>Subject: [PHP-DB] Re: UPDATE command
>Date: Fri, 17 Jun 2005 23:47:31 -0400
>
>This is kind of interesting ...
>
>$query="SELECT * FROM quiettimequotation WHERE used = 0 ORDER BY 
RAND()
>LIMIT 1";
>
>works;
>
>$query="SELECT * FROM bibleverses WHERE 'used' = 0 ORDER BY RAND() 
LIMIT 
>1";
>
>doesn't!  Having the ' around used makes that select command fail --- 
but
>the UPDATE command requires it!
>
>Thanks for those of you who responded to my question below.  I am 
creating 
>a
>mailing list for my web site that I am wanting each entry which is 
randomly
>selected from the database to only be used once and not be available 
again
>until the entire list has been used.  I needed the UPDATE command to 
change
>the used column all back to 0 again once the last entry had been 
selected
>from the database.  I think I like programming mySQL stuff :)  Ron
>
>---
>
> >Does the UPDATE command only change one row or each occurance if the 
the
> >criteria repeat itself through the table?
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


Send instant messages to your online friends http://au.messenger.yahoo.com 


**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


<<<>>>AdmID:2D9388A3F9FA0C7BE52690ABC7B22408



**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.


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

RE: [PHP-DB] Re: UPDATE command

2005-06-19 Thread JeRRy
The trick is your using the wrong ' instead you need ` ...
 
go away from kl;->' and go to `->123 ;)
The key above the (Tab) key, or the key next to the number 1 above the q.  
 
so ...
 
$query="SELECT * FROM bibleverses WHERE `used` = 0 ORDER BY RAND() 
LIMIT 1";
 
When I first learned this also I was fooled and used ' instead of `.  But in 
some cases you don't need to use it also.
 
I hope this covers it!  Sorry if someone else has responded before me.  I might 
of been a bit slow! ;)

Jerry

 


>From: "Ron Piggott" <[EMAIL PROTECTED]>
>Reply-To: "Ron Piggott" <[EMAIL PROTECTED]>
>To: "Webmaster" <[EMAIL PROTECTED]>
>CC: "PHP DB" 
>Subject: [PHP-DB] Re: UPDATE command
>Date: Fri, 17 Jun 2005 23:47:31 -0400
>
>This is kind of interesting ...
>
>$query="SELECT * FROM quiettimequotation WHERE used = 0 ORDER BY 
RAND()
>LIMIT 1";
>
>works;
>
>$query="SELECT * FROM bibleverses WHERE 'used' = 0 ORDER BY RAND() 
LIMIT 
>1";
>
>doesn't!  Having the ' around used makes that select command fail --- 
but
>the UPDATE command requires it!
>
>Thanks for those of you who responded to my question below.  I am 
creating 
>a
>mailing list for my web site that I am wanting each entry which is 
randomly
>selected from the database to only be used once and not be available 
again
>until the entire list has been used.  I needed the UPDATE command to 
change
>the used column all back to 0 again once the last entry had been 
selected
>from the database.  I think I like programming mySQL stuff :)  Ron
>
>---
>
> >Does the UPDATE command only change one row or each occurance if the 
the
> >criteria repeat itself through the table?
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


Send instant messages to your online friends http://au.messenger.yahoo.com 

RE: [PHP-DB] Re: UPDATE command

2005-06-18 Thread Bastien Koert
used is a column name, if you need to surround it use the back ticks (beow 
the esc key, same button as the tilde (~). That is why it fails...it 
shouldn't be req'd for the update, though the value may need to be quoted 
depending on the col data type


Bastien


From: "Ron Piggott" <[EMAIL PROTECTED]>
Reply-To: "Ron Piggott" <[EMAIL PROTECTED]>
To: "Webmaster" <[EMAIL PROTECTED]>
CC: "PHP DB" 
Subject: [PHP-DB] Re: UPDATE command
Date: Fri, 17 Jun 2005 23:47:31 -0400

This is kind of interesting ...

$query="SELECT * FROM quiettimequotation WHERE used = 0 ORDER BY RAND()
LIMIT 1";

works;

$query="SELECT * FROM bibleverses WHERE 'used' = 0 ORDER BY RAND() LIMIT 
1";


doesn't!  Having the ' around used makes that select command fail --- but
the UPDATE command requires it!

Thanks for those of you who responded to my question below.  I am creating 
a

mailing list for my web site that I am wanting each entry which is randomly
selected from the database to only be used once and not be available again
until the entire list has been used.  I needed the UPDATE command to change
the used column all back to 0 again once the last entry had been selected
from the database.  I think I like programming mySQL stuff :)  Ron

---

>Does the UPDATE command only change one row or each occurance if the the
>criteria repeat itself through the table?

--
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-DB] Re: UPDATE command

2005-06-17 Thread Ron Piggott
This is kind of interesting ...

$query="SELECT * FROM quiettimequotation WHERE used = 0 ORDER BY RAND()
LIMIT 1";

works;

$query="SELECT * FROM bibleverses WHERE 'used' = 0 ORDER BY RAND() LIMIT 1";

doesn't!  Having the ' around used makes that select command fail --- but
the UPDATE command requires it!

Thanks for those of you who responded to my question below.  I am creating a
mailing list for my web site that I am wanting each entry which is randomly
selected from the database to only be used once and not be available again
until the entire list has been used.  I needed the UPDATE command to change
the used column all back to 0 again once the last entry had been selected
from the database.  I think I like programming mySQL stuff :)  Ron

---

>Does the UPDATE command only change one row or each occurance if the the
>criteria repeat itself through the table?

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