[PHP-DB] setting a timeout on ocilogon

2005-03-24 Thread Jos Juffermans
Hi,

I have a script that connects to a database which is in another country and 
connected to our network thru a VPN.

The script tries to connect using ocilogon() and checks if a connection is 
established. If not, it presents the visitor with a nice errorpage.

However, ocilogon takes a very long time before it returns control to the 
script (ie aborts the connection) if it fails. I would like ocilogon to quit 
trying after eg 10 seconds. How can I do that?

Rgds,
Jos 

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



Re: [PHP-DB] MySQL query problems...

2005-03-24 Thread J. Connolly
yeah...errora are important. I do not escape my quotation marks in a 
query. I use single quotes within my insert and select statements.
If it says No valis MySQL resource then you are returning 0 records 
which may be caused by escaping the quotations.

I follow this pattern
$sql =INSERT INTO table VALUES ('some value','another value','etc');
NIPP, SCOTT V (SBCSI) wrote:
I am getting errors for the following queries.  This query seems
to work fine in phpMyAdmin.
$query2 = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, accounts
   WHERE AllMid_Data.CPU_IN_SVC = \Y\
   AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\
   AND accounts.sbcuid = $sbcuid
   AND accounts.system = AllMid_Data.CPU_Hostname
   AND accounts.ctime IS NULL
   ORDER BY CPU_Hostname ASC;
$results2 = mysql_query($query2, $Prod) or die(mysql_error());
$system2 = mysql_fetch_assoc($results2);
$query3 = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, acct_db
   WHERE AllMid_Data.CPU_IN_SVC = \Y\
   AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\
   AND acct_db.key1 LIKE \$sbcuid%\
   AND acct_db.key1 LIKE \%\.AllMid_Data.CPU_Hostname
   ORDER BY CPU_Hostname ASC;
$results3 = mysql_query($query3, $Prod) or die(mysql_error());
$system3 = mysql_fetch_assoc($results3);
I am assuming that I have an issue with query3.  Thanks in
advance.
Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com
 

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


Re: [PHP-DB] MySQL query problems...

2005-03-24 Thread Bastien Koert
Not quite correct, No valis MySQL resource means the query and/or link 
failed in connection in some way. A correct and proper query MAY easily 
return 0 rows and that is correct and will give you a  valid resource 
(handle) and simply no data.

Bastien
From: J. Connolly [EMAIL PROTECTED]
CC: php-db@lists.php.net
Subject: Re: [PHP-DB] MySQL query problems...
Date: Thu, 24 Mar 2005 08:35:56 -0500
yeah...errora are important. I do not escape my quotation marks in a query. 
I use single quotes within my insert and select statements.
If it says No valis MySQL resource then you are returning 0 records which 
may be caused by escaping the quotations.

I follow this pattern
$sql =INSERT INTO table VALUES ('some value','another value','etc');
NIPP, SCOTT V (SBCSI) wrote:
I am getting errors for the following queries.  This query seems
to work fine in phpMyAdmin.
$query2 = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, accounts
   WHERE AllMid_Data.CPU_IN_SVC = \Y\
   AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\
   AND accounts.sbcuid = $sbcuid
   AND accounts.system = AllMid_Data.CPU_Hostname
   AND accounts.ctime IS NULL
   ORDER BY CPU_Hostname ASC;
$results2 = mysql_query($query2, $Prod) or die(mysql_error());
$system2 = mysql_fetch_assoc($results2);
$query3 = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, acct_db
   WHERE AllMid_Data.CPU_IN_SVC = \Y\
   AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\
   AND acct_db.key1 LIKE \$sbcuid%\
   AND acct_db.key1 LIKE \%\.AllMid_Data.CPU_Hostname
   ORDER BY CPU_Hostname ASC;
$results3 = mysql_query($query3, $Prod) or die(mysql_error());
$system3 = mysql_fetch_assoc($results3);
I am assuming that I have an issue with query3.  Thanks in
advance.
Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.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] database connection timeout

2005-03-24 Thread Martin Norland
Juffermans, Jos wrote:
Hi,
[snip]
Hello, again.
I'm afraid phrasing a question multiple ways over a course of days tends 
not to have much success.  In an effort to avoid populating google with 
just the question, I will give to you what I would try.

