Re: [PHP-DB] MySQL problem..

2004-11-10 Thread Leo G. Divinagracia III
okay.. i'm stumped.  what client libraries?
using php 5, so is it "php_mysql.dll"???
i'm using a "canned" script, so i have to make the changes there too?
i checked out the mysql help link.  i even started the mysqld with the 
"--old-passwords" parameter...

still getting the error...
thanks...
Bastien Koert wrote:
Check the mysql website. Have you upgraded from 4.0x to 4.1 recently. If 
so you need to update the client libraries that come with mysql. There 
are significant protocol changes from 4.0x to  4.1.

Bastien
From: ian <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL problem..
Date: Mon, 08 Nov 2004 17:02:53 +
Any body met this error?
Warning: mysql_connect(): Client does not support authentication
protocol requested by server; consider upgrading MySQL client in
/usr/local/apache2/html/poems/browse.php on line 15
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Leo G. Divinagracia III
[EMAIL PROTECTED]
z
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] MySQL problem..

2004-11-08 Thread ian
thnx ya'll... :)

On Mon, 2004-11-08 at 17:52, Bastien Koert wrote:
> Check the mysql website. Have you upgraded from 4.0x to 4.1 recently. If so 
> you need to update the client libraries that come with mysql. There are 
> significant protocol changes from 4.0x to  4.1.
> 
> Bastien
> 
> >From: ian <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: [EMAIL PROTECTED]
> >Subject: [PHP-DB] MySQL problem..
> >Date: Mon, 08 Nov 2004 17:02:53 +
> >
> >Any body met this error?
> >Warning: mysql_connect(): Client does not support authentication
> >protocol requested by server; consider upgrading MySQL client in
> >/usr/local/apache2/html/poems/browse.php on line 15
> >
> >--
> >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] MySQL problem..

2004-11-08 Thread Doug Thompson
ian wrote:
Any body met this error?
Warning: mysql_connect(): Client does not support authentication
protocol requested by server; consider upgrading MySQL client in
/usr/local/apache2/html/poems/browse.php on line 15
http://dev.mysql.com/doc/mysql/en/Old_client.html
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] MySQL problem..

2004-11-08 Thread Bastien Koert
Check the mysql website. Have you upgraded from 4.0x to 4.1 recently. If so 
you need to update the client libraries that come with mysql. There are 
significant protocol changes from 4.0x to  4.1.

Bastien
From: ian <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL problem..
Date: Mon, 08 Nov 2004 17:02:53 +
Any body met this error?
Warning: mysql_connect(): Client does not support authentication
protocol requested by server; consider upgrading MySQL client in
/usr/local/apache2/html/poems/browse.php on line 15
--
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] MySQL problem..

2004-11-08 Thread ian
Any body met this error?
Warning: mysql_connect(): Client does not support authentication
protocol requested by server; consider upgrading MySQL client in
/usr/local/apache2/html/poems/browse.php on line 15

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



