Re: [PHP] Re: MySQL and PHP weirdness - RESOLVED

2012-02-15 Thread Richard S. Crawford
This has been resolved. A previous programmer had snuck in a function that
would convert the value of the description field to a date value if it
contained the word Date. This has been fixed.


On Tue, Feb 14, 2012 at 5:44 PM, David Robley robl...@aapt.net.au wrote:

 Richard S. Crawford wrote:

  Bear with me here. I have a problem with PHP and MySQL that's been
  stumping me for a couple of days now. I'm not even sure how to describe
  it, so I'll just do my best.
 
  There's a row in our bugs database that looks like every other row in the
  table, but when it's pulled from the database and displayed in PHP, the
  description field -- which is defined as a mediumtext field -- is
  displayed as a date field with a value of 12/31/1969. Moreoever, when I
  use PHPMyAdmin to look at the row directly, the description field has
  the data that I expect it to.
 
  Just for fun, here's the text in question:
  
  Quarterly Course Set Up - Spring 2012 (114)
  Section  Course titleCourse Start
 Date
  114MHI214 The Internet and the Future of Patient Care 04/02/2012
  114MHI212 Health Information Systems Analysis and Design  04/02/2012
  Program administrator 2 users; Laurel Aroner - Susan Catron - Jennifer
  Kremer
  Instructors;
  MHI214; Peter Yellowlees
  MHI212; Robert Balch
  Per instructions from Rita Smith-Simms - I'm creating this task for
 myself
  and based on instructions given which are that all listed courses are now
  to be backed-up and restored sooner (original course set up time-frame
 was
  a month before course starts).
  Adding instructions - Follow the 52-step quarterly course set up process
  and information from the course matrix; if matrix incomplete, input
  information during this set up
  As you track your time each day, please include in the notes which
 courses
  (use project code) you worked on and indicate either working on or
  completed.
  Create and notify by 2/15/2012
  
 
  I've made sure there are no odd characters that would mess up how PHP is
  displaying the text. I've tried changing the field type from mediumtext
  to text but this didn't work.
 
  If anyone has any ideas as to why this might be happening -- or if I just
  wasn't clear -- please let me know.
 
 

 If phpmyadmin gives expected results and _your_ code doesn't, I'd be
 suspicious of your code :-)

 It might be helpful for you to post relevant part(s) ofthe actual code you
 are using.



 Cheers
 --
 David Robley

 Man who run behind car get exhausted.
 Today is Sweetmorn, the 46th day of Chaos in the YOLD 3178.


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




-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


[PHP] Re: MySQL and PHP weirdness

2012-02-14 Thread David Robley
Richard S. Crawford wrote:

 Bear with me here. I have a problem with PHP and MySQL that's been
 stumping me for a couple of days now. I'm not even sure how to describe
 it, so I'll just do my best.
 
 There's a row in our bugs database that looks like every other row in the
 table, but when it's pulled from the database and displayed in PHP, the
 description field -- which is defined as a mediumtext field -- is
 displayed as a date field with a value of 12/31/1969. Moreoever, when I
 use PHPMyAdmin to look at the row directly, the description field has
 the data that I expect it to.
 
 Just for fun, here's the text in question:
 
 Quarterly Course Set Up - Spring 2012 (114)
 Section  Course titleCourse Start Date
 114MHI214 The Internet and the Future of Patient Care 04/02/2012
 114MHI212 Health Information Systems Analysis and Design  04/02/2012
 Program administrator 2 users; Laurel Aroner - Susan Catron - Jennifer
 Kremer
 Instructors;
 MHI214; Peter Yellowlees
 MHI212; Robert Balch
 Per instructions from Rita Smith-Simms - I'm creating this task for myself
 and based on instructions given which are that all listed courses are now
 to be backed-up and restored sooner (original course set up time-frame was
 a month before course starts).
 Adding instructions - Follow the 52-step quarterly course set up process
 and information from the course matrix; if matrix incomplete, input
 information during this set up
 As you track your time each day, please include in the notes which courses
 (use project code) you worked on and indicate either working on or
 completed.
 Create and notify by 2/15/2012
 
 
 I've made sure there are no odd characters that would mess up how PHP is
 displaying the text. I've tried changing the field type from mediumtext
 to text but this didn't work.
 
 If anyone has any ideas as to why this might be happening -- or if I just
 wasn't clear -- please let me know.
 
 

If phpmyadmin gives expected results and _your_ code doesn't, I'd be
suspicious of your code :-)

It might be helpful for you to post relevant part(s) ofthe actual code you
are using.



Cheers
-- 
David Robley

Man who run behind car get exhausted.
Today is Sweetmorn, the 46th day of Chaos in the YOLD 3178. 


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



[PHP] Re: MySQL select matching

2010-07-19 Thread Michael Dykman
Not quite sure what the question is.

from:
 mysql select * from table where id='1';
 +---+-+-+---+
 | 1 | 123 | 0.0 | C |
 | 1 | 234 | 0.1 | D |
 | 1 | 345 | 0.0 | D |
 | 1 | 456 | 0.1 | C |
 | 1 | 567 | 0.1 | G |
 +---+-+-+---+

How do we deduce that you would want ID '3' ?

This conversation would be easier if we gave names to those columns..

 - michael dykman


On Mon, Jul 19, 2010 at 12:36 PM, Ashley M. Kirchner ash...@pcraft.com wrote:

    I may be going at this completely wrong but at the moment I'm stuck.  I
 have a DB from a client and need to do several searches on it.  This one
 sentence is important because it's their DB, not mine.  So I can't modify
 the way the DB was created in the first place, I can only work with what I
 have.  And, whatever the solution to this might be, it does NOT have to be
 strictly MySQL, it can also be a PHP solution (which is why I'm sending it
 there as well.)  So, having said that, consider the following table:

 +---+-+-+---+
 | 1 | 123 | 0.0 | C |
 | 1 | 234 | 0.1 | D |
 | 1 | 345 | 0.0 | D |
 | 1 | 456 | 0.1 | C |
 | 1 | 567 | 0.1 | G |
 | 2 | 123 | 0.0 | C |
 | 2 | 234 | 0.1 | D |
 | 2 | 345 | 0.0 | D |
 | 3 | 234 | 0.1 | D |
 | 3 | 345 | 0.0 | D |
 | 3 | 123 | 0.0 | C |
 | 3 | 456 | 0.1 | C |
 | 3 | 567 | 0.1 | G |
 | 4 | 123 | 0.0 | C |
 | 4 | 234 | 0.1 | D |
 | 4 | 345 | 0.0 | D |
 +---+-+-+---+

 mysql select * from table where id='1';
 +---+-+-+---+
 | 1 | 123 | 0.0 | C |
 | 1 | 234 | 0.1 | D |
 | 1 | 345 | 0.0 | D |
 | 1 | 456 | 0.1 | C |
 | 1 | 567 | 0.1 | G |
 +---+-+-+---+

    Now, I have to find other IDs that match the above result.  In the table,
 that would be ID '3' (and in the entire DB, there may be others as well
 - I need to find all those IDs.)  But, notice how ID 0003 isn't in the same
 order as ID 1, but the data is still the same.

    So how do I efficiently search through the DB to find other IDs that
 matches the one I need?  I can't imagine doing a for loop selecting each ID
 and comparing their result to the one I'm starting with.  If the DB contains
 thousands upon thousands of rows, that might take a very long time.

    Open to suggestions.

 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:    http://lists.mysql.com/mysql?unsub=mdyk...@gmail..com





-- 
 - michael dykman
 - mdyk...@gmail.com

 May the Source be with you.

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



[PHP] Re: [MySQL] Re: MySQL select matching

2010-07-19 Thread Ashley M. Kirchner

On 7/19/2010 10:48 AM, Michael Dykman wrote:

Not quite sure what the question is.

from:
   

mysql  select * from table where id='1';
+---+-+-+---+
| 1 | 123 | 0.0 | C |
| 1 | 234 | 0.1 | D |
| 1 | 345 | 0.0 | D |
| 1 | 456 | 0.1 | C |
| 1 | 567 | 0.1 | G |
+---+-+-+---+
 

How do we deduce that you would want ID '3' ?

This conversation would be easier if we gave names to those columns..
   


I didn't think it mattered, but the ID that I'm starting with (in 
this case '1') is the user id currently searching the DB.  Basically 
I take the user id and collect the initial data set I need to compare 
against.


As for names on the columns, ok:

+---+-+-+---+
|   uid | set | dec | l |
+---+-+-+---+
| 1 | 123 | 0.0 | C |
| 1 | 234 | 0.1 | D |
| 1 | 345 | 0.0 | D |
| 1 | 456 | 0.1 | C |
| 1 | 567 | 0.1 | G |
+---+-+-+---+




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



[PHP] RE: mysql query returning slowly

2010-04-07 Thread David Murphy
Nathan,


The profiling I included proved that was not the case.

Mysql run the query and return the single column single  row result in under
1 second but  PHP's mysql-query waited much longer than that to return.  If
it was a big result set I could  see some slow down in parsing the results
into memory but  this wasn't the case. Updates/Deletes have similar random
timing  issues , and using mysql profiling, I can see its not transit or
lock or  clean up time from mysql - php , it is purely inside the php
mysql functions  the slow down seems to be occurs , but I can dive into
those as they are compiled modules not  userland functions.

-Original Message-

-Original Message-
From: Nathan Rixham [mailto:nrix...@gmail.com] 
Sent: Tuesday, April 06, 2010 6:35 PM
To: David Murphy
Cc: php-general@lists.php.net
Subject: Re: mysql query returning slowly

David Murphy wrote:
  
 This is from our application 
 I enabled profile in mysql to determine why an update took 20seconds.  As
 you can see  MySQL reported no where near that amount of duration took
 place. 
 Is there any way I can dig into php and determine why  mysql client libs
are
 so slow (this is not using mysqlnd but  mysql-client-libs on CentOS using
 5.3.2)
  
  
 04/06/2010 14:54:54 20.6899s

maybe it was waiting to acquire a lock


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



[PHP] Re: mysql query returning slowly

2010-04-06 Thread Nathan Rixham
David Murphy wrote:
  
 This is from our application 
 I enabled profile in mysql to determine why an update took 20seconds.  As
 you can see  MySQL reported no where near that amount of duration took
 place. 
 Is there any way I can dig into php and determine why  mysql client libs are
 so slow (this is not using mysqlnd but  mysql-client-libs on CentOS using
 5.3.2)
  
  
 04/06/2010 14:54:54 20.6899s

maybe it was waiting to acquire a lock

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



[PHP] Re: MySQL: Return Number of Matched Rows

2010-03-26 Thread Shawn McKenzie
James Colannino wrote:
 Hey everyone,
 
 I have a question.  If I do a mysql query that updates a column in a row
 to the same value, I get 0 rows affected.  However, I also get 1 or more
  matched rows.  Is there a way that I can return the number of matched
 rows, rather than the number of rows affected?
 
 I'm trying to get something done with as few SQL queries as possible.
 Thanks!
 
 James

If it works in your situation you can use REPLACE instead of UPDATE and
the mysql_affected_rows() should work.  You may need to divide this
number by 2 as I think it counts the deletes and inserts.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: MySQL ID -- what happens when you run out of range?

2010-01-25 Thread Nathan Rixham
Parham Doustdar wrote:
 Hello there,
 A friend called me today and was wondering what happens if the ID colomn of 
 an MYSQL database, set to autoinc reaches the int limit. Will it return and 
 begin choosing the ID's that have been deleted, or... what?

you change it to bigint before that happens :)

for a more accurate answer ask on the mysql forum?

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



Re: [PHP] Re: MySQL ID -- what happens when you run out of range?

2010-01-25 Thread John Meyer

On 1/25/2010 1:19 PM, Nathan Rixham wrote:

Parham Doustdar wrote:

Hello there,
A friend called me today and was wondering what happens if the ID colomn of
an MYSQL database, set to autoinc reaches the int limit. Will it return and
begin choosing the ID's that have been deleted, or... what?


you change it to bigint before that happens :)

for a more accurate answer ask on the mysql forum?



Or the e-mail list: my...@lists.mysql.com (though I understand the 
cross-pollination)



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



[PHP] Re: MySQL auto_increment fields Server version: 5.1.32-community-log

2009-08-11 Thread Nisse Engström
On Mon, 10 Aug 2009 01:17:21 +0200, Ralph Deffke wrote:

 On Sun, 9 Aug 2009 20:17:15 +0200, Ralph Deffke wrote:

 I'm facing the fact that it seems that auto_increment fields in a table not
 start at 1 like it was in earlier versions even if I install mySQL brand new
 creating all tables new. it seems to me that auto_increments handling has
 
 I should mention that I use MyISAM as storage engine what makes it even more
 wiered.

Also check out auto_increment_offset (introduced in 5.0.2):

http://dev.mysql.com/doc/refman/5.0/en/replication-options-master.html#sysvar_auto_increment_offset


/Nisse

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



[PHP] Re: MySQL auto_increment fields Server version: 5.1.32-community-log

2009-08-10 Thread Ollisso
On Sun, 09 Aug 2009 21:17:15 +0300, Ralph Deffke ralph_def...@yahoo.de  
wrote:



Hi all,

I'm facing the fact that it seems that auto_increment fields in a table  
not
start at 1 like it was in earlier versions even if I install mySQL brand  
new

creating all tables new. it seems to me that auto_increments handling has
changed to older version. is somebody out there who can give me a quick
background about auto_increment and how and if I can control the  
behavior of

mySQL about them.

ralph_def...@yahoo.de



