[PHP-DB] MySQL, Multiple tables, and Multipage form using sessions

2004-10-13 Thread Stuart Felenstein
Can anyone, someone please point me in the right
direction.
I have a multi page form, so at the last page I want
to insert all data into database. Basically I'm trying
to go from 0 - 90 , meaning my skills are less the
basic. And this seems like a big task.

Couple of other things.
1-There would need to be rollback.  One insert fails,
they all get rolled back.  
2-The first table that get inserted has a recordID,
from an auto inc int  field. That recordID has to be
put into all of the other child tables.
3-There are two multi select boxes.  The challenge
with them is they need to be looped in the insert to
their respecitive tables.

i.e. 

Choice of colors - 5 (multi select)

+--+--+
| RecordID | Color|
+--+--+
|  295 Blue   |
|  295 Red|
|  295 Green  |
|  295 Oragne |
---

Are there any tutorials , good books that go into this
type of depth ? Is it really simple and Im just scared
? :)

I'm open to listening , 
Thank you ,
Stuart

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



RE: [PHP-DB] MySQL, Multiple tables, and Multipage form using sessions

2004-10-13 Thread Bastien Koert
If you are usiing the INNOdb table type/engine in the mysql db, it supports 
transactions. you can wrap the entire set of sql statement in a transaction 
and they would get executed as one block. If any fail, then the whole thing 
is rolled back. This DOES NOT work with the myISAM table types.

$sql = begin ;
$sql .=insert into table 1...;
$sql .=insert into table 2...;
$sql .=insert into table N...;
$sql .=end;
$result = mysql_query($sql);
hth

From: Stuart Felenstein [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL, Multiple tables, and Multipage form using sessions
Date: Wed, 13 Oct 2004 13:41:46 -0700 (PDT)
Can anyone, someone please point me in the right
direction.
I have a multi page form, so at the last page I want
to insert all data into database. Basically I'm trying
to go from 0 - 90 , meaning my skills are less the
basic. And this seems like a big task.
Couple of other things.
1-There would need to be rollback.  One insert fails,
they all get rolled back.
2-The first table that get inserted has a recordID,
from an auto inc int  field. That recordID has to be
put into all of the other child tables.
3-There are two multi select boxes.  The challenge
with them is they need to be looped in the insert to
their respecitive tables.
i.e.
Choice of colors - 5 (multi select)
+--+--+
| RecordID | Color|
+--+--+
|  295 Blue   |
|  295 Red|
|  295 Green  |
|  295 Oragne |
---
Are there any tutorials , good books that go into this
type of depth ? Is it really simple and Im just scared
? :)
I'm open to listening ,
Thank you ,
Stuart
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] MySQL performance and crash

2004-10-02 Thread Mikhail U. Petrov
MySQL is stable enough. May be it'll be better to rewrite your code or 
to add some indexes to Users?
I can help you with ideas of refactoring.
Murat BIYIKLI wrote:

I use a Linux web server with PHP-MySQL. The hardware is good enough with
2GHz CPU and 1 GB RAM. and 7200 Cycle/min Serial ATA IDE HDD. Only one web
site is running on it and on every page of that site, it searchs for a value
in Users table including 78000 records and updates that value. The MySQL
crashes on everyweek and needs to be killed and restarted, sometimes the
server becomes unreachable and needs to be restarted.
Do you think MySQL is not stable or bad configured? How to optimize that and
monitor what goes wrong, or is it time for Oracle?
 

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


[PHP-DB] MySQL performance and crash

2004-10-01 Thread Murat BIYIKLI
I use a Linux web server with PHP-MySQL. The hardware is good enough with
2GHz CPU and 1 GB RAM. and 7200 Cycle/min Serial ATA IDE HDD. Only one web
site is running on it and on every page of that site, it searchs for a value
in Users table including 78000 records and updates that value. The MySQL
crashes on everyweek and needs to be killed and restarted, sometimes the
server becomes unreachable and needs to be restarted.
Do you think MySQL is not stable or bad configured? How to optimize that and
monitor what goes wrong, or is it time for Oracle?

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



RE: [PHP-DB] MySQL performance and crash

2004-10-01 Thread Bastien Koert
Do you have indexes on the searched columns?
Are you searching on numeric links not text (numbers are easier to compare)
What is your structure / data like?
Bastien