( please note the irony of this  now. )
I'm trying to connect to an Oracle database (using ocilogon) which is in a
different country and connected to our serverfarm via a VPN (the database
has no public access). Unfortunately the VPN or the database is not always
available. In those cases I will present the visitor with a page explaining
that the service is unavailable.
[snip]
Is it that it's not always available, or that it needs time to 'come 
back up'.  You may want to try running some random low-traffic 
application over it to make sure it remains running.  Some simple SNMP 
protocol or even simpler just connect to a remote GKrellM.  Heck, a ssh 
connection with top running would do - just something that is constantly 
transmitting a trickle of data.

My problem is that ocilogon takes a long time to return control if the
connection cannot be established - often even more than 30 seconds. I've
learned that if a connection can be established it'll happen in only a few
seconds (usually within 1 second) and am convinced that if the connection is
not established in eg 5 seconds, there is no point in waiting another eg 30
seconds. How can I tell ocilogon to timeout after eg 5 seconds (like you can
with fsockopen)?
[snip]
I can't claim whether or not it will work since I don't have an Oracle 
server handy, so I will merely name functions and talk a bunch.

Essentially, you want ocilogon (complex network function to login to a 
networked Oracle [in this case] server) to timeout just like fsockopen 
(fairly simple function to open a socket, including network resources). 
 My suggestion is to try connecting using fsockopen, with the timeout. 
 If it successfully connects - chances are, the majority of the time, 
your ocilogon that follows will work as well.

Unfortunately, the stream_set_* functions rely on a valid stream 
resource, so they won't work with ocilogon (if there was any chance they 
would).  That would have been a nice route to go otherwise.

Another dirty little trick you might use is running the ocilogon in a 
separate script and making use of set_time_limit() to make sure it 
doesn't run too long.  Just be sure not to set_time_limit() for your 
whole set of scripts, unless you really want them to abort after the 5 
or 10 second limit you're setting ocilogon (unlikely).

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


RE: [PHP-DB] database connection timeout

2005-03-24 Thread Juffermans, Jos
Hi,

Martin Norland wrote:

MN I'm afraid phrasing a question multiple ways over a course of days tends

MN not to have much success.  In an effort to avoid populating google with 
MN just the question, I will give to you what I would try.
I understand your point but since I wasn't getting any response and never
received a confirmation email from the system telling me that my email
account had been verified, I wasn't sure that the original post was actually
sent to the community. Oddly enough I got an email from the system this
morning asking me to verify my email address - again :s

Anyway, at least this time it triggered a response ;)

MN Is it that it's not always available, or that it needs time to 'come 
MN back up'.  You may want to try running some random low-traffic 
MN application over it to make sure it remains running.  Some simple SNMP 
MN protocol or even simpler just connect to a remote GKrellM.  Heck, a ssh 
MN connection with top running would do - just something that is constantly

MN transmitting a trickle of data.
The VPN connection is not always available. I'm afraid I don't have much
control over the VPN myself and I believe only the Oracle port has been
opened in this VPN.

MN Essentially, you want ocilogon (complex network function to login to a 
MN networked Oracle [in this case] server) to timeout just like fsockopen 
MN (fairly simple function to open a socket, including network resources). 
MN   My suggestion is to try connecting using fsockopen, with the timeout. 
MN   If it successfully connects - chances are, the majority of the time, 
MN your ocilogon that follows will work as well.
That's a good idea, I'll try to connect to the Oracle port thru fsockopen.

MN Another dirty little trick you might use is running the ocilogon in a 
MN separate script and making use of set_time_limit() to make sure it 
MN doesn't run too long.  Just be sure not to set_time_limit() for your 
MN whole set of scripts, unless you really want them to abort after the 5 
MN or 10 second limit you're setting ocilogon (unlikely).
I'm not sure if I can set the time limit (safemode...) but are you saying
that set_time_limit only affects the script that you include and not the
caller script?

I'll try the fsockopen connection test on the oracle port. Thanks for your
help.

Rgds,
Jos

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



RE: [PHP-DB] MySQL query problems...

2005-03-24 Thread NIPP, SCOTT V \(SBCSI\)
OK.  I think I have resolved this issue.  The problem I am
having now is that I have a simple table that is a list of systems to
exclude from the display.  I am having trouble figuring out how to
structure my query to actually exclude the systems in this table.  Here
is what I tried, and it gives me 13 instances of every entry, 13 is the
number of hostnames in the exclusion table.

$query = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, exclusion
  WHERE AllMid_Data.CPU_IN_SVC = \Y\ 
  AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\ 
  AND AllMid_Data.CPU_Hostname != exclusion.hostname
  ORDER BY CPU_Hostname ASC;