try:
ALTER TABLE xxx AUTO_INCREMENT=1;



--

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



[PHP] Re: MySQL auto_increment fields Server version: 5.1.32-community-log

2009-08-09 Thread Nisse Engström
On Sun, 9 Aug 2009 20:17:15 +0200, Ralph Deffke wrote:

 I'm facing the fact that it seems that auto_increment fields in a table not
 start at 1 like it was in earlier versions even if I install mySQL brand new
 creating all tables new. it seems to me that auto_increments handling has
 changed to older version. is somebody out there who can give me a quick
 background about auto_increment and how and if I can control the behavior of
 mySQL about them.

Did you Google for it? I found the following page that
might be relevant:

http://dev.mysql.com/doc/refman/5.1/en/innodb-auto-increment-handling.html

   Beginning with MySQL 5.1.22, InnoDB provides a locking
strategy that significantly improves scalability and
performance of SQL statements that add rows to tables
with AUTO_INCREMENT columns.
...
InnoDB uses the following algorithm to initialize the
auto-increment counter for a table t that contains an
AUTO_INCREMENT column named ai_col: After a server
startup, for the first insert into a table t, InnoDB
executes the equivalent of this statement: 

  SELECT MAX(ai_col) FROM t FOR UPDATE;

InnoDB increments by one the value retrieved by the
statement and assigns it to the column and to the
auto-increment counter for the table.


/Nisse

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



[PHP] Re: MySQL auto_increment fields Server version: 5.1.32-community-log

2009-08-09 Thread Ralph Deffke
this is a very good startup for the issue. now the question is where does it
get the value if there is no max(ai) or when I do an insert in an empty
table with the ai field set to 1 where does the innoDB get the next ai value
10720 ?

I assume that the SELECT MAX(ai_col) FROM t FOR UPDATE; return is
incremented by 1 so how does this end up with 10720?

anyway, ur statement shows that there has changed somethimg definately. but
what?
maid be there is some flag telling the kernel that ai fields should be
unique throughout the database? some left behind of the cluster version of
mySQL?


Nisse Engström news.nospam.0ixbt...@luden.se wrote in message
news:91.f7.55947.dc74f...@pb1.pair.com...
 On Sun, 9 Aug 2009 20:17:15 +0200, Ralph Deffke wrote:

  I'm facing the fact that it seems that auto_increment fields in a table
not
  start at 1 like it was in earlier versions even if I install mySQL brand
new
  creating all tables new. it seems to me that auto_increments handling
has
  changed to older version. is somebody out there who can give me a quick
  background about auto_increment and how and if I can control the
behavior of
  mySQL about them.

 Did you Google for it? I found the following page that
 might be relevant:


http://dev.mysql.com/doc/refman/5.1/en/innodb-auto-increment-handling.html

Beginning with MySQL 5.1.22, InnoDB provides a locking
 strategy that significantly improves scalability and
 performance of SQL statements that add rows to tables
 with AUTO_INCREMENT columns.
 ...
 InnoDB uses the following algorithm to initialize the
 auto-increment counter for a table t that contains an
 AUTO_INCREMENT column named ai_col: After a server
 startup, for the first insert into a table t, InnoDB
 executes the equivalent of this statement:

   SELECT MAX(ai_col) FROM t FOR UPDATE;

 InnoDB increments by one the value retrieved by the
 statement and assigns it to the column and to the
 auto-increment counter for the table.


 /Nisse



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



[PHP] Re: MySQL auto_increment fields Server version: 5.1.32-community-log

2009-08-09 Thread Ralph Deffke
I should mention that I use MyISAM as storage engine what makes it even more
wiered.

Nisse Engström news.nospam.0ixbt...@luden.se wrote in message
news:91.f7.55947.dc74f...@pb1.pair.com...
 On Sun, 9 Aug 2009 20:17:15 +0200, Ralph Deffke wrote:

  I'm facing the fact that it seems that auto_increment fields in a table
not
  start at 1 like it was in earlier versions even if I install mySQL brand
new
  creating all tables new. it seems to me that auto_increments handling
has
  changed to older version. is somebody out there who can give me a quick
  background about auto_increment and how and if I can control the
behavior of
  mySQL about them.

 Did you Google for it? I found the following page that
 might be relevant:


http://dev.mysql.com/doc/refman/5.1/en/innodb-auto-increment-handling.html

Beginning with MySQL 5.1.22, InnoDB provides a locking
 strategy that significantly improves scalability and
 performance of SQL statements that add rows to tables
 with AUTO_INCREMENT columns.
 ...
 InnoDB uses the following algorithm to initialize the
 auto-increment counter for a table t that contains an
 AUTO_INCREMENT column named ai_col: After a server
 startup, for the first insert into a table t, InnoDB
 executes the equivalent of this statement:

   SELECT MAX(ai_col) FROM t FOR UPDATE;

 InnoDB increments by one the value retrieved by the
 statement and assigns it to the column and to the
 auto-increment counter for the table.


 /Nisse



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



[PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Jo�o C�ndido de Souza Neto
If you need date and hour the best way is:

CREATE TABLE diary (
 iddiary int auto_increment not null,
 imepriimek varchar(50),
 when timestamp,
 action varchar(30),
 onfile varchar(100)
 unique id(iddiary)
);

if you need only date you can use:

CREATE TABLE diary (
 iddiary int auto_increment not null,
 imepriimek varchar(50),
 when date,
 action varchar(30),
 onfile varchar(100)
 unique id(iddiary)
);

To get formated date you should use:

select date_format(when, %T%W%e%c%y) from diary;

To put data in this field you can use:

insert into diary (when) values (str_to_date(10:55:14Thursday28509, 
%T%W%e%c%y));



-- 
João Cândido de Souza Neto
SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
Fone: (0XX41) 3033-3636 - JS
www.siens.com.br

Grega Leskovsek mavri...@gmail.com escreveu na mensagem 
news:1df2d4810905280643y62a0f092p91fa2c57558d8...@mail.gmail.com...
 CREATE TABLE diary(iddiary int auto_increment not null, imepriimek
 varchar(50), when date(%T%W%e%c%y), action varchar(30), onfile
 varchar(100) unique id(iddiary));

 I tried the above and it didn't work. What must I do to create a table
 with full time and date. If I should use timestamp how do I convert
 thee timestamp in php back to normal time? (I also tried the mysql
 command:
 when timestamp
 and
 when date
 in the above first mysql clause but it didnt work
 )

 Please help me. Thanks in advance,
 -- 
 When the sun rises I receive and when it sets I forgive -
 http://users.skavt.net/~gleskovs/
 All the Love, Grega Leskov'sek 



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



Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Grega Leskovsek
I GOT THIS ERROR when  I tried first sample with when timestamp;


ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual thatcorresponds to your MySQL server version for the right
syntax to use near 'id(iddiary) )' at line 1


2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br:
 If you need date and hour the best way is:

 CREATE TABLE diary (
  iddiary int auto_increment not null,
  imepriimek varchar(50),
  when timestamp,
  action varchar(30),
  onfile varchar(100)
  unique id(iddiary)
 );

Please advice. Thanks in advance, Grega

 if you need only date you can use:

 CREATE TABLE diary (
  iddiary int auto_increment not null,
  imepriimek varchar(50),
  when date,
  action varchar(30),
  onfile varchar(100)
  unique id(iddiary)
 );

 To get formated date you should use:

 select date_format(when, %T%W%e%c%y) from diary;

 To put data in this field you can use:

 insert into diary (when) values (str_to_date(10:55:14Thursday28509,
 %T%W%e%c%y));



 --
 João Cândido de Souza Neto
 SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
 Fone: (0XX41) 3033-3636 - JS
 www.siens.com.br

 Grega Leskovsek mavri...@gmail.com escreveu na mensagem
 news:1df2d4810905280643y62a0f092p91fa2c57558d8...@mail.gmail.com...
 CREATE TABLE diary(iddiary int auto_increment not null, imepriimek
 varchar(50), when date(%T%W%e%c%y), action varchar(30), onfile
 varchar(100) unique id(iddiary));

 I tried the above and it didn't work. What must I do to create a table
 with full time and date. If I should use timestamp how do I convert
 thee timestamp in php back to normal time? (I also tried the mysql
 command:
 when timestamp
 and
 when date
 in the above first mysql clause but it didnt work
 )

 Please help me. Thanks in advance,
 --
 When the sun rises I receive and when it sets I forgive -
 http://users.skavt.net/~gleskovs/
 All the Love, Grega Leskov'sek



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





-- 
When the sun rises I receive and when it sets I forgive -
http://users.skavt.net/~gleskovs/
All the Love, Grega Leskov'sek

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



Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Jo�o C�ndido de Souza Neto
It´s not auto_increment, it´s auto increment.

-- 
João Cândido de Souza Neto
SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
Fone: (0XX41) 3033-3636 - JS
www.siens.com.br

Grega Leskovsek mavri...@gmail.com escreveu na mensagem 
news:1df2d4810905280748uec4f425kaf14b6410caa...@mail.gmail.com...
I GOT THIS ERROR when  I tried first sample with when timestamp;


ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual thatcorresponds to your MySQL server version for the right
syntax to use near 'id(iddiary) )' at line 1


2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br:
 If you need date and hour the best way is:

 CREATE TABLE diary (
 iddiary int auto_increment not null,
 imepriimek varchar(50),
 when timestamp,
 action varchar(30),
 onfile varchar(100)
 unique id(iddiary)
 );

Please advice. Thanks in advance, Grega

 if you need only date you can use:

 CREATE TABLE diary (
 iddiary int auto_increment not null,
 imepriimek varchar(50),
 when date,
 action varchar(30),
 onfile varchar(100)
 unique id(iddiary)
 );

 To get formated date you should use:

 select date_format(when, %T%W%e%c%y) from diary;

 To put data in this field you can use:

 insert into diary (when) values (str_to_date(10:55:14Thursday28509,
 %T%W%e%c%y));



 --
 João Cândido de Souza Neto
 SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
 Fone: (0XX41) 3033-3636 - JS
 www.siens.com.br

 Grega Leskovsek mavri...@gmail.com escreveu na mensagem
 news:1df2d4810905280643y62a0f092p91fa2c57558d8...@mail.gmail.com...
 CREATE TABLE diary(iddiary int auto_increment not null, imepriimek
 varchar(50), when date(%T%W%e%c%y), action varchar(30), onfile
 varchar(100) unique id(iddiary));

 I tried the above and it didn't work. What must I do to create a table
 with full time and date. If I should use timestamp how do I convert
 thee timestamp in php back to normal time? (I also tried the mysql
 command:
 when timestamp
 and
 when date
 in the above first mysql clause but it didnt work
 )

 Please help me. Thanks in advance,
 --
 When the sun rises I receive and when it sets I forgive -
 http://users.skavt.net/~gleskovs/
 All the Love, Grega Leskov'sek



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





-- 
When the sun rises I receive and when it sets I forgive -
http://users.skavt.net/~gleskovs/
All the Love, Grega Leskov'sek 



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



Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Grega Leskovsek
The problem was I  didn't type a comma before unique id(iddary).
Thanks to everybody for helping me on the seminar. Love, Grega

2009/5/28 LinuxManMikeC linuxmanmi...@gmail.com:
 Actually, AUTO_INCREMENT is the correct syntax for MySQL.  I think the
 problem is NOT NULL should come first: iddiary INT NOT NULL
 AUTO_INCREMENT.

 2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br:
 It´s not auto_increment, it´s auto increment.

 --
 João Cândido de Souza Neto
 SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
 Fone: (0XX41) 3033-3636 - JS
 www.siens.com.br

 Grega Leskovsek mavri...@gmail.com escreveu na mensagem
 news:1df2d4810905280748uec4f425kaf14b6410caa...@mail.gmail.com...
 I GOT THIS ERROR when  I tried first sample with when timestamp;


 ERROR 1064 (42000): You have an error in your SQL syntax; check the
 manual thatcorresponds to your MySQL server version for the right
 syntax to use near 'id(iddiary) )' at line 1


 2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br:
 If you need date and hour the best way is:

 CREATE TABLE diary (
 iddiary int auto_increment not null,
 imepriimek varchar(50),
 when timestamp,
 action varchar(30),
 onfile varchar(100)
 unique id(iddiary)
 );

 Please advice. Thanks in advance, Grega

 if you need only date you can use:

 CREATE TABLE diary (
 iddiary int auto_increment not null,
 imepriimek varchar(50),
 when date,
 action varchar(30),
 onfile varchar(100)
 unique id(iddiary)
 );

 To get formated date you should use:

 select date_format(when, %T%W%e%c%y) from diary;

 To put data in this field you can use:

 insert into diary (when) values (str_to_date(10:55:14Thursday28509,
 %T%W%e%c%y));



 --
 João Cândido de Souza Neto
 SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
 Fone: (0XX41) 3033-3636 - JS
 www.siens.com.br

 Grega Leskovsek mavri...@gmail.com escreveu na mensagem
 news:1df2d4810905280643y62a0f092p91fa2c57558d8...@mail.gmail.com...
 CREATE TABLE diary(iddiary int auto_increment not null, imepriimek
 varchar(50), when date(%T%W%e%c%y), action varchar(30), onfile
 varchar(100) unique id(iddiary));

 I tried the above and it didn't work. What must I do to create a table
 with full time and date. If I should use timestamp how do I convert
 thee timestamp in php back to normal time? (I also tried the mysql
 command:
 when timestamp
 and
 when date
 in the above first mysql clause but it didnt work
 )

 Please help me. Thanks in advance,
 --
 When the sun rises I receive and when it sets I forgive -
 http://users.skavt.net/~gleskovs/
 All the Love, Grega Leskov'sek



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





 --
 When the sun rises I receive and when it sets I forgive -
 http://users.skavt.net/~gleskovs/
 All the Love, Grega Leskov'sek



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



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





-- 
When the sun rises I receive and when it sets I forgive -
http://users.skavt.net/~gleskovs/
All the Love, Grega Leskov'sek

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



Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Daniel Brown
On Thu, May 28, 2009 at 11:15, Andrew Ballard aball...@gmail.com wrote:

 Make that a 'comma', not the 'coma' that I seem to be in.  :-)