From: Murat BIYIKLI [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL performance and crash
Date: Fri, 1 Oct 2004 17:41:57 +0300
I use a Linux web server with PHP-MySQL. The hardware is good enough with
2GHz CPU and 1 GB RAM. and 7200 Cycle/min Serial ATA IDE HDD. Only one web
site is running on it and on every page of that site, it searchs for a 
value
in Users table including 78000 records and updates that value. The MySQL
crashes on everyweek and needs to be killed and restarted, sometimes the
server becomes unreachable and needs to be restarted.
Do you think MySQL is not stable or bad configured? How to optimize that 
and
monitor what goes wrong, or is it time for Oracle?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
Take charge with a pop-up guard built on patented Microsoft® SmartScreen 
Technology  
http://join.msn.com/?pgmarket=en-capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market_MSNIS_Taglines 
 Start enjoying all the benefits of MSN® Premium right now and get the 
first two months FREE*.

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


[PHP-DB] mysql to postgres migration blues...

2004-09-23 Thread Antoine
Hi,
I am trying to get skilled up on postgres and decided to port a little
movie database I wrote for mysql with php to access it.
I used an auto converter for the bulk and then tried to tweak. The
following code does not work but the error message it gives me is
strange. It tells me that the connection string used on line 82 (where
it calls pg_query in makelistboxentries) is invalid... but the same
string/connection works just great in another script... any pointers
appreciated.
Cheers
Antoine


?php

/* Connect to database */
$link = pg_connect(dbname=movies host=localhost user=anton
password=password)
or die(Could not connect :  . pg_result_error($link));

print TII
div id=mybody
Search by:
BR
TABLE border=1 cellpadding=10 cellspacing=10TR
TD align=center
ID: 
form name=input action=searchout.php method=post
input type=text name=mychoice
input type=hidden name = wherestring value= t1.ID = 
input type=hidden name = othertable value=movies
input type=submit value=Submit
/form
/TD
TD align=center
Name:
form name=input action=searchname.php method=post
input type=text name=mychoice
input type=submit value=Submit
/form
/TD/TR
/TABLEBR
TABLE border=1 cellpadding=10 cellspacing=10TR
TII;
makelistboxentries(Audio Language, lang, lang,  audio , 
t2.movie = t1.ID and t2.lang = );
makelistboxentries(Subtitle Language, lang, lang,  subtitles ,
 t2.movie = t1.ID and t2.lang = );
makelistboxentries(Genre, Genre, Genre,  moviegenre , 
t2.movie = t1.ID and t2.genre = );


print TINI
/TD
/TR/TABLE
brbr
PShow All:/P
form name=input action=allout.php
method=post
input type=submit value=Submit
/form
/div
div id=mymenu
PA href=index.phpH3Back to main page/H3/A/P
PA href=movie.phpAdd a movie/A/P
Pa href=audio.phpAdd a movie's audio languages/a/P
Pa href=subtitles.phpAdd a movie's subtitle languages/a/P 
Pa href=searchin.phpSearch the movies/a/P
/div
TINI;
/* Close connection */
pg_close($link);
   
function makelistboxentries($title, $mytable, $mycolumn, $othertable,
$wherestring)
{

print TD align=\center\;

print $title:;
/* Perform SQL query */
$query = SELECT $mycolumn FROM $mytable;
$result = pg_query($link,$query)
or die(Query failed :  . pg_result_error($link));
print form name=\input\ action=\searchout.php\ method=\post\;
print SELECT NAME=\mychoice\;
print option value=\zz\ SELECTEDSelect $title/option;
while ($line = pg_fetch_array($result,$result_countt++,PGSQL_ASSOC)) {
foreach ($line as $col_value) {
print (OPTION VALUE=\.$col_value.\);
print $col_value;
print (/OPTION);
}

}
print /select;
print input type=hidden name = wherestring value=\$wherestring\;
print input type=hidden name = othertable value=$othertable;
print input type=\submit\ value=\Submit\;
print /form;

pg_free_result($result);
}

?



-- 
G System, The Evolving GUniverse - http://www.g-system.at

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



RE: [PHP-DB] mysql to postgres migration blues...

2004-09-23 Thread Bastien Koert
Could be a scope problem. The connection is declared outside the function 
and the attempt to run a query is inside the function...Maybe add the global 
command to the connection. Or declare the connection inside the function...

Bastien
From: Antoine [EMAIL PROTECTED]
Reply-To: Antoine [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql to postgres migration blues...
Date: Thu, 23 Sep 2004 19:44:51 +0200
Hi,
I am trying to get skilled up on postgres and decided to port a little
movie database I wrote for mysql with php to access it.
I used an auto converter for the bulk and then tried to tweak. The
following code does not work but the error message it gives me is
strange. It tells me that the connection string used on line 82 (where
it calls pg_query in makelistboxentries) is invalid... but the same
string/connection works just great in another script... any pointers
appreciated.
Cheers
Antoine
?php
/* Connect to database */
$link = pg_connect(dbname=movies host=localhost user=anton
password=password)
or die(Could not connect :  . pg_result_error($link));
print TII
div id=mybody
Search by:
BR
TABLE border=1 cellpadding=10 cellspacing=10TR
TD align=center
ID:
form name=input action=searchout.php method=post
input type=text name=mychoice
input type=hidden name = wherestring value= t1.ID = 
input type=hidden name = othertable value=movies
input type=submit value=Submit
/form
/TD
TD align=center
Name:
form name=input action=searchname.php method=post
input type=text name=mychoice
input type=submit value=Submit
/form
/TD/TR
/TABLEBR
TABLE border=1 cellpadding=10 cellspacing=10TR
TII;
makelistboxentries(Audio Language, lang, lang,  audio , 
t2.movie = t1.ID and t2.lang = );
makelistboxentries(Subtitle Language, lang, lang,  subtitles ,
 t2.movie = t1.ID and t2.lang = );
makelistboxentries(Genre, Genre, Genre,  moviegenre , 
t2.movie = t1.ID and t2.genre = );
print TINI
/TD
/TR/TABLE
brbr
PShow All:/P
form name=input action=allout.php
method=post
input type=submit value=Submit
/form
/div
div id=mymenu
PA href=index.phpH3Back to main page/H3/A/P
PA href=movie.phpAdd a movie/A/P
Pa href=audio.phpAdd a movie's audio languages/a/P
Pa href=subtitles.phpAdd a movie's subtitle languages/a/P
Pa href=searchin.phpSearch the movies/a/P
/div
TINI;
/* Close connection */
pg_close($link);
function makelistboxentries($title, $mytable, $mycolumn, $othertable,
$wherestring)
{
print TD align=\center\;
print $title:;
/* Perform SQL query */
$query = SELECT $mycolumn FROM $mytable;
$result = pg_query($link,$query)
or die(Query failed :  . pg_result_error($link));
print form name=\input\ action=\searchout.php\ method=\post\;
print SELECT NAME=\mychoice\;
print option value=\zz\ SELECTEDSelect $title/option;
while ($line = pg_fetch_array($result,$result_countt++,PGSQL_ASSOC)) {
foreach ($line as $col_value) {
print (OPTION VALUE=\.$col_value.\);
print $col_value;
print (/OPTION);
}
}
print /select;
print input type=hidden name = wherestring value=\$wherestring\;
print input type=hidden name = othertable value=$othertable;
print input type=\submit\ value=\Submit\;
print /form;
pg_free_result($result);
}
?

--
G System, The Evolving GUniverse - http://www.g-system.at
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
Take advantage of powerful junk e-mail filters built on patented Microsoft® 
SmartScreen Technology. 
http://join.msn.com/?pgmarket=en-capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market_MSNIS_Taglines 
 Start enjoying all the benefits of MSN® Premium right now and get the 
first two months FREE*.

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


Re: [PHP-DB] mysql to postgres migration blues...

2004-09-23 Thread Eduardo Sampaio
Its because the function cannot access your connection object...
Try passing it to the function..

function makelistboxentries($link, $title, $mytable, $mycolumn, $othertable,
$wherestring)


On Thu, 23 Sep 2004 19:44:51 +0200, Antoine [EMAIL PROTECTED] wrote:
 Hi,
 I am trying to get skilled up on postgres and decided to port a little
 movie database I wrote for mysql with php to access it.
 I used an auto converter for the bulk and then tried to tweak. The
 following code does not work but the error message it gives me is
 strange. It tells me that the connection string used on line 82 (where
 it calls pg_query in makelistboxentries) is invalid... but the same
 string/connection works just great in another script... any pointers
 appreciated.
 Cheers
 Antoine
 
 ?php
 
/* Connect to database */
$link = pg_connect(dbname=movies host=localhost user=anton
 password=password)
or die(Could not connect :  . pg_result_error($link));
 
 print TII
 div id=mybody
 Search by:
 BR
 TABLE border=1 cellpadding=10 cellspacing=10TR
 TD align=center
 ID:
 form name=input action=searchout.php method=post
 input type=text name=mychoice
 input type=hidden name = wherestring value= t1.ID = 
 input type=hidden name = othertable value=movies
 input type=submit value=Submit
 /form
 /TD
 TD align=center
 Name:
 form name=input action=searchname.php method=post
 input type=text name=mychoice
 input type=submit value=Submit
 /form
 /TD/TR
 /TABLEBR
 TABLE border=1 cellpadding=10 cellspacing=10TR
 TII;
 makelistboxentries(Audio Language, lang, lang,  audio , 
 t2.movie = t1.ID and t2.lang = );
 makelistboxentries(Subtitle Language, lang, lang,  subtitles ,
  t2.movie = t1.ID and t2.lang = );
 makelistboxentries(Genre, Genre, Genre,  moviegenre , 
 t2.movie = t1.ID and t2.genre = );
 
 print TINI
 /TD
 /TR/TABLE
 brbr
 PShow All:/P
 form name=input action=allout.php
 method=post
 input type=submit value=Submit
 /form
 /div
 div id=mymenu
PA href=index.phpH3Back to main page/H3/A/P
PA href=movie.phpAdd a movie/A/P
Pa href=audio.phpAdd a movie's audio languages/a/P
Pa href=subtitles.phpAdd a movie's subtitle languages/a/P
Pa href=searchin.phpSearch the movies/a/P
 /div
 TINI;
/* Close connection */
pg_close($link);
 
 function makelistboxentries($title, $mytable, $mycolumn, $othertable,
 $wherestring)
 {
 
 print TD align=\center\;
 
 print $title:;
/* Perform SQL query */
$query = SELECT $mycolumn FROM $mytable;
$result = pg_query($link,$query)
or die(Query failed :  . pg_result_error($link));
print form name=\input\ action=\searchout.php\ method=\post\;
print SELECT NAME=\mychoice\;
print option value=\zz\ SELECTEDSelect $title/option;
while ($line = pg_fetch_array($result,$result_countt++,PGSQL_ASSOC)) {
foreach ($line as $col_value) {
print (OPTION VALUE=\.$col_value.\);
print $col_value;
print (/OPTION);
}
 
}
 print /select;
 print input type=hidden name = wherestring value=\$wherestring\;
 print input type=hidden name = othertable value=$othertable;
 print input type=\submit\ value=\Submit\;
 print /form;
 
pg_free_result($result);
 }
 
 ?
 
 --
 G System, The Evolving GUniverse - http://www.g-system.at
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP-DB] mysql to postgres migration blues...

2004-09-23 Thread M Saleh EG
define the connection object as a global var in ur function

function ( params)
{
 global $ur_connection_obj;
 ...
...
}


On Thu, 23 Sep 2004 14:56:10 -0300, Eduardo Sampaio [EMAIL PROTECTED] wrote:
 Its because the function cannot access your connection object...
 Try passing it to the function..
 
 function makelistboxentries($link, $title, $mytable, $mycolumn, $othertable,
 $wherestring)
 
 
 
 
 On Thu, 23 Sep 2004 19:44:51 +0200, Antoine [EMAIL PROTECTED] wrote:
  Hi,
  I am trying to get skilled up on postgres and decided to port a little
  movie database I wrote for mysql with php to access it.
  I used an auto converter for the bulk and then tried to tweak. The
  following code does not work but the error message it gives me is
  strange. It tells me that the connection string used on line 82 (where
  it calls pg_query in makelistboxentries) is invalid... but the same
  string/connection works just great in another script... any pointers
  appreciated.
  Cheers
  Antoine
 
  ?php
 
 /* Connect to database */
 $link = pg_connect(dbname=movies host=localhost user=anton
  password=password)
 or die(Could not connect :  . pg_result_error($link));
 
  print TII
  div id=mybody
  Search by:
  BR
  TABLE border=1 cellpadding=10 cellspacing=10TR
  TD align=center
  ID:
  form name=input action=searchout.php method=post
  input type=text name=mychoice
  input type=hidden name = wherestring value= t1.ID = 
  input type=hidden name = othertable value=movies
  input type=submit value=Submit
  /form
  /TD
  TD align=center
  Name:
  form name=input action=searchname.php method=post
  input type=text name=mychoice
  input type=submit value=Submit
  /form
  /TD/TR
  /TABLEBR
  TABLE border=1 cellpadding=10 cellspacing=10TR
  TII;
  makelistboxentries(Audio Language, lang, lang,  audio , 
  t2.movie = t1.ID and t2.lang = );
  makelistboxentries(Subtitle Language, lang, lang,  subtitles ,
   t2.movie = t1.ID and t2.lang = );
  makelistboxentries(Genre, Genre, Genre,  moviegenre , 
  t2.movie = t1.ID and t2.genre = );
 
  print TINI
  /TD
  /TR/TABLE
  brbr
  PShow All:/P
  form name=input action=allout.php
  method=post
  input type=submit value=Submit
  /form
  /div
  div id=mymenu
 PA href=index.phpH3Back to main page/H3/A/P
 PA href=movie.phpAdd a movie/A/P
 Pa href=audio.phpAdd a movie's audio languages/a/P
 Pa href=subtitles.phpAdd a movie's subtitle languages/a/P
 Pa href=searchin.phpSearch the movies/a/P
  /div
  TINI;
 /* Close connection */
 pg_close($link);
 
  function makelistboxentries($title, $mytable, $mycolumn, $othertable,
  $wherestring)
  {
 
  print TD align=\center\;
 
  print $title:;
 /* Perform SQL query */
 $query = SELECT $mycolumn FROM $mytable;
 $result = pg_query($link,$query)
 or die(Query failed :  . pg_result_error($link));
 print form name=\input\ action=\searchout.php\ method=\post\;
 print SELECT NAME=\mychoice\;
 print option value=\zz\ SELECTEDSelect $title/option;
 while ($line = pg_fetch_array($result,$result_countt++,PGSQL_ASSOC)) {
 foreach ($line as $col_value) {
 print (OPTION VALUE=\.$col_value.\);
 print $col_value;
 print (/OPTION);
 }
 
 }
  print /select;
  print input type=hidden name = wherestring value=\$wherestring\;
  print input type=hidden name = othertable value=$othertable;
  print input type=\submit\ value=\Submit\;
  print /form;
 
 pg_free_result($result);
  }
 
  ?
 
  --
  G System, The Evolving GUniverse - http://www.g-system.at
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 



-- 
M.Saleh.E.G
97150-4779817

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



Re: [PHP-DB] mysql to postgres migration blues...

2004-09-23 Thread Antoine
On Thu, 23 Sep 2004 22:27:38 +0400, M Saleh EG [EMAIL PROTECTED] wrote:
 define the connection object as a global var in ur function
 
 function ( params)
 {
  global $ur_connection_obj;
  ...
 ...
 
Damn you guys are quick! I like this list...
declaring it as global didn't seem to work - 

global $link;
/* Connect to database */
$link = pg_connect(dbname=movies host=localhost user=anton
password=password)
or die(Could not connect :  . pg_result_error($link));

still didn't get it but passing it to the function did. I'll get
there, but I pretty much copied and pasted all the php up until now so
I have a little way to go...
Cheers
Antoine


-- 
G System, The Evolving GUniverse - http://www.g-system.at

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



Re: [PHP-DB] mysql to postgres migration blues...

2004-09-23 Thread Andrew Kreps
On Thu, 23 Sep 2004 20:51:52 +0200, Antoine [EMAIL PROTECTED] wrote:
 declaring it as global didn't seem to work -
 
 global $link;
 /* Connect to database */
 $link = pg_connect(dbname=movies host=localhost user=anton
 password=password)

The global keyword works a little bit differently in PHP.  You need to
inform your function that your variable is global, as opposed to
declaring it as global outside the function.  Like:

$link = database connection

function processData () {
global $link;
...
}

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



Re: [PHP-DB] mysql to postgres migration blues...

2004-09-23 Thread Antoine
On Thu, 23 Sep 2004 12:23:32 -0700, Andrew Kreps [EMAIL PROTECTED] wrote:
 On Thu, 23 Sep 2004 20:51:52 +0200, Antoine [EMAIL PROTECTED] wrote:
  declaring it as global didn't seem to work -
 
  global $link;
  /* Connect to database */
  $link = pg_connect(dbname=movies host=localhost user=anton
  password=password)
 
 The global keyword works a little bit differently in PHP.  You need to
 inform your function that your variable is global, as opposed to
 declaring it as global outside the function.  Like:
 
 $link = database connection
 
 function processData () {
 global $link;
 ...

Like i said, I'll get there ;-). Cheers! I hope you folks don't mind
answering some rather basic questions... I am going to be starting
some serious development soon and promise to search the docs first
:-).
I have just followed up on the suggestion of pear and it looks like a
winner. That may mean a change of mailing list but all good for the
moment.
Cheers
Antoine

-- 
G System, The Evolving GUniverse - http://www.g-system.at

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



[PHP-DB] MySql Client API still old version

2004-09-14 Thread squirrel
After installing MySQL 4.1.4-gamma, phpinfo() shows MySql client API
v3.23.49 and it needs to be updated to 4.1.  But I can't seem to get it
updated.  Please help.

I recompiled with:
  ./configure --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.31
  make clean
  make
  make test
  make install

'make test' shows that it's using /usr/local/mysql/lib/mysql, but after
'make install' phpinfo() still shows old API version.  Output of 'make
install' is shown below:

[PEAR] Archive_Tar- already installed: 1.1
[PEAR] Console_Getopt - already installed: 1.2
[PEAR] PEAR   - already installed: 1.3.2
[PEAR] DB - already installed: 1.6.2
[PEAR] HTTP   - already installed: 1.2.2
[PEAR] Mail   - already installed: 1.1.3
[PEAR] Net_SMTP   - already installed: 1.2.3
[PEAR] Net_Socket - already installed: 1.0.1
[PEAR] XML_Parser - already installed: 1.0.1
[PEAR] XML_RPC- already installed: 1.1.0



**
Computer problems? ...
..http://www.multibyte.net

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



Re: [PHP-DB] MySql Client API still old version

2004-09-14 Thread Mikhail U. Petrov
1. Did you install MySQL-client or only MySQL-server?
2. Do you think I'm a telepath? Please, if you want good answers, tell, 
at least, your OS and PHP version.
  I can't help you without any information.
3. You choose wrong maillist for this question. Here are many 
php-programmers, but not system administrators.

Best wishes, MadMike.
http://www.madmike.ru/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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

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

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

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

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

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

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

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

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


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

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

HTH ~randy

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



-- 
randy [EMAIL PROTECTED]

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



Re: [PHP-DB] mySQL searching through serialized arrays

2004-09-09 Thread Jason Wong
On Tuesday 07 September 2004 12:14, rolando g wrote:
 I am storing array of user IDs as TEXT using the serialize() function
 on the array, since several users, one or none can be part of each
 record...

 and I noticed that the serialized array has the values in double
 quotes  like :21;  for example... so since I know that the values
 will be enclosed,  i am using the sql statement, with 21 as the
 example variable:

 SELECT FROM table WHERE userarray LIKE '%\21\%'

 is there a better way or a built-in mySQL function to filter through
 the serialized array

You're not using the database properly. Have a separate table where each 
record contains a user_id and the record_id to which it is linked.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
T-shirt:
Life is *not* a Cabaret, and stop calling me chum!
*/

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



[PHP-DB] mySQL searching through serialized arrays

2004-09-06 Thread rolando g
I am storing array of user IDs as TEXT using the serialize() function
on the array, since several users, one or none can be part of each
record...

and I noticed that the serialized array has the values in double
quotes  like :21;  for example... so since I know that the values
will be enclosed,  i am using the sql statement, with 21 as the
example variable:

SELECT FROM table WHERE userarray LIKE '%\21\%'

is there a better way or a built-in mySQL function to filter through
the serialized array

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



Re: [PHP-DB] mysql results with limit

2004-09-05 Thread Michael Gale

Excellent ... thanks that is exactly what I wanted.

Michael.

On Sat, 04 Sep 2004 20:21:46 -0600
Doug Thompson [EMAIL PROTECTED] wrote:

 Michael Gale wrote:
  Hello,
  
  Right now I have a mysql select statement with the LIMIT option
  of 500.
  Is there a way to find what the total number of selected results
  would of been with out doing a mysql select first with out the limi
  and using mysql_num_rows ?
  
  Thanks
  
 
 You could use SQL_CALC_FOUND_ROWS as it works somewhat differently,
 and probably faster, than the approach you suggest above.  This
 function was introduced in mysql 4.0.0.
 
 http://dev.mysql.com/doc/mysql/en/Information_functions.html
 
 Doug
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
Hand over the Slackware CD's and back AWAY from the computer, your geek
rights have been revoked !!!

Michael Gale
Slackware user :)
Bluesuperman.com 

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



[PHP-DB] mysql results with limit

2004-09-04 Thread Michael Gale
Hello,

Right now I have a mysql select statement with the LIMIT option of 500.
Is there a way to find what the total number of selected results would
of been with out doing a mysql select first with out the limi and using
mysql_num_rows ?

Thanks

-- 
Hand over the Slackware CD's and back AWAY from the computer, your geek
rights have been revoked !!!

Michael Gale
Slackware user :)
Bluesuperman.com 

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