$results = mysql_query($query, $Prod) or die(mysql_error());
$system = mysql_fetch_assoc($results);

Additionally, what I am actually working towards is that if a
system shows up in either of the other queries it gets excluded from
this one.  I have not tried anything to make that happen yet.  I will
tackle that challenge once I can resolve this part.  Thanks again.

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



-Original Message-
From: J. Connolly [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 24, 2005 7:36 AM
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] MySQL query problems...


yeah...errora are important. I do not escape my quotation marks in a 
query. I use single quotes within my insert and select statements.
If it says No valis MySQL resource then you are returning 0 records 
which may be caused by escaping the quotations.

I follow this pattern
$sql =INSERT INTO table VALUES ('some value','another value','etc');

NIPP, SCOTT V (SBCSI) wrote:

   I am getting errors for the following queries.  This query seems
to work fine in phpMyAdmin.

$query2 = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, accounts
  WHERE AllMid_Data.CPU_IN_SVC = \Y\
  AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\
  AND accounts.sbcuid = $sbcuid
  AND accounts.system = AllMid_Data.CPU_Hostname
  AND accounts.ctime IS NULL
  ORDER BY CPU_Hostname ASC;
$results2 = mysql_query($query2, $Prod) or die(mysql_error());
$system2 = mysql_fetch_assoc($results2);
$query3 = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, acct_db
  WHERE AllMid_Data.CPU_IN_SVC = \Y\
  AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\
  AND acct_db.key1 LIKE \$sbcuid%\
  AND acct_db.key1 LIKE \%\.AllMid_Data.CPU_Hostname
  ORDER BY CPU_Hostname ASC;
$results3 = mysql_query($query3, $Prod) or die(mysql_error());
$system3 = mysql_fetch_assoc($results3);

   I am assuming that I have an issue with query3.  Thanks in
advance.
Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.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] database connection timeout

2005-03-24 Thread Martin Norland
Juffermans, Jos wrote:
I understand your point but since I wasn't getting any response and never
received a confirmation email from the system telling me that my email
account had been verified, I wasn't sure that the original post was actually
sent to the community. Oddly enough I got an email from the system this
morning asking me to verify my email address - again :s
Fair enough, I've been on that boat before. :)
The VPN connection is not always available. I'm afraid I don't have much
control over the VPN myself and I believe only the Oracle port has been
opened in this VPN.
You might want to contact whoever manages the VPN - it sure sounds like 
it needs to always be up!

MN Essentially, you want ocilogon (complex network function to login to a 
MN networked Oracle [in this case] server) to timeout just like fsockopen 
MN (fairly simple function to open a socket, including network resources). 
MN   My suggestion is to try connecting using fsockopen, with the timeout. 
MN   If it successfully connects - chances are, the majority of the time, 
MN your ocilogon that follows will work as well.
That's a good idea, I'll try to connect to the Oracle port thru fsockopen.
Let us on the list know how/whether or not this works, It's definitely 
worth having some info on.

MN Another dirty little trick you might use is running the ocilogon in a 
MN separate script and making use of set_time_limit() to make sure it 
MN doesn't run too long.  Just be sure not to set_time_limit() for your 
MN whole set of scripts, unless you really want them to abort after the 5 
MN or 10 second limit you're setting ocilogon (unlikely).
I'm not sure if I can set the time limit (safemode...) but are you saying
that set_time_limit only affects the script that you include and not the
caller script?
No no no - include() should be the same as if you just placed the code 
right where the include is, so it would apply it to the whole script.
You'll have to call out separately and make it another process,  and 
exec or something - a small script whose sole intention is to determine 
if the VPN is up.  exec() or the likes - like I said - dirty trick/hack. 
 The idea is to just have it return 0 or 1 [actually, depending on how 
the time limit works, it may not return anything if it ends 
prematurely].  Definitely try the fsockopen bit first, and give it a few 
go's if it's not working.

I'll try the fsockopen connection test on the oracle port. Thanks for your
help.
Welcome to the list!
cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


[PHP-DB] Why not ?

2005-03-24 Thread JeRRy
Why does this NOT work?

UPDATE tipping SET score = 3 WHERE round1.game1 = H
AND tipping.username = jerry;

Please inform?

J



Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

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



Re: [PHP-DB] Why not ?