Eh, it's your birthday.  You're allowed.  ;-P

Happy birthday, by the way.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Andrew Ballard
On Thu, May 28, 2009 at 11:15 AM, Andrew Ballard aball...@gmail.com wrote:
 2009/5/28 Grega Leskovsek mavri...@gmail.com:
 I GOT THIS ERROR when  I tried first sample with when timestamp;


 ERROR 1064 (42000): You have an error in your SQL syntax; check the
 manual thatcorresponds to your MySQL server version for the right
 syntax to use near 'id(iddiary) )' at line 1


 2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br:
 If you need date and hour the best way is:

 CREATE TABLE diary (
  iddiary int auto_increment not null,
  imepriimek varchar(50),
  when timestamp,
  action varchar(30),
  onfile varchar(100)
  unique id(iddiary)
 );

 Please advice. Thanks in advance, Grega

 There is a coma missing between the lines for the last column and the
 unique key.

 Andrew


Make that a 'comma', not the 'coma' that I seem to be in.  :-)

Andrew

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



Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Andrew Ballard
On Thu, May 28, 2009 at 11:20 AM, Daniel Brown danbr...@php.net wrote:
 On Thu, May 28, 2009 at 11:15, Andrew Ballard aball...@gmail.com wrote:

 Make that a 'comma', not the 'coma' that I seem to be in.  :-)

    Eh, it's your birthday.  You're allowed.  ;-P

    Happy birthday, by the way.


Thanks! It's a weak excuse, but I'll take it.  :-)

Andrew

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



[PHP] Re: MYSQL 5 auto increment not working

2009-05-21 Thread Nathan Rixham

Leidago !Noabeb wrote:

Hi All


I know this is not strictly a PHP question, but i have a problem whenever i
insert a record using PHP. Basically the auto increment field does not work
at all. Here's the structure of the table that i'm using:

CREATE TABLE `children` (
  `cid` int(4) NOT NULL auto_increment,
  `cname` char(50) default NULL,
  `csname` char(50) default NULL,
  PRIMARY KEY  (`cid`)
) ENGINE=InnoDB

I use PHP 5.1 and MYSQL 5

I'm pretty sure the code i use to insert the data is sound since i've tested
it with older versions of MYSQL.

Has anyone else had similar problems?



*works for me*

check cid is empty in your insert statement
check you haven't hit  rows, seeing as you are using int 4
drop and recreate the table (or truncate)

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



Re: [PHP] Re: MYSQL 5 auto increment not working

2009-05-21 Thread Bastien Koert
On Thu, May 21, 2009 at 9:34 AM, Nathan Rixham nrix...@gmail.com wrote:

 Leidago !Noabeb wrote:

 Hi All


 I know this is not strictly a PHP question, but i have a problem whenever
 i
 insert a record using PHP. Basically the auto increment field does not
 work
 at all. Here's the structure of the table that i'm using:

 CREATE TABLE `children` (
  `cid` int(4) NOT NULL auto_increment,
  `cname` char(50) default NULL,
  `csname` char(50) default NULL,
  PRIMARY KEY  (`cid`)
 ) ENGINE=InnoDB

 I use PHP 5.1 and MYSQL 5

 I'm pretty sure the code i use to insert the data is sound since i've
 tested
 it with older versions of MYSQL.

 Has anyone else had similar problems?


 *works for me*

 check cid is empty in your insert statement
 check you haven't hit  rows, seeing as you are using int 4
 drop and recreate the table (or truncate)

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


openfire is something you may want to look at...it has a flash client in
there somewhere...also i believe you can find FLEX based IM chat code that
you can use

-- 

Bastien

Cat, the other other white meat


[PHP] Re: MySQL class. Thoughts?

2009-01-21 Thread Al



Jay Moore wrote:
This is a MySQL class I use and I wanted to get everyone's thoughts on 
how/if I can improve it.  This is for MySQL only.  I don't need to make 
it compatible with other databases.  I'm curious what you all think.


Thanks,
Jay

Class:
--
?php

// Standard MySQL class
class do_mysql
{   
// Constructor

function __construct()
{
$this-do_mysql();
}

// Destructor

function __destruct()
{
//$this-close();
}

function do_mysql()

{
$this-login = '';
$this-pass = '';
   
$this-link = @mysql_connect('localhost', $this-login, 
$this-pass) or die('Could not connect to the database.');

} // End do_mysql

// Functions   
function close()

{
if ($this-link)
{
mysql_close($this-link);
unset($this-link);
}
} // End close

function fetch_array()

{
return mysql_fetch_array($this-result);
} // End fetch_array

function last_id()

{
return mysql_insert_id($this-link);
} // End last_id
   
function num_rows()

{
return mysql_num_rows($this-result);
} // End num_rows

function process($database = '')

{
if (is_null($this-query))
{
die('Error:  Query string empty.  Cannot proceed.');
}
   
$this-db = @mysql_select_db($database, $this-link) or 
die(Database Error:  Couldn't select $database br / . mysql_error());
$this-result = @mysql_query($this-query, $this-link) or 
die('Database Error:  Couldn\'t query. br /' . mysql_error() . br 
/br / $this-query);

} // End process

function sanitize($ref)

{
$ref = mysql_real_escape_string($ref);
} // End sanitize

} // End do_mysql


?


Sample usage:
$value = 'value';
$sql = new do_mysql();
$sql-sanitize($value);
$sql-query = SELECT * FROM `wherever` WHERE `field` = '$value';
$sql-process('dbname');
$sql-close();

if ($sql-num_rows())
{
while ($row = $sql-fetch_array())
{
do stuff;
}
}


I think I'd use one of 20+ Pear classes. They are pretty throughly tested 
because of the thousands of users.


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



[PHP] Re: MYSQL insert problems

2008-10-17 Thread Frank Stanovcak
Just incase the problem was refrencing an array in an SQL statement I tried 
this too with the same result.

?php
session_start();
$connection = mysql_connect('localhost','FrankS','rastane');
mysql_select_db('envelope1',$connection);
$filtered = $_SESSION['filtered'];
$salesorder = $filtered['SalesOrder'];
$user = 1;
$date = date('m/d/Y', time());
$shipdate = $filtered['ShipDate'];
$quantity = $_SESSION['quantity'];
$cases = $_SESSION['cases'];
$pallets = $filtered['FullPallets'];
$weight = $filtered['Weight'];
$shippedby = $filtered['ShippedBy'];
$billoflading = $filtered['BillofLading'];
mysql_query(INSERT INTO shipped
(FKOESalesOrder,
FKUSUsers,
DateEntered,
DateShipped,
Quantity,
Cases,
Pallets,
Weight,
FKUSShippedBy,
BillofLading,)
VALUES
('$salesorder',
'$user',
'$date',
'$shipdate',
'$quantity',
'$cases',
'$pallets',
'$weight',
'$shippedby',
'$billoflading'), $connection);

$that = mysql_query('SELECT * FROM shipped',$connection);

$i = 0;
while($result_row = mysql_fetch_array($that,MYSQL_ASSOC)) {
 echo ++$i;
 foreach($result_row as $key = $value) {
  echo $key . ' : ' . $value . 'br';
 };
 echo 'br';
};
mysql_close($connection);
include('..\VariableReveal.php');
? 



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



Re: [PHP] Re: MySQL Workbench coming for Linux

2008-09-18 Thread Luke
so it's like Microsoft Access? I don't get it...

2008/9/18 Ross McKay [EMAIL PROTECTED]

 Bastien Koert wrote:

 what about dia on llinux? Not quite as nice as visio...but livable

 The Enterprise Architect version of Visio lets you add column
 definitions to your entities, add foreign key relationships, add
 indices, add comments at the table and column level, and then generate a
 build script. It also has a reporting tool for generating a data
 dictionary. In short, it makes a pretty good stab at being a data
 modelling tool (imperfectly, but sufficiently for my needs).

 Dia is just a diagramming tool (unless you can tell me otherwise).
 --
 Ross McKay, Toronto, NSW Australia
 Nobody ever rioted for austerity - George Monbiot

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




-- 
Luke Slater


Re: [PHP] Re: MySQL Workbench coming for Linux

2008-09-18 Thread Ross McKay
Luke wrote:

so it's like Microsoft Access? I don't get it...

No, Microsoft Access is a development environment sitting on top of a
simplistic database (JET). Access gives you a nice GUI to help you
interactively build up your database, and it makes a great prototyping
tool and data massage tool, but it isn't very good for data modelling.

I'm talking about proper data modelling tools, where you design the
conceptual and physical databases, then generate scripts to build them
(e.g. in Oracle, Microsoft SQL Server, MySQL, etc.) and generate nice
documentation including diagrams that help you understand your database
at a quick glance. Usually, they can also suck a live database back in
(reverse engineer) to help you document whatever nasty hack you've
inherited from your predecessors in a legacy application ;-)

MySQL Workbench is what I really want, or something similar. I just
happen to already have a copy of Visio Enterprise Architect that comes
close enough to doing the job, so I use that until Workbench is up and
working properly on Linux. I hack the generated SQL scripts (minimally)
to make them MySQL friendly, and I hack the generated RTF data
dictionary files to make them more to my liking, and load them into OOo
and embed the ER diagrams, to get nice, easily referenced documentation
on my DBs.

See here for more information about data modelling tools in general, and
a couple of specific ones:

http://en.wikipedia.org/wiki/Entity-relationship_model
http://en.wikipedia.org/wiki/CA_ERwin_Data_Modeler
http://en.wikipedia.org/wiki/ER/Studio
http://en.wikipedia.org/wiki/Toad_Data_Modeler
http://en.wikipedia.org/wiki/MySQL_Workbench
-- 
Ross McKay, Toronto, NSW Australia
Before enlightenment: chop wood, carry water;
 After enlightenment: chop wood, carry water - Wu Li

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



[PHP] Re: MySQL Workbench coming for Linux

2008-09-17 Thread Dax Solomon Umaming
Ross McKay wrote:
 Posting this here, because a few people responded when I mentioned not
 having a Linux-native data modelling tool. Apparently, MySQL Workbench
 should be alpha-ready by end of the month...

I've been waiting for this. I'm getting tired of DBDesigner4's bugs and all.

-- 
Dax Solomon Umaming
http://blog.knightlust.com/

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



Re: [PHP] Re: MySQL Workbench coming for Linux

2008-09-17 Thread Luke
What is it?

I'm only familiar with the MySQL tools such as Query Browser and Admin?

2008/9/17 Dax Solomon Umaming [EMAIL PROTECTED]

 Ross McKay wrote:
  Posting this here, because a few people responded when I mentioned not
  having a Linux-native data modelling tool. Apparently, MySQL Workbench
  should be alpha-ready by end of the month...

 I've been waiting for this. I'm getting tired of DBDesigner4's bugs and
 all.

 --
 Dax Solomon Umaming
 http://blog.knightlust.com/

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




-- 
Luke Slater


Re: [PHP] Re: MySQL Workbench coming for Linux

2008-09-17 Thread Ross McKay
On Wed, 17 Sep 2008 09:00:45 +0100, Luke wrote:

What is it?

I'm only familiar with the MySQL tools such as Query Browser and Admin?

http://dev.mysql.com/downloads/workbench/5.0.html

In short, it's a data modelling tool. Such things are very handy for
designing and building databases, and usually also for documenting them.
If your DB has more than a handful of tables, it's well worth the
effort.
-- 
Ross McKay, Toronto, NSW Australia
Let the laddie play wi the knife - he'll learn
- The Wee Book of Calvin

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



Re: [PHP] Re: MySQL Workbench coming for Linux

2008-09-17 Thread Bastien Koert
On Wed, Sep 17, 2008 at 4:13 AM, Ross McKay [EMAIL PROTECTED] wrote:

 On Wed, 17 Sep 2008 09:00:45 +0100, Luke wrote:

 What is it?
 
 I'm only familiar with the MySQL tools such as Query Browser and Admin?

 http://dev.mysql.com/downloads/workbench/5.0.html

 In short, it's a data modelling tool. Such things are very handy for
 designing and building databases, and usually also for documenting them.
 If your DB has more than a handful of tables, it's well worth the
 effort.
 --
 Ross McKay, Toronto, NSW Australia
 Let the laddie play wi the knife - he'll learn
 - The Wee Book of Calvin

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


what about dia on llinux? Not quite as nice as visio...but livable

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: MySQL Workbench coming for Linux

2008-09-17 Thread Ross McKay
Bastien Koert wrote:

what about dia on llinux? Not quite as nice as visio...but livable

The Enterprise Architect version of Visio lets you add column
definitions to your entities, add foreign key relationships, add
indices, add comments at the table and column level, and then generate a
build script. It also has a reporting tool for generating a data
dictionary. In short, it makes a pretty good stab at being a data
modelling tool (imperfectly, but sufficiently for my needs).

Dia is just a diagramming tool (unless you can tell me otherwise).
-- 
Ross McKay, Toronto, NSW Australia
Nobody ever rioted for austerity - George Monbiot

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