Re: [PHP-DB] mysql results with limit

2004-09-04 Thread Doug Thompson
Michael Gale wrote:
Hello,
Right now I have a mysql select statement with the LIMIT option of 500.
Is there a way to find what the total number of selected results would
of been with out doing a mysql select first with out the limi and using
mysql_num_rows ?
Thanks
You could use SQL_CALC_FOUND_ROWS as it works somewhat differently, and probably 
faster, than the approach you suggest above.  This function was introduced in mysql 
4.0.0.
http://dev.mysql.com/doc/mysql/en/Information_functions.html
Doug
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] [MySQL] Sometimes I get empty rows from SELECT query...

2004-08-28 Thread Michal Pleban
Hello!
I'm writing a PHP script which accesses a MySQL database. As it turns 
out, sometimes I get an empty row from a SELECT query which should 
normally return one or more rows. The same query executed a while later, 
on unchanged data, returns the rows perfectly fine. No errors are 
returned, just mysql_fetch_array simply returns nothing. What can be a 
caouse of this? Perhaps I forgot to put mysql_free_result somewhere, and 
it causes such effects? Anyone had this problem before?

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


[PHP-DB] MySQL denying access to...everything

2004-08-18 Thread AceZero2790
I finally got my PHP5 installation to support MySQL and now this. When I try 
to edit anything on mysqlgui.exe, it just gives me this error: error in 
database function: access denied for user @localhost...

I don't know if this has to do with my php installation or what. If not, 
flame me for all I care. I'm too sick of all this mess to care.

...somebody help...


RE: [PHP-DB] MySQL to EXCEL?

2004-08-18 Thread Ed Lazor
 -Original Message-
 
 You can use
 table
   tr
 td
 
 and each tr becomes an excel row and each td becomes a cell.  This may or
 may not work in/before excel97??
 
 If you're looking to create true excel files, then i highly suggest
 spreadsheetwrite_excel,
 It is an excellent codeset, enabling you to use many features of excel
 such
 as colors, math, formats, etc.
 
 doing it this way, is little to no different from exporting in csv format,
 but it does work
 as described.
 
 HTH
 Jeff

Wow, that's pretty interesting.  I'll play around with it =)

-Ed

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



Re: [PHP-DB] MySQL denying access to...everything

2004-08-18 Thread Peter Ellis
This is a MySQL error on the server side - you need to make sure that
whatever user you're signing into MySQL with has access to modify the
database/table you're using.  I believe the GRANT keyword in MySQL is
what you need -- look at the MySQL reference manual:

http://dev.mysql.com/doc/

Good luck!
-- 
Peter Ellis - [EMAIL PROTECTED]
Web Design and Development Consultant
naturalaxis | http://www.naturalaxis.com/


On Tue, 2004-08-17 at 23:03 -0400, [EMAIL PROTECTED] wrote:
 I finally got my PHP5 installation to support MySQL and now this. When I try 
 to edit anything on mysqlgui.exe, it just gives me this error: error in 
 database function: access denied for user @localhost...
 
 I don't know if this has to do with my php installation or what. If not, 
 flame me for all I care. I'm too sick of all this mess to care.
 
 ...somebody help...

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



Re: [PHP-DB] MySQL denying access to...everything

2004-08-18 Thread Paul
Also, take care with the new password hashing:
http://dev.mysql.com/doc/mysql/en/Password_hashing.html

Paul


On Wed, 18 Aug 2004 00:56:08 -0700, Peter Ellis [EMAIL PROTECTED] wrote:
 This is a MySQL error on the server side - you need to make sure that
 whatever user you're signing into MySQL with has access to modify the
 database/table you're using.  I believe the GRANT keyword in MySQL is
 what you need -- look at the MySQL reference manual:
 
 http://dev.mysql.com/doc/
 
 Good luck!
 --
 Peter Ellis - [EMAIL PROTECTED]
 Web Design and Development Consultant
 naturalaxis | http://www.naturalaxis.com/
 
 
 
 
 On Tue, 2004-08-17 at 23:03 -0400, [EMAIL PROTECTED] wrote:
  I finally got my PHP5 installation to support MySQL and now this. When I try
  to edit anything on mysqlgui.exe, it just gives me this error: error in
  database function: access denied for user @localhost...
 
  I don't know if this has to do with my php installation or what. If not,
  flame me for all I care. I'm too sick of all this mess to care.
 
  ...somebody help...
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP-DB] MySQL denying access to...everything

2004-08-18 Thread Doug Thompson
[EMAIL PROTECTED] wrote:
I finally got my PHP5 installation to support MySQL and now this. When I try 
to edit anything on mysqlgui.exe, it just gives me this error: error in 
database function: access denied for user @localhost...

I don't know if this has to do with my php installation or what. If not, 
flame me for all I care. I'm too sick of all this mess to care.

...somebody help...
http://dev.mysql.com/doc/mysql/en/User_Account_Management.html
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] MySQL denying access to everything...Part 2

2004-08-18 Thread AceZero2790
Ok, thanks to many people's help, I have managed to install MySQL right and 
login as root with no password. However, MySQL will not allow to log in to my 
databases as root. Is this normal, because when I try it brings back the old 
access denies: [EMAIL PROTECTED] thing.

So I thought maybe I just have to figure out how to create accounts, and then 
configure them to be all access. I have read the manual on  creating 
accounts, but for some reason it doesn't work. Here is how it goes:

I access mysql.exe and put in this:

mysql GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost'


Then I hit enter. It starts me off with an indented down arrow and I finish 
the GRANT command.
 
- IDENTIFIED BY 'password' WITH GRANT OPTION;

Then I hit enter. IT gives me another down arrow. I hit enter again and again 
and again and all it does is give me more indented down arrows...  What now?









Re: [PHP-DB] MySQL denying access to everything...Part 2

2004-08-18 Thread Peter Ellis
This isn't the appropriate list to direct this question to.  I suggest
one of the MySQL help lists or a careful reading of the documentation,
which tells you exactly what you need to know.
-- 
Peter Ellis - [EMAIL PROTECTED]
Web Design and Development Consultant
naturalaxis | http://www.naturalaxis.com/

On Wed, 2004-08-18 at 14:43 -0400, [EMAIL PROTECTED] wrote:
 Ok, thanks to many people's help, I have managed to install MySQL right and 
 login as root with no password. However, MySQL will not allow to log in to my 
 databases as root. Is this normal, because when I try it brings back the old 
 access denies: [EMAIL PROTECTED] thing.
 
 So I thought maybe I just have to figure out how to create accounts, and then 
 configure them to be all access. I have read the manual on  creating 
 accounts, but for some reason it doesn't work. Here is how it goes:
 
 I access mysql.exe and put in this:
 
 mysql GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost'
 
 
 Then I hit enter. It starts me off with an indented down arrow and I finish 
 the GRANT command.
  
 - IDENTIFIED BY 'password' WITH GRANT OPTION;
 
 Then I hit enter. IT gives me another down arrow. I hit enter again and again 
 and again and all it does is give me more indented down arrows...  What now?

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



RE: [PHP-DB] MySQL denying access to everything...Part 2

2004-08-18 Thread balwantsingh
mysql grant all privileges on *.* to [EMAIL PROTECTED] identified by
'password' with grant option;

try this out

balwant


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 19, 2004 12:13 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL denying access to everything...Part 2


Ok, thanks to many people's help, I have managed to install MySQL right and
login as root with no password. However, MySQL will not allow to log in to
my
databases as root. Is this normal, because when I try it brings back the old
access denies: [EMAIL PROTECTED] thing.

So I thought maybe I just have to figure out how to create accounts, and
then
configure them to be all access. I have read the manual on  creating
accounts, but for some reason it doesn't work. Here is how it goes:

I access mysql.exe and put in this:

mysql GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost'


Then I hit enter. It starts me off with an indented down arrow and I finish
the GRANT command.

- IDENTIFIED BY 'password' WITH GRANT OPTION;

Then I hit enter. IT gives me another down arrow. I hit enter again and
again
and again and all it does is give me more indented down arrows...  What now?

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



[PHP-DB] MySQL to EXCEL?

2004-08-17 Thread Chris Payne
Hi there everyone,

 

I'm having a dilemma (Now that I have power back after the hurricane hit us
directly in Orlando).  Anyway, I need to export a database table to Excel, I
can do it as a .txt file without a problem, but I can't seem to get it to
put each column into a separate cell when I try to export as an .xls form, I
think I have this line formed incorrectly for an XLS file, can anyone see if
I need to use any special characters rather than a comma?

 

fwrite($filesession,$id,$new,$recno,$category,$product,$description,$unit,$
certificate,$instock,$orderpt,$ordernow,$vendor,$unitcost,$unitsell\015\012
);

 

Thank you.

 

Chris 



Re: [PHP-DB] MySQL to EXCEL?

2004-08-17 Thread Matt M.
 I'm having a dilemma (Now that I have power back after the hurricane hit us
 directly in Orlando).  Anyway, I need to export a database table to Excel, I
 can do it as a .txt file without a problem, but I can't seem to get it to
 put each column into a separate cell when I try to export as an .xls form, I
 think I have this line formed incorrectly for an XLS file, can anyone see if
 I need to use any special characters rather than a comma?
 
 fwrite($filesession,$id,$new,$recno,$category,$product,$description,$unit,$
 certificate,$instock,$orderpt,$ordernow,$vendor,$unitcost,$unitsell\015\012
 );
 


either output the data as a csv which you are doing (on windoze name
the file with a .csv extension) or take a look at
http://pear.php.net/package/Spreadsheet_Excel_Writer

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



Re: [PHP-DB] MySQL to EXCEL?

2004-08-17 Thread randy
You could always use phpMyAdmin...I believe it will export to Excel
(if not, CSV file).

http://phpmyadmin.sourceforge.net/



On Tue, 17 Aug 2004 15:36:49 -0400, Chris Payne
[EMAIL PROTECTED] wrote:
 Hi there everyone,
 
 I'm having a dilemma (Now that I have power back after the hurricane hit us
 directly in Orlando).  Anyway, I need to export a database table to Excel, I
 can do it as a .txt file without a problem, but I can't seem to get it to
 put each column into a separate cell when I try to export as an .xls form, I
 think I have this line formed incorrectly for an XLS file, can anyone see if
 I need to use any special characters rather than a comma?
 
 fwrite($filesession,$id,$new,$recno,$category,$product,$description,$unit,$
 certificate,$instock,$orderpt,$ordernow,$vendor,$unitcost,$unitsell\015\012
 );
 
 Thank you.
 
 
 Chris
 
 