2005-03-24 Thread Larry E . Ullman
Why does this NOT work?
UPDATE tipping SET score = 3 WHERE round1.game1 = H
AND tipping.username = jerry;
For starters, you should quote strings in a query. There may also be a 
problem with the round1 reference.

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


Re: [PHP-DB] Why not ?

2005-03-24 Thread Martin Norland
JeRRy wrote:
Why does this NOT work?
UPDATE tipping SET score = 3 WHERE round1.game1 = H
AND tipping.username = jerry;
Please inform?
You're not linking table round1 to table tipping in any way, and you've 
got some quoting issues.

something like this:
UPDATE tipping SET score=3 WHERE round1.game1='H' AND 
round1.username=tipping.username AND tipping.username='jerry';

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] Why not ?

2005-03-24 Thread JeRRy


--- Larry E. Ullman [EMAIL PROTECTED]
wrote:
  Why does this NOT work?
 
  UPDATE tipping SET score = 3 WHERE round1.game1 =
 H
  AND tipping.username = jerry;
 
 For starters, you should quote strings in a query.
 There may also be a 
 problem with the round1 reference.
 
 Larry
 

I was getting an error earlier stating round1 does not
exist, however it does.  round1 table does not exist. 
So does not say round1.game1 does not exist.

But the table name exists.  And I use the correct
quotations, this does not effect it without it when i
use other queries.

I will keep trying...  If anyone knows, shoot! :)

J

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

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



RE: [PHP-DB] Why not ?

2005-03-24 Thread Bastien Koert
missing single quotes around text
UPDATE tipping SET score = 3 WHERE round1.game1 =' H'
AND tipping.username = 'jerry';
bastien
From: JeRRy [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Why not ?
Date: Fri, 25 Mar 2005 04:05:28 +1100 (EST)
Why does this NOT work?
UPDATE tipping SET score = 3 WHERE round1.game1 = H
AND tipping.username = jerry;
Please inform?
J

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.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] Why not ?

2005-03-24 Thread Simon Rees
On Thursday 24 March 2005 17:26, JeRRy wrote:

 I was getting an error earlier stating round1 does not
 exist, however it does.  round1 table does not exist.
 So does not say round1.game1 does not exist.

Does a table named round1 exist in your database?
If so and you are using mysql  4.0.4 you will need to mention all tables 
referenced in the WHERE clause in the UPDATE clause. e.g.

UPDATE tipping, round1
SET tipping.score = 3
WHERE round1.game1 = 'H'
AND tipping.username = 'jerry'

(assuming the score column you want to update is in the tipping table...)

You almost certainly want to join the two tables as well but without knowing 
your database it is impossible for me to say how.
If you are using an older mysql version what you want to do is probably 
impossible in one statement.

Simon