[PHP] Re: MySQL Group?

2008-03-19 Thread John Taylor-Johnston

John Taylor-Johnston wrote:

Does anyone know of a good MySQL group?

Found it: http://lists.mysql.com/mysql/
Thanks,
John

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



[PHP] Re: MySQL Group?

2008-03-19 Thread George J
Hi John,

John Taylor-Johnston [EMAIL PROTECTED] wrote in 
message news:[EMAIL PROTECTED]
 Does anyone know of a good MySQL group?
 I want to make a relational link from `data` to `shopping` so when I 
 insert a new record in `shopping`, I will see the contents of
 `data`.`name` and `data`.`email` as a drop-down menu in `shopping`.

 Where does one go to get this kind of help?

 Thanks,
 John


 DROP TABLE IF EXISTS `data`;
 CREATE TABLE `data` (
   `id` int(5) NOT NULL auto_increment,
   `name` varchar(255) NOT NULL,
   `email` varchar(255) NOT NULL default '',
   PRIMARY KEY  (`id`)
 ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

 INSERT INTO `data` VALUES(1, 'Allen, Carolyn', '[EMAIL PROTECTED]');
 INSERT INTO `data` VALUES(2, 'Atwood, Margaret', 
 '[EMAIL PROTECTED]');

 DROP TABLE IF EXISTS `shopping`;
 CREATE TABLE `shopping` (
   `id` int(5) NOT NULL auto_increment,
   `name` varchar(100) NOT NULL,
   `address` varchar(100) NOT NULL,
   `email` varchar(100) NOT NULL,
   PRIMARY KEY  (`id`)
 ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;

I'm not certain but think you need to include a 'references 
table_name(field_name)' clause that sets up the Foreign key relationship 
between the 2 tables. I think the Reference clause would replace the 
auto_increment in your primary key of the referencing table.

HTH
George 



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



Re: [PHP] Re: MySQL Group?

2008-03-19 Thread Chris

George J wrote:

Hi John,

John Taylor-Johnston [EMAIL PROTECTED] wrote in 
message news:[EMAIL PROTECTED]

Does anyone know of a good MySQL group?
I want to make a relational link from `data` to `shopping` so when I 
insert a new record in `shopping`, I will see the contents of

`data`.`name` and `data`.`email` as a drop-down menu in `shopping`.

Where does one go to get this kind of help?

Thanks,
John


DROP TABLE IF EXISTS `data`;
CREATE TABLE `data` (
  `id` int(5) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

INSERT INTO `data` VALUES(1, 'Allen, Carolyn', '[EMAIL PROTECTED]');
INSERT INTO `data` VALUES(2, 'Atwood, Margaret', 
'[EMAIL PROTECTED]');


DROP TABLE IF EXISTS `shopping`;
CREATE TABLE `shopping` (
  `id` int(5) NOT NULL auto_increment,
  `name` varchar(100) NOT NULL,
  `address` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;

I'm not certain but think you need to include a 'references 
table_name(field_name)' clause that sets up the Foreign key relationship 
between the 2 tables. I think the Reference clause would replace the 
auto_increment in your primary key of the referencing table.


The references goes into the secondary table, not the main one and it 
definitely doesn't replace the auto_increment field.


You end up with something like this:

create table person
(
  person_id int primary key,
  name varchar(255),
  email varchar(255)
) engine=innodb;

create table shopping
(
  shopping_id int primary key,
  person_id int,
  foreign key (person_id) references person(person_id)
) engine=innodb;

insert into person(person_id,name,email) 
values(1,'Name','[EMAIL PROTECTED]');


insert into shopping(shopping_id, person_id) values(1, 1);

The 'person' table still needs at least a unique field for the field 
being referenced (the foreign key), usually a primary key (and if 
necessary an auto_increment).



The secondary table uses that key to check:
- if that id exists:

insert into shopping(shopping_id, person_id) values (2,2);

ERROR 1452 (23000): Cannot add or update a child row: a foreign key 
constraint fails



- if it should delete that id (when using on delete cascade)

mysql delete from person where person_id=1;
Query OK, 1 row affected (0.00 sec)

mysql select * from shopping;
Empty set (0.00 sec)


- if it needs to be updated (when using on update cascade)

mysql update person set person_id=2 where person_id=1;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql select * from shopping;
+-+---+
| shopping_id | person_id |
+-+---+
|   1 | 2 |
+-+---+
1 row in set (0.00 sec)



See manual for more examples:
http://dev.mysql.com/doc/refman/4.1/en/innodb-foreign-key-constraints.html

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Re: MySQL Group?

2008-03-19 Thread John Taylor-Johnston
Thanks for getting me started. (Sorry, I'm a top quoter.) Below is some 
working code for the archives.


What I've learned so far is that :
1) what I'm referring to in `person` has to be a key.
2) if I want to refer to more than one field from person in shopping, I 
have to use unique keys.


I'm still discovering what keys are for.
John



DROP TABLE IF EXISTS `person`;
CREATE TABLE `person` (
  `person_id` int(11) NOT NULL auto_increment,
  `name` varchar(255) default NULL,
  `email` varchar(255) default NULL,
  PRIMARY KEY  (`person_id`),
  KEY `email` (`email`),
  KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

INSERT INTO `person`( `person_id`, `name`, `email` ) VALUES ( 1, 'Name', 
'[EMAIL PROTECTED]' ) ;
INSERT INTO `person`( `person_id`, `name`, `email` ) VALUES ( 2, 'second 
Name', '[EMAIL PROTECTED]' ) ;


DROP TABLE IF EXISTS `shopping`;
CREATE TABLE IF NOT EXISTS `shopping` (
  `shopping_id` int(11) NOT NULL,
  `email` varchar(255) default NULL,
  `name` varchar(255) default NULL,
  PRIMARY KEY  (`shopping_id`),
  UNIQUE KEY `email` (`email`),
  UNIQUE KEY `name` (`name`),
FOREIGN KEY (`email`) REFERENCES `person` (`email`),
FOREIGN KEY (`name`) REFERENCES `person` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;




You end up with something like this:

create table person
(
  person_id int primary key,
  name varchar(255),
  email varchar(255)
) engine=innodb;

create table shopping
(
  shopping_id int primary key,
  person_id int,
  foreign key (person_id) references person(person_id)
) engine=innodb;

insert into person(person_id,name,email) 
values(1,'Name','[EMAIL PROTECTED]');


insert into shopping(shopping_id, person_id) values(1, 1);


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



Re: [PHP] Re: MySQL Group?

2008-03-19 Thread Chris

John Taylor-Johnston wrote:
Thanks for getting me started. (Sorry, I'm a top quoter.) Below is some 
working code for the archives.


What I've learned so far is that :
1) what I'm referring to in `person` has to be a key.


It should be a unique item rather than just a 'key' (indexed item).

If you add this data:

insert into person(name, email) values ('my name', '[EMAIL PROTECTED]');
insert into person(name, email) values ('another name', 
'[EMAIL PROTECTED]');


and I share an email address, and you use email as the foreign key, 
which one is it going to link to?


Mysql should really throw an error if you try to reference a non-unique 
field or combination of fields - every other db does.



A unique key can cover more than one field:

create table person
(
  person_id int primary key,
  name varchar(255),
  email varchar(255),
  unique key (name, email)
) engine=innodb;

So you can only have one combination of name  email then you can use 
that as a foreign key:


create table shopping
(
  shopping_id int primary key,
  person_name varchar(255),
  person_email varchar(255),
  foreign key (person_name, person_email) references person(name,email)
) engine=innodb;


Though I'd suggest starting off with the person_id (primary key) as the 
foreign key so you don't have data redundancy and integrity issues 
(unless you use on update cascade).


I'd also suggest getting an intro-to-sql book as this is all reasonably 
basic stuff.


--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] Re: mysql test and error

2008-02-24 Thread Nathan Rixham

hE wrote:

hi,
I found an e-book in the net about php and mysql and with its sample 
program I am trying to test whether I have mysql working correctly or 
not. the following program gives error message. why?


html
headtitleTest MySQL/title/head
body
!-- mysql_up.php --
?php3
$host=”localhost”;
$user=”root”;
$password=””;
mysql_connect($host,$user,$password);
$sql=”show status”;
$result = mysql_query($sql);
if ($result == 0)
echo “bError “ . mysql_errno() . “: “
. mysql_error() . “/b”;
else
{
?
!-- Table that displays the results --
table border=”1”
trtdbVariable_name/b/tdtdbValue/b
/td/tr
?php3
for ($i = 0; $i  mysql_num_rows($result); $i++) {
echo “TR”;
$row_array = mysql_fetch_row($result);
for ($j = 0; $j  mysql_num_fields($result); $j++)
{
echo “TD” . $row_array[$j] . “/td”;
}
echo “/tr”;
}
?
/table
?php3 } ?
/body/html


because the ebook is ancient and ?php3 isn't used anymore [i'd sure hope]

try..

html
headtitleTest MySQL/title/head
body
!-- mysql_up.php --
?php
$host=”localhost”;
$user=”root”;
$password=””;
mysql_connect($host,$user,$password) or die(mysql_errno() . “: “. 
mysql_error());

$sql=”show status”;
$result = mysql_query($sql);
if ($result == 0)
echo “bError “ . mysql_errno() . “: “
. mysql_error() . “/b”;
else
{
?
!-- Table that displays the results --
table border=”1”
trtdbVariable_name/b/tdtdbValue/b
/td/tr
?php
for ($i = 0; $i  mysql_num_rows($result); $i++) {
echo “TR”;
$row_array = mysql_fetch_row($result);
for ($j = 0; $j  mysql_num_fields($result); $j++)
{
echo “TD” . $row_array[$j] . “/td”;
}
echo “/tr”;
}
?
/table
/body/html

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



Re: [PHP] Re: mysql input

2008-02-19 Thread Richard Heyes

Shawn McKenzie wrote:

nihilism machine wrote:

I have a user saving a VARCHAR(255) field in a mysql db which has single
quotes in the text, how can i replace them so that they dont fuck up my
mysql command?

-e



Have you tried:  dont_fuck_up_my_mysql_command()


Hrmph, I can't seem to find that in the manual...

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and Helpdesk software hosted for you - no
installation, no maintenance, new features automatic and free

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



Re: [PHP] Re: mysql input

2008-02-19 Thread Zoltán Németh
2008. 02. 19, kedd keltezéssel 11.03-kor Nathan Rixham ezt írta:
 Richard Heyes wrote:
  Shawn McKenzie wrote:
  nihilism machine wrote:
  I have a user saving a VARCHAR(255) field in a mysql db which has single
  quotes in the text, how can i replace them so that they dont fuck up my
  mysql command?
 
  -e
 
 
  Have you tried:  dont_fuck_up_my_mysql_command()
  
  Hrmph, I can't seem to find that in the manual...
  
 
 it's been depricated I heard in favour of unfuck();
 

as I remember its also in SPL.
$whatever = new MySqlCommandUnFucker($command);
$whatever-unFuck();

:D

greets
Zoltán Németh

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



Re: [PHP] Re: mysql input

2008-02-19 Thread Nathan Rixham

Nathan Rixham wrote:

Zoltán Németh wrote:

2008. 02. 19, kedd keltezéssel 11.03-kor Nathan Rixham ezt írta:

Richard Heyes wrote:

Shawn McKenzie wrote:

nihilism machine wrote:
I have a user saving a VARCHAR(255) field in a mysql db which has 
single
quotes in the text, how can i replace them so that they dont fuck 
up my

mysql command?

-e


Have you tried:  dont_fuck_up_my_mysql_command()

Hrmph, I can't seem to find that in the manual...


it's been depricated I heard in favour of unfuck();



as I remember its also in SPL.
$whatever = new MySqlCommandUnFucker($command);
$whatever-unFuck();

:D

greets
Zoltán Németh


?php

class MySqlCommandUnFucker {

 public function _unfucker($toUnFuck) {
  if(function_exists('get_magic_quotes_gpc')) {
   if (get_magic_quotes_gpc()) {
$in = stripslashes($toUnFuck);
   }
  }
  return $in;
 }

 public function unFuck($fucked) {

  if(function_exists('mysql_real_escape_string')) {
   return mysql_real_escape_string($this-_unfucker($fucked));
  } else {
   return $fucked;
  }
 }
}
?


usage:
$unfucker = new MySqlCommandUnFucker;
$sql = $unfucker -unFuck($sql);

:)


apologies! a slight correction for nihilism (the class does work..)

usage:
$unfucker = new MySqlCommandUnFucker;
$sql = INSERT INTO tablename (varcol) VALUES (';
$sql .= $unfucker-unFuck($myfuckedvariable);
$sql .= ');

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



Re: [PHP] Re: mysql input

2008-02-19 Thread Nathan Rixham

Zoltán Németh wrote:

2008. 02. 19, kedd keltezéssel 11.03-kor Nathan Rixham ezt írta:

Richard Heyes wrote:

Shawn McKenzie wrote:

nihilism machine wrote:

I have a user saving a VARCHAR(255) field in a mysql db which has single
quotes in the text, how can i replace them so that they dont fuck up my
mysql command?

-e


Have you tried:  dont_fuck_up_my_mysql_command()

Hrmph, I can't seem to find that in the manual...


it's been depricated I heard in favour of unfuck();



as I remember its also in SPL.
$whatever = new MySqlCommandUnFucker($command);
$whatever-unFuck();

:D

greets
Zoltán Németh


?php

class MySqlCommandUnFucker {

 public function _unfucker($toUnFuck) {
  if(function_exists('get_magic_quotes_gpc')) {
   if (get_magic_quotes_gpc()) {
$in = stripslashes($toUnFuck);
   }
  }
  return $in;
 }

 public function unFuck($fucked) {
  if(function_exists('mysql_real_escape_string')) {
   return mysql_real_escape_string($this-_unfucker($fucked));
  } else {
   return $fucked;
  }
 }
}
?


usage:
$unfucker = new MySqlCommandUnFucker;
$sql = $unfucker -unFuck($sql);

:)

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



Re: [PHP] Re: mysql input

2008-02-19 Thread Nathan Rixham

Richard Heyes wrote:

Shawn McKenzie wrote:

nihilism machine wrote:

I have a user saving a VARCHAR(255) field in a mysql db which has single
quotes in the text, how can i replace them so that they dont fuck up my
mysql command?

-e



Have you tried:  dont_fuck_up_my_mysql_command()


Hrmph, I can't seem to find that in the manual...



it's been depricated I heard in favour of unfuck();

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



Re: [PHP] Re: mysql input

2008-02-19 Thread Nathan Rixham

Bastien Koert wrote:

thats awesome
 
bastien To: php-general@lists.php.net Date: Tue, 19 Feb 2008 11:21:02 + From: [EMAIL PROTECTED] Subject: Re: [PHP] Re: mysql input  Zoltán Németh wrote:  2008. 02. 19, kedd keltezéssel 11.03-kor Nathan Rixham ezt írta:  Richard Heyes wrote:  Shawn McKenzie wrote:  nihilism machine wrote:  I have a user saving a VARCHAR(255) field in a mysql db which has single  quotes in the text, how can i replace them so that they dont fuck up my  mysql command?   -e   Have you tried: dont_fuck_up_my_mysql_command()  Hrmph, I can't seem to find that in the manual...   it's been depricated I heard in favour of unfuck(); as I remember its also in SPL.  $whatever = new MySqlCommandUnFucker($command);  $whatever-unFuck();:Dgreets  Zoltán Németh  ?php  class MySqlCommandUnFucker {  public function _unfucker($toUnFuck) { if(function_exists('get_magic_quotes_gpc')) { if (get_mag
ic_quotes_gpc()) { $in = stripslashes($toUnFuck); } } return $in; }  public function unFuck($fucked) { if(function_exists('mysql_real_escape_string')) { return mysql_real_escape_string($this-_unfucker($fucked)); } else { return $fucked; } } } ?   usage: $unfucker = new MySqlCommandUnFucker; $sql = $unfucker -unFuck($sql);  :)  --  PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 

_





:)

although $in should be $toUnFuck; just can't be bothered chanign a mock 
class again!


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



RE: [PHP] Re: mysql input

2008-02-19 Thread Bastien Koert

thats awesome
 
bastien To: php-general@lists.php.net Date: Tue, 19 Feb 2008 11:21:02 + 
From: [EMAIL PROTECTED] Subject: Re: [PHP] Re: mysql input  Zoltán Németh 
wrote:  2008. 02. 19, kedd keltezéssel 11.03-kor Nathan Rixham ezt írta:  
Richard Heyes wrote:  Shawn McKenzie wrote:  nihilism machine wrote: 
 I have a user saving a VARCHAR(255) field in a mysql db which has single 
 quotes in the text, how can i replace them so that they dont fuck up my 
 mysql command?   -e   Have you tried: 
dont_fuck_up_my_mysql_command()  Hrmph, I can't seem to find that in the 
manual...   it's been depricated I heard in favour of unfuck();
 as I remember its also in SPL.  $whatever = new 
MySqlCommandUnFucker($command);  $whatever-unFuck();:D
greets  Zoltán Németh  ?php  class MySqlCommandUnFucker {  public 
function _unfucker($toUnFuck) { if(function_exists('get_magic_quotes_gpc')) { 
if (get_magic_quotes_gpc()) { $in = stripslashes($toUnFuck); } } return 
$in; }  public function unFuck($fucked) { 
if(function_exists('mysql_real_escape_string')) { return 
mysql_real_escape_string($this-_unfucker($fucked)); } else { return 
$fucked; } } } ?   usage: $unfucker = new MySqlCommandUnFucker; $sql 
= $unfucker -unFuck($sql);  :)  --  PHP General Mailing List 
(http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 
_



Re: [PHP] Re: mysql input

2008-02-19 Thread admin
Filter the data
 
$data = str_replace(', , $data);

I am sure there are many ways to filter the data before insert.




(If you are SURE you have A.D.D. then it wont matter what I say to you.)
Rick B.




On Feb 18, 2008 11:24 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:
 nihilism machine wrote:
  I have a user saving a VARCHAR(255) field in a mysql db which has single
  quotes in the text, how can i replace them so that they dont fuck up my
  mysql command?
 
  -e


 Have you tried:  dont_fuck_up_my_mysql_command()

That has thrown E_DEPRECATED since PHP 4.1.  RTFM, n00b.  ;-D

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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

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



Re: [PHP] Re: mysql input

2008-02-19 Thread Daniel Brown
On Feb 18, 2008 11:24 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:
 nihilism machine wrote:
  I have a user saving a VARCHAR(255) field in a mysql db which has single
  quotes in the text, how can i replace them so that they dont fuck up my
  mysql command?
 
  -e


 Have you tried:  dont_fuck_up_my_mysql_command()

That has thrown E_DEPRECATED since PHP 4.1.  RTFM, n00b.  ;-D

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



[PHP] Re: mysql input

2008-02-18 Thread Shawn McKenzie
nihilism machine wrote:
 I have a user saving a VARCHAR(255) field in a mysql db which has single
 quotes in the text, how can i replace them so that they dont fuck up my
 mysql command?
 
 -e


Have you tried:  dont_fuck_up_my_mysql_command()

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



[PHP] Re: mysql question #2

2008-02-10 Thread Shawn McKenzie
nihilism machine wrote:
 Ok, I read the php.net info. so with this function though:
 
 public function select_one($sql) {
 $this-last_query = $sql;
 $r = mysql_query($sql);
 if (!$r) {
 $this-last_error = mysql_error();
 return false;
 }
 if (mysql_num_rows($r) != 1) {
 return false; 
 }
 $ret = mysql_result($r, 0);
 mysql_free_result($r);
 if ($this-auto_slashes) {
 return stripslashes($ret);
 } else {
 return $ret;
 }
 }
 
 
 how can i get the contents of a column in the returned row say for
 something called Email as the column name. here is my code now:

HUH?

 
 // Attempt to login a user
 public function CheckValidUser($Email, $Password) {
 $PasswordEncoded = $this-encode($Password);
 $sql = SELECT * FROM CMS_Users WHERE Email='$Email' AND
 Password='$PasswordEncoded';
 $result = $this-DB-select_one($sql);
 if ($result) {
 // User info stored in Sessions
 $_SESSION['Status'] = loggedIn;
 $_SESSION['ID'] = $row['ID'];
 $_SESSION['Email'] = $row['Email'];
 $_SESSION['AdminLevel'] = $row['AdminLevel'];
 $_SESSION['FirstName'] = $row['FirstName'];
 $_SESSION['LastName'] = $row['LastName'];
 return true;
 } else {
 return false;
 }
 }

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



[PHP] Re: mysql date question

2008-01-03 Thread Adam Williams
nevermind, figure it out, had to take the ' ' away from 
contract.length_start :)


Adam Williams wrote:

I have a field in mysql as shown by describe contract;

| length_start | date| YES  | | NULL
||


Which stores it in the mysql format of -MM-DD.  However, I need 
the output of my select statement to show it in MM-DD- format.  I 
can select it to see the date in the field:


select length_start from contract where user_id = 1;
+--+
| length_start |
+--+
| 2006-01-12   |
+--+
1 row in set (0.00 sec)

so then I do my date_format() select statement, but it returns a NULL 
value.  Why?


select date_format('contract.length_start', '%m-%d-%Y') as 
length_start from contract where user_id = 1;

+--+
| length_start |
+--+
| NULL |
+--+
1 row in set, 1 warning (0.00 sec)




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



[PHP] Re: MySQL Identifying worst-performing codes

2007-11-08 Thread Colin Guthrie
Lasitha Alawatta wrote:
 There is  a tool call “idera” (SQL diagnostic manager). Basically it is
 a performance monitoring and diagnostics tool.
 
 It has a feature; 
 Identifying of worst-performing codes –
 
 Identifies performance bottlenecks such as the worst-performing stored
 procedures, long-running queries, most frequently run queries, SQL
 Statements and SQL batches
 
 http://www.idera.com/Products/SQLdm/Features.aspx
  
 
 I’m looking for a same like tool for MySQL. Is anyone have any  ideas.


I know this is OT for this list but.

In addition to the slow query logging I mentioned before (which you
seemed to appreciate :)), I've just stumbled across this:
http://rackerhacker.com/mysqltuner/

HTH some people.

Col

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



[PHP] Re: MySQL and SVN

2007-10-25 Thread Jens Kleikamp

Emil Edeholt schrieb:

Hi all!

Maybe slightly off topic, but I would like to know how you guys handle 
mysql structures between different computers (and for that matter from 
the developer desktop to the stable server).


I work on my home and my office computer with the same php projects. I 
keep all my php files on svn, so I just update and commit the first and 
last thing I do when I switch computer. The problem is when I've made a 
change in the structure of my mysql tables. I usually try to save a dump 
and ssh it to my server and download and import it on the other 
computer. But that feels clumsy, and if I've made changes on both 
computers I have no simple way to merge the structures like I can in svn.


How do you handle this in your projects?

Best Regards Emil Edeholt


Hi Emil,

I use pear MDB2_Schema package to handle and manage my database structures.

Another option would be http://dbdeploy.com/. There is also a pear 
proposal: http://pear.php.net/pepr/pepr-proposal-show.php?id=507.


Both, very interesting components in the area of database deployment.

Cheers,
Jens

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



[PHP] Re: mySQL Results To XML -- my xmltag() functions

2007-10-06 Thread Timothy Murphy
posted  mailed

mike wrote:

 I made this at one point:
 
 function array2xml($array, $complete = true) {
 $xml = $array[NODE] ;
 unset($array['NODE']);
 ksort($array);
 foreach(array_keys($array) as $key) {
 $xml .= $key=\$array[$key]\ ;
 }
 if($complete) {
 $xml .= /;
 }
 $xml .= ;
 return $xml;
 }

What about the reverse - converting the XML back to MySQL?
(I'm interested for an address book project,
but don't know too much of XML or mySQL!)

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



[PHP] Re: MySQL Identifying worst-performing codes

2007-10-04 Thread Colin Guthrie
Lasitha Alawatta wrote:
 There is  a tool call “idera” (SQL diagnostic manager). Basically it is
 a performance monitoring and diagnostics tool.
 
 It has a feature; 
 
  
 
 Identifying of worst-performing codes –
 
 Identifies performance bottlenecks such as the worst-performing stored
 procedures, long-running queries, most frequently run queries, SQL
 Statements and SQL batches

You can just turn on the MySQL option log slow queries and it logs
them for you. Make those more efficient and you've already taken care of
a lot of the low hanging fruit for db optimisation.

Col.

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



[PHP] Re: mysql question

2007-07-16 Thread Daniel Kullik
Man-wai Chang wrote:
 I tried to post to mysql.general, but the message never appeared. So I
 am trying my luck here.
 
 How could I build an index for a table created using the  CREATE
 TEMPORARY TABLE ... SELECT ... FROM ... syntax, using an account
 without the privilege to use ALTER TABLE?
 
See the docs.

CREATE INDEX syntax:
http://dev.mysql.com/doc/refman/5.0/en/create-index.html

About privileges:
http://dev.mysql.com/doc/refman/5.0/en/grant.html

You didn't send much info along, so I assume you're using some version
of MySQL 5.0.

HTH

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



[PHP] Re: mysql question

2007-07-16 Thread Man-wai Chang
 You didn't send much info along, so I assume you're using some version
 of MySQL 5.0.

Thanks. I figured it out (doesn't need 5.0):

CREATE TEMPORARY haha ( KEY (field1), KEY (field2) )
AS
SELECT  po_no, po_date, item_no FROM . WHERE 

Then I don't need the privilege for ALTER TABLE.


-- 
  .~.   Might. Courage. Vision. Sincerity. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Fedora Core 4)  Linux 2.6.17-1.2142_FC4
  ^ ^   17:33:02 up 165 days 1:17 1 user load average: 0.03 0.08 0.08

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



[PHP] Re: mysql question

2007-07-16 Thread Man-wai Chang
 CREATE TEMPORARY haha ( KEY (field1), KEY (field2) )
 AS
 SELECT  po_no, po_date, item_no FROM . WHERE 
 Then I don't need the privilege for ALTER TABLE.

I meant I could build index on a temp table without
the privilege to use ALTER TABLE by making the index
definitions as part of the CREATE TEMPORARY statement.

-- 
  .~.   Might. Courage. Vision. Sincerity. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Fedora Core 4)  Linux 2.6.17-1.2142_FC4
  ^ ^   17:40:01 up 165 days 1:24 1 user load average: 0.02 0.04 0.06

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



Re: [PHP] Re: MySQL exceptions

2007-04-10 Thread Richard Lynch
On Mon, April 9, 2007 6:34 pm, Davi wrote:
 Em Segunda 09 Abril 2007 21:21, itoctopus escreveu:
 Use the @ in front of the statement and then check the result if
 it's
 valid.

 --
 itoctopus - http://www.itoctopus.com


 I already use it, but I believe that try-catch would be _more_
 useful...
 With try-cath I can _get_ more errors instead with a if-then-else
 clasule...

I don't think MySQL or even mysqli have any kind of exception throwing
yet, if ever.

 i.e.: with if-then-else:

 $connect=mysql_connect(...);

 if($connect)
 {
 if(!(mysql_select_db(...,$connect)))
 {
 echo Impossible select db.;
 }
 }
 else
 {
 echo Impossible connect to server.;
 }

If you didn't connect to the server, doing the select_db is rather
pointless, so I'd check the $connect FIRST, and deal with that
completely before trying to use a dead connection.

You don't put more money into the phone if the line is dead, do you?
:-)

 If I want to get some debug info, I put some mysql_error() and I get
 the error
 string and error code (mysql_errno()), but I believe that with
 exception I
 can get some useful error message without... hum... *critical*
 infos...