-- 
randy [EMAIL PROTECTED]

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



RE: [PHP-DB] MySQL to EXCEL?

2004-08-17 Thread Ed Lazor
 -Original Message-
 either output the data as a csv which you are doing (on windoze name
 the file with a .csv extension) or take a look at
 http://pear.php.net/package/Spreadsheet_Excel_Writer

I have another option that might work for you also.  Go to MySQL's website
and grab their ODBC driver and use that to pull data directly into Excel.
That's what I do and the end result tends to be a lot cleaner than going
through cvs or other MySQL exports.

-Ed

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



Re: [PHP-DB] MySQL to EXCEL?

2004-08-17 Thread Matt M.
 I have another option that might work for you also.  Go to MySQL's website
 and grab their ODBC driver and use that to pull data directly into Excel.
 That's what I do and the end result tends to be a lot cleaner than going
 through cvs or other MySQL exports.

I was not sure that this was a mysql db.

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



Re: [PHP-DB] MySQL to EXCEL?

2004-08-17 Thread Matt M.
  I have another option that might work for you also.  Go to MySQL's website
  and grab their ODBC driver and use that to pull data directly into Excel.
  That's what I do and the end result tends to be a lot cleaner than going
  through cvs or other MySQL exports.
 
 I was not sure that this was a mysql db.

sorry for the second email, I see now in the subject of the email it
is mysql, stupid me.

You could also try an excel com object to do this.

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



Re: [PHP-DB] MySQL to EXCEL?

2004-08-17 Thread Daniel Brunner
I don't know how you have it setup.
But you can create a XLS file on the fly using PHP
By using header...
header(Content-Type: application/vnd.ms-excel);
header(Content-Dispostion: attachemnt; filename='Project.xls');
header(Pragma: no-cache);
header(Expires: 0);
Then just echo your results from your query, like normal...
You have just created a XLS from PHP...Which can be saved to a XLS 
Workbook...


Dan



On Aug 17, 2004, at 4:33 PM, [EMAIL PROTECTED] wrote:
I have another option that might work for you also.  Go to MySQL's 
website
and grab their ODBC driver and use that to pull data directly into 
Excel.
That's what I do and the end result tends to be a lot cleaner than 
going
through cvs or other MySQL exports.
I was not sure that this was a mysql db.
sorry for the second email, I see now in the subject of the email it
is mysql, stupid me.
You could also try an excel com object to do this.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] MySQL to EXCEL?

2004-08-17 Thread Ed Lazor
 -Original Message-
 From: Daniel Brunner [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, August 17, 2004 2:45 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] MySQL to EXCEL?
 
 I don't know how you have it setup.
 
 But you can create a XLS file on the fly using PHP
 
 By using header...
 
 header(Content-Type: application/vnd.ms-excel);
 header(Content-Dispostion: attachemnt; filename='Project.xls');
 header(Pragma: no-cache);
 header(Expires: 0);
 
 
 Then just echo your results from your query, like normal...

Could you expound on this?  What field delimiter are you using?


 
 
 You have just created a XLS from PHP...Which can be saved to a XLS
 Workbook...

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



RE: [PHP-DB] MySQL to EXCEL?

2004-08-17 Thread jeffrey_n_Dyke




 I don't know how you have it setup.

 But you can create a XLS file on the fly using PHP

 By using header...

 header(Content-Type: application/vnd.ms-excel);
 header(Content-Dispostion: attachemnt; filename='Project.xls');
 header(Pragma: no-cache);
 header(Expires: 0);


 Then just echo your results from your query, like normal...

 Could you expound on this?  What field delimiter are you using?

You can use
table
  tr
td

and each tr becomes an excel row and each td becomes a cell.  This may or
may not work in/before excel97??

If you're looking to create true excel files, then i highly suggest
spreadsheetwrite_excel,
It is an excellent codeset, enabling you to use many features of excel such
as colors, math, formats, etc.

doing it this way, is little to no different from exporting in csv format,
but it does work
as described.

HTH
Jeff




 You have just created a XLS from PHP...Which can be saved to a XLS
 Workbook...

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

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



[PHP-DB] mysql query

2004-08-13 Thread Quentin Cotillard
Consider a table similar to the one below.
What I want to do is to get ONE random record from categories(cat) A
and 5 random record from category B
| ID | computer | name | cat |...
  1 dell   834A
  2 ibm526A
  3 apple  134B
  4 sony   333A
  5 dell   834B
  6 ibm556A
  7 apple  534B
  8 sony   233A
  9 dell   874A
...
How could I construct my query to the mysql?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] mysql query

2004-08-13 Thread Torsten Roehr
Justin Patrin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Fri, 13 Aug 2004 15:20:36 +0200, Quentin Cotillard
 [EMAIL PROTECTED] wrote:
  Consider a table similar to the one below.
  What I want to do is to get ONE random record from categories(cat) A
  and 5 random record from category B
 
  | ID | computer | name | cat |...
 1dell   834A
 2ibm526A
 3apple  134B
 4sony   333A
 5dell   834B
 6ibm556A
 7apple  534B
 8sony   233A
 9dell   874A
  
 
  How could I construct my query to the mysql?
 

 This is an SQL question, not a PHP question.

 order by rand limit 5

Hi Justin,

this won't work because he needs to make sure to get 1 from category A *AND*
5 from category B with one query. I had a similar problem some weeks ago and
even though a lot of people from the list were trying to help we didn't find
a solution. In the end I had to do seperate queries.

Regards, Torsten

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



Re: [PHP-DB] mysql query

2004-08-13 Thread Justin Patrin
On Fri, 13 Aug 2004 19:39:59 +0200, Torsten Roehr [EMAIL PROTECTED] wrote:
 Justin Patrin [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  On Fri, 13 Aug 2004 15:20:36 +0200, Quentin Cotillard
  [EMAIL PROTECTED] wrote:
   Consider a table similar to the one below.
   What I want to do is to get ONE random record from categories(cat) A
   and 5 random record from category B
  
   | ID | computer | name | cat |...
  1dell   834A
  2ibm526A
  3apple  134B
  4sony   333A
  5dell   834B
  6ibm556A
  7apple  534B
  8sony   233A
  9dell   874A
   
  
   How could I construct my query to the mysql?
  
 
  This is an SQL question, not a PHP question.
 
  order by rand limit 5
 
 Hi Justin,
 
 this won't work because he needs to make sure to get 1 from category A *AND*
 5 from category B with one query. I had a similar problem some weeks ago and
 even though a lot of people from the list were trying to help we didn't find
 a solution. In the end I had to do seperate queries.
 

I actually assumed that. This *can* be done in a query, but it
requires sub-queriesunions. Something like this:

SELECT * FROM computer WHERE cat = 'A' ORDER BY rand() LIMIT 1
UNION
SELECT * FROM computer WHERE cat = 'B' ORDER BY rand() LIMIT 5

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

paperCrane --Justin Patrin--

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



Re: [PHP-DB] MySQL fulltext search with InnoDB table?

2004-08-04 Thread Brent Baisley
I don't think there is anything you can do that won't require a full 
table scan. I think some people break out the field they want to do a 
full text search on into another table using the MyISAM format. So your 
core table is InnoDB and your full text search fields are in a 
related table that is MyISAM. This could actually help performance if 
it then allows your core table to have fixed length records (i.e. no 
varchar, text, etc.). But, of course, it all depends on your data and 
how you can break it up.

On Aug 3, 2004, at 3:44 PM, Swan, Nicole wrote:
What is the best way to simulate a fulltext search on a MySQL table of 
type InnoDB?  Do I index the searchable fields and use the LIKE() 
function with appropriate wildcards?

What are the performance implications with this?  Switching back to a 
table type of MyISAM is really not an option.  Is there an accepted 
way of dealing with this issue?

Thanks in advance for any tips,

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] MySQL fulltext search with InnoDB table?

2004-08-03 Thread Swan, Nicole
What is the best way to simulate a fulltext search on a MySQL table of type InnoDB?  
Do I index the searchable fields and use the LIKE() function with appropriate 
wildcards?

What are the performance implications with this?  Switching back to a table type of 
MyISAM is really not an option.  Is there an accepted way of dealing with this issue?

Thanks in advance for any tips,


Nicole
---
Nicole Swan
Web Programming Specialist
Carroll College CCIT
(406)447-4310

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



[PHP-DB] MySQL software question

2004-07-28 Thread Vincent Jordan
Is there a piece of software that will allow my to create MySQL
databases and table relations in a graphical format without having to
connect to the database?
 
I am looking for something where I can point and click the creation of
tables and easily create several relationships between tables ( kinda
like in access ) and when in done it will create the .sql file?
 
I prefer this to be a desktop application.
 
 
Thanks


Re: [PHP-DB] MySQL software question

2004-07-28 Thread Mikhail U. Petrov
May be ERwin or BPwin can help you.
imho ERwin works with MSSQL, Access, so maybe new versions work with 
MySQL too.
Vincent Jordan wrote:

Is there a piece of software that will allow my to create MySQL
databases and table relations in a graphical format without having to
connect to the database?
I am looking for something where I can point and click the creation of
tables and easily create several relationships between tables ( kinda
like in access ) and when in done it will create the .sql file?
I prefer this to be a desktop application.
Thanks
 

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


Re: [PHP-DB] MySQL software question

2004-07-28 Thread dpgirago
I have ERwin 4.1.2208 installed, and it connects to MySQL only through 
ODBC, so one needs to have the MyODBC.dll installed. You can then make an 
ODBC connection with it. But ERwin is probably a $4,000.00 software 
package. Pretty steep for an individual...

dave 

 May be ERwin or BPwin can help you.
 imho ERwin works with MSSQL, Access, so maybe new versions work with 
 MySQL too.
 Vincent Jordan wrote:

 Is there a piece of software that will allow my to create MySQL
 databases and table relations in a graphical format without having to
 connect to the database?
 
 I am looking for something where I can point and click the creation 
of
 tables and easily create several relationships between tables ( kinda
 like in access ) and when in done it will create the .sql file?

RE: [PHP-DB] MySQL software question

2004-07-28 Thread Gilmore, Corey (DPC)
I've used ERWin recently with MySQL 4.1.x and it works well.  It's
fairly expensive, but they do have demo versions available.  As with any
WYSIWYG program you'll probably want to clean up the final product
before using it. 

 -Original Message-
 From: Mikhail U. Petrov [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, July 28, 2004 7:39 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] MySQL software question
 
 
 May be ERwin or BPwin can help you.
 imho ERwin works with MSSQL, Access, so maybe new versions 
 work with MySQL too.
 Vincent Jordan wrote:
 
 Is there a piece of software that will allow my to create MySQL 
 databases and table relations in a graphical format without 
 having to 
 connect to the database?
  
 I am looking for something where I can point and click the 
 creation 
 of tables and easily create several relationships between tables ( 
 kinda like in access ) and when in done it will create the .sql file?
  
 I prefer this to be a desktop application.
  
  
 Thanks
 
   
 
 
 --
 PHP Database Mailing List (http://www.php.net/) To 
 unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

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



Re: [PHP-DB] MySQL software question

2004-07-28 Thread Rory McKinley
Vincent Jordan wrote:
Is there a piece of software that will allow my to create MySQL
databases and table relations in a graphical format without having to
connect to the database?
 

snip
Try DB Designer from Fabforce - it has it's idiosyncracies, but it is 
free, and I use it without major problems.

HTH
--
Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za

This e-mail is intended only for the person to whom it is addressed and
may contain confidential information which may be legally privileged.
Nebula Solutions accepts no liability for any loss, expense or damage
arising from this e-mail and/or any attachments.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] MySQL '!=' ???

2004-07-20 Thread Tristan . Pretty
Hi there...
I'm trying to select all records from a MySQL database, and exclude those 
from certain countries...
I've posted a copy of an SQL statement I've got that I'm using in 
PHPMyADMIN.
And as you can see, I've said not to pick Argentina, but there it is???
What first year mistake am I making?

See image below:
http://www.risk.sungard.com/sql.gif

Tris...