-- 
~~
Simon Rees  | [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

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



[PHP-DB] Re: MySQL query problems...

2005-03-24 Thread Frank M Flynn
The error message and  when I have problems I find it's very helpful to 
print  the  actual value of the $query  variable.

In your case it looks like
		   AND acct_db.key1 LIKE \%\.AllMid_Data.CPU_Hostname
is adding   AND acct_db.key1 LIKE %.AllMid_Data.CPU_Hostname
and you can't join two strings in SQL with a '.' like you can in PHP 
you should use a + for the  two strings.  I think what  you want is:

  AND acct_db.key1 LIKE \%\ + AllMid_Data.CPU_Hostname
Good Luck,
Frank
On Mar 24, 2005, at 1:33 AM, [EMAIL PROTECTED] wrote:
From: NIPP, SCOTT V \(SBCSI\) [EMAIL PROTECTED]
Date: March 23, 2005 3:18:44 PM PST
To: php-db@lists.php.net
Subject: MySQL query problems...
I am getting errors for the following queries.  This query seems
to work fine in phpMyAdmin.
$query2 = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, accounts
   WHERE AllMid_Data.CPU_IN_SVC = \Y\
   AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\
   AND accounts.sbcuid = $sbcuid
   AND accounts.system = AllMid_Data.CPU_Hostname
   AND accounts.ctime IS NULL
   ORDER BY CPU_Hostname ASC;
$results2 = mysql_query($query2, $Prod) or die(mysql_error());
$system2 = mysql_fetch_assoc($results2);
$query3 = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, acct_db
   WHERE AllMid_Data.CPU_IN_SVC = \Y\
   AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\
   AND acct_db.key1 LIKE \$sbcuid%\
   AND acct_db.key1 LIKE \%\.AllMid_Data.CPU_Hostname
   ORDER BY CPU_Hostname ASC;
$results3 = mysql_query($query3, $Prod) or die(mysql_error());
$system3 = mysql_fetch_assoc($results3);
I am assuming that I have an issue with query3.  Thanks in
advance.
Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com


[PHP-DB] OCI ignoring NLS_DATE_FORMAT parameter

2005-03-24 Thread Doug McMaster
Regardless of how I set the NLS_DATE_FORMAT parameter, when I do a select 
statement DATE fields are returned in the Oracle default DD-MON-RR format.

I can successfully set NLS_DATE_FORMAT using either an environment variable 
and restarting apache or by using ALTER SESSION SET NLS_DATE_FORMAT = 
'DD-MM- HH24:MI:SS' (I would prefer to use this method).

I can verify that the NLS_DATE_FORMAT is set to my desired format both before 
and after my select statement by running the query SELECT * FROM 
NLS_SESSION_PARAMETERS WHERE PARAMETER='NLS_DATE_FORMAT' in my script.

This problem occurs with both PEAR DB, and with ADODB oci8 drivers.  However 
if I use the ADODB oracle drivers, which use the older ora functions instead 
of the oci functions, ALTER SESSION works and I am able to retrieve dates in 
the format I set.  Unfortunately, the software I'm working on uses PEAR 
DB_DataObject, and the PEAR DB Oracle driver uses the oci calls.

Version info:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
PHP 4.3.4
Apache 1.3.29

Anyone have any ideas or suggestions on why I'm seeing this problem?

Thanks,
Doug

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



[PHP-DB] What wrong with my Query??

2005-03-24 Thread HarryG
What the hell is wrong with this MYSQL query?? PHP keeps giving me the error 
message:

You have an error in your SQL syntax. Check the manual that corresponds to your 
MySQL server version for the right syntax to use near 'limit=2, 
name='test1', email='[EMAIL PROTECTED]', password='t 

$query = INSERT INTO mfadmin SET id='', account='$accname_lc', limit=$plans, 
name='$yourname', email='$email', password='$password', lastlogin='$datetoday', 
datecreated='$datetoday', expiry='$expirydate', lastip=123.123.123.123;
   
This is my table structure
CREATE TABLE `admin` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `account` varchar(50) NOT NULL default '',
  `limit` int(10) unsigned NOT NULL default '0',
  `name` varchar(50) NOT NULL default '',
  `email` varchar(50) NOT NULL default '',
  `password` varchar(50) NOT NULL default '',
  `lastlogin` varchar(50) NOT NULL default '',
  `datecreated` varchar(50) NOT NULL default '',
  `expiry` varchar(50) NOT NULL default '',
  `lastip` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;

Re: [PHP-DB] What wrong with my Query??

2005-03-24 Thread HarryG
thanks. Stupid me. I've been banging by head for the last two hours.


Bastien Koert [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 limit is a mysql keyword...change that field name and the corresonding
names
 in your sql

 bastien

 From: HarryG [EMAIL PROTECTED]
 To: php-db@lists.php.net
 Subject: [PHP-DB] What wrong with my Query??
 Date: Fri, 25 Mar 2005 16:26:38 +1100
 
 What the hell is wrong with this MYSQL query?? PHP keeps giving me the
 error message:
 
 You have an error in your SQL syntax. Check the manual that corresponds
to
 your MySQL server version for the right syntax to use near 'limit=2,
 name='test1', email='[EMAIL PROTECTED]', password='t
 
 $query = INSERT INTO mfadmin SET id='', account='$accname_lc',
 limit=$plans, name='$yourname', email='$email', password='$password',
 lastlogin='$datetoday', datecreated='$datetoday', expiry='$expirydate',
 lastip=123.123.123.123;
 
 This is my table structure
 CREATE TABLE `admin` (
`id` int(10) unsigned NOT NULL auto_increment,
`account` varchar(50) NOT NULL default '',
`limit` int(10) unsigned NOT NULL default '0',
`name` varchar(50) NOT NULL default '',
`email` varchar(50) NOT NULL default '',
`password` varchar(50) NOT NULL default '',
`lastlogin` varchar(50) NOT NULL default '',
`datecreated` varchar(50) NOT NULL default '',
`expiry` varchar(50) NOT NULL default '',
`lastip` varchar(50) NOT NULL default '',
PRIMARY KEY  (`id`)
 ) TYPE=MyISAM;

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