Re: [PHP-DB] MySQL: Problem optimizing multi-table row deletion ... errors out :(

2004-09-13 Thread randy
If the threadID column is an int, you don't need to wrap the $threadID
variable in quotes.

HTH ~randy

On Tue, 14 Sep 2004 00:05:56 +0200, -{ Rene Brehmer }-
<[EMAIL PROTECTED]> wrote:
> hi gang
> 
> I'm working on optimizing the SQL for my forum system, but have run into a
> problem trying to optimize the function for deleting a thread with
> accompanying stats data and posts from the database using 1 query.
> 
> The current function, that works, looks like this:
> 
> // delete all traces of a thread
> function delThread($threadID) {
>$result = mysql_query("DELETE FROM hf_threads WHERE
> `threadID`='$threadID'");
>$result = mysql_query("DELETE FROM hf_thread_stats WHERE
> `threadID`='$threadID'");
>$result = mysql_query("DELETE FROM hf_posts WHERE `threadID`='$threadID'");
> }
> 
> I went through the MySQL manual, to try and find a way to optimize this,
> and came up with this variant:
> 
> // delete all traces of a thread
> function delThread($threadID) {
>$result = mysql_query("DELETE FROM hf_threads,hf_thread_stats,hf_posts
> WHERE `threadID`='$threadID'") or die('Unable to delete
> thread'.mysql_error());
> }
> 
> only it doesn't work at all ... the error output says this:
> 
> Unable to delete thread
> You have an error in your SQL syntax near 'hf_thread_stats,hf_posts WHERE
> `threadID`='85'' at line 1
> 
> (Obviously I attempted to delete the thread with ID 85 here)
> 
> I'm dealing with MySQL 3.23.56-log and PHP 4.3.0 ...
> 
> Any ideas for optimizing this will be greatly appreciated, esp since I'm
> not all that great with the more complex SQL syntax...
> 
> TIA
> 
> Rene
> --
> Rene Brehmer
> aka Metalbunny
> 
> If your life was a dream, would you wake up from a nightmare, dripping of
> sweat, hoping it was over? Or would you wake up happy and pleased, ready to
> take on the day with a smile?
> 
> http://metalbunny.net/
> References, tools, and other useful stuff...
> Check out the new Metalbunny forums at http://forums.metalbunny.net/
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 



-- 
randy [EMAIL PROTECTED]

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



[PHP-DB] MySQL: Problem optimizing multi-table row deletion ... errors out :(

2004-09-13 Thread -{ Rene Brehmer }-
hi gang
I'm working on optimizing the SQL for my forum system, but have run into a 
problem trying to optimize the function for deleting a thread with 
accompanying stats data and posts from the database using 1 query.

The current function, that works, looks like this:
// delete all traces of a thread
function delThread($threadID) {
  $result = mysql_query("DELETE FROM hf_threads WHERE 
`threadID`='$threadID'");
  $result = mysql_query("DELETE FROM hf_thread_stats WHERE 
`threadID`='$threadID'");
  $result = mysql_query("DELETE FROM hf_posts WHERE `threadID`='$threadID'");
}

I went through the MySQL manual, to try and find a way to optimize this, 
and came up with this variant:

// delete all traces of a thread
function delThread($threadID) {
  $result = mysql_query("DELETE FROM hf_threads,hf_thread_stats,hf_posts 
WHERE `threadID`='$threadID'") or die('Unable to delete 
thread'.mysql_error());
}

only it doesn't work at all ... the error output says this:
Unable to delete thread
You have an error in your SQL syntax near 'hf_thread_stats,hf_posts WHERE 
`threadID`='85'' at line 1

(Obviously I attempted to delete the thread with ID 85 here)
I'm dealing with MySQL 3.23.56-log and PHP 4.3.0 ...
Any ideas for optimizing this will be greatly appreciated, esp since I'm 
not all that great with the more complex SQL syntax...

TIA
Rene
--
Rene Brehmer
aka Metalbunny
If your life was a dream, would you wake up from a nightmare, dripping of 
sweat, hoping it was over? Or would you wake up happy and pleased, ready to 
take on the day with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] mysql problem importing data

2003-08-14 Thread Mark
You could use mysqlimport with --fields-terminated-by=";"

or you could open it in something like Excel, parse it there (text to
columns), and save it as a CSV

or you could read it line by, line into PHP, explode each line on the
;, then insert the data into MySQL

or you could write a  script that does a string
substitution of ; to ,

Lots ofother options, too, which I haven't thought of.

--- Merlin <[EMAIL PROTECTED]> wrote:
> Hi there,
> 
> I have a data file with data seperated by semicolons. It is about
> 8MB big.
> Now I just want to import it into mysql.
> I tryed several things. First I took phpmyadmin, which resulted in 
> a white
> page without error msg. Then I tryed it by hand with load data.
> This did not
> work as well. No I installed myodbc and tryed to export it from MS
> Access.
> This completly crashes my database server with this message:
> 
>  /usr/local/mysql/bin/safe_mysqld: line 1:  1067 Segmentation fault
> nice --5 nohup
> /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql
> --datadir=/home/m
> ysqladm/data --user=mysql --pid-file=/home/mysqladm/var/mysqld.pid
> --skip-lo
> cking -u mysqladm >>/home/mysqladm/data/SARATOGA.err 2>&1
> 030807 00:00:45  mysqld ended
> 
> Has anybody an idea on how to import that data? Its nicely
> seperated by ;
> 
> Thanx for any help,
> 
> Merlin
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Re: [PHP-DB] mysql problem importing data

2003-08-14 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hello Mark,
> 
> I have tryed it by splitting the file into pices and then insert it with the
> help of phpmyadmin. This woked.
> 
> however, I do have some more files to upload, and this seems to be not the
> fastest way:-)
> 
> I tryed this:
> mysql> LOAD DATA  INFILE 'Hotel_Description.txt'INTO TABLE
> test.hotels_descriptionFIELDS  TERMINATED BY '\t' LINES TERMINATED BY
> '\n';
> ERROR 2013: Lost connection to MySQL server during query
> mysql> 030806 02:08:37  mysqld ended
> 
> As you can see, my db server creashed! Nothing special about this file.
> 
> I am running MySQL 3.23.49 without problems so far.
> 
> Merlin
> 
> "Mark" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> news:[EMAIL PROTECTED]
> > You could use mysqlimport with --fields-terminated-by=";"
> >
> > or you could open it in something like Excel, parse it there (text to
> > columns), and save it as a CSV
> >
> > or you could read it line by, line into PHP, explode each line on the
> > ;, then insert the data into MySQL
> >
> > or you could write a  script that does a string
> > substitution of ; to ,
> >
> > Lots ofother options, too, which I haven't thought of.
> >
> > --- Merlin <[EMAIL PROTECTED]> wrote:
> > > Hi there,
> > >
> > > I have a data file with data seperated by semicolons. It is about
> > > 8MB big.
> > > Now I just want to import it into mysql.
> > > I tryed several things. First I took phpmyadmin, which resulted in
> > > a white
> > > page without error msg. Then I tryed it by hand with load data.
> > > This did not
> > > work as well. No I installed myodbc and tryed to export it from MS
> > > Access.
> > > This completly crashes my database server with this message:
> > >
> > >  /usr/local/mysql/bin/safe_mysqld: line 1:  1067 Segmentation fault
> > > nice --5 nohup
> > > /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql
> > > --datadir=/home/m
> > > ysqladm/data --user=mysql --pid-file=/home/mysqladm/var/mysqld.pid
> > > --skip-lo
> > > cking -u mysqladm >>/home/mysqladm/data/SARATOGA.err 2>&1
> > > 030807 00:00:45  mysqld ended
> > >
> > > Has anybody an idea on how to import that data? Its nicely
> > > seperated by ;
> > >
> > > Thanx for any help,
> > >
> > > Merlin

I assume here that when you say the data is separated by semicolons, you 
mean that the fields are separated by semicolons. In that case you should 
be able to use LOAD DATA INFILE and tell it that the fields are terminated 
by semicolons, not tabs as in the example you show above.

-- 
Quod subigo farinam

$email =~ s/oz$/au/o;
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



[PHP-DB] mysql problem importing data

2003-08-11 Thread Merlin
Hi there,

I have a data file with data seperated by semicolons. It is about 8MB big.
Now I just want to import it into mysql.
I tryed several things. First I took phpmyadmin, which resulted in  a white
page without error msg. Then I tryed it by hand with load data. This did not
work as well. No I installed myodbc and tryed to export it from MS Access.
This completly crashes my database server with this message:

 /usr/local/mysql/bin/safe_mysqld: line 1:  1067 Segmentation fault
nice --5 nohup
/usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/home/m
ysqladm/data --user=mysql --pid-file=/home/mysqladm/var/mysqld.pid --skip-lo
cking -u mysqladm >>/home/mysqladm/data/SARATOGA.err 2>&1
030807 00:00:45  mysqld ended

Has anybody an idea on how to import that data? Its nicely seperated by ;

Thanx for any help,

Merlin



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



Re: [PHP-DB] mysql problem importing data

2003-08-07 Thread Merlin
Hello Mark,

I have tryed it by splitting the file into pices and then insert it with the
help of phpmyadmin. This woked.

however, I do have some more files to upload, and this seems to be not the
fastest way:-)

I tryed this:
mysql> LOAD DATA  INFILE 'Hotel_Description.txt'INTO TABLE
test.hotels_descriptionFIELDS  TERMINATED BY '\t' LINES TERMINATED BY
'\n';
ERROR 2013: Lost connection to MySQL server during query
mysql> 030806 02:08:37  mysqld ended

As you can see, my db server creashed! Nothing special about this file.

I am running MySQL 3.23.49 without problems so far.

Merlin

"Mark" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> You could use mysqlimport with --fields-terminated-by=";"
>
> or you could open it in something like Excel, parse it there (text to
> columns), and save it as a CSV
>
> or you could read it line by, line into PHP, explode each line on the
> ;, then insert the data into MySQL
>
> or you could write a  script that does a string
> substitution of ; to ,
>
> Lots ofother options, too, which I haven't thought of.
>
> --- Merlin <[EMAIL PROTECTED]> wrote:
> > Hi there,
> >
> > I have a data file with data seperated by semicolons. It is about
> > 8MB big.
> > Now I just want to import it into mysql.
> > I tryed several things. First I took phpmyadmin, which resulted in
> > a white
> > page without error msg. Then I tryed it by hand with load data.
> > This did not
> > work as well. No I installed myodbc and tryed to export it from MS
> > Access.
> > This completly crashes my database server with this message:
> >
> >  /usr/local/mysql/bin/safe_mysqld: line 1:  1067 Segmentation fault
> > nice --5 nohup
> > /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql
> > --datadir=/home/m
> > ysqladm/data --user=mysql --pid-file=/home/mysqladm/var/mysqld.pid
> > --skip-lo
> > cking -u mysqladm >>/home/mysqladm/data/SARATOGA.err 2>&1
> > 030807 00:00:45  mysqld ended
> >
> > Has anybody an idea on how to import that data? Its nicely
> > seperated by ;
> >
> > Thanx for any help,
> >
> > Merlin
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> =
> Mark Weinstock
> [EMAIL PROTECTED]
> ***
> You can't demand something as a "right" unless you are willing to fight to
death to defend everyone else's right to the same thing.
> ***
>
> __
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com



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



Re: [PHP-DB] MySQL problem -- new to PHP

2003-02-14 Thread Mike Peters
On Fri, 14 Feb 2003 11:30:03 +0200
[EMAIL PROTECTED] (Evan Morris) wrote:

> Thanks for all the help everyone sent me on this. However, nothing
> seems to make any difference whatsoever (except putting the
> 'localhost' part in quotes). I am still getting permission denied
> errors based on the user credentials.
> 
> I have entered a user into the user table with host='localhost',
> user='php' and a password.
> I have entered these credentials into the db table also, and given the
> various privileges for this user to the specific database.
> I have run both mysqladmin reload and mysqladmin flush-privileges.
> I have even rebooted the machine.
> I have also tried typing GRANT SELECT,INSERT,DELETE,UPDATE TO
> php@localhost IDENTIFED BY ***, but this just throws up an error
> at the MySQL prompt.
> 

Try:
GRANT ALL PRIVILEGES ON *.* TO php@localhost IDENTIFIED BY 'pass' WITH
GRANT OPTION;
To give user php admin access for testing (you may want to revoke this
later). Remember to:
FLUSH PRIVILEGES;
to put the new privileges into affect.

> My PHP page can still not connect to the database. It just says:
> 
> MySQL Connection Failed: Access denied for user: 'php@localhost'
> (Using password: YES)
> 
> I know the problem is a permissions thing, because if I connect to the
> test database as 'nobody', there is no problem.
> 

Can you connect as php from the prompt?

> Again, any and all help will be appreciated. This is ridiculously
> frustrating, especially since I have no problem connecting to the
> database from a perl script. I am tempted to stop trying to learn PHP
> and build my entire web site using perl cgi instead.
> 
 You might want to create a new user for testing using the GRANT command
above, don't enter anything into the host or db tables as I suspect this
is where things are fouled.

-- 
Mike

Registered Linux User #247123

It was all very well going about pure logic and how the universe was
ruled by logic and the harmony of numbers, but the plain fact was that
the disc was manifestly traversing space on the back of a giant turtle
and the gods had a habit of going round to atheists' houses and smashing
their windows.
(Colour of Magic)

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




Re: [PHP-DB] MySQL problem -- new to PHP

2003-02-14 Thread Evan Morris
Thanks for all the help everyone sent me on this. However, nothing seems to
make any difference whatsoever (except putting the 'localhost' part in
quotes). I am still getting permission denied errors based on the user
credentials.

I have entered a user into the user table with host='localhost', user='php'
and a password.
I have entered these credentials into the db table also, and given the
various privileges for this user to the specific database.
I have run both mysqladmin reload and mysqladmin flush-privileges.
I have even rebooted the machine.
I have also tried typing GRANT SELECT,INSERT,DELETE,UPDATE TO php@localhost
IDENTIFED BY ***, but this just throws up an error at the MySQL prompt.

My PHP page can still not connect to the database. It just says:

MySQL Connection Failed: Access denied for user: 'php@localhost' (Using
password: YES)

I know the problem is a permissions thing, because if I connect to the test
database as 'nobody', there is no problem.

Again, any and all help will be appreciated. This is ridiculously
frustrating, especially since I have no problem connecting to the database
from a perl script. I am tempted to stop trying to learn PHP and build my
entire web site using perl cgi instead.

Thanks

Evan Morris
[EMAIL PROTECTED]
Tel: +27 11 792 2777
Fax: +27 11 792 2711
Cell: +27 82 926 3630



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




Re: [PHP-DB] MySQL problem -- new to PHP

2003-02-13 Thread Mignon Hunter
When changing/adding permissions to the mysql db for specific users,
dont forget to do 'flush privileges'...

my 2 cents


On Thu, 2003-02-13 at 07:19, Evan Morris wrote:
> Hi all
> 
> I am new to PHP (just basically started yesterday). I am currently having a
> problem connecting to a MySQL database.
> 
> My sample code is:
> 
> --
>  mysql_connect(localhost,"username","password") or die ("Unable to connect to
> MySQL server.");
> $db = mysql_select_db("DB_NAME") or die ("Unable to select requested
> database.");
> ?>
> ---
> 
> This throws the following error:
> 
> ---
> Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to
> connect to this MySQL server
> ---
> 
> Now, the mySQL server and the web server reside on the same machine. This
> warning is therefore saying that this machine does not have permission to
> connect to itself. Hmm. I have put entries in the host table and the user
> table, using both hostname and ip address, but no luck. I keep getting the
> same error.
> 
> What am I doing wrong?
> 
> Any and all help appreciated.
> 
> Thanks
> 
> Evan Morris
> [EMAIL PROTECTED]
> +27 11 792 2777 (tel)
> +27 11 792 2711 (fax)
-- 
Mignon Hunter
Web Developer
Toshiba International
713.466.0277 x 3461


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




RE: [PHP-DB] MySQL problem -- new to PHP

2003-02-13 Thread Gary . Every
If you cut and pasted your code, try to put localhost into quotes as well.


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
"Pay It Forward"
mailto:[EMAIL PROTECTED]
http://accessingram.com


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 13, 2003 7:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL problem -- new to PHP


Hi all

I am new to PHP (just basically started yesterday). I am currently having a
problem connecting to a MySQL database.

My sample code is:

--

---

This throws the following error:

---
Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to
connect to this MySQL server
---

Now, the mySQL server and the web server reside on the same machine. This
warning is therefore saying that this machine does not have permission to
connect to itself. Hmm. I have put entries in the host table and the user
table, using both hostname and ip address, but no luck. I keep getting the
same error.

What am I doing wrong?

Any and all help appreciated.

Thanks

Evan Morris
[EMAIL PROTECTED]
+27 11 792 2777 (tel)
+27 11 792 2711 (fax)



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



RE: [PHP-DB] MySQL problem -- new to PHP

2003-02-13 Thread Clarkson, Nick

PHPMyAdmin is just a web-based tool for administering MySQL and it's pretty
intuitive, assuming you've used similar tools before. You can download it
and read more here http://www.phpwizard.net/projects/phpMyAdmin/

I would recommend SQLYog as an alternative;
http://www.webyog.com/sqlyog/index.html as it's VERY intuitive and pretty
simple to use.

But then you can't beat going straight into the MySQL prompt and learning
from there

Here are some good links for tutorials and examples;

www.php.net and www.mysql.com for searching on specific functions - unless
you have the memory of a few Cray computers ;o)

http://www.evilwalrus.com
http://www.zend.com/zend/tut/
http://www.devshed.com/Server_Side/MySQL/
http://www.devshed.com/Server_Side/PHP/

There are tons out there, but they are good starting points.

Good luck,

Nick




-Original Message-
From: Mark Loewenberg [mailto:[EMAIL PROTECTED]]
Sent: 13 February 2003 14:01
To: Clarkson, Nick
Subject: Re: [PHP-DB] MySQL problem -- new to PHP


Well you opened up my question!  Do you know where to learn PHPMyAdmin?

Thanks in advance,

Mark

Clarkson, Nick wrote:

>Looks like is to do with MySQL permissions. Check your host's (the one you
>are trying to connect from) permissions to the server.
>
>To change permissions, from the MySQL prompt type;
>
>GRANT ALL ON * TO username@host IDENTIFIED BY password;
>
>Substitute in username, host and password for your ones.
>
>Easier to use PHPMyAdmin or SQLYog (www.sqlyog.com) if you're new to it.
I'm
>pretty new, so learning all the time.
>
>A couple of links to get you started;
>http://www.mysql.com/doc/en/GRANT.html
>http://www.mysql.com/doc/en/GRANT.html
>
>Good luck,
>
>Nick
>
>
>
>-Original Message-
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>Sent: 13 February 2003 13:20
>To: [EMAIL PROTECTED]
>Subject: [PHP-DB] MySQL problem -- new to PHP
>
>
>Hi all
>
>I am new to PHP (just basically started yesterday). I am currently having a
>problem connecting to a MySQL database.
>
>My sample code is:
>
>--
>mysql_connect(localhost,"username","password") or die ("Unable to connect
to
>MySQL server.");
>$db = mysql_select_db("DB_NAME") or die ("Unable to select requested
>database.");
>?>
>---
>
>This throws the following error:
>
>---
>Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to
>connect to this MySQL server
>---
>
>Now, the mySQL server and the web server reside on the same machine. This
>warning is therefore saying that this machine does not have permission to
>connect to itself. Hmm. I have put entries in the host table and the user
>table, using both hostname and ip address, but no luck. I keep getting the
>same error.
>
>What am I doing wrong?
>
>Any and all help appreciated.
>
>Thanks
>
>Evan Morris
>[EMAIL PROTECTED]
>+27 11 792 2777 (tel)
>+27 11 792 2711 (fax)
>
>
>
>  
>

-- 

Mark Loewenberg
770 428 1071
[EMAIL PROTECTED]
http://www.ITSbiz.net

Affordable Website Design
Website Hosting @ $9.95/month

ITSbiz also provides:
IT Solutions
Phone Systems
Phone & Data Wiring Services




This private and confidential e-mail has been sent to you by Egg.
The Egg group of companies includes Egg Banking plc
(registered no. 2999842), Egg Financial Products Ltd (registered
no. 3319027) and Egg Investments Ltd (registered no. 3403963) which
carries out investment business on behalf of Egg and is regulated
by the Financial Services Authority.  
Registered in England and Wales. Registered offices: 1 Waterhouse Square,
138-142 Holborn, London EC1N 2NA.
If you are not the intended recipient of this e-mail and have
received it in error, please notify the sender by replying with
'received in error' as the subject and then delete it from your
mailbox.


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




RE: [PHP-DB] MySQL problem -- new to PHP

2003-02-13 Thread Clarkson, Nick

Should have added; You don't have to GRANT ALL, obviously you can assign
permissions as required so you could just do GRANT SELECT, UPDATE if that is
all that is required.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 13 February 2003 13:20
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL problem -- new to PHP


Hi all

I am new to PHP (just basically started yesterday). I am currently having a
problem connecting to a MySQL database.

My sample code is:

--

---

This throws the following error:

---
Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to
connect to this MySQL server
---

Now, the mySQL server and the web server reside on the same machine. This
warning is therefore saying that this machine does not have permission to
connect to itself. Hmm. I have put entries in the host table and the user
table, using both hostname and ip address, but no luck. I keep getting the
same error.

What am I doing wrong?

Any and all help appreciated.

Thanks

Evan Morris
[EMAIL PROTECTED]
+27 11 792 2777 (tel)
+27 11 792 2711 (fax)



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


This private and confidential e-mail has been sent to you by Egg.
The Egg group of companies includes Egg Banking plc
(registered no. 2999842), Egg Financial Products Ltd (registered
no. 3319027) and Egg Investments Ltd (registered no. 3403963) which
carries out investment business on behalf of Egg and is regulated
by the Financial Services Authority.  
Registered in England and Wales. Registered offices: 1 Waterhouse Square,
138-142 Holborn, London EC1N 2NA.
If you are not the intended recipient of this e-mail and have
received it in error, please notify the sender by replying with
'received in error' as the subject and then delete it from your
mailbox.


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




RE: [PHP-DB] MySQL problem -- new to PHP

2003-02-13 Thread Clarkson, Nick

Looks like is to do with MySQL permissions. Check your host's (the one you
are trying to connect from) permissions to the server.

To change permissions, from the MySQL prompt type;

GRANT ALL ON * TO username@host IDENTIFIED BY password;

Substitute in username, host and password for your ones.

Easier to use PHPMyAdmin or SQLYog (www.sqlyog.com) if you're new to it. I'm
pretty new, so learning all the time.

A couple of links to get you started;
http://www.mysql.com/doc/en/GRANT.html
http://www.mysql.com/doc/en/GRANT.html

Good luck,

Nick



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 13 February 2003 13:20
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL problem -- new to PHP


Hi all

I am new to PHP (just basically started yesterday). I am currently having a
problem connecting to a MySQL database.

My sample code is:

--

---

This throws the following error:

---
Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to
connect to this MySQL server
---

Now, the mySQL server and the web server reside on the same machine. This
warning is therefore saying that this machine does not have permission to
connect to itself. Hmm. I have put entries in the host table and the user
table, using both hostname and ip address, but no luck. I keep getting the
same error.

What am I doing wrong?

Any and all help appreciated.

Thanks

Evan Morris
[EMAIL PROTECTED]
+27 11 792 2777 (tel)
+27 11 792 2711 (fax)



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


This private and confidential e-mail has been sent to you by Egg.
The Egg group of companies includes Egg Banking plc
(registered no. 2999842), Egg Financial Products Ltd (registered
no. 3319027) and Egg Investments Ltd (registered no. 3403963) which
carries out investment business on behalf of Egg and is regulated
by the Financial Services Authority.  
Registered in England and Wales. Registered offices: 1 Waterhouse Square,
138-142 Holborn, London EC1N 2NA.
If you are not the intended recipient of this e-mail and have
received it in error, please notify the sender by replying with
'received in error' as the subject and then delete it from your
mailbox.


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




[PHP-DB] MySQL problem -- new to PHP

2003-02-13 Thread Evan Morris
Hi all

I am new to PHP (just basically started yesterday). I am currently having a
problem connecting to a MySQL database.

My sample code is:

--

---

This throws the following error:

---
Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to
connect to this MySQL server
---

Now, the mySQL server and the web server reside on the same machine. This
warning is therefore saying that this machine does not have permission to
connect to itself. Hmm. I have put entries in the host table and the user
table, using both hostname and ip address, but no luck. I keep getting the
same error.

What am I doing wrong?

Any and all help appreciated.

Thanks

Evan Morris
[EMAIL PROTECTED]
+27 11 792 2777 (tel)
+27 11 792 2711 (fax)



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




[PHP-DB] MySQL problem with RedHat 8

2003-01-14 Thread Daniel Elenius
Hi!

I'm trying to connect to my mysql database using something like

 mysql_connect( 'localhost', 'root', 'thepassword' )
or die ( 'Unable to connect to server.' );

But I get the error message:
Fatal error: Call to undefined function: mysql_connect() in
/home/daniel/public_html/index.php on line 21

I have:

[root@p85 /]# rpm -qa |grep sql
php-mysql-4.2.2-8.0.5
mysql-3.23.52-3
mysql-server-3.23.52-3
mysql-devel-3.23.52-3

and:

[root@p85 /]# rpm -q php
php-4.2.2-8.0.5

Someone mentioned these two settings in php.ini, which I tried with no
success:

register_globals = On
short_open_tag = On

phpinfo() says that php was compiled with '--with-mysql=shared,/usr'

Can someone help me please?

regards,
-- 
Daniel Elenius <[EMAIL PROTECTED]>


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




RE: [PHP-DB] mysql problem

2002-11-28 Thread John W. Holmes
So what's the problem? The data doesn't appear in the table? Did you try
to see if mysql_error() had anything in it after your query?

---John Holmes...

> -Original Message-
> From: Bill Arbuckle, Jr. [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 28, 2002 5:56 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] mysql problem
> 
> Hello all!  I am new to php and I am trying to update a mySQL table
using
> php v4.2.3 for Windows.  I am using the command:
> 
> mysql_query("insert into tblquotehits
> (qoption,referer,browser,remoteaddr,dt) values
> ($quotetype,$referer,$browser,$remoteaddress,$currentdtstring)",$db);
> 
> I have read the documentation and found some notes on the topic but
none
> seemed to solve my problem.  I have tried other variations of the
command
> such as inserting a semicolon at the end of the insert statement
before
> the
> closing double quotes.  All variables are defined and all columns are
> actually columns in the table ... I have checked all of this.  I have
also
> returned the result to a variable and echoed it to the screen ... the
> result
> printed is "Resource id #2".
> 
> This is driving me crazy as I know it must be something quite simple
that
> I
> am overlooking.  Any help is greatly appreciated!  TIA
> 
> Bill
> 
> 
> --
> 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] mysql problem

2002-11-28 Thread Peter Lovatt
Hi

you need quotes around the values

mysql_query("insert into tblquotehits
(qoption,referer,browser,remoteaddr,dt) values
('$quotetype','$referer','$browser','$remoteaddress','$currentdtstring')",$d
b);

HTH

Peter
---
Excellence in internet and open source software
---
Sunmaia
Birmingham
UK
www.sunmaia.net
tel. 0121-242-1473
International +44-121-242-1473
---

-Original Message-
From: Bill Arbuckle, Jr. [mailto:[EMAIL PROTECTED]]
Sent: 28 November 2002 22:56
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql problem


Hello all!  I am new to php and I am trying to update a mySQL table using
php v4.2.3 for Windows.  I am using the command:

mysql_query("insert into tblquotehits
(qoption,referer,browser,remoteaddr,dt) values
($quotetype,$referer,$browser,$remoteaddress,$currentdtstring)",$db);

I have read the documentation and found some notes on the topic but none
seemed to solve my problem.  I have tried other variations of the command
such as inserting a semicolon at the end of the insert statement before the
closing double quotes.  All variables are defined and all columns are
actually columns in the table ... I have checked all of this.  I have also
returned the result to a variable and echoed it to the screen ... the result
printed is "Resource id #2".

This is driving me crazy as I know it must be something quite simple that I
am overlooking.  Any help is greatly appreciated!  TIA

Bill


--
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] mysql problem

2002-11-28 Thread Bill Arbuckle, Jr.
Hello all!  I am new to php and I am trying to update a mySQL table using
php v4.2.3 for Windows.  I am using the command:

mysql_query("insert into tblquotehits
(qoption,referer,browser,remoteaddr,dt) values
($quotetype,$referer,$browser,$remoteaddress,$currentdtstring)",$db);

I have read the documentation and found some notes on the topic but none
seemed to solve my problem.  I have tried other variations of the command
such as inserting a semicolon at the end of the insert statement before the
closing double quotes.  All variables are defined and all columns are
actually columns in the table ... I have checked all of this.  I have also
returned the result to a variable and echoed it to the screen ... the result
printed is "Resource id #2".

This is driving me crazy as I know it must be something quite simple that I
am overlooking.  Any help is greatly appreciated!  TIA

Bill


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




RE: [PHP-DB] MySQL Problem

2002-11-21 Thread Griffiths, Daniel
the month starts at 1, at the moment I'm just hard coding the month into the statment.

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: 21 November 2002 16:55
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL Problem


On Friday 22 November 2002 00:46, Griffiths, Daniel wrote:
> the statement runs without errors, its just the output thats wrong (see the
> two tables) I'm displaying the results by doing a simple dump of the query,
> through my own code and have also tried through phpMyAdmin.

Not sure if this could be the problem -- where are you getting MONTH from and 
does it start at 0 or 1?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
I saw Lassie.  It took me four shows to figure out why the hairy kid never
spoke. I mean, he could roll over and all that, but did that deserve a series?
*/


-- 
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] MySQL Problem

2002-11-21 Thread Jason Vincent
Still think we need to see the PHP code before determining that it is an SQL
problem.

Regards,

J


-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, November 21, 2002 11:55 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL Problem


On Friday 22 November 2002 00:46, Griffiths, Daniel wrote:
> the statement runs without errors, its just the output thats wrong 
> (see the two tables) I'm displaying the results by doing a simple dump 
> of the query, through my own code and have also tried through 
> phpMyAdmin.

Not sure if this could be the problem -- where are you getting MONTH from
and 
does it start at 0 or 1?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
I saw Lassie.  It took me four shows to figure out why the hairy kid never
spoke. I mean, he could roll over and all that, but did that deserve a
series? */


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




Re: [PHP-DB] MySQL Problem

2002-11-21 Thread Jason Wong
On Friday 22 November 2002 00:46, Griffiths, Daniel wrote:
> the statement runs without errors, its just the output thats wrong (see the
> two tables) I'm displaying the results by doing a simple dump of the query,
> through my own code and have also tried through phpMyAdmin.

Not sure if this could be the problem -- where are you getting MONTH from and 
does it start at 0 or 1?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
I saw Lassie.  It took me four shows to figure out why the hairy kid never
spoke. I mean, he could roll over and all that, but did that deserve a series?
*/


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




RE: [PHP-DB] MySQL Problem

2002-11-21 Thread Griffiths, Daniel
the statement runs without errors, its just the output thats wrong (see the two 
tables) I'm displaying the results by doing a simple dump of the query, through my own 
code and have also tried through phpMyAdmin.

-Original Message-
From: Michael Hazelden [mailto:[EMAIL PROTECTED]]
Sent: 21 November 2002 16:41
To: Griffiths, Daniel; PHP List
Subject: RE: [PHP-DB] MySQL Problem


Maybe I'm missing something - but the MySQL statement looks right ...

How are you displaying the results?

-Original Message-
From: Griffiths, Daniel [mailto:[EMAIL PROTECTED]]
Sent: 21 November 2002 16:37
To: PHP List
Subject: [PHP-DB] MySQL Problem


Hi,

I have a problem with an MySQL statement that is driving me mad, I'm using
php to connect to the database. this  is it : -

SELECT LINE,SUM(IF(MONTH=2,WB.TEU,0)) AS '2' ,SUM(IF(MONTH=3,WB.TEU,0)) AS
'3' ,SUM(IF(MONTH=4,WB.TEU,0)) AS '4' ,SUM(IF(MONTH=5,WB.TEU,0)) AS '5'
,SUM(IF(MONTH=6,WB.TEU,0)) AS '6' ,SUM(IF(MONTH BETWEEN 2 AND 6,WB.TEU,0))
AS '2 TO 6' FROM WB WHERE EAST_PORT='A' AND WEST_PORT='B' GROUP BY LINE

what I want to produce with this is this : -

LINE2   3   4   5   6   2 TO 6
A   133511181260139512766384
B   432 469 451 480 555 2387
C   504 554 575 517 764 2914

however what I get is this : -

LINE2   3   4   5   6   2 TO 6
A   111812601395127663846384
B   469 451 480 555 23872387
C   554 575 517 764 29142914

the last column of figures (2 TO 6) has been replicated under 6 and pushed
the values that were in 6 into 5 and so on!

I can not see for the life of me why this should or could be happening,
especially as the equivalent code in MS Access : - 

SELECT LINE, Sum(IIf(MONTH=2,TEU,0)) AS ['2'], Sum(IIf(MONTH=3,TEU,0)) AS
['3'], Sum(IIf(MONTH=4,TEU,0)) AS ['4'], Sum(IIf(MONTH=5,TEU,0)) AS ['5'],
Sum(IIf(MONTH=6,TEU,0)) AS ['6'],
SUM(IIF(MONTH BETWEEN 2 AND 6,TEU,0)) AS 'FEB TO JUNE' ,
SUM(IIF(MONTH BETWEEN 1 AND 6,TEU,0)) AS 'YTD' 
FROM DUMP
WHERE (((DUMP.[EAST PORT])='HONG KONG') AND ((DUMP.[WEST PORT])='UK'))
GROUP BY DUMP.LINE; 

gives the correct results.

If anyone has any idea of what is going on here please let me know, I'm
hoping its something simple I'm missing..

Thanks

Dan

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


_
This message has been checked for all known viruses by the 
MessageLabs Virus Control Centre.

This message has been checked for all known viruses by the MessageLabs Virus Control 
Centre.


*

Notice:  This email is confidential and may contain copyright material of Ocado 
Limited (the "Company"). Opinions and views expressed in this message may not 
necessarily reflect the opinions and views of the Company.
If you are not the intended recipient, please notify us immediately and delete all 
copies of this message. Please note that it is your responsibility to scan this 
message for viruses.

Company reg. no. 3875000.  Swallowdale Lane, Hemel Hempstead HP2 7PY

*

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




RE: [PHP-DB] MySQL Problem

2002-11-21 Thread Michael Hazelden
Maybe I'm missing something - but the MySQL statement looks right ...

How are you displaying the results?

-Original Message-
From: Griffiths, Daniel [mailto:[EMAIL PROTECTED]]
Sent: 21 November 2002 16:37
To: PHP List
Subject: [PHP-DB] MySQL Problem


Hi,

I have a problem with an MySQL statement that is driving me mad, I'm using
php to connect to the database. this  is it : -

SELECT LINE,SUM(IF(MONTH=2,WB.TEU,0)) AS '2' ,SUM(IF(MONTH=3,WB.TEU,0)) AS
'3' ,SUM(IF(MONTH=4,WB.TEU,0)) AS '4' ,SUM(IF(MONTH=5,WB.TEU,0)) AS '5'
,SUM(IF(MONTH=6,WB.TEU,0)) AS '6' ,SUM(IF(MONTH BETWEEN 2 AND 6,WB.TEU,0))
AS '2 TO 6' FROM WB WHERE EAST_PORT='A' AND WEST_PORT='B' GROUP BY LINE

what I want to produce with this is this : -

LINE2   3   4   5   6   2 TO 6
A   133511181260139512766384
B   432 469 451 480 555 2387
C   504 554 575 517 764 2914

however what I get is this : -

LINE2   3   4   5   6   2 TO 6
A   111812601395127663846384
B   469 451 480 555 23872387
C   554 575 517 764 29142914

the last column of figures (2 TO 6) has been replicated under 6 and pushed
the values that were in 6 into 5 and so on!

I can not see for the life of me why this should or could be happening,
especially as the equivalent code in MS Access : - 

SELECT LINE, Sum(IIf(MONTH=2,TEU,0)) AS ['2'], Sum(IIf(MONTH=3,TEU,0)) AS
['3'], Sum(IIf(MONTH=4,TEU,0)) AS ['4'], Sum(IIf(MONTH=5,TEU,0)) AS ['5'],
Sum(IIf(MONTH=6,TEU,0)) AS ['6'],
SUM(IIF(MONTH BETWEEN 2 AND 6,TEU,0)) AS 'FEB TO JUNE' ,
SUM(IIF(MONTH BETWEEN 1 AND 6,TEU,0)) AS 'YTD' 
FROM DUMP
WHERE (((DUMP.[EAST PORT])='HONG KONG') AND ((DUMP.[WEST PORT])='UK'))
GROUP BY DUMP.LINE; 

gives the correct results.

If anyone has any idea of what is going on here please let me know, I'm
hoping its something simple I'm missing..

Thanks

Dan

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


_
This message has been checked for all known viruses by the 
MessageLabs Virus Control Centre.

This message has been checked for all known viruses by the MessageLabs Virus Control 
Centre.


*

Notice:  This email is confidential and may contain copyright material of Ocado 
Limited (the "Company"). Opinions and views expressed in this message may not 
necessarily reflect the opinions and views of the Company.
If you are not the intended recipient, please notify us immediately and delete all 
copies of this message. Please note that it is your responsibility to scan this 
message for viruses.

Company reg. no. 3875000.  Swallowdale Lane, Hemel Hempstead HP2 7PY

*

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




[PHP-DB] MySQL Problem

2002-11-21 Thread Griffiths, Daniel
Hi,

I have a problem with an MySQL statement that is driving me mad, I'm using php to 
connect to the database. this  is it : -

SELECT LINE,SUM(IF(MONTH=2,WB.TEU,0)) AS '2' ,SUM(IF(MONTH=3,WB.TEU,0)) AS '3' 
,SUM(IF(MONTH=4,WB.TEU,0)) AS '4' ,SUM(IF(MONTH=5,WB.TEU,0)) AS '5' 
,SUM(IF(MONTH=6,WB.TEU,0)) AS '6' ,SUM(IF(MONTH BETWEEN 2 AND 6,WB.TEU,0)) AS '2 TO 6' 
FROM WB WHERE EAST_PORT='A' AND WEST_PORT='B' GROUP BY LINE

what I want to produce with this is this : -

LINE2   3   4   5   6   2 TO 6
A   133511181260139512766384
B   432 469 451 480 555 2387
C   504 554 575 517 764 2914

however what I get is this : -

LINE2   3   4   5   6   2 TO 6
A   111812601395127663846384
B   469 451 480 555 23872387
C   554 575 517 764 29142914

the last column of figures (2 TO 6) has been replicated under 6 and pushed the values 
that were in 6 into 5 and so on!

I can not see for the life of me why this should or could be happening, especially as 
the equivalent code in MS Access : - 

SELECT LINE, Sum(IIf(MONTH=2,TEU,0)) AS ['2'], Sum(IIf(MONTH=3,TEU,0)) AS ['3'], 
Sum(IIf(MONTH=4,TEU,0)) AS ['4'], Sum(IIf(MONTH=5,TEU,0)) AS ['5'], 
Sum(IIf(MONTH=6,TEU,0)) AS ['6'],
SUM(IIF(MONTH BETWEEN 2 AND 6,TEU,0)) AS 'FEB TO JUNE' ,
SUM(IIF(MONTH BETWEEN 1 AND 6,TEU,0)) AS 'YTD' 
FROM DUMP
WHERE (((DUMP.[EAST PORT])='HONG KONG') AND ((DUMP.[WEST PORT])='UK'))
GROUP BY DUMP.LINE; 

gives the correct results.

If anyone has any idea of what is going on here please let me know, I'm hoping its 
something simple I'm missing..

Thanks

Dan

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




[PHP-DB] MySql problem..............

2002-10-15 Thread Rodrigo

Hi People.

I need import some data from a Paradox table, i used the script below, it worked just 
fine..but all the data was imported without the " ç or á or é ", understand??? 
portuguese words all this changes to some wierd caracter is there a way to fix 
this, since my table is a Paradox 4 ANSI INTL850. am i fried??

";
 echo"$clicod";

$insert = mysql_query("INSERT INTO cli (clirep, clicod, cliemp, clinom, cliend, 
clitel, clifax, cliema, clibai, clicid, cliest, clicep, cliins,clifat, clicgc, clicta, 
clilic, clidia) VALUES('$clirep', '$clicod', '$cliemp', '$clinom', '$cliend', 
'$clitel', '$clifax', '$cliema', '$clibai', '$clicid', '$cliest', '$clicep', 
'$cliins', '$clifat', '$clicgc', '$clicta', '$clilic', '$clidia');");
}
?>


Equipe Pratic Sistemas
Rodrigo Corrêa
Fone: (14) 441-1700
[EMAIL PROTECTED]
[EMAIL PROTECTED] 
 





Re: [PHP-DB] MySQL problem on Yellow Dog Linux

2002-06-09 Thread Garrett Nelson

Woo-hoo! Fixing the extensions directory worked. I am now all set with MySQL
support ... Thanks for all the help!


-- 



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




Re: [PHP-DB] MySQL problem on Yellow Dog Linux

2002-06-08 Thread Jason Wong

On Sunday 09 June 2002 01:28, Garrett Nelson wrote:
>
> Well, we're getting closer now, maybe. I added the line extension=mysql.so,
> and I still get the same error when trying to run the web-based PHP apps,
> but in the command line when I type "php" I get back,
>
> PHP Warning:  Unable to load dynamic library './mysql.so' - ./mysql.so:
> cannot open shared object file: No such file or directory in Unknown on
> line 0
>
> Does that help at all in identifying what may be wrong?

In php.ini check/add the line

extension_dir = /path/to/directory/containing-mysql.so

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Euch ist becannt, was wir beduerfen;
Wir wollen stark Getraenke schluerfen.
-- Goethe, "Faust"
*/


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




Re: [PHP-DB] MySQL problem on Yellow Dog Linux

2002-06-08 Thread Garrett Nelson

On 6/8/02 12:07 PM, "Jason Wong" <[EMAIL PROTECTED]> wrote:

> On Saturday 08 June 2002 23:20, Garrett Nelson wrote:
>> I have both the lines in httpd.conf. As I said, PHP is working fine, it's
>> just an issue with MySQL support I believe.
> 
> Sorry my mistake. Check in php.ini for this line:
> 
> extension=mysql.so


Well, we're getting closer now, maybe. I added the line extension=mysql.so,
and I still get the same error when trying to run the web-based PHP apps,
but in the command line when I type "php" I get back,

PHP Warning:  Unable to load dynamic library './mysql.so' - ./mysql.so:
cannot open shared object file: No such file or directory in Unknown on line
0

Does that help at all in identifying what may be wrong?

-- 



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




Re: [PHP-DB] MySQL problem on Yellow Dog Linux

2002-06-08 Thread Jason Wong

On Saturday 08 June 2002 23:20, Garrett Nelson wrote:
> I have both the lines in httpd.conf. As I said, PHP is working fine, it's
> just an issue with MySQL support I believe.

Sorry my mistake. Check in php.ini for this line:

extension=mysql.so

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
A tautology is a thing which is tautological.
*/


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




Re: [PHP-DB] MySQL problem on Yellow Dog Linux

2002-06-08 Thread Garrett Nelson

I have both the lines in httpd.conf. As I said, PHP is working fine, it's
just an issue with MySQL support I believe.


On 6/8/02 2:24 AM, "Jason Wong" <[EMAIL PROTECTED]> wrote:

> On Saturday 08 June 2002 05:29, Garrett Nelson wrote:
>> I now downloaded "php-mysql-4.1.2-1a.ppc.rpm" from rpmfinder, and again I
>> get
>> 
>> rpm -ivh php-mysql*
>> Preparing...###
>> [100%]
>> package php-mysql-4.1.2-1a is already installed
>> 
>> (Same error with -Uvh, too)
>> 
>> So I suppose it's something else. Do I have to uninstall PHP first? Or,
>> again, could it be something wrong with the PHP configs? Is php.ini the
>> only config file that might need to be edited?
> 
> Check in your httpd.conf file that you have these lines:
> 
> LoadModule php4_modulemodules/libphp4.so
> AddModule mod_php4.c

-- 



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




Re: [PHP-DB] MySQL problem on Yellow Dog Linux

2002-06-07 Thread Jason Wong

On Saturday 08 June 2002 05:29, Garrett Nelson wrote:
> I now downloaded "php-mysql-4.1.2-1a.ppc.rpm" from rpmfinder, and again I
> get
>
> rpm -ivh php-mysql*
> Preparing...###
> [100%]
> package php-mysql-4.1.2-1a is already installed
>
> (Same error with -Uvh, too)
>
> So I suppose it's something else. Do I have to uninstall PHP first? Or,
> again, could it be something wrong with the PHP configs? Is php.ini the
> only config file that might need to be edited?

Check in your httpd.conf file that you have these lines:

LoadModule php4_modulemodules/libphp4.so
AddModule mod_php4.c

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
To err is human, to moo bovine.
*/


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




Re: [PHP-DB] MySQL problem on Yellow Dog Linux

2002-06-07 Thread Garrett Nelson

On 6/6/02 4:48 PM, "Jason Wong" <[EMAIL PROTECTED]> wrote:

> On Friday 07 June 2002 04:36, Garrett Nelson wrote:
>> I'm a relative newbie to the Linux/web server world, having worked with
>> Macs most of my life. I recently installed the Server install of Yellow Dog
>> Linux, with no window managers, CLI only. Everything is working pretty much
>> correctly, except PHP interaction with MySQL. When I tried to install
>> Invision Board, I got the following error‹
>> 
>> Fatal error: Call to undefined function: mysql_connect() in
>> /var/www/default/forums/sm_install.php on line 249
> 
> It means there's no support in php for mysql
> 
>> I figured this meant MySQL or PHP was configured incorrectly so I installed
>> PhpMyAdmin to see if that would work, and I got the error message
>> 
>> cannot load MySQL extension,
>> please check PHP Configuration.
> 
> ditto
> 
>> What needs to be configured? I was under the impression that MySQL support
>> was built into PHP now and that it needs no extension.
> 
> Yes and no. PHP has 'builtin' support for MySQL but it needs to be enabled at
> compile time.
> 
>> I downloaded the RPM
>> of PHP 4.1.2 (the latest PPC RPM available at rpmfind) and it told me it
>> was already installed. I then installed MySQL 3.23.41 to no effect.
>> 
>> So what can I do to fix this?
> 
> Try looking for an RPM with both 'php' and 'mysql' in its name. Eg for Redhat
> a suitable rpm would be named: php-mysql-4.1.2-7.i386.rpm.


Hrm 

I now downloaded "php-mysql-4.1.2-1a.ppc.rpm" from rpmfinder, and again I
get

rpm -ivh php-mysql*
Preparing...###
[100%]
package php-mysql-4.1.2-1a is already installed

(Same error with -Uvh, too)

So I suppose it's something else. Do I have to uninstall PHP first? Or,
again, could it be something wrong with the PHP configs? Is php.ini the only
config file that might need to be edited?


-- 



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




Re: [PHP-DB] MySQL problem on Yellow Dog Linux

2002-06-06 Thread Jason Wong

On Friday 07 June 2002 04:36, Garrett Nelson wrote:
> I'm a relative newbie to the Linux/web server world, having worked with
> Macs most of my life. I recently installed the Server install of Yellow Dog
> Linux, with no window managers, CLI only. Everything is working pretty much
> correctly, except PHP interaction with MySQL. When I tried to install
> Invision Board, I got the following error‹
>
> Fatal error: Call to undefined function: mysql_connect() in
> /var/www/default/forums/sm_install.php on line 249

It means there's no support in php for mysql

> I figured this meant MySQL or PHP was configured incorrectly so I installed
> PhpMyAdmin to see if that would work, and I got the error message
>
> cannot load MySQL extension,
> please check PHP Configuration.

ditto

> What needs to be configured? I was under the impression that MySQL support
> was built into PHP now and that it needs no extension. 

Yes and no. PHP has 'builtin' support for MySQL but it needs to be enabled at 
compile time.

> I downloaded the RPM
> of PHP 4.1.2 (the latest PPC RPM available at rpmfind) and it told me it
> was already installed. I then installed MySQL 3.23.41 to no effect.
>
> So what can I do to fix this?

Try looking for an RPM with both 'php' and 'mysql' in its name. Eg for Redhat 
a suitable rpm would be named: php-mysql-4.1.2-7.i386.rpm. 

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
I generally avoid temptation unless I can't resist it.
-- Mae West
*/


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




Re: [PHP-DB] MySQL problem on Yellow Dog Linux

2002-06-06 Thread Paul Burney

on 6/6/02 4:36 PM, Garrett Nelson at [EMAIL PROTECTED] appended the
following bits to my mbox:

> What needs to be configured? I was under the impression that MySQL support
> was built into PHP now and that it needs no extension. I downloaded the RPM
> of PHP 4.1.2 (the latest PPC RPM available at rpmfind) and it told me it was
> already installed. I then installed MySQL 3.23.41 to no effect.

Well, the MySQL library comes bundled with PHP, but to actually build in
support, you need to configure it with --with-MySQL.

I'm not a big RPM guy, but you should probably look for an RPM for PHP that
mentions MySQL as well.

HTH.

Sincerely,

Paul Burney






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




[PHP-DB] MySQL problem on Yellow Dog Linux

2002-06-06 Thread Garrett Nelson

I'm a relative newbie to the Linux/web server world, having worked with Macs
most of my life. I recently installed the Server install of Yellow Dog
Linux, with no window managers, CLI only. Everything is working pretty much
correctly, except PHP interaction with MySQL. When I tried to install
Invision Board, I got the following error‹

Fatal error: Call to undefined function: mysql_connect() in
/var/www/default/forums/sm_install.php on line 249

I figured this meant MySQL or PHP was configured incorrectly so I installed
PhpMyAdmin to see if that would work, and I got the error message

cannot load MySQL extension,
please check PHP Configuration.

What needs to be configured? I was under the impression that MySQL support
was built into PHP now and that it needs no extension. I downloaded the RPM
of PHP 4.1.2 (the latest PPC RPM available at rpmfind) and it told me it was
already installed. I then installed MySQL 3.23.41 to no effect.

So what can I do to fix this?

-- 



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




RE: [PHP-DB] MySQL Problem

2002-05-21 Thread Gurhan Ozen

That means PHP is not compiled with the MySQL support... Configure it with
mysql support, I bbelieve there were a lot of questions about this in the
list, so you may wanna search the archives..

Gurhan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 8:49 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL Problem


Hi, i've a problem with MySQL in my PHP pages. My PHP version is 4.0.1 i
think. it's been installed with Redhat Linux 7.2 with default MySQL support.
(I've verified it). when i want to connect to my sample MySQL database, it
give me error :
Call to undifined function mysql_connect
with all MySQL functions, i've the same error. what's problem? and what i
can do? please somebody help me.

Many thanks, Alan


mail2web - Check your email from the web at
http://mail2web.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




[PHP-DB] MySQL Problem

2002-05-21 Thread [EMAIL PROTECTED]

Hi, i've a problem with MySQL in my PHP pages. My PHP version is 4.0.1 i think. it's 
been installed with Redhat Linux 7.2 with default MySQL support. (I've verified it). 
when i want to connect to my sample MySQL database, it give me error :
Call to undifined function mysql_connect
with all MySQL functions, i've the same error. what's problem? and what i can do? 
please somebody help me.

Many thanks, Alan


mail2web - Check your email from the web at
http://mail2web.com/ .


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




Re: [PHP-DB] MySQL problem

2002-02-21 Thread Markus Lervik

On Fri, 2002-02-22 at 09:37, Caleb Walker wrote:
> I keep on getting this error statement:
> Warning: Supplied argument is not a valid MySQL result resource in 
> /usr/local/www/data/phone/insert2.php on line 10
> 2
> 
> Can someone tell me what is wrong with the code below, I just cannot figure 
> it out... Thank you very much in advance.  I am using php4.
> 
> 
>  session_start();
> include("info.inc.php");
> 
> mysql_connect("$host","$user","$pass") || die(mysql_error());
> mysql_select_db("$db") || die(mysql_error());
> 
> 
> $q = mysql_query("SELECT FName, LName FROM user_info WHERE (FName='$FName' && 
> LName='$LName')") || die(1);

Try this out:

$q = mysql_query("SELECT FName, LName FROM user_info WHERE
(FName='$FName' && LName='$LName')",$db) || die(1);
^^^

It might help. Or it might not :)


Cheers,
Markus

-- 
Markus Lervik
Linux-administrator with a kungfoo grip
Vaasa City Library - Regional Library
[EMAIL PROTECTED]
+358-6-325 3589 / +358-40-832 6709


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




[PHP-DB] MySQL problem

2002-02-21 Thread Caleb Walker

I keep on getting this error statement:
Warning: Supplied argument is not a valid MySQL result resource in 
/usr/local/www/data/phone/insert2.php on line 10
2

Can someone tell me what is wrong with the code below, I just cannot figure 
it out... Thank you very much in advance.  I am using php4.







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




Re: [PHP-DB] MySQL - Problem with multiple INSERTs?

2001-03-06 Thread JJeffman

Try this changes:

$con_id = mysql_connect("localhost", "myusername", "mypassword");
if($con_id){
mysql_db_query("DocCountry", "INSERT INTO projects (idCreator, name,
comment) VALUES (0, 'sysmsg9.txt', 'Some file')");
mysql_db_query("DocCountry", "INSERT INTO files (idProject, name,
comment) VALUES (0, 'sysmsg9.txt', 'Some file')");
}
else echo("Connection failed");

-Mensagem Original-
De: Chris <[EMAIL PROTECTED]>
Para: <[EMAIL PROTECTED]>
Enviada em: terça-feira, 6 de março de 2001 16:13
Assunto: Re: [PHP-DB] MySQL - Problem with multiple INSERTs?


> I did change the id fields from TINYINT to INT (that was just a careless
> error), and fixed something else. But I still have the same problems. The
> new table schemas are below, along with the queries that don't work.
>
> I'd love for someone to reproduce the error. As a possible workaround,
> everything seems to be fine when I prime the tables by adding a record;
> they only seem to have a problem when the tables are empty.
>
> Thanks,
> Chris
>
>
>
> mysql_connect("localhost", "myusername", "mypassword");
> mysql_db_query("DocCountry", "INSERT INTO projects (idCreator, name,
> comment) VALUES (1, 'sysmsg9.txt', 'Some file')");
> mysql_db_query("DocCountry", "INSERT INTO files (idProject, name, comment)
> VALUES (1, 'sysmsg9.txt', 'Some file')");
>
> CREATE TABLE projects ( id int(11) NOT NULL auto_increment, timestamp
> timestamp(14), idCreator int(11) DEFAULT '0' NOT NULL, name varchar(80)
NOT
> NULL, comment text NOT NULL, authLevel varchar(32) NOT NULL, PRIMARY KEY
> (id) );
>
> CREATE TABLE files ( id int(11) NOT NULL auto_increment, idProject int(11)
> DEFAULT '0' NOT NULL, idCreator int(11) DEFAULT '0' NOT NULL, name
> varchar(80) DEFAULT '0' NOT NULL, comment text NOT NULL, PRIMARY KEY
(id) );
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] MySQL - Problem with multiple INSERTs?

2001-03-06 Thread Chris

I did change the id fields from TINYINT to INT (that was just a careless 
error), and fixed something else. But I still have the same problems. The 
new table schemas are below, along with the queries that don't work.

I'd love for someone to reproduce the error. As a possible workaround, 
everything seems to be fine when I prime the tables by adding a record; 
they only seem to have a problem when the tables are empty.

Thanks,
Chris



mysql_connect("localhost", "myusername", "mypassword");
mysql_db_query("DocCountry", "INSERT INTO projects (idCreator, name, 
comment) VALUES (1, 'sysmsg9.txt', 'Some file')");
mysql_db_query("DocCountry", "INSERT INTO files (idProject, name, comment) 
VALUES (1, 'sysmsg9.txt', 'Some file')");

CREATE TABLE projects ( id int(11) NOT NULL auto_increment, timestamp 
timestamp(14), idCreator int(11) DEFAULT '0' NOT NULL, name varchar(80) NOT 
NULL, comment text NOT NULL, authLevel varchar(32) NOT NULL, PRIMARY KEY 
(id) );

CREATE TABLE files ( id int(11) NOT NULL auto_increment, idProject int(11) 
DEFAULT '0' NOT NULL, idCreator int(11) DEFAULT '0' NOT NULL, name 
varchar(80) DEFAULT '0' NOT NULL, comment text NOT NULL, PRIMARY KEY (id) );



Re: [PHP-DB] MySQL - Problem with multiple INSERTs?

2001-03-05 Thread JJeffman

Have you put an echo with mysql_error() after performing each query ?

Jayme.


-Mensagem Original-
De: Chris <[EMAIL PROTECTED]>
Para: <[EMAIL PROTECTED]>
Enviada em: segunda-feira, 5 de março de 2001 05:04
Assunto: [PHP-DB] MySQL - Problem with multiple INSERTs?


> Howdy,
>
> I'm getting weird problems trying to INSERT to two different tables, in
> consecutive mysql_queries. Before, I had 3 queries going, and only 2 would
> work at any time. It seemed like it was 'rotating' the bad query - first
> the 1st query would fail (the other two were fine), then I'd empty all my
> tables and refresh, and this time the 2nd query was the problem, and if I
> did it again the 3rd was. All queries worked fine in phpMyAdmin, both
> individually and when executed en masse.
>
> I've boiled it down to just two queries that don't work. I've included
> everything below (including table schemata), to enable reproduction. It
> seems like a bug to me - the question is, is the bug in PHP, MySQL, or my
> brain?
>
> This is driving me CRAZY
>   - Chris
>
> mysql_connect("localhost", "myusername", "mypassword");
> mysql_db_query("DocCountry", "INSERT INTO projects (idCreator, name,
> comment) VALUES (1, 'sysmsg9.txt', 'Some file')");
> mysql_db_query("DocCountry", "INSERT INTO files (idProject, name, comment)
> VALUES (1, 'sysmsg9.txt', 'Some file')");
>
> CREATE TABLE projects ( id int(11) NOT NULL auto_increment, timestamp
> timestamp(14), idCreator int(11) DEFAULT '0' NOT NULL, name varchar(80)
NOT
> NULL, comment text NOT NULL, authLevel varchar(32) NOT NULL, PRIMARY KEY
> (id) );
>
> CREATE TABLE files ( id tinyint(4) NOT NULL auto_increment, idProject
> tinyint(4) DEFAULT '0' NOT NULL, name tinyint(4) DEFAULT '0' NOT NULL,
> comment text NOT NULL, PRIMARY KEY (id) );
>
> (P.S. I've tried things like using SET syntax, using mysql_query instead
of
> mysql_db_query, etc. Nothing helps.)


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] MySQL - Problem with multiple INSERTs?

2001-03-05 Thread php3

Addressed to: Chris <[EMAIL PROTECTED]>
  [EMAIL PROTECTED]

** Reply to note from Chris <[EMAIL PROTECTED]> Mon, 05 Mar 2001 02:04:28 -0600

The first thing that jumps out is using tinyint for keys.  Are you sure
there will never be more than 127 entries in the table?

I usually use bigint for all my auto_increment keys.  Not so much
because I expect to use that many entries in the table, as because a
bigint is almost big enough that it provides enough space for the delete
chain marker used in myisam files.

Once upon a time I did a DELTE FROM table and regretted it.  I happened
to have used two bigint fields as the first fields of the table, and was
able to recover the data by looking into the table files with a hex
editor.  It was not fun, but it worked because the delete chain MySQL
puts at the front of a deleted record was smaller than the two bigints.
All the text data that I needed was still there.  Since them it is my
policy to place a bigint primary key as the first entry every table
where it is apropriate.

>
> I'm getting weird problems trying to INSERT to two different tables, in
> consecutive mysql_queries. Before, I had 3 queries going, and only 2 would
> work at any time. It seemed like it was 'rotating' the bad query - first
> the 1st query would fail (the other two were fine), then I'd empty all my
> tables and refresh, and this time the 2nd query was the problem, and if I
> did it again the 3rd was. All queries worked fine in phpMyAdmin, both
> individually and when executed en masse.
>
> I've boiled it down to just two queries that don't work. I've included
> everything below (including table schemata), to enable reproduction. It
> seems like a bug to me - the question is, is the bug in PHP, MySQL, or my
> brain?
>
> This is driving me CRAZY
>   - Chris
>
> mysql_connect("localhost", "myusername", "mypassword");
> mysql_db_query("DocCountry", "INSERT INTO projects (idCreator, name,
> comment) VALUES (1, 'sysmsg9.txt', 'Some file')");
> mysql_db_query("DocCountry", "INSERT INTO files (idProject, name, comment)
> VALUES (1, 'sysmsg9.txt', 'Some file')");
>
> CREATE TABLE projects ( id int(11) NOT NULL auto_increment, timestamp
> timestamp(14), idCreator int(11) DEFAULT '0' NOT NULL, name varchar(80) NOT
> NULL, comment text NOT NULL, authLevel varchar(32) NOT NULL, PRIMARY KEY
> (id) );
>
> CREATE TABLE files ( id tinyint(4) NOT NULL auto_increment, idProject
> tinyint(4) DEFAULT '0' NOT NULL, name tinyint(4) DEFAULT '0' NOT NULL,
> comment text NOT NULL, PRIMARY KEY (id) );
>
> (P.S. I've tried things like using SET syntax, using mysql_query instead of
> mysql_db_query, etc. Nothing helps.)



Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] MySQL - Problem with multiple INSERTs?

2001-03-04 Thread Chris

Howdy,

I'm getting weird problems trying to INSERT to two different tables, in 
consecutive mysql_queries. Before, I had 3 queries going, and only 2 would 
work at any time. It seemed like it was 'rotating' the bad query - first 
the 1st query would fail (the other two were fine), then I'd empty all my 
tables and refresh, and this time the 2nd query was the problem, and if I 
did it again the 3rd was. All queries worked fine in phpMyAdmin, both 
individually and when executed en masse.

I've boiled it down to just two queries that don't work. I've included 
everything below (including table schemata), to enable reproduction. It 
seems like a bug to me - the question is, is the bug in PHP, MySQL, or my 
brain?

This is driving me CRAZY
  - Chris

mysql_connect("localhost", "myusername", "mypassword");
mysql_db_query("DocCountry", "INSERT INTO projects (idCreator, name, 
comment) VALUES (1, 'sysmsg9.txt', 'Some file')");
mysql_db_query("DocCountry", "INSERT INTO files (idProject, name, comment) 
VALUES (1, 'sysmsg9.txt', 'Some file')");

CREATE TABLE projects ( id int(11) NOT NULL auto_increment, timestamp 
timestamp(14), idCreator int(11) DEFAULT '0' NOT NULL, name varchar(80) NOT 
NULL, comment text NOT NULL, authLevel varchar(32) NOT NULL, PRIMARY KEY 
(id) );

CREATE TABLE files ( id tinyint(4) NOT NULL auto_increment, idProject 
tinyint(4) DEFAULT '0' NOT NULL, name tinyint(4) DEFAULT '0' NOT NULL, 
comment text NOT NULL, PRIMARY KEY (id) );

(P.S. I've tried things like using SET syntax, using mysql_query instead of 
mysql_db_query, etc. Nothing helps.)