*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***

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



RE: [PHP-DB] MySQL '!=' ???

2004-07-20 Thread Hutchins, Richard
Tris,

Instead of using != in your statement, try using . I looked in my copy of
the MySQL Manual and it shows both != and  for the not equal concept, but
the examples given only show the  format used.

Not sure if it'll solve the problem, but it's the first thing I'd try.

Rich


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 20, 2004 4:58 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] MySQL '!=' ???
 
 
 Hi there...
 I'm trying to select all records from a MySQL database, and 
 exclude those 
 from certain countries...
 I've posted a copy of an SQL statement I've got that I'm using in 
 PHPMyADMIN.
 And as you can see, I've said not to pick Argentina, but 
 there it is???
 What first year mistake am I making?
 
 See image below:
 http://www.risk.sungard.com/sql.gif
 
 Tris...
 
 *
 The information contained in this e-mail message is intended only for 
 the personal and confidential use of the recipient(s) named above.  
 If the reader of this message is not the intended recipient 
 or an agent
 responsible for delivering it to the intended recipient, you 
 are hereby 
 notified that you have received this document in error and that any
 review, dissemination, distribution, or copying of this message is 
 strictly prohibited. If you have received this communication 
 in error, 
 please notify us immediately by e-mail, and delete the 
 original message.
 **
 *
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



RE: [PHP-DB] MySQL '!=' ???

2004-07-20 Thread VANDOORINE A RsrhCppRfaRva
Hello.

The query is false, because if you loook what an OR do this give :

false OR false = false
true OR false = true
false OR true = true
true OR true = true

So when your request find Argentina It is false, but when it looks the next statement 
and check if country is different of Mexico this is true, so following the OR table, 
the statement is true, so it is printed.

I think you can fix this by using a NOT stament and inverting your WHERE parameters.

and changes your request to 

SELECT country
FROM reech_leed_tool
WHERE NOT(country = 'Argentina' OR country = 'Mexico' )

So if we got one of the country you did not want to be printed the statement within 
the NOT is true, so by inverting it it become false and so not printed; and if the 
country of the line that is checked did not have a country WITHIN the condition.

That should fix your problem, even if I'm quite sure there is a better way.

Regards,

Aurelien Vandoorine

-Message d'origine-
De : Hutchins, Richard [mailto:[EMAIL PROTECTED]
Envoyé : mardi 20 juillet 2004 14:20
À : [EMAIL PROTECTED]
Objet : RE: [PHP-DB] MySQL '!=' ???


Tris,

Instead of using != in your statement, try using . I looked in my copy of
the MySQL Manual and it shows both != and  for the not equal concept, but
the examples given only show the  format used.

Not sure if it'll solve the problem, but it's the first thing I'd try.

Rich


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 20, 2004 4:58 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] MySQL '!=' ???
 
 
 Hi there...
 I'm trying to select all records from a MySQL database, and 
 exclude those 
 from certain countries...
 I've posted a copy of an SQL statement I've got that I'm using in 
 PHPMyADMIN.
 And as you can see, I've said not to pick Argentina, but 
 there it is???
 What first year mistake am I making?
 
 See image below:
 http://www.risk.sungard.com/sql.gif
 
 Tris...
 
 *
 The information contained in this e-mail message is intended only for 
 the personal and confidential use of the recipient(s) named above.  
 If the reader of this message is not the intended recipient 
 or an agent
 responsible for delivering it to the intended recipient, you 
 are hereby 
 notified that you have received this document in error and that any
 review, dissemination, distribution, or copying of this message is 
 strictly prohibited. If you have received this communication 
 in error, 
 please notify us immediately by e-mail, and delete the 
 original message.
 **
 *
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



===

Ce message et toutes les pieces jointes (ci-apres le message) 
sont confidentiels et etablis a l'intention exclusive de ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite. 
Tout message electronique est susceptible d'alteration. 
La SOCIETE GENERALE et ses filiales declinent toute responsabilite
au titre de ce message s'il a ete altere, deforme ou falsifie.
 
===

This message and any attachments (the message) are confidential
and intended solely for the addressees.
Any unauthorized use or dissemination is prohibited. 
E-mails are susceptible to alteration.   
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates
shall be liable for the message if altered, changed or falsified. 

===

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



Re: [PHP-DB] Mysql and rollbacks

2004-07-14 Thread Peter Westergaard
 I was about to suggest the same, the latest builds of MySQL have theese
 functions from what I knew... I think youll find what you need there.

Thanks, Kim.

Any stable and fairly affordable hosts out there using these latest builds?
Mine is back a few, no transactional functionality that I can discern yet...
but having said that, let me disclaim that I haven't finished my reading on
the subject.

-P

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



Re: [PHP-DB] mysql auto increment

2004-07-13 Thread Peter Westergaard
I've done exactly this for a really cheap-and-dirty instance where two
people were doing bulk data entry into two different instances of a mysql
table which would eventually be stitched together.  by giving one a higher
range, the data migration afterwords was very easy.

Other than that, can't imagine a use for this approach.

-P

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



Re: [PHP-DB] mysql auto increment

2004-07-13 Thread Jonathan Haddad
There might be some system that requires a 4 digit number and the PK is 
being used directly.   Also, this same system might need to be exported 
to Excel, which trims leading zeros and is generally a pain in the ass.

Peter Westergaard wrote:
I've done exactly this for a really cheap-and-dirty instance where two
people were doing bulk data entry into two different instances of a mysql
table which would eventually be stitched together.  by giving one a higher
range, the data migration afterwords was very easy.
Other than that, can't imagine a use for this approach.
-P
 

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


[PHP-DB] Mysql and rollbacks

2004-07-13 Thread Peter Westergaard
I'm developing a site where I anticipate the need to make several updates to
several forms, and I'll want to commit them all at once (i.e. if there's a
failure with any of the transactions, I'd like to be able to back out to
before I started).

Is there a decent way to do this with PHP and Mysql?  Obviously start with
ignoring user interrupt, and I was thinking a fairly easy way to reduce the
risk is to perform numerous tests before attempting any activity, but that
means at least doubling my database activity - does that pose more
performance issues than it solves?

Or has someone else got a good strategy for dealing with this? Perhaps
writing temp-rows, and then executing some sort of stored procedure to move
all the temp-rows to the real tables in one fell swoop?  Or, really, any
wisdom to impart?

-P

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



Re: [PHP-DB] Mysql and rollbacks

2004-07-13 Thread John W. Holmes
Peter Westergaard wrote:
I'm developing a site where I anticipate the need to make several updates to
several forms, and I'll want to commit them all at once (i.e. if there's a
failure with any of the transactions, I'd like to be able to back out to
before I started).
Is there a decent way to do this with PHP and Mysql?  
Use InnoDB tables which have transaction support.
Or use a database abstraction layer that simulates transactions such as 
ADOdb: http://phplens.com/adodb/tutorial.smart.transactions.html

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Mysql and rollbacks

2004-07-13 Thread Kim Steinhaug
I was about to suggest the same, the latest builds of MySQL have theese
functions from what I knew... I think youll find what you need there.

--
Kim Steinhaug
-
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
-
www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com
-


John W. Holmes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Peter Westergaard wrote:

  I'm developing a site where I anticipate the need to make several
updates to
  several forms, and I'll want to commit them all at once (i.e. if
there's a
  failure with any of the transactions, I'd like to be able to back out to
  before I started).
 
  Is there a decent way to do this with PHP and Mysql?

 Use InnoDB tables which have transaction support.

 Or use a database abstraction layer that simulates transactions such as
 ADOdb: http://phplens.com/adodb/tutorial.smart.transactions.html

 --
 ---John Holmes...

 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

 php|architect: The Magazine for PHP Professionals – www.phparch.com

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



[PHP-DB] mysql auto increment

2004-07-12 Thread Michael Gale
Hello,

I know this is more of a mysql question then php with mysql but I can not find 
the answer. I have a primary key in a
table the is setup and working with auto increment. 

Now I want to change it so it will start auto incrementing from 1000. So each entry 
will be:

1001, then 1002, 


-- 
Michael Gale
Network Administrator
Utilitran Corporation

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



Re: [PHP-DB] mysql auto increment

2004-07-12 Thread John W. Holmes
Michael Gale wrote:
I know this is more of a mysql question then php with 
 mysql but I can not find the answer. I have a primary
 key in a table the is setup and working with auto increment.
Now I want to change it so it will start auto incrementing 
 from 1000. So each entry will be:
First of all, why? There's no reason to do this.
Second, this link was just posted an hour ago or so. Check it out.
http://dev.mysql.com/doc/mysql/en/example-AUTO_INCREMENT.html
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] mysql auto increment

2004-07-12 Thread Jason Wong
On Tuesday 13 July 2004 07:19, Michael Gale wrote:

   I know this is more of a mysql question then php with mysql but I can not
 find the answer. 

www.mysql.com  search auto increment  
http://dev.mysql.com/doc/mysql/en/CREATE_TABLE.html

Keep reading and re-reading that page until you have your answer or ask on the 
mysql mailing list.

 I have a primary key in a table the is setup and working
 with auto increment.

 Now I want to change it so it will start auto incrementing from 1000. So
 each entry will be:

 1001, then 1002, 

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Average temperature increases with the amount of clothing brought
-- Murphy's Laws of Camping n10
*/

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



Re: [PHP-DB] mysql auto increment

2004-07-12 Thread Ross Honniball
I just had a bit of a play with it and discovered you can do this:
say your auto-increment index is named 'fred' for arguments sake.
INSERT INTO table SET FRED = 1000
This will just create a record where the auto-index fred will equal 1000.
Next auto-increment, NOT specifying a value for 'fred', will be 1001.
No idea if there are any dangerous side-effects. Perhaps others will know?
At 09:19 AM 13/07/2004, you wrote:
Hello,
I know this is more of a mysql question then php with mysql but I 
can not find the answer. I have a primary key in a
table the is setup and working with auto increment.

Now I want to change it so it will start auto incrementing from 1000. So 
each entry will be:

1001, then 1002, 
--
Michael Gale
Network Administrator
Utilitran Corporation
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
.
. Ross Honniball. JCU Bookshop Cairns, Qld, Australia.
.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: Re[2]: [PHP-DB] MySQL: Random select with specific count of a column