There is nothing you'd be able to get from a thrown exception that you
can't get with mysql_errno() and vice versa, in theory.

In reality, it will probably be some time before every possile MySQL
error code number (and they are legion) would be encapsulated as an
Exception.

So for maxiumu customization, short-term, mysql_errno() is probably
the way to go.

I often, for example, simply want to IGNORE mysql_errno($connection)
== 1062 becaue it's just a duplicate key insert, and that means I've
already dealt with whatever I was trying to insert, and just don't
care.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Re: MySQL exceptions

2007-04-10 Thread Davi
Em Terça 10 Abril 2007 19:26, Richard Lynch escreveu:

 I don't think MySQL or even mysqli have any kind of exception throwing
 yet, if ever.

Googling a bit more, I think that MySQL already have some exceptions [1], the 
question, now, is: how to catch them with PHP? =]

I think that just using the exceptions name I can do that... So... Let's make 
some testes... =]


  i.e.: with if-then-else:
 
  $connect=mysql_connect(...);
 
  if($connect)
  {
  if(!(mysql_select_db(...,$connect)))
  {
  echo Impossible select db.;
  }
  }
  else
  {
  echo Impossible connect to server.;
  }

 If you didn't connect to the server, doing the select_db is rather
 pointless, so I'd check the $connect FIRST, and deal with that
 completely before trying to use a dead connection.