2004-07-06 Thread Torsten Roehr
Pablo M. Rivas [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello Torsten,


 TR thanks for your help. Unfortunately it's always returning the same row
for
 TR each category (maybe because of the group by) and only one row for
each
 TR category. I need to select 2 random rows for each category. Any more
ideas?

 I'ts returning 2 rows each RECORD, but the fields have
 the same name, so if you do a mysql_fetch_array, you'll find only
 one...

 Change your sql to:
select a.category  as categorya, a.name as namea, b.name as
nameb from tablename as a left join tablename as b on
  a.category = b.category and a.nameb.name and
  a.language=b.language where a.language='de' and b.name is not
  null group by a.category

 and you'll do:
 echo trthlanguajetdcategorytdname\n;
 while ($data=mysql_fetch_array($result)) {
echo trtddetd . $data[categorya] . td . $data[namea];
echo trtddetd . $data[categorya] . td . $data[nameb];
 }
 ok?...
 EACH ROW CONTAINS 2 RECORDS...but.. we need something more, 'cause
 you're needing RANDOM rows...

 If you need RANDOM, i think mysql will not help you, and you must
 change your query to:
 select a.category  as categorya, a.name as namea, b.name as
nameb from tablename as a left join tablename as b on
  a.category = b.category and a.nameb.name and
  a.language=b.language where a.language='de' and b.name is not
  null order by a.category

 and then do something in php like store everything in an array, and take
some
 randomly...

 srand(time());
 $lastcat=0;
 echo trthlanguajetdcategorytdname\n;
 while ($data=mysql_fetch_array($result)) {
   if (($lastcat) and ($lastcat$data[categorya])) {
   echo trtddetd . $lastcat . td .
$myarray[$lastcat][rand()%count($myarray[$lastcat])];
   echo trtddetd . $lastcat . td .
$myarray[$lastcat][rand()%count($myarray[$lastcat])];
   }
   $myarray[$data[categorya]][]=$data[namea];
   $myarray[$data[categorya]][]=$data[nameb];
   $lastcat=$data[categorya];
 }
 echo trtddetd . $lastcat . td .
$myarray[$lastcat][rand()%count($myarray[$lastcat])];
 echo trtddetd . $lastcat . td .
$myarray[$lastcat][rand()%count($myarray[$lastcat])];

 mhhh... i don't like... but i think this will work and you can make it
 better!!

Hi Pablo,

thank you very much for your extensive efforts! This will definitely help
me.

Best regards, Torsten

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



[PHP-DB] MySQL query, using DISTINCT...

2004-07-06 Thread Tristan . Pretty
I have a system that tracks downloads, capturing loadsa info, but of 
interest here, is email and filename.
Simply put, I wanna show all results where file name AND email are unique.
(so if email '[EMAIL PROTECTED]' has filename 'word.doc' 5 times in a table, 
I want to only see it once.)

What am I doing wrong...?

SELECT DISTINCT(file_name, email) FROM `completed_downloads` WHERE `bu`  = 
 'reech' AND date BETWEEN '2004-06-01' AND '2004-06-30'

Tris...

*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***

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



Re: [PHP-DB] MySQL query, using DISTINCT...

2004-07-06 Thread Jason Wong
On Tuesday 06 July 2004 17:58, [EMAIL PROTECTED] wrote:
 I have a system that tracks downloads, capturing loadsa info, but of
 interest here, is email and filename.
 Simply put, I wanna show all results where file name AND email are unique.
 (so if email '[EMAIL PROTECTED]' has filename 'word.doc' 5 times in a table,
 I want to only see it once.)

 What am I doing wrong...?

Well what did you expect your code to do when you run it, and what is it 
actually doing?

Please spend a little time describing your problem clearly and succintly when 
posting.

In the absence of more information, my guess is that your biggest problem is 
that you're not doing sufficient error checking in your code.

AFAICS ...

 SELECT DISTINCT(file_name, email) FROM `completed_downloads` WHERE `bu`  =
  'reech' AND date BETWEEN '2004-06-01' AND '2004-06-30'

would give a mysql error. The correct syntax is:

  SELECT DISTINCT col1, col2, etc FROM table ...


Please follow the examples in the manual and incorporate error checking when 
using mysql.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Nondeterminism means never having to say you are wrong.
*/

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



[PHP-DB] mysql versus mysqli versus db abstraction

2004-07-06 Thread Jensen, Kimberlee
Hello,
I was wondering how many of you have made the switch to mysqli from the mysql library? 
I teach a class in PHP/MySQL and want to keep current with what industry folks are 
doing. I did not immediately adopt mysqli into my classroom and am wondering if it's 
time.
I was also wondering how many of you are working strictly with DB abstraction classes 
at this point. 
Any input you can share is most appreciated.
Cheers, Kimberlee Jensen


Re[2]: [PHP-DB] MySQL: Random select with specific count of a column

2004-07-05 Thread Pablo M. Rivas
Hello Torsten,


TR thanks for your help. Unfortunately it's always returning the same row for
TR each category (maybe because of the group by) and only one row for each
TR category. I need to select 2 random rows for each category. Any more ideas?

I'ts returning 2 rows each RECORD, but the fields have
the same name, so if you do a mysql_fetch_array, you'll find only
one...

Change your sql to:
   select a.category  as categorya, a.name as namea, b.name as
   nameb from tablename as a left join tablename as b on
 a.category = b.category and a.nameb.name and
 a.language=b.language where a.language='de' and b.name is not
 null group by a.category

and you'll do:
echo trthlanguajetdcategorytdname\n;
while ($data=mysql_fetch_array($result)) {
   echo trtddetd . $data[categorya] . td . $data[namea];
   echo trtddetd . $data[categorya] . td . $data[nameb];
}
ok?...
EACH ROW CONTAINS 2 RECORDS...but.. we need something more, 'cause
you're needing RANDOM rows...

If you need RANDOM, i think mysql will not help you, and you must
change your query to:
select a.category  as categorya, a.name as namea, b.name as
   nameb from tablename as a left join tablename as b on
 a.category = b.category and a.nameb.name and
 a.language=b.language where a.language='de' and b.name is not
 null order by a.category

and then do something in php like store everything in an array, and take some
randomly...

srand(time());
$lastcat=0;
echo trthlanguajetdcategorytdname\n;
while ($data=mysql_fetch_array($result)) {
  if (($lastcat) and ($lastcat$data[categorya])) {
  echo trtddetd . $lastcat . td . 
$myarray[$lastcat][rand()%count($myarray[$lastcat])];
  echo trtddetd . $lastcat . td . 
$myarray[$lastcat][rand()%count($myarray[$lastcat])];
  }
  $myarray[$data[categorya]][]=$data[namea];
  $myarray[$data[categorya]][]=$data[nameb];
  $lastcat=$data[categorya];
}
echo trtddetd . $lastcat . td . 
$myarray[$lastcat][rand()%count($myarray[$lastcat])];
echo trtddetd . $lastcat . td . 
$myarray[$lastcat][rand()%count($myarray[$lastcat])];

mhhh... i don't like... but i think this will work and you can make it
better!!

-- 
Best regards,
 Pablo

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



[PHP-DB] MySQL variable question

2004-07-03 Thread Chris Payne
Hi there everyone,

 

I'm using MySQL 4's built-in Boolean handling abilities with PHP 4 which
works wonderfully, but I need to change:

 

ft_min_word_len

 

to be 3 characters instead of 4 for fulltext indexing, how can I change this
as words such as cat etc ... are not showing up in my PHP search engine and
I need them to.

 

I know I have to edit ft_min_word_len to show 3 instead of 4, but what file
do I edit?  (Sorry to sound dumb but I haven't reconfigured MySQL before).

 

Thanks everyone.

 

Chris



Re: [PHP-DB] MySQL variable question

2004-07-03 Thread John W. Holmes
Chris Payne wrote:
I'm using MySQL 4's built-in Boolean handling abilities with PHP 4 which
works wonderfully, but I need to change:
ft_min_word_len
See here: http://dev.mysql.com/doc/mysql/en/Option_files.html
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Mysql 5.0 Redhat

2004-07-02 Thread Cole S. Ashcraft
You need to compile PHP with MySQL support. There is a php-mysql.rpm 
package, but I'm not sure if it will work with MySQL 5. You might just 
have to recompile PHP (but probably not).

Cole
Iain Wiseman wrote:
Cole S. Ashcraft wrote:
They are at http://dev.mysql.com/downloads/mysql/5.0.html.
Iain Wiseman wrote:
Hi,
Sure this has been asked but I want to use the new mysql 5.0 rather 
than downgrade and I want to use a package installer so I can take 
it off if it does not work.

Are there rpms for Redhat 9.0 to enable PHP to work with MySql 5.0
I am assumming (and maybe incorrectly) that this is my problem for
Fatal error: Call to undefined function: mysql_connect() in 
/var/www/html/guestbook/guest.config.php on line 14

Thanks
Iain

I have dowloaded and installed
MySQL-shared-5.0.0-0
MySQL-server-5.0.0-0
MySQL-client-5.0.0-0
MySQL-devel-5.0.0-0
However I still get the error. I seems pretty common when I put it 
into google. There used to be a package call 
php-mysql-4.2.2-17.i386.rpm that seemed to do the neccesaries for PHP. 
Added a mysql.ini and put a library mysql.so into the php extension 
directory.

What does this for 5.0? And what steps do I need to do to analyze the 
error. Obviously I can connect to my database from the command prompt.

Thanks
Iain

--
This message has been scanned for viruses and
dangerous content by MailScanner on mail.ashcraftfamily.net, and is believed
to be clean.
Please report any deviance from this condition immediately to the AFN
Administrator at [EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] mysql limit

2004-06-30 Thread Bob Lockie
If I select rows with a limit clause I need to know if there are more 
rows than the limit.

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


Re: [PHP-DB] mysql limit

2004-06-30 Thread John W. Holmes
Bob Lockie wrote:
If I select rows with a limit clause I need to know if there are more 
rows than the limit.
Either do a SELECT COUNT(*) prior to your LIMIT query to see how many 
total rows there are, or use SQL_CALC_FOUND_ROWS and FOUND_ROWS() (more 
info here: http://dev.mysql.com/doc/mysql/en/Information_functions.html)

oh, and
echo something about php;
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] MySQL: Random select with specific count of a column

2004-06-29 Thread Torsten Roehr
Hi,

I've got the following table:

categorylanguagename
1   de  a
1   de  b
1   de  c
2   de  a
2   de  b
2   de  c
3   de  a
3   de  b
3   de  c
...
1   en  a
1   en  b
1   en  c

I would like to select 6 random rows where the language is 'de' AND make
sure that I will always have 2 rows of EACH category in my result set:
1   de  b
1   de  c
2   de  a
2   de  c
3   de  a
3   de  b

Any help greatly appreciated.


Thanks and best regards,

Torsten Roehr

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



Re: [PHP-DB] MySQL: Random select with specific count of a column

2004-06-29 Thread Pablo M. Rivas
Hello Torsten,

 This is one, but I think you can find another one:
 Supose your table is called tablename
 
 select * from tablename as a left join tablename as b on
 a.category = b.category and a.nameb.name and
 a.language=b.language where a.language='de' and b.name is not
 null group by a.category


TR I would like to select 6 random rows where the language is 'de' AND make
TR sure that I will always have 2 rows of EACH category in my result set:

-- 
Best regards,
 Pablo

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



Re: [PHP-DB] MySQL: Random select with specific count of a column

2004-06-29 Thread Torsten Roehr
Pablo M. Rivas [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello Torsten,

  This is one, but I think you can find another one:
  Supose your table is called tablename

  select * from tablename as a left join tablename as b on
  a.category = b.category and a.nameb.name and
  a.language=b.language where a.language='de' and b.name is not
  null group by a.category

Hi Pablo,

thanks for your help. Unfortunately it's always returning the same row for
each category (maybe because of the group by) and only one row for each
category. I need to select 2 random rows for each category. Any more ideas?

Thanks, Torsten

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



[PHP-DB] MYSQL Too Many Connections

2004-06-22 Thread John
How do I enable more connections for mysql. the default is 100 but i want to
set more. does anyone know?

--
**
Free Nokia Ringtones US
http://www.ring-tones.us
**

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



Re: [PHP-DB] MYSQL Too Many Connections

2004-06-22 Thread Sumito_Oda
Hi,

Refer to
http://dev.mysql.com/doc/mysql/en/Too_many_connections.html

Concretely, the description below is added to the [mysqld] section
of my.cnf (my.ini for Windows), and mysqld is rebooted. 

[mysqld]
set-variable=max_connections=500

-- 
Sumito_Oda mailto:[EMAIL PROTECTED]

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



[PHP-DB] mysql and indexes

2004-06-16 Thread Michael Gale
Hello,

   I know this question is more mysql related then PHP with mysql .. but


If I do a SHOW INDEX from table_name

I see what appears to be two index for the same column ?

table_name  0 PRIMARY   1   columnname  A   NULLNULLNULL
table_name  0 columnname1   columnname  A   6623NULLNULL

Could the multiple index cause a problem ? I am trying to speed up a DB
query ?


Michael.

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



[PHP-DB] MySQL executes several times the same request

2004-06-14 Thread Loïc Moisy
Hi Everyone !

I've coded a php site for a musical store. At the end of every page, before
closing the connection, I send an UPDATE request to increment a statistical
tool. Recently I saw weird results, so I tried to understand. Looking in my
logs, I saw that this request could be sent several times, arbitrary - can
be 5 times or 8 or whatever... So my counter is incremented from 4 to 8
times. The server seems to resend the whole requestes several times. I have
read all of my scripts, even coded some trace code, and sure there is no
loop.

The code seems like that:

$counter++;
$SQL = UPDATE statistics SET VALUE (`counter` = $counter)
$res = mysql_query($SQL);
mysql_closedb($DB);

So, I do not see anything strange. Can u help me ? My own thought about it
is something like a buffer not empty or something like that.

Thanks !

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



[PHP-DB] Mysql not receiving the data

2004-06-13 Thread Andrew Rothwell
Good day list,
I was running a Mysql/PHP DB/Webpage that was hosted on Redhat 8.0 
It was a simple DB - only 1 table, and the php page connected and fed data
to it.

Last weekend I rebuilt the server to Fedora Core 2 - using the default
PHP/Mysql/apache installs.

I setup the databases, and imported the old data (taken from a MySQL dump)
into the new DB, and setup Apache, so that I could view the pages that
displayed the data, and also the page that I used to add the data.

Online I could see everything, and the pages gave the appearance of working,
however when I went into the DB using PHPMYADMIN to check the status of the
new data entered, all I found was blank rows ( for the new data since the
rebuild, all the old data was there) There were the correct number of new
rows for the amount of records that I had entered, which tells me (unless I
am nistaken) that the PHP is talking to the DB, and is atleast sending a
insert command, but the rest of the data is not getting in. - 

I hope that I have made sense, Please note that the php/html pages used to
input the data used to work on the old server and had been running for
several years flawlessly. 

As I said I have a default conf for apache, obviously changing the bits that
needed to be changed (servername, etc) and did not change anything on the
PHP  MySQL confs.

Any ideas?

Thank you 
Andrew Rothwell

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



Re: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread Larry E . Ullman
Online I could see everything, and the pages gave the appearance of 
working,
however when I went into the DB using PHPMYADMIN to check the status 
of the
new data entered, all I found was blank rows ( for the new data since 
the
rebuild, all the old data was there) There were the correct number of 
new
rows for the amount of records that I had entered, which tells me 
(unless I
am nistaken) that the PHP is talking to the DB, and is atleast sending 
a
insert command, but the rest of the data is not getting in. -
Without seeing any code whatsoever and since this worked before but no 
longer works on a new install, I can only assume that your code was 
written with the assumption that register_globals was turned on and 
it's not on in your current configuration.

If that is the case, see the PHP manual or search the Web for the 
solution ($_POST, $_GET, etc.).

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


RE: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread Andrew Rothwell
Hi Larry, Thank you very much for the very quick response, I set my php.ini
file (located /etc/php.ini ) for the register_globals = On (it was off by
default)

Now however I get an error 
Error adding entry: You have an error in your SQL syntax near 's spanish
driver is found shot dead, Inspector Jacques Clouseau is the first off' at
line 8

My Database is a movie database of my dvd's that I own (for insurance
reasons)

My addmovie.php is this
?
  mysql_connect(localhost,username,password);
  mysql_select_db(movies);
  $add = INSERT INTO movies SET
 movie_name='$movie_name',
 genre='$genre',
 director='$director',
 star1='$star1',
 star2='$star2',
 star3='$star3',
 brief_synopsis='$brief_synopsis',
 imdb_link='$imdb_link';
  if (@mysql_query($add))
{
  echo(pYour entry has been added. br
  $movie_name/p);
}
  else
{
echo(pError adding entry:  .
mysql_error() . /p);
   }
?


And the addmovie.htm page (atleast the form action is this)

body bgcolor=#FF
form method=post action=addmovie.php name=addmovies
  table width=300 border=0 cellspacing=2 cellpadding=2
bordercolordark=#FF0033 bordercolorlight=#66
tr
  td width=41% bgcolor=#99Movie Name /td
  td width=59% bgcolor=#99FFCC 
input type=text name=movie_name
  /td
/tr


Andrew

-Original Message-
From: Larry E. Ullman [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 13, 2004 11:22 AM
To: Andrew Rothwell
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Mysql not receiving the data

 Online I could see everything, and the pages gave the appearance of 
 working, however when I went into the DB using PHPMYADMIN to check the 
 status of the new data entered, all I found was blank rows ( for the 
 new data since the rebuild, all the old data was there) There were the 
 correct number of new rows for the amount of records that I had 
 entered, which tells me (unless I am nistaken) that the PHP is talking 
 to the DB, and is atleast sending a insert command, but the rest of 
 the data is not getting in. -

Without seeing any code whatsoever and since this worked before but no
longer works on a new install, I can only assume that your code was written
with the assumption that register_globals was turned on and it's not on in
your current configuration.

If that is the case, see the PHP manual or search the Web for the solution
($_POST, $_GET, etc.).

Larry

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



Re: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread Lester Caine
Andrew Rothwell wrote:
Hi Larry, Thank you very much for the very quick response, I set my php.ini
file (located /etc/php.ini ) for the register_globals = On (it was off by
default)
Now however I get an error 
Error adding entry: You have an error in your SQL syntax near 's spanish
driver is found shot dead, Inspector Jacques Clouseau is the first off' at
line 8
I would think it fairly obvious that the extra ' in the text you are 
loading is causing a problem, use an ` instead, or escape the single 
'
Not sure if MySQL uses '' or \' :)

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


RE: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread Rich Hutchins
The apostrophe (') in your data is, most likely, killing the SQL statement
when it is sent to the server. Use addslashes() around all of your form data
to prevent this and also to help guard against SQL injection attacks.

Ex:

$add = INSERT INTO movies SET
 movie_name='.addslashes($movie_name).',
 genre='.addslashes($genre).',
 director='.addslashes($director).',
 star1='.addslashes($star1).',
 star2='.addslashes($star2).',
 star3='.addslashes($star3).',
 brief_synopsis='.addslashes($brief_synopsis).',
 imdb_link='$imdb_link';

Hope this helped.
Rich
-Original Message-
From: Andrew Rothwell [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 13, 2004 1:48 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Mysql not receiving the data


Hi Larry, Thank you very much for the very quick response, I set my php.ini
file (located /etc/php.ini ) for the register_globals = On (it was off by
default)

Now however I get an error
Error adding entry: You have an error in your SQL syntax near 's spanish
driver is found shot dead, Inspector Jacques Clouseau is the first off' at
line 8

My Database is a movie database of my dvd's that I own (for insurance
reasons)

My addmovie.php is this
?
  mysql_connect(localhost,username,password);
  mysql_select_db(movies);
  $add = INSERT INTO movies SET
 movie_name='$movie_name',
 genre='$genre',
 director='$director',
 star1='$star1',
 star2='$star2',
 star3='$star3',
 brief_synopsis='$brief_synopsis',
 imdb_link='$imdb_link';
  if (@mysql_query($add))
{
  echo(pYour entry has been added. br
  $movie_name/p);
}
  else
{
echo(pError adding entry:  .
mysql_error() . /p);
   }
?


And the addmovie.htm page (atleast the form action is this)

body bgcolor=#FF
form method=post action=addmovie.php name=addmovies
  table width=300 border=0 cellspacing=2 cellpadding=2
bordercolordark=#FF0033 bordercolorlight=#66
tr
  td width=41% bgcolor=#99Movie Name /td
  td width=59% bgcolor=#99FFCC
input type=text name=movie_name
  /td
/tr


Andrew

-Original Message-
From: Larry E. Ullman [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 13, 2004 11:22 AM
To: Andrew Rothwell
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Mysql not receiving the data

 Online I could see everything, and the pages gave the appearance of
 working, however when I went into the DB using PHPMYADMIN to check the
 status of the new data entered, all I found was blank rows ( for the
 new data since the rebuild, all the old data was there) There were the
 correct number of new rows for the amount of records that I had
 entered, which tells me (unless I am nistaken) that the PHP is talking
 to the DB, and is atleast sending a insert command, but the rest of
 the data is not getting in. -

Without seeing any code whatsoever and since this worked before but no
longer works on a new install, I can only assume that your code was written
with the assumption that register_globals was turned on and it's not on in
your current configuration.

If that is the case, see the PHP manual or search the Web for the solution
($_POST, $_GET, etc.).

Larry

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

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



Re: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread franciccio
I agree, the slashes are killing the query. I would suggets doing this:

 $add = INSERT INTO movies SET
  movie_name=\$movie_name\,
  genre=\$genre\,
  director=\$director\,
  star1=\$star1\,
  star2=\$star2\,
  star3=\$star3\,
  brief_synopsis=\$brief_synopsis\,
  imdb_link=\$imdb_link\;



Rich Hutchins [EMAIL PROTECTED] ha scritto nel messaggio
news:[EMAIL PROTECTED]
 The apostrophe (') in your data is, most likely, killing the SQL statement
 when it is sent to the server. Use addslashes() around all of your form
data
 to prevent this and also to help guard against SQL injection attacks.

 Ex:

 $add = INSERT INTO movies SET
  movie_name='.addslashes($movie_name).',
  genre='.addslashes($genre).',
  director='.addslashes($director).',
  star1='.addslashes($star1).',
  star2='.addslashes($star2).',
  star3='.addslashes($star3).',
  brief_synopsis='.addslashes($brief_synopsis).',
  imdb_link='$imdb_link';

 Hope this helped.
 Rich
 -Original Message-
 From: Andrew Rothwell [mailto:[EMAIL PROTECTED]
 Sent: Sunday, June 13, 2004 1:48 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Mysql not receiving the data


 Hi Larry, Thank you very much for the very quick response, I set my
php.ini
 file (located /etc/php.ini ) for the register_globals = On (it was off by
 default)

 Now however I get an error
 Error adding entry: You have an error in your SQL syntax near 's spanish
 driver is found shot dead, Inspector Jacques Clouseau is the first off' at
 line 8

 My Database is a movie database of my dvd's that I own (for insurance
 reasons)

 My addmovie.php is this
 ?
   mysql_connect(localhost,username,password);
   mysql_select_db(movies);
   $add = INSERT INTO movies SET
  movie_name='$movie_name',
  genre='$genre',
  director='$director',
  star1='$star1',
  star2='$star2',
  star3='$star3',
  brief_synopsis='$brief_synopsis',
  imdb_link='$imdb_link';
   if (@mysql_query($add))
 {
   echo(pYour entry has been added. br
   $movie_name/p);
 }
   else
 {
 echo(pError adding entry:  .
 mysql_error() . /p);
}
 ?


 And the addmovie.htm page (atleast the form action is this)

 body bgcolor=#FF
 form method=post action=addmovie.php name=addmovies
   table width=300 border=0 cellspacing=2 cellpadding=2
 bordercolordark=#FF0033 bordercolorlight=#66
 tr
   td width=41% bgcolor=#99Movie Name /td
   td width=59% bgcolor=#99FFCC
 input type=text name=movie_name
   /td
 /tr


 Andrew

 -Original Message-
 From: Larry E. Ullman [mailto:[EMAIL PROTECTED]
 Sent: Sunday, June 13, 2004 11:22 AM
 To: Andrew Rothwell
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Mysql not receiving the data

  Online I could see everything, and the pages gave the appearance of
  working, however when I went into the DB using PHPMYADMIN to check the
  status of the new data entered, all I found was blank rows ( for the
  new data since the rebuild, all the old data was there) There were the
  correct number of new rows for the amount of records that I had
  entered, which tells me (unless I am nistaken) that the PHP is talking
  to the DB, and is atleast sending a insert command, but the rest of
  the data is not getting in. -

 Without seeing any code whatsoever and since this worked before but no
 longer works on a new install, I can only assume that your code was
written
 with the assumption that register_globals was turned on and it's not on in
 your current configuration.

 If that is the case, see the PHP manual or search the Web for the solution
 ($_POST, $_GET, etc.).

 Larry

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

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



RE: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread Andrew Rothwell
Thank you everybody that responded so quickly -
I used the suggestion of Franciccio - and the data is now gow into the db
Thank you very much - I really appreciate the help.

Another question - with this fix in place - do I still need the
register_globals = On ?
Or can I now turn it off?

Thank you all again
Andrew

 

-Original Message-
From: franciccio [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 13, 2004 12:26 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Mysql not receiving the data

I agree, the slashes are killing the query. I would suggets doing this:

 $add = INSERT INTO movies SET
  movie_name=\$movie_name\,
  genre=\$genre\,
  director=\$director\,
  star1=\$star1\,
  star2=\$star2\,
  star3=\$star3\,
  brief_synopsis=\$brief_synopsis\,
  imdb_link=\$imdb_link\;

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



Re: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread Hans Lellelid
Hi Andrew,
Andrew Rothwell wrote:
Thank you everybody that responded so quickly -
I used the suggestion of Franciccio - and the data is now gow into the db
Thank you very much - I really appreciate the help.
Another question - with this fix in place - do I still need the
register_globals = On ?
Or can I now turn it off?
It seems like you should have kept your old php.ini file, as this other 
error you encountered was probably due to your old php.ini file having 
this setting:

magic_quotes_gpc = 1
That INI var instructs PHP to automatically addslashes() to any 
GET/POST/COOKIE data.  I would suggest turning this back on, unless 
you've thoroughly redesigned your code to not need it.

This is unrelated to register_globals, which you will need to leave on 
unless you redesign your application.

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


Re: [PHP-DB] Mysql not receiving the data

2004-06-13 Thread franciccio
Some of the reason to have register_global on is to easly use variables
sent by post, get, cookie method of a form.
Ex.
form name=form1 method=post action=anypage.php?get_var=1
  input type=text name=text_post value=Hello World
  input type=submit name=Submit value=Submit
/form


in your code at the page anypage.php you will have available the
variables:
$get_var==1 and $text_post==Hello World
if register_global=TRUE  in php.ini file
 - in this case u still have available $_POST;GET ecc...

$_GET['get_var']==1 and $_POST['text_post']==Hello World
if register_global=FALSE  in php.ini file
- in this case you don't have the $get_var e $text_post
available, so code is safer

I would suggest to leave register global=FALSE as to have safer code unless
u have to rewrite the whole code. Think about having hacked variables value
send by GET, COOKIE method.

Bye



Hans Lellelid [EMAIL PROTECTED] ha scritto nel messaggio
news:[EMAIL PROTECTED]
 Hi Andrew,

 Andrew Rothwell wrote:
  Thank you everybody that responded so quickly -
  I used the suggestion of Franciccio - and the data is now gow into the
db
  Thank you very much - I really appreciate the help.
 
  Another question - with this fix in place - do I still need the
  register_globals = On ?
  Or can I now turn it off?
 

 It seems like you should have kept your old php.ini file, as this other
 error you encountered was probably due to your old php.ini file having
 this setting:

 magic_quotes_gpc = 1

 That INI var instructs PHP to automatically addslashes() to any
 GET/POST/COOKIE data.  I would suggest turning this back on, unless
 you've thoroughly redesigned your code to not need it.

 This is unrelated to register_globals, which you will need to leave on
 unless you redesign your application.

 Hans

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



Re: [PHP-DB] MySQL persistent connections

2004-06-13 Thread Michael Gale
Hello,

I am no expert but I believe more information is required, like what
would be the average return of a mysql operation ? How many different
DB's are you accessing ? How many different usernames and passwords for
mysql are you using ??

I believe persistent connections are only useful when the amount of DB
connections being made is inversely proportional to the amount of data
being returned.

That is if you have 50 connections being created to check the same one
field in one table. Then persistent connections would be worth it. But
is you are returning 4-5MB of data per-query then persistent connections
would not be worth it.

Plus with persistent connections I have heard most people have issues
with hitting the too many open connections limit. Because the
connections are not being closed or reused.

Michael.




On Fri, 11 Jun 2004 11:38:37 -0400
Radek Zajkowski [EMAIL PROTECTED] wrote:

 
 
 Hey there PHP fiends,
 
 I have a bit of cookie here. We're designing a PHP based app that uses
 MySQL as the data storage. Scalability is an issue, we want to be able
 to handle up to 1 people utilizing the system (not at once of
 course).
 
 Question is, should I be connecting and disconnecting from the DB on
 each operation or increase the maximum number of allowed connections
 with MySQL and connect just once.
 
 TIA
 
 R
 
 -
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



[PHP-DB] mysql results, arrays, and for loops

2004-06-11 Thread Philip Thompson
Hi all!
I am using a select statement to obtain all the dates whenever someone 
submitted a problem in a database. Well, I want to get the result 
(which could be multiple dates) and then print that in a table format 
with some other information on a webpage. So I want to use a FOR loops 
and go through each of the dates and dynamically create a table.

My question is: how do I store the results of the select query? Would I 
want to store them in an array, and then just parse through each 
element of the array, and what is the syntax for that? Or is there a 
better way?

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


[PHP-DB] MySQL persistent connections

2004-06-11 Thread Radek Zajkowski


Hey there PHP fiends,

I have a bit of cookie here. We're designing a PHP based app that uses MySQL as
the data storage. Scalability is an issue, we want to be able to handle up to
1 people utilizing the system (not at once of course).

Question is, should I be connecting and disconnecting from the DB on each
operation or increase the maximum number of allowed connections with MySQL and
connect just once.

TIA

R

-

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



[PHP-DB] MySql syntax error using PHPWiki

2004-06-10 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Greetings,

I'm trying to set up a PHPWiki using Apache 2.0.49, PHP 4.3.7, PEAR 4.1.0,
and PHPWiki 1.3.10.

I get this error when trying to load index.php:

C:\Program Files\Apache
Group\Apache2\htdocs\lib\WikiDB\backend\PearDB.php:778: Fatal[256]:
wikidb_backend_mysql: fatal database error

DB Error: syntax error 
(SELECT sess_data FROM WHERE sess_id='8e7d43511c4184e42da9ed552e431332'
[nativecode=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
'WHERE sess_id='8e7d43511c4184e42da9ed552e431332'' at line 1])

It seems that the SQL syntax is incorrect as no table is included in the
SQL statement. Is it something to do with adding a 'prefix' = '', line
to $DBParams in index.php? Is it something else entirely?

Any help is appreciated.

James.

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



Re: [PHP-DB] MySql syntax error using PHPWiki

2004-06-10 Thread Mikhail U. Petrov
Hi!
You missed table definition:
 ... FROM my_table where ...


Wednesday, June 9, 2004, 12:57:02 PM, PHPDiscuss wrote:

PPNaml Greetings,

PPNaml I'm trying to set up a PHPWiki using Apache 2.0.49, PHP 4.3.7, PEAR 4.1.0,
PPNaml and PHPWiki 1.3.10.

PPNaml I get this error when trying to load index.php:

PPNaml C:\Program Files\Apache
PPNaml Group\Apache2\htdocs\lib\WikiDB\backend\PearDB.php:778: Fatal[256]:
PPNaml wikidb_backend_mysql: fatal database error

PPNaml DB Error: syntax error 
PPNaml (SELECT sess_data FROM WHERE sess_id='8e7d43511c4184e42da9ed552e431332'
PPNaml [nativecode=You have an error in your SQL syntax. Check the manual that
PPNaml corresponds to your MySQL server version for the right syntax to use near
PPNaml 'WHERE sess_id='8e7d43511c4184e42da9ed552e431332'' at line 1])

PPNaml It seems that the SQL syntax is incorrect as no table is included in the
PPNaml SQL statement. Is it something to do with adding a 'prefix' = '', line
PPNaml to $DBParams in index.php? Is it something else entirely?

PPNaml Any help is appreciated.

PPNaml James.



-- 
Best regards,
Mikhail U. Petrov
mailto:[EMAIL PROTECTED]

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



[PHP-DB] mysql adding

2004-06-04 Thread Steven Morgan
is there anyway to add 1 to an int with 1 mysql query, i know i can pull 
the value down with a SELECT then add 1 with php.. then do an UPDATE on 
it.. but i didn't know if there was any other way?
thanks
Steve Mo'

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


Re: [PHP-DB] mysql adding

2004-06-04 Thread Micah Stevens

update field = field + 1;



On Friday 04 June 2004 01:47 pm, Steven Morgan wrote:
 is there anyway to add 1 to an int with 1 mysql query, i know i can pull
 the value down with a SELECT then add 1 with php.. then do an UPDATE on
 it.. but i didn't know if there was any other way?
 thanks
 Steve Mo'

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



Re: [PHP-DB] mysql adding

2004-06-04 Thread Micah Stevens

Wait, sorry, It's late.. 

update tablename set fieldname = fieldname + 1;

That will increment all the rows in table, you can add a 'where' statement to 
limit the update. 

update tablename set fieldname = fieldname + 1 where indexfield = someindex;

-Micah

On Friday 04 June 2004 01:47 pm, Steven Morgan wrote:
 is there anyway to add 1 to an int with 1 mysql query, i know i can pull
 the value down with a SELECT then add 1 with php.. then do an UPDATE on
 it.. but i didn't know if there was any other way?
 thanks
 Steve Mo'

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



[PHP-DB] MySQL to DBF

2004-05-19 Thread Emilio Alvarado
I need to make a dbf file with some mysql records
The creation of the dbf with the dbase_create works FINE
Now I need to fill the dbf, I have a mysql database with some of the data, I
have the apropiate SQL to view that data but I need to make an array with
that data and some , 0.
How can i do this

Thanks

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



Re: [PHP-DB] mysql went away

2004-05-13 Thread Jeffrey Moss
I would start by seeing if the files are there after you create/load the
table. It should by default create a file for each table you create. Sounds
to me like a problem reading the disk.

If you don't find any answers on your own, post your system specs to the
MySQL lists. You could also try verbose debugging options, I've never used
any debugging, but here's how to do it in mysqladmin.

--debug[=debug_options], -# [debug_options]
Write a debugging log. The debug_options string often is 'd:t:o,file_name'.
The default is 'd:t:o,/tmp/mysqladmin.trace'.

-Jeff

- Original Message - 
From: Bill Green [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 12, 2004 4:05 PM
Subject: [PHP-DB] mysql went away


 HI. I've been using mySQL 4.0.13, php4.3.4, and phpMyAdmin2.5.5 on Mac
 OS 10.3.3 as a learning/testing/development environment for a couple of
 months now - no problems, works great.

 I've created more than a few mySQL databases and tables, but yesterday
 I created a database, a table, and LOAD DATA from within phpMyAdmin.
 Successfully. I looked at the data and all was fine. Logged out and
 went away for a while. Came back and phpMyAdmin would not show me my
 databases in the left frame, and I could not launch a query window. I
 could see runtime information, system vars, processes, and even
 privileges.

 I tried logging in to mySQL through the terminal, and I can run simple
 commands and connect OK, but any commands to show databases or tables
 will hang the terminal. Through the command line client I can run
 simple commands, but no commands to view or affect databases or tables.

 I can run php scripts - connect to databases, retrieve and even
 insert/update data, but I cannot view databases or tables.

 Does anyone have a clue about what the problems may be or where I
 should start?

 ---
 Bill Green
 20 Meadowview Drive
 Asheville, NC 28804
 --
 [EMAIL PROTECTED]
 http://www.billgreen.org
 828.252.1492

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


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



[PHP-DB] MySQL InnoDB vs MaxDB / SAP DB

2004-05-12 Thread Uzi Klein
Hello

We currently  run mysql 4.0.14 in MyISAM table format.
Server config :
Dual P-3 600
1GB of ECC SDRAM
6 SCSI drives 10,000 RPM using RAID 5 Array.

OS :
RedHat Linux 9.

We just realized we really need the adnvaned futures of InnoDB or MaxDB/SAP DB.
What would it takes (System preformance, code optimization etc.) to do such un upgrade,
and what would you sugest as the most stable / reliable database / table format to 
suit our needs?
(what we really lack right now is the use of foreign keys and replications).

Kind Regards

Uzi Klein
Web Development
BMBY Ltd



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



[PHP-DB] mysql went away

2004-05-12 Thread Bill Green
HI. I've been using mySQL 4.0.13, php4.3.4, and phpMyAdmin2.5.5 on Mac 
OS 10.3.3 as a learning/testing/development environment for a couple of 
months now - no problems, works great.

I've created more than a few mySQL databases and tables, but yesterday 
I created a database, a table, and LOAD DATA from within phpMyAdmin. 
Successfully. I looked at the data and all was fine. Logged out and 
went away for a while. Came back and phpMyAdmin would not show me my 
databases in the left frame, and I could not launch a query window. I 
could see runtime information, system vars, processes, and even 
privileges.

I tried logging in to mySQL through the terminal, and I can run simple 
commands and connect OK, but any commands to show databases or tables 
will hang the terminal. Through the command line client I can run 
simple commands, but no commands to view or affect databases or tables.

I can run php scripts - connect to databases, retrieve and even 
insert/update data, but I cannot view databases or tables.

Does anyone have a clue about what the problems may be or where I 
should start?

---
Bill Green
20 Meadowview Drive
Asheville, NC 28804
--
[EMAIL PROTECTED]
http://www.billgreen.org
828.252.1492
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


<    1   2   3   4   5   6   7   8   9   10   >