If I don't connect to server, I'll echo an error... Otherwise, I'll select 
DB...


 You don't put more money into the phone if the line is dead, do you?

 :-)
 :

 There is nothing you'd be able to get from a thrown exception that you
 can't get with mysql_errno() and vice versa, in theory.

Sure!
But with try-catch, I get some advantages [2]... It's a _big_ project... So, I 
_need_ OOP structure...


 In reality, it will probably be some time before every possile MySQL
 error code number (and they are legion) would be encapsulated as an
 Exception.

 So for maxiumu customization, short-term, mysql_errno() is probably
 the way to go.

 I often, for example, simply want to IGNORE mysql_errno($connection)
 == 1062 becaue it's just a duplicate key insert, and that means I've
 already dealt with whatever I was trying to insert, and just don't
 care.

 --


BTW, thanks a lot... =]


[1] - http://ehuss.org/mysql/api/mysql.exceptions-module.html
[2] - 
http://java.sun.com/docs/books/tutorial/essential/exceptions/advantages.html

-- 
Davi Vidal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--

Agora com fortune:
You know you're using the computer too much when:
when your life becomes routine enough to write a script to do it for you.
-- smonijhay1

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



[PHP] Re: MySQL exceptions

2007-04-09 Thread itoctopus
Use the @ in front of the statement and then check the result if it's valid.

--
itoctopus - http://www.itoctopus.com
Davi [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 Hi all!

 I'm developing an OOP app using PHP 5.
 I want to use try-catch with mysql functions.

 So, the question is: what are the exceptions classes of MySQL?
 Where can I found it?

 TIA


 --
 Davi Vidal
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 --

 Agora com fortune:
 BOFH Excuse #426:

 internet is needed to catch the etherbunny

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



Re: [PHP] Re: MySQL exceptions

2007-04-09 Thread Davi
Em Segunda 09 Abril 2007 21:21, itoctopus escreveu:
 Use the @ in front of the statement and then check the result if it's
 valid.

 --
 itoctopus - http://www.itoctopus.com


I already use it, but I believe that try-catch would be _more_ useful...
With try-cath I can _get_ more errors instead with a if-then-else clasule...

i.e.: with if-then-else:

$connect=mysql_connect(...);

if($connect)
{
if(!(mysql_select_db(...,$connect)))
{
echo Impossible select db.;
}
}
else
{
echo Impossible connect to server.;
}

If I want to get some debug info, I put some mysql_error() and I get the error 
string and error code (mysql_errno()), but I believe that with exception I 
can get some useful error message without... hum... *critical* infos...

try
{
$connect=mysql_connect(...);
mysql_select_db(...,$connect);
}
catch (CONNECTION_EXCEPTION $e)
{
echo Impossible connect: .$e-get_message();
}
catch (SELECT_EXCEPTION $e)
{
echo Impossible select db: .$e-get_message();
}
catch (ANOTHER_USEFUL_EXCEPTION $e)
{
echo another error: .$e-get_message();
}
catch (Exception $e)
{
echo Unknown error: .$e-get_message();
}


I'm right?

TIA


-- 
Davi Vidal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--

Agora com fortune:
Stanford women are responsible for the success of many Stanford men:
they give them just one more reason to stay in and study every night.

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



[PHP] Re: mysql ORDER BY problem

2006-06-18 Thread Michael Rasmussen
On Sun, 18 Jun 2006 15:55:14 -0500, Rob W. wrote:

 
 Is there a way with my mysql query so that I can list the numbers in
 correct order?
 
In what way is this problem related to PHP?
Try a MySQL group instead.

-- 
Hilsen/Regards
Michael Rasmussen
http://keyserver.veridis.com:11371/pks/lookup?op=getsearch=0xE3E80917

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



Re: [PHP] Re: mysql ORDER BY problem

2006-06-18 Thread Rob W.

It's not in general to mysql, it's how php and mysql is displaying it.


- Original Message - 
From: Michael Rasmussen [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Sunday, June 18, 2006 4:51 PM
Subject: [PHP] Re: mysql ORDER BY problem



On Sun, 18 Jun 2006 15:55:14 -0500, Rob W. wrote:



Is there a way with my mysql query so that I can list the numbers in
correct order?


In what way is this problem related to PHP?
Try a MySQL group instead.

--
Hilsen/Regards
Michael Rasmussen
http://keyserver.veridis.com:11371/pks/lookup?op=getsearch=0xE3E80917

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





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



Re: [PHP] Re: mysql ORDER BY problem

2006-06-18 Thread John Nichel

Rob W. wrote:

It's not in general to mysql, it's how php and mysql is displaying it.



That's not what you asked.  You asked how to do it with your query, 
which has nothing, nadda, zip to do with PHP.  You want MySQL to do the 
sorting, look at the MySQL manual under the select syntax, or ask on the 
MySQL list.  You want PHP to do the sorting, look at PHP's array 
functions; however, it'd be more efficient to go the MySQL route.



- Original Message - From: Michael Rasmussen [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Sunday, June 18, 2006 4:51 PM
Subject: [PHP] Re: mysql ORDER BY problem



On Sun, 18 Jun 2006 15:55:14 -0500, Rob W. wrote:



Is there a way with my mysql query so that I can list the numbers in
correct order?


In what way is this problem related to PHP?
Try a MySQL group instead.




--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com

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



RE: [PHP] Re: mysql ORDER BY problem

2006-06-18 Thread Peter Lauri
Just do:

SELECT * FROM thetable ORDER BY yourfieldyouwanttoorder

If you want it in reverse order you add DESC in the end.

/Peter


-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 19, 2006 5:51 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Re: mysql ORDER BY problem

Rob W. wrote:
 It's not in general to mysql, it's how php and mysql is displaying it.
 

That's not what you asked.  You asked how to do it with your query, 
which has nothing, nadda, zip to do with PHP.  You want MySQL to do the 
sorting, look at the MySQL manual under the select syntax, or ask on the 
MySQL list.  You want PHP to do the sorting, look at PHP's array 
functions; however, it'd be more efficient to go the MySQL route.

 - Original Message - From: Michael Rasmussen [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Sent: Sunday, June 18, 2006 4:51 PM
 Subject: [PHP] Re: mysql ORDER BY problem
 
 
 On Sun, 18 Jun 2006 15:55:14 -0500, Rob W. wrote:


 Is there a way with my mysql query so that I can list the numbers in
 correct order?

 In what way is this problem related to PHP?
 Try a MySQL group instead.



-- 
By-Tor.com
...it's all about the Rush
http://www.by-tor.com

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

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



[PHP] Re: mysql query/$post problem

2006-03-27 Thread Barry

Mark wrote:

I havnt even tried this query but i know its wrong can anyone help!

How do you know it's wrong ? O_o


***
?php
include(header.php);
include(connect.php);

$comp_id = $_SESSION['comp_id'];
$user_id = $_SESSION['user_id'];

// Grab variables and insert into database

$avname = $_POST['avname'];


$query = INSERT INTO users AVATARS WHERE id =$user_id '','$avname');
$query = INSERT INTO users (AVATARS) VALUES ('$avname') WHERE id = 
$user_id;


This works only if the $avname is a STRING!


mysql_query($query);s

--^
This will cause an error.
That's why you should test scripts before you post em ...


mysql_close();

include(footer.html);
?

**



I am trying to insert the value of $avname into the users table, into the 
avatar field. 

Yeah seems, so ;)

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] Re: MySql connection error on win XP for script that works on Freebsd 5.3

2005-10-26 Thread Holografix
Hi
See this
http://dev.mysql.com/doc/refman/5.0/en/old-client.html

Best regards

Vizion [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
I have just installed MySql on Win XP and am attempting to run a php script 
to
 create some databases. The script works fine on FreeBSD 5.3 running
 mysql-client-5.0.11 and mysql-server-5.0.11.

 MySQL has been installed on windows XP using a download of
 mysql-5.0.13-rc-win32.zip. Test.php reports php version 4.3.1.0 and is
 installed with ZendStudio which I am currently testing on win XP as I 
 cannot
 yet  get any version of Zend later than 3.x to run on FreeBSD.

 The username for mysql is 10 chars with a password of 8 chars and is able 
 to
 login successfully from the command line.

 However when attempting to login via the script I get the following error:

 Error while connecting to MySQL: Client does not support authentication
 protocol requested by server; consider upgrading MySQL client.

 I have searched the mysql website and located an article which shows 
 reference
 to this error indicating that the client may need to be upgraded but as I 
 am
 using the mysql-5.0.13-rc-win32.zip package I am cautious about assuming 
 that
 that is the actual cause.

 I am curious whether it is something to do with the php version.

 Does anyone know how I can fix this?

 Please ask for additional information you think might be helpful
 Thanks in advance

 david


 -- 
 40 yrs navigating and computing in blue waters.
 English Owner  Captain of British Registered 60' bluewater Ketch S/V 
 Taurus.
 Currently in San Diego, CA. Sailing bound for Europe via Panama Canal 
 after
 completing engineroom refit. 

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



[PHP] Re: mysql table row updation based on user input.

2005-09-18 Thread John Taylor-Johnston
Me thinks you have to name the checkboxes differently, otherwise the 
post variable will only take the last value it found, overwriting 
previous values. Otherwise they act like radioboxes.


print TD style='border: 1pt solid black cell-padding: 3px'input type='checkbox' name=\id[]\ value=\.$row[id].\ /TD;  
 



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



Re: [PHP] Re: mysql table row updation based on user input.

2005-09-18 Thread Jasper Bryant-Greene

John Taylor-Johnston wrote:
Me thinks you have to name the checkboxes differently, otherwise the 
post variable will only take the last value it found, overwriting 
previous values. Otherwise they act like radioboxes.


print TD style='border: 1pt solid black cell-padding: 
3px'input type='checkbox' name=\id[]\ value=\.$row[id].\ 
/TD;   





No, he's passing an array of checkboxes -- see the [] ?

If you haven't seen that done before check out these pages:
http://php.net/language.variables.external#AEN3832
http://php.net/faq.html#faq.html.arrays

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

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



[PHP] Re: mysql problem- I know it isn't strictly php

2005-07-20 Thread Ethilien
That last line always causes me problems, I think it is probably a 
difference in versions of mysql. Just change the last line to:


);

without any of the text in their. It doesn't really do much anyway.

Ross wrote:

Hi all,

I am trying to create a table on the remote server but it never seems to 
work


CREATE TABLE `sheet1` (
  `id` int(10) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL default '',
  `fname` varchar(255) NOT NULL default '',
  `sname` varchar(255) default NULL,
  `job_title` varchar(255) default NULL,
  `organisation` varchar(255) default NULL,
  `email` varchar(255) default NULL,
  `street` varchar(255) default NULL,
  `city` varchar(255) default NULL,
  `postcode` varchar(255) default NULL,
  `office_tel` varchar(255) default NULL,
  `mobile` varchar(255) default NULL,
  `fax` varchar(255) default NULL,
  `web` varchar(255) default NULL,
  `add_info` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=303 ;


There seems to be a problem with the last line (this is exported from my 
local server). I am just learning about mySql as I go so have no real clue 
about CHARSET and ENGINE (which I believe may be the problem)


This is the error

1064 - 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 
'DEFAULT CHARSET=latin1 AUTO_INCREMENT=303' at line 18


and this is what the manual  says (not very helpful)

a.. Error: 1064 SQLSTATE: 42000 (ER_PARSE_ERROR)

Message: %s near '%s' at line %d


Any help will be appreciated.

R. 


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



[PHP] Re: MySQL error

2005-07-01 Thread Jasper Bryant-Greene

Wessley Roche wrote:

I'm having a problem with the following code:

$sql = LOAD DATA LOCAL INFILE '/path/to/file.txt' INTO TABLE  `mytable` 
FIELDS TERMINATED BY '\t' ESCAPED BY '\' LINES TERMINATED  BY '\n';

mysql_query($sql) or die('brbr'.mysql_error());

I get this MySQL error:
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 ''' at 
line 2


You're on the wrong list. You want the MySQL mailing list.

Just as a pointer, you probably want ESCAPED BY '\'' rather than 
ESCAPED BY '\' (added a ' to close the first quote, as the second one 
is escaped.


Jasper

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



[PHP] Re: MySql injections....

2005-05-11 Thread M. Sokolewicz
[EMAIL PROTECTED] wrote:
Hi,
This is not the proper list to put this question but i hope you can help me. 
Does anyone know a good tutorial about mysql injections?

Thanks a lot for your help

what's there to make a tutorial about? :|
If you can get out of a value via a variable, then that means there's a 
possibility for a SQL injection. Easy as that...

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


Re: [PHP] Re: MySql injections....

2005-05-11 Thread Richard Lynch
On Wed, May 11, 2005 3:36 am, M. Sokolewicz said:
 [EMAIL PROTECTED] wrote:

 Hi,
 This is not the proper list to put this question but i hope you can help
 me.
 Does anyone know a good tutorial about mysql injections?

 Thanks a lot for your help


 what's there to make a tutorial about? :|
 If you can get out of a value via a variable, then that means there's a
 possibility for a SQL injection. Easy as that...

Actually...

The combinations of SQL injections and potential statements and tips to
scrub data could fill a good chapter in a book, much less a one-page
tutorial...

Just my opinion.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: mysql blob datatype for documents

2005-04-18 Thread Satyam
Dave Bosky [EMAIL PROTECTED] wrote in message

Would it be better to store uploaded pdf, word, or excel documents in a
MySql blob field rather than keeping them in a directory?

I really want to secure the documents and limit document access to
specific users.

 Curious

Dave

---
Obscuring access to information is not a safe security policy, it just makes 
it harder to some, it doesn't make it foolproof against all.  And, in the 
meantime, you are placing a toll on your resources and performance for no 
real gain.

If you have lousy security, you can have it in MySql or in your directories.

Satyam 

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



[PHP] Re: mysql regexp select questions

2005-04-07 Thread Eli
Andras Kende wrote:
I would like to do the following:

mysql db:
andrew
anthony
joe
janice
john
simon

sql_query ( select names .

I would need only the distinct first character from the query
result would be: a,j,s
I think maybe its REGEXP but never did it before...
Thanks!!
Andras Kende

Try the query (no REGEXP):
SELECT DISTINCT SUBSTRING(names,0,1) FROM .
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: MySQL empty row

2005-04-05 Thread GamblerZG
DB Error: constraint violation
What DB do you use?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: MySQL empty row

2005-04-04 Thread GamblerZG
Please replace die($res-getMessage()) with 
user_error($res-getMessage(), E_USER_ERROR) and then post the output.

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


Re: [PHP] Re: MySQL empty row

2005-04-04 Thread Neo Theone
GamblerZG wrote:
Please replace die($res-getMessage()) with 
user_error($res-getMessage(), E_USER_ERROR) and then post the output.

If I uncomment this it seems to work. Not error or anything in the code.
Truely don't know what the error is.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: MySQL empty row

2005-04-04 Thread Satyam
You might have changed inadvertently one of the include files.  It might 
have trailing blanks after the final ?, which obviously you don't see, 
being blank, but they are echoed to the browser, and the header('location 
... then gives an error.  Might have nothing to do with the SQl instructions

Satyam

Neo Theone [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Until some time I could make a new empty line in mysql with this query:
 INSERT INTO `.$_SESSION['type'].`() VALUES ()
 where $_SESSION['type'] was the table I wanted to use but now I get an 
 error and since I use DB I just get this error

 INSERT INTO `authors`() VALUES ()
 *Warning*: Cannot modify header information - headers already sent by 
 (output started at 
 /usr/local/ftp/faps/public_html/pubDB/edit/newline.php:9) in 
 */usr/local/ftp/faps/public_html/pubDB/edit/newline.php* on line *19

 *This is the file
 ?php
include ./checkuser.php;

include ../modules/connect.php;
   array_pop($_REQUEST);
$query = INSERT INTO `.$_SESSION['type'].`() VALUES ();
   $res = $db-query($query);
//Always check that result is not an error
if (DB::isError($res)) {
die($res-getMessage());
}

include ../modules/disconnect.php;
   header (Location: ./edit.php?.$_SESSION['stayurl']);

 ?
 Howcome does line nine: $res = $db-query($query); write anything?? 

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



Re: [PHP] Re: MySQL empty row

2005-04-04 Thread Neo Theone
GamblerZG wrote:
Please replace die($res-getMessage()) with 
user_error($res-getMessage(), E_USER_ERROR) and then post the output.

on one table it still does not work:
this is the error:
DB Error: constraint violation
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: mySQL outputting XML

2005-03-25 Thread C Drozdowski
There is a pear package that does this: XML_sql2xml.
It's at:
http://pear.php.net/package-info.php?pacid=18
There is more info at:
http://php.chregu.tv/sql2xml/
It's pretty flexible. But not so complicated that you cannot read 
through the code to figure out what's going on.

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


[PHP] Re: mysql problems

2005-03-04 Thread Jon Drukman
Jed R. Brubaker wrote:
I have a PHP script that populates a database table. No big deal. It creates 
mailing labels. However, a weird things keeps happening - every once in a 
while, a query is run twice. It is the same query, same information, even 
the same time (there is a now() in the query - and it is identical).
create a unique index on the table so that it CAN'T possibly create 
duplicate rows.  this will cause the problematic part of your php script 
to start choking with errors about duplicate keys (assuming you're 
checking the return status of your mysql_query()'s which you should 
always be doing!!).  this should help you isolate the problem.

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


Re: [PHP] Re: mysql problems

2005-03-04 Thread Richard Lynch
Jed R. Brubaker wrote:
 Thank you both for your responces.

 Unfotuantely there is no form that instantiates this action. So the double
 submit (while a good idea), is not possible.

 As for some sample code, it is part of a rather complicated system that
 makes a number of changes but essentailly what is going on is this:

 1. Grab all items that we need to do some shipping stuff to.
 2. Foreach through the items, giving each item number to a function to
 assign it to a customer and create a mailling label.

 That simple!

 The interesting this is this - the duplicate record is inserted into the
 mailing labels queue. I can see it long before I grab the data for output
 to
 labels. Moreover, I can tell that the problem isn't in the original item
 select statement because the function (executed for each item) would have
 created different insert times in the database based on the now( ).

Show us code excerpts.

We can't second-guess from your description, as good as it is.

Pin-point the code that is doing the double insert, and print out some
debugging info there.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: mysql problems

2005-03-03 Thread Jed R. Brubaker
Thank you both for your responces.

Unfotuantely there is no form that instantiates this action. So the double 
submit (while a good idea), is not possible.

As for some sample code, it is part of a rather complicated system that 
makes a number of changes but essentailly what is going on is this:

1. Grab all items that we need to do some shipping stuff to.
2. Foreach through the items, giving each item number to a function to 
assign it to a customer and create a mailling label.

That simple!

The interesting this is this - the duplicate record is inserted into the 
mailing labels queue. I can see it long before I grab the data for output to 
labels. Moreover, I can tell that the problem isn't in the original item 
select statement because the function (executed for each item) would have 
created different insert times in the database based on the now( ).

More ideas?

Thanks!


Jed R. Brubaker [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi all -

 I could use a lead on a problem. I just don't know where to start.

 I have a PHP script that populates a database table. No big deal. It 
 creates mailing labels. However, a weird things keeps happening - every 
 once in a while, a query is run twice. It is the same query, same 
 information, even the same time (there is a now() in the query - and it is 
 identical).

 So the question is a simple one - is this a PHP problem or a MySQL 
 problem? Or somewhere in the MySQL extension? And how would I know?

 There is one clue to this otherwise vague problem. I believe that this 
 predominantly happens when the database is under an above average load.

 I would appreciate any help that I might be able to get.

 Thank you. 

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



[PHP] Re: MySQL Error 1251 / phpMyAdmin

2005-02-07 Thread Michael Stassen
You have mysql 4.1.8, but your php was built with the library for an earlier 
version, which, as the error message says, doesn't support the new, more 
secure authentication protocol.  Your choices are to tell mysql to use the 
older, less-secure protocol, or build a copy of php using your current mysql 
client library.  See the manual for more 
http://dev.mysql.com/doc/mysql/en/old-client.html.

Michael
GH wrote:
I just installed phpMyAdmin 2.6.1 on my Windows Laptop with PHP
Version 4.3.10  [Build Date  Dec 14 2004 17:46:48] and mySql 4.1.8
I am receiving the enclosed error  when I attempt to go into
phpMyAdmin and do not know how to solve the issue...
Any assistance would be greatful.
Thank you
Gary
//## ERROR RECIEVED //
Welcome to phpMyAdmin 2.6.1
phpMyAdmin tried to connect to the MySQL server, and the server
rejected the connection. You should check the host, username and
password in config.inc.php and make sure that they correspond to the
information given by the administrator of the MySQL server.
Error 
MySQL said:  

#1251 - Client does not support authentication protocol requested by server
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: MySQL Error 1251 / phpMyAdmin

2005-02-07 Thread GH
I am still new to the PHP scene could you tell me how I rebuild the
PHP with the client library...


On Mon, 07 Feb 2005 12:20:26 -0500, Michael Stassen
[EMAIL PROTECTED] wrote:
 
 You have mysql 4.1.8, but your php was built with the library for an earlier
 version, which, as the error message says, doesn't support the new, more
 secure authentication protocol.  Your choices are to tell mysql to use the
 older, less-secure protocol, or build a copy of php using your current mysql
 client library.  See the manual for more
 http://dev.mysql.com/doc/mysql/en/old-client.html.
 
 Michael
 
 GH wrote:
 
  I just installed phpMyAdmin 2.6.1 on my Windows Laptop with PHP
  Version 4.3.10  [Build Date  Dec 14 2004 17:46:48] and mySql 4.1.8
 
  I am receiving the enclosed error  when I attempt to go into
  phpMyAdmin and do not know how to solve the issue...
 
  Any assistance would be greatful.
 
  Thank you
  Gary
 
 
  //## ERROR RECIEVED //
 
  Welcome to phpMyAdmin 2.6.1
 
  phpMyAdmin tried to connect to the MySQL server, and the server
  rejected the connection. You should check the host, username and
  password in config.inc.php and make sure that they correspond to the
  information given by the administrator of the MySQL server.
 
  Error
  MySQL said:
 
  #1251 - Client does not support authentication protocol requested by server
 


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



[PHP] Re: MySQL Error 1251 / phpMyAdmin

2005-02-07 Thread Michael Stassen
The short answer is, download the php source and add
  --with-mysql=/your/path/to/mysql
to your build options.  The long answer is in the directions in the php 
manual http://us4.php.net/manual/en/install.unix.php.

Michael
GH wrote:
I am still new to the PHP scene could you tell me how I rebuild the
PHP with the client library...
On Mon, 07 Feb 2005 12:20:26 -0500, Michael Stassen
[EMAIL PROTECTED] wrote:
You have mysql 4.1.8, but your php was built with the library for an earlier
version, which, as the error message says, doesn't support the new, more
secure authentication protocol.  Your choices are to tell mysql to use the
older, less-secure protocol, or build a copy of php using your current mysql
client library.  See the manual for more
http://dev.mysql.com/doc/mysql/en/old-client.html.
Michael
GH wrote:

I just installed phpMyAdmin 2.6.1 on my Windows Laptop with PHP
Version 4.3.10  [Build Date  Dec 14 2004 17:46:48] and mySql 4.1.8
I am receiving the enclosed error  when I attempt to go into
phpMyAdmin and do not know how to solve the issue...
Any assistance would be greatful.
Thank you
Gary
//## ERROR RECIEVED //
Welcome to phpMyAdmin 2.6.1
phpMyAdmin tried to connect to the MySQL server, and the server
rejected the connection. You should check the host, username and
password in config.inc.php and make sure that they correspond to the
information given by the administrator of the MySQL server.
Error
MySQL said:
#1251 - Client does not support authentication protocol requested by server


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


[PHP] Re: MySQL Connection problem

2004-12-11 Thread Peter Lauri
It would be nice if you submit code that generates the error.

/Peter


Mike Francis [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
Hi,
I have Apache 2, PHP 5 and MySQL 4.1 installed on an XP pro box.

I have created a new database 'ijdb' with a single table 'joke' and have
entered data into two of the three fields in the table.

I can access the database / tables / data from a command prompt.

However, when I try to connect through WAMP I either receive a 'Unable to
connect to the
database server at this time.' error message - which is my default error
message, or, I receive a blank window in IE / Mozilla / Opera etc and no
error messages.

I have tried removing the @ from the file and this has no effect -
interesting?!
The error logs do not reveal anything that indicates a missing table /
field.

I wonder if anyone has any ideas ?

Cheers,
Mike

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


[PHP] Re: MySQL Excel

2004-11-12 Thread Manuel Lemos
Hello,
On 11/12/2004 07:44 PM, Sam Smith wrote:
I've got it working writing out a file (fopen) to CSV (comma delimited) and
the header('Content-Disposition: attachment; filename=myFile.csv')
method but it's clumsy for the user to figure out how to use the file.
Is there some totally slick way of spitting out a file that Excel can open
right up?
This class does exactly what you want just using 
fopen(xlsfile:/path/to/spreadsheet.xls,w) and then you use fwrite to 
send your rows of cells as serialized arrays:

http://www.phpclasses.org/xlsstream
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: MySQL scalability...

2004-10-22 Thread Kevin Grigorenko
Kevin Grigorenko [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 Now, I just found out after implementing this whole solution locally that
 when I uploaded to the server, the PHP safe_mode options are on, and
 non-overwritable.  Therefore, fopen() doesn't even work!


Well, I just figured out my own problem.  The problem was these files didn't
exist, and it couldn't create them the first time because I guess the script
didn't have write access to the directory.  I thought I checked for this
possibility before by touching the file, but I must have forgotten to set
write permissions to the 'other' group.

Are there any pitfalls in setting the directory to write permissions for
other, or should I just create all of these files individually and set
their write permissions atomically?

Sorry about that,
Thanks,
Kevin Grigorenko

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



[PHP] Re: MySQL to OO

2004-09-15 Thread Matthew Weier O'Phinney
* Neo Theone [EMAIL PROTECTED]:
 I am searching for a MySQl to Object abstraction class.
 I am thinking something like WebObjects does in Java (it is just a part) 
 in PHP. I had one for Ruby but now I have to use a DB in MySQL and such 
 a class would make it alot easier.

 Does anybody know such a project or something similar?
 I just want to avoid writing to much SQL

You might want to look into PEAR's DB_DataObject class.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



RE: [PHP] RE: MySQL PHP Examples Training Providers Required

2004-08-12 Thread Jay Blanchard
[snip]
 On Wed, 11 Aug 2004 18:20:23 -0400, Lukasz Karapuda
[EMAIL PROTECTED] wrote:
Why I chose to reply to your email is because PHP is not usually used
for
the development of more complex functionality like the Web site module
that
we have developed.
 
 I beg to differ. Many large and complex sites are written in PHP.
 There are also many large and complex programs written in PHP which
 are in production use. Take TYPO3, for example: http://www.typo3.org

I'll second that, PHP is an excellent choice for website development - 
especially when supported by the correct web server and database ;)
[/snip]

I'll third this. Extremely complex applications are programmed using
PHP. I responded off list to Michael about this, but we are using PHP to
process and report on millions of records per day in MySQL databases. 

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



Re: [PHP] RE: MySQL PHP Examples Training Providers Required

2004-08-12 Thread Harlequin
Jay, guys. Thanks very much for all your responses on this issue.

I'm sorry if I don't always reply through the group but if I am working from
the office I have a problem connecting to the mailing list. which is just
one of the reasons I prefer working from home.

I, along with your help, have instilled some level of confidence in the
languages I am using within my colleagues here at work. even though I am
knew, I am no newbie to programming and designing databases and knew that
PHP and MySQL would be up to the job. I'm particularly interested in what
you are doing with them Jay. I was very surprised to see how many record
manipulations your system manages on a daily basis - maybe one day eh...?

again: thanks very much :)
-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-
Jay Blanchard [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
[snip]
 On Wed, 11 Aug 2004 18:20:23 -0400, Lukasz Karapuda
[EMAIL PROTECTED] wrote:
Why I chose to reply to your email is because PHP is not usually used
for
the development of more complex functionality like the Web site module
that
we have developed.

 I beg to differ. Many large and complex sites are written in PHP.
 There are also many large and complex programs written in PHP which
 are in production use. Take TYPO3, for example: http://www.typo3.org

I'll second that, PHP is an excellent choice for website development -
especially when supported by the correct web server and database ;)
[/snip]

I'll third this. Extremely complex applications are programmed using
PHP. I responded off list to Michael about this, but we are using PHP to
process and report on millions of records per day in MySQL databases.

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



[PHP] RE: MySQL PHP Examples Training Providers Required

2004-08-11 Thread Lukasz Karapuda
Michael,

My company has recently developed a Web site module for a local
manufacturing company. The Web site module is a PHP and MySQL application
composed of several screens and advanced engineering functionality
(graphing, calculations etc). One of the database tables for the application
has over 110,000 records.

Why I chose to reply to your email is because PHP is not usually used for
the development of more complex functionality like the Web site module that
we have developed. The module performed well in testing. It has not been
released for production yet, so I don't have a good performance report on
the production version of the Web site module (with many concurrent users).

I could provide you the URL to the Web site when it is released to
production.

Regards,

--
Lukasz Karapuda
VP Application Development - newline Creations LLC
 e-mail: [EMAIL PROTECTED]
 http://www.thenewline.com



 -Original Message-
 From: Harlequin [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, August 10, 2004 7:07 PM
 To: [EMAIL PROTECTED]
 Subject: MySQL  PHP Examples  Training Providers Required
 
 Hi all.
 
 This might sound like a strange request but here goes.
 
 I'm looking for some examples of sites that are purely MySQL 
 and PHP running on Unix and that contain a few thousand 
 records preferably held in relational databases.
 
 Rationale:
 
 I need to justify PHP as a tool of choice over say vb.net or 
 Oracle. My recommendation, despite my limited knowledge of 
 MySQL and PHP is that even if we have 10-15 databases holding 
 upwards of 10,000 records each PHP and MySQL are the tools of 
 choice and I doubt that there are any functions missing that 
 you'd find in VB.Net. I could be wrong and if so, please let me know.
 
 My other question is that I am looking for training in the 
 UK, preferably in the North. I have no idea about 
 accreditation or certification requirements and wondered if 
 anyone could provide any recommendations...?
 
 Thanks for your time guys.
 
 --
 -
  Michael Mason
  Arras People
  www.arraspeople.co.uk
 -
 

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



Re: [PHP] RE: MySQL PHP Examples Training Providers Required

2004-08-11 Thread Justin Patrin
On Wed, 11 Aug 2004 18:20:23 -0400, Lukasz Karapuda [EMAIL PROTECTED] wrote:
 Michael,
 
 My company has recently developed a Web site module for a local
 manufacturing company. The Web site module is a PHP and MySQL application
 composed of several screens and advanced engineering functionality
 (graphing, calculations etc). One of the database tables for the application
 has over 110,000 records.
 
 Why I chose to reply to your email is because PHP is not usually used for
 the development of more complex functionality like the Web site module that
 we have developed.

I beg to differ. Many large and complex sites are written in PHP.
There are also many large and complex programs written in PHP which
are in production use. Take TYPO3, for example: http://www.typo3.org

 The module performed well in testing. It has not been
 released for production yet, so I don't have a good performance report on
 the production version of the Web site module (with many concurrent users).
 
 I could provide you the URL to the Web site when it is released to
 production.
 
 Regards,
 
 --
 Lukasz Karapuda
 VP Application Development - newline Creations LLC
  e-mail: [EMAIL PROTECTED]
  http://www.thenewline.com
 
 
 
 
  -Original Message-
  From: Harlequin [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, August 10, 2004 7:07 PM
  To: [EMAIL PROTECTED]
  Subject: MySQL  PHP Examples  Training Providers Required
 
  Hi all.
 
  This might sound like a strange request but here goes.
 
  I'm looking for some examples of sites that are purely MySQL
  and PHP running on Unix and that contain a few thousand
  records preferably held in relational databases.
 
  Rationale:
 
  I need to justify PHP as a tool of choice over say vb.net or
  Oracle. My recommendation, despite my limited knowledge of
  MySQL and PHP is that even if we have 10-15 databases holding
  upwards of 10,000 records each PHP and MySQL are the tools of
  choice and I doubt that there are any functions missing that
  you'd find in VB.Net. I could be wrong and if so, please let me know.
 
  My other question is that I am looking for training in the
  UK, preferably in the North. I have no idea about
  accreditation or certification requirements and wondered if
  anyone could provide any recommendations...?
 
  Thanks for your time guys.
 

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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



Re: [PHP] RE: MySQL PHP Examples Training Providers Required

2004-08-11 Thread Lester Caine
Justin Patrin wrote:
On Wed, 11 Aug 2004 18:20:23 -0400, Lukasz Karapuda [EMAIL PROTECTED] wrote:
Why I chose to reply to your email is because PHP is not usually used for
the development of more complex functionality like the Web site module that
we have developed.
I beg to differ. Many large and complex sites are written in PHP.
There are also many large and complex programs written in PHP which
are in production use. Take TYPO3, for example: http://www.typo3.org
I'll second that, PHP is an excellent choice for website development - 
especially when supported by the correct web server and database ;)

MANAGING a PHP project can be fun. Remember to track all changes to 
EVERY file, but the ability to drop into a particular function and make 
corrections and changes means that little niggles do not need to wait 
for a full system update like we have with older Builder C++ based 
applications.

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: [mysql]Problem with PHP5

2004-07-19 Thread [EMAIL PROTECTED]
Ciprian,
I may have missed whether or not you were able to resolve your problem 
from a couple days ago.

In one of my development environments (Win2K), I decided to install PHP 
5.0 with MySQL(i) 4.1.x support in IIS5.0 and Apache 2 (running on 
different ports).  It took a bit more work than I intended, but here's 
what I did:

FOR IIS (port 80):
1. downloaded and unzipped php-5.0.0-Win32.zip to c:\php
2. installed php as ISAPI
3. edited php-ini-recommended, tailored it to my environment, and copied 
it as php.ini into c:\winnt
NOTE: extension_dir = c:\php\ext
4. tested phpinfo() without extensions
5. edited php.ini enabling needed extensions.
NOTE: when uncommenting the line: extension=mysql.dll, changed line to 
read: extension=mysqli.dll
6. downloaded and unzipped mysql-4.1.3b-beta-win-noinstall.zip to c:\
7. configured mysql per www.mysql.com install instructions
8. copied c:\mysql\bin\libmysql.dll to c:\winnt\system32
9. restarted IIS, and IIS started successfully,
10. reloaded phpinfo(), and noticed that mysqli was properly loaded, but 
now my old mysql_connect_db scripts don't work!
Refer to the new mysqli PHP code: 
http://us3.php.net/manual/en/ref.mysqli.php
11. Here's a VERY basic example of the old mysql VS. new mysqli PHP code:

OLD mysql:
?php
// connect to the database
mysql_connect(localhost, wong, password) or die (Could not 
connect to mySQL server);

// select the database
mysql_select_db(music) or die (Could not connect to database);
// store result
$result = mysql_query(SELECT * FROM artists) or die (mysql_error());
// display returned results
while ($row = mysql_fetch_array($result))
{
   echo $row[artist], nbsp;nbsp;, $row[album];
   echo BR /;
}
// free result
mysql_free_result($result);
?

NEW mysqli:
?php
// connect to the database
$link = mysqli_connect(localhost, wong, password, music);
// check connection
if (mysqli_connect_errno()) {
  printf(Connect failed: %s\n, mysqli_connect_error());
  exit();
}
// store query
$query = SELECT * FROM artists;
// store result
$result = mysqli_query($link, $query);
// loop thru rows using associative array
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
{
   echo $row[artist], nbsp;nbsp;, $row[album];
   echo BR /;
}
// free the result
mysqli_free_result($result);
// close the link
mysqli_close($link);
?
Additionally, for Apache 2 on Win2k (running on port 82):
1. Copied php.ini to c:\Apache Groups\Apache2
2. edited httpd.conf:
- added LoadModule php5_module c:/php/php5apache2.dll
- added AddType application/x-httpd-php .php
3. Restarted Apache server
Hopes this helps.
Dan
Ciprian Constantinescu wrote:
I have included the extension. Now I get Unable to load dynamic library
'C:\php\ext\php_mysql.dll' - The specified procedure could not be found
I have in Windows\System32 the file libmysql.dll. I have also put it in the
php\ext directory without any result.
 

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


[PHP] Re: mysql connection question

2004-07-16 Thread Torsten Roehr
John Meyer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,
 For a long time, on all of my mysql pages, I've done something like this

 $conn = mysql_connect($server,$username,$password) or die(Could not
 connect)
 mysql_select_db($db);


 I've finally put that into its own script file, moved it to my include
 files, and simply included it whereever I needed a connection.  My
question
 is, could this get me into trouble if multiple people access the database
at
 the same time?

Including it is no different to placing it directly into your code. So there
will be no difference.

Regards, Torsten Roehr

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



[PHP] Re: [mysql]Problem with PHP5

2004-07-15 Thread Ciprian Constantinescu
I have included the extension. Now I get Unable to load dynamic library
'C:\php\ext\php_mysql.dll' - The specified procedure could not be found

I have in Windows\System32 the file libmysql.dll. I have also put it in the
php\ext directory without any result.

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



[PHP] Re: [mysql]Problem with PHP5

2004-07-14 Thread Ben Ramsey
Ciprian Constantinescu wrote:
I have installed PHP5 and i get the following error from a script that was
working on PHP4
 Fatal error: Call to undefined function mysql_pconnect() in
D:\htdocs\cdalex\Connections\listacon.php on line 9 
MySQL is no longer embedded in PHP, as of PHP 5.  Depending on your 
platform, you will either need to build PHP 5 with support for MySQL, or 
you will need to modify php.ini to load in the MySQL extension.

--
Regards,
 Ben Ramsey
 http://benramsey.com
---
http://www.phpcommunity.org/
Open Source, Open Community
Visit for more information or to join the movement.
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


  1   2   3   4   >