[PHP-DB] Re: [PHP] Re: ARRAY, IF INSERT

2002-06-24 Thread Jesper Brunholm

César aracena wrote:
 The catch would be to make PHP to auto assign the relatives level by
 knowing it has to start from $i=1 and loop $i++ until no other kid is
 inserted. Now that I write it, it seems I could use a for loop, but what
 should be the structure of it using the $name  0 you told me?

the name  0 was a sql-query - it will return a ressource which will 
enable you to make something like

$i=0;
while($row = mysql_fetch_assoc($nameless_result){

#psuedo-code#
# mysql_query=(insert into table set relativenumber = 'jr$i' where 
ID=$row[ID]);
}

regards

Jesper Brunholm

btw: please do not write to my private email

-- 
Phønix - Danish folk music from young musicians - http://www.phonixfolk.dk



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




[PHP-DB] Comment on Paper

2002-06-24 Thread ckra

Friends,
 I would like someone to comment upon the paper listed at 
http://business.vsnl.com/kalapila/socialrelevance.pdf , that mainly lists out the 
social relevance of Free Software, more so in the context of governance.

The comments would also be incorporated in the paper.

CK Raju
Kerala Institute of Local Administration,
Kerala, INDIA

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




[PHP-DB] RE: [PHP] Re: ARRAY, IF INSERT

2002-06-24 Thread César Aracena

 the name  0 was a sql-query - it will return a ressource which will
 enable you to make something like
 
 $i=0;
 while($row = mysql_fetch_assoc($nameless_result){
 
 #psuedo-code#
 # mysql_query=(insert into table set relativenumber = 'jr$i' where
 ID=$row[ID]);
 }

[César L. Aracena] I think you just showed me the smartest way of doing
it. After I deal with a deadline here, I will change my hard coded
script in order to try it... will let you know.

Thanks a lot.


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




[PHP-DB] PHP looses Resource-Id's

2002-06-24 Thread Michael Bretterklieber

Hi,

I found a bug in php4.2.1 (Windows XP, IIS with php as CGI).

- I have a db-class wich stores the resource-id of a db-connection.
- I have a function (itk_new_db) where I return an object of the class 
above and I remember this object in a static-var.
- the second call on that function (itk_new_db) returns the same object, 
but the resource-id is lost!?!?!?

This nice feature also exists with com-objects. This seems to be a cool 
bug in the resource-manager of php.

Any hints? If not I make a bugreport.

class db_class {
var $dbc = null;

function connect() {
$this-dbc = mssql_connect('wincubix', 'oebb', 'oebb');
// 
$this-dbc = mysql_connect('localhost:3308', 'root', '')
}
}

function itk_new_db(){
static $db;

if (!isset($db)) $db = new db_class;

return $db;
}

$db1 = itk_new_db();
$db1-connect();
$db2 = itk_new_db();

if ($db1 === $db2) echo 'identbr';

echo 'S1'.$db1-dbc.'br' ;
echo 'S2'.$db2-dbc.'br'  ;


bye,
-- 
--
Michael Bretterklieber
LCP
JAWA Management Software GmbH
Liebenauer Hauptstr. 200
A-8041 GRAZ
Tel: ++43-(0)316-403274-12
Fax: ++43-(0)316-403274-10
GSM: ++43-(0)676-93 96 698
[EMAIL PROTECTED]
homepage: http://www.jawa.at
- privat ---
E-mail:   [EMAIL PROTECTED]
homepage: http://www.inode.at/mbretter
--
...the number of UNIX installations has grown to 10, with more expected...
   - Dennis Ritchie and Ken Thompson, June 1972


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




[PHP-DB] Comment on Paper

2002-06-24 Thread ckra

Friends,

My earlier mail might not take the link to the intended destination.

The link is http://business.vsnl.com/kalapila/socialrelevance.pdf



Rgds,

CK Raju

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




Re: [PHP-DB] PHP looses Resource-Id's

2002-06-24 Thread Michael Bretterklieber

Hi,

not a bug in php a bug in my brain.

returning references from functions only works if you have  on 
function-declaration and call:

$db1 = itk_new_db();
$db1-connect();
$db2 = itk_new_db();

and then it works,

bye,

Michael Bretterklieber schrieb:
 Hi,
 
 I found a bug in php4.2.1 (Windows XP, IIS with php as CGI).
 
 - I have a db-class wich stores the resource-id of a db-connection.
 - I have a function (itk_new_db) where I return an object of the class 
 above and I remember this object in a static-var.
 - the second call on that function (itk_new_db) returns the same object, 
 but the resource-id is lost!?!?!?
 
 This nice feature also exists with com-objects. This seems to be a cool 
 bug in the resource-manager of php.
 
 Any hints? If not I make a bugreport.
 
 class db_class {
 var $dbc = null;
 
 function connect() {
 $this-dbc = mssql_connect('wincubix', 'oebb', 'oebb');
 // $this-dbc = mysql_connect('localhost:3308', 'root', '')
 }
 }
 
 function itk_new_db(){
 static $db;
 
 if (!isset($db)) $db = new db_class;
 
 return $db;
 }
 
 $db1 = itk_new_db();
 $db1-connect();
 $db2 = itk_new_db();
 
 if ($db1 === $db2) echo 'identbr';
 
 echo 'S1'.$db1-dbc.'br' ;
 echo 'S2'.$db2-dbc.'br'  ;
 
 
 bye,


-- 
--
Michael Bretterklieber
LCP
JAWA Management Software GmbH
Liebenauer Hauptstr. 200
A-8041 GRAZ
Tel: ++43-(0)316-403274-12
Fax: ++43-(0)316-403274-10
GSM: ++43-(0)676-93 96 698
[EMAIL PROTECTED]
homepage: http://www.jawa.at
- privat ---
E-mail:   [EMAIL PROTECTED]
homepage: http://www.inode.at/mbretter
--
...the number of UNIX installations has grown to 10, with more expected...
   - Dennis Ritchie and Ken Thompson, June 1972


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




[PHP-DB] Re: Whats more efficient....?

2002-06-24 Thread John Lim

Hi,

In a server farm, it depends on which machine has the lighter load, MySQL
or PHP.

If you are talking about running on the same machine, probably joining in
MySQL would be faster as it is optimized C code, while PHP is still running
in a virtual machine.

In general, benchmarks are the best test as above a just generalizations.

Regards, John

Matthew Nock [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Is it more efficient to run a SELECT query on a MySQL database that
 retrieves maybe 100 records from approximately 6 tables (based on one
 result - such as a product ID) and then process these results using
PHP

 or is it more efficient to run say 6 SELECT statements that get the exact
 details we want, and in the process returning a smaller number of results
 over all?

 If its the first of the two, then is it possible to use the MySQL Group
by
 structure to group the results, and store the results of each group (for
 example a product category) in separate arrays?

 ie;  array_prodcat1, array_prodcat2 etc etc?





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




[PHP-DB] Re: sql standard

2002-06-24 Thread John Lim

In general, columns are case-insensitive in every relational database I have
tried. However table names might not be.

Regards, John

Gerard Samuel [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hope someone can confirm this.
 I was moving a mysql dump to postgresql, and I had 2 tables with MiXeD
 upper/lower case letters, that
 got converted to lowercase.  I found a discussion that sql
 column/table/database names should be lowercase.
 Just trying to keep in line with a standard.
 Thanks

 --
 Gerard Samuel
 http://www.trini0.org:81/
 http://dev.trini0.org:81/





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




[PHP-DB] Writting in MSSQL

2002-06-24 Thread Santhyago B. Gallªo

Good morning, List,

Could somebody help me with the following problem?
When I call the function:

$sql= mssql_query(declare @temp numeric(9) set @temp =
(SELECT MAX(reqNumero)FROM requisicao)+1 insert into
requisicao
(reqNumero,codCliente,reqDataOpen,reqIP,reqHost,reqCriticidade
,reqCateg,reqDescricao,reqClosed) values
(@temp,'$codCliente','$data_abertura','$ip','$host_user','$cri
ticidade','$categoria','$descricao','0'));

The program starts writing in the database (M$SQL) and
doesn't stop until I stop the service of database and PWS.

The partial-full code is:

   switch ($acao) {
  case 'salvar':
 $con=mssql_pconnect($host,$user,$pass);
 mssql_select_db($banco);
 $sql= mssql_query(declare @temp numeric(9) set
@temp = (SELECT MAX(reqNumero)FROM requisicao)+1 insert into
requisicao
(reqNumero,codCliente,reqDataOpen,reqIP,reqHost,reqCriticidade
,reqCateg,reqDescricao,reqClosed) values
(@temp,'$codCliente','$data_abertura','$ip','$host_user','$cri
ticidade','$categoria','$descricao','0'));
 header(Location: $PHP_SELF?acao=salvo);
 break;
   }


Tks,

//--
Santhyago B. Gallão
e-mail: [EMAIL PROTECTED]
ICQ: 9708192
MSN: [EMAIL PROTECTED]


---
UOL na Copa 2002 - As principais notícias estão em UOL Esporte
http://esporte.uol.com.br/copa/


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




Re: [PHP-DB] Problem whith mysql_connect()

2002-06-24 Thread Fernando Gonzalez

Php Was installed when installing the Red Hat 7.0 .
Mysql Was installed later from rpm.

Any ideas of what can I do???

Thanks

Fernando


- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, June 23, 2002 3:01 PM
Subject: Re: [PHP-DB] Problem whith mysql_connect()


 On Monday 11 June 2001 23:46, Fernando Gonzalez wrote:
  When I try to connect to mysql on a linux server It gives me the
following
  message:
 
  Fatal error: Call to undefined function: mysql_connect() in
  /home/web/media/conection.inc on line 2

 The error means that your version of PHP was not compiled with MySQL
support.
 How did you install PHP? From source or RPM or whatever?

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


 /*
 Sic Transit Gloria Thursdi.
 */


 --
 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] Problem w/ mysql_pconnect

2002-06-24 Thread Tracker 1

Yes, the actual resolution of how the system is accessed is restricted,
usually the accounts are restricted by user@localhost, however, you
can iirc use user@% for access from anywhere, as part of the grant
statement... you can also change the account's host in the mysql.user
table.

Be carefull about using @%, unless you are behind a firewall and
blocking the port used by mysql (3306 by default).. you can change
the port to a non-standard port for mysql, but I have had issues with
various connection drivers, so, I am just more carefull with my firewall
restrictions.

--
===
Michael J. Ryan  -  tracker1[*at*]theroughnecks.com
Roughneck BBS: http://www.theroughnecks.net  telnet://theroughnecks.net
===
Y!: aztracker1 - aim: azTracker1 - icq: 4935386 - msn: see email
One program for aim/icq/yahoo/msn/irc  -  http://www.trillian.cc/


Chris Barnes [EMAIL PROTECTED] wrote in message
000201c21ac1$3f0c0d80$[EMAIL PROTECTED]">news:000201c21ac1$3f0c0d80$[EMAIL PROTECTED]...
 Hi Paul,
 I'm no MySQL expert and i'm only very new to this list but i have had the
 same problem before.
 What i did to fix the problem was replace localhost with the ip address of
 the machine...so on my network i my MySQL server is 10.3.2.1 so i used
 10.3.2.1 instead of localhost and it worked for me.

 the real solution i guess would be to grant access for that username from
 the localhost.localdomain address in your MySQL server.

 see how u go.

 -Original Message-
 From: Paul D [mailto:[EMAIL PROTECTED]]
 Sent: Monday, 24 June 2002 12:07 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Problem w/ mysql_pconnect


 I'm using PHP 4.2.0 with MYSQL 3.23. When I try to use either the
 mysql_connect or mysql_pconnect to access the database, I get the
 following error message:

 Access denied for user: '[EMAIL PROTECTED]' (Using password: YES)

 I have tried different user names and nothing seems to work. If I use
 the functions without any parameters, it'll work just fine, and when I
 try access directly from the console, it'll work fine also. The problem
 seems to lie with the function parameters, which is written as follows:

   $db = mysql_pconnect(localhost, pauld, any_pwd) or
 die($php_errormsg);

 Any suggestions would be very much appreciated.


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




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




[PHP-DB] Re: Problem w/ mysql_pconnect

2002-06-24 Thread Tracker 1

php, is probably resolving localhost, to its' bound external ip,
or something other than 127.0.0.1 (in your hosts file, make
sure that localhost is in it.) or change the user's host in the
mysql.user table to localhost.localdomain, which will work too.

--
===
Michael J. Ryan  -  tracker1[*at*]theroughnecks.com
Roughneck BBS: http://www.theroughnecks.net  telnet://theroughnecks.net
===
Y!: aztracker1 - aim: azTracker1 - icq: 4935386 - msn: see email
One program for aim/icq/yahoo/msn/irc  -  http://www.trillian.cc/


Paul D [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Guys,

 I appreciate your input very much. This machine is a standalone unit.
 That's why I'm using localhost. The user account has already been
 set-up in MySQL with the correct privileges, and I'm able to login at
 the console command prompt using mysql -h localhost -u pauld -p
 my_pwd, with no problem at all. That's why I'm assuming that the
 problem lies somewhere else.

 Paul D wrote:
  I'm using PHP 4.2.0 with MYSQL 3.23. When I try to use either the
  mysql_connect or mysql_pconnect to access the database, I get the
  following error message:
 
  Access denied for user: '[EMAIL PROTECTED]' (Using password: YES)
 
  I have tried different user names and nothing seems to work. If I use
  the functions without any parameters, it'll work just fine, and when I
  try access directly from the console, it'll work fine also. The problem
  seems to lie with the function parameters, which is written as follows:
 
   $db = mysql_pconnect(localhost, pauld, any_pwd) or
  die($php_errormsg);
 
  Any suggestions would be very much appreciated.
 




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




[PHP-DB] Re: Question

2002-06-24 Thread Tracker 1

you are thinking backwards..

drives 1- computers

tblComputers
iCompID As BigInt Primary Key Autonumber,
sCompName As VARCHAR(25)
...

tblDrives
iDriveID As BigInt Primary Key Autonumber,
iComputerID As BigInt Not Null,
Foreign Key fkDriveComputer (iCompID) References tblComputers(iCompID)

note, you need to use InnoDB tables in mysql for foreign key references
to work properly, you should do it in your code anyway..

select * from tblComputers
for each rsComp..
select * from drives where iComputerID = (rsComp.iCompID)

there you go.. :)

--
===
Michael J. Ryan  -  tracker1[*at*]theroughnecks.com
Roughneck BBS: http://www.theroughnecks.net  telnet://theroughnecks.net
===
Y!: aztracker1 - aim: azTracker1 - icq: 4935386 - msn: see email
One program for aim/icq/yahoo/msn/irc  -  http://www.trillian.cc/


Mike Tuller [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I am wanting to create a PHP frontend to a database that holds information
 about the computers that I take care of. I have a problem though when it
 comes to storing hard drive information. In most cases, the computers have
 one drive, but some have 2 or more, so I can't create the main database with
 fields like this.

 ComputerID
 HardDriveType
 HardDriveSize

 I know I will need to create a separate table to hold information about the
 drives, and connect them to the computer by attaching the primary key of the
 drives table to the Computer table.

 Computer Table

 ComputerID
 DriveID
 
 Drive Table

 DriveID
 HardDriveType
 HardDriveSize

 This is where I am unsure. If there is more than one drive, then this would
 be incomplete because it would only show one drive. What is the best way to
 make it so that all drives show for the computer, or am I doing this
 backwards? Should I tie the computer to the drive instead?

 Thanks,
 Mike




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




Re: [PHP-DB] Question

2002-06-24 Thread Tracker 1

in this instance, where a computer isn't likely to contain more than
x drives, it may work, however, if he wants to later include sn's,
and mfg's a separate table would be better.. :)

--
===
Michael J. Ryan  -  tracker1[*at*]theroughnecks.com
Roughneck BBS: http://www.theroughnecks.net  telnet://theroughnecks.net
===
Y!: aztracker1 - aim: azTracker1 - icq: 4935386 - msn: see email
One program for aim/icq/yahoo/msn/irc  -  http://www.trillian.cc/


Chris Barnes [EMAIL PROTECTED] wrote in message
01c21ae8$b7ad7bd0$[EMAIL PROTECTED]">news:01c21ae8$b7ad7bd0$[EMAIL PROTECTED]...
 i dont know how will this will work, but you could try storing the multiple
 hard disk details for each computer in an array in 1 field.
 then when you want to get the information from the db, use explode() to
 store the value in the field into an array again.

 e.g.
 the field in the DB might look like this...
 HardDriveSize = 1.2Gb,25Gb,25Gb

 so get the field from the db and then use explode() to store it in an array
 in php.
 e.g.
 $disk_size = explode(, , $field);

 i dont know how well this will work for you...i'm only a newbie.


 -Original Message-
 From: Mike Tuller [mailto:[EMAIL PROTECTED]]
 Sent: Monday, 24 June 2002 3:43 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Question


 I am wanting to create a PHP frontend to a database that holds information
 about the computers that I take care of. I have a problem though when it
 comes to storing hard drive information. In most cases, the computers have
 one drive, but some have 2 or more, so I can't create the main database with
 fields like this.

 ComputerID
 HardDriveType
 HardDriveSize

 I know I will need to create a separate table to hold information about the
 drives, and connect them to the computer by attaching the primary key of the
 drives table to the Computer table.

 Computer Table

 ComputerID
 DriveID
 
 Drive Table

 DriveID
 HardDriveType
 HardDriveSize

 This is where I am unsure. If there is more than one drive, then this would
 be incomplete because it would only show one drive. What is the best way to
 make it so that all drives show for the computer, or am I doing this
 backwards? Should I tie the computer to the drive instead?

 Thanks,
 Mike


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




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




[PHP-DB] Re: Whats more efficient....?

2002-06-24 Thread Tracker 1

For now, probably more effective to run separate queries, in 4.1 mySQL
is supposed to include stored proc's at least for InnoDB tables, which
would be best of all... and is what I would like to see, in addition to
multiple query/recordset returns...

in MS-SQL/DB2/Oracle, i've created some complex security models, that
return all the security parameters for a given user in one stored
procedure, that returns 4 recordsets...

If there is no easy way to return the data you want, do it in code,
this may have a higher memory hit, but will be more maintainable in
code... try to break it into smaller functions if you need to, then
you can have the functions call a stored procedure later when that
functionality becomes available.

--
===
Michael J. Ryan  -  tracker1[*at*]theroughnecks.com
Roughneck BBS: http://www.theroughnecks.net  telnet://theroughnecks.net
===
Y!: aztracker1 - aim: azTracker1 - icq: 4935386 - msn: see email
One program for aim/icq/yahoo/msn/irc  -  http://www.trillian.cc/


Matthew Nock [EMAIL PROTECTED] wrote in message...
 Is it more efficient to run a SELECT query on a MySQL database that
 retrieves maybe 100 records from approximately 6 tables (based on one
 result - such as a product ID) and then process these results using PHP

 or is it more efficient to run say 6 SELECT statements that get the exact
 details we want, and in the process returning a smaller number of results
 over all?

 If its the first of the two, then is it possible to use the MySQL Group by
 structure to group the results, and store the results of each group (for
 example a product category) in separate arrays?

 ie;  array_prodcat1, array_prodcat2 etc etc?





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




[PHP-DB] Re: sql standard

2002-06-24 Thread Tracker 1

usually, stick with one of the following..

all lowercase, all uppercase, Or Always InterCase

or, my personal preference... lblInterCase


Have seen some that will make DB names caps, tbl names lower, and
column names lblInterCase... pick what you want, and go with it, if
you are working with others, try to match their methodology...

There really isn't a right way, I use lblIntercase for columns
dbname_TableName for tables, and dbname for the db, this is in case
I ever have to work with foreign dbs or join a project, you can tell
where something came from, and what it holds.

Keeping a UML diagram helps too...

--
===
Michael J. Ryan  -  tracker1[*at*]theroughnecks.com
Roughneck BBS: http://www.theroughnecks.net  telnet://theroughnecks.net
===
Y!: aztracker1 - aim: azTracker1 - icq: 4935386 - msn: see email
One program for aim/icq/yahoo/msn/irc  -  http://www.trillian.cc/


Gerard Samuel [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hope someone can confirm this.
 I was moving a mysql dump to postgresql, and I had 2 tables with MiXeD
 upper/lower case letters, that
 got converted to lowercase.  I found a discussion that sql
 column/table/database names should be lowercase.
 Just trying to keep in line with a standard.
 Thanks

 --
 Gerard Samuel
 http://www.trini0.org:81/
 http://dev.trini0.org:81/





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




[PHP-DB] force no results

2002-06-24 Thread Martin Adler

Hi,

is it possible to force mysql in a SELECT clause depend on a
condition to give no results?

for example:
I do a SELECT and get 3 rows as result,
but one row contains a value, which make the
other rows worthless. and I won't get this results

thank's

sincerely
Martin

-
Martin Adler   CGI, Perl, PHP

Continum AG  Tel. +49 761 4794090
Bötzinger Straße 29a Fax. +49 761 4794099
79111 Freiburg i. Br. http://www.continum.net
-



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




Re: [PHP-DB] force no results

2002-06-24 Thread Martin Clifford

Could you give us some examples of entries in the table?  You might need to set it up 
as a relational database, but we can't know that without information.

Martin C

 Martin Adler [EMAIL PROTECTED] 06/24/02 10:47AM 
Hi,

is it possible to force mysql in a SELECT clause depend on a
condition to give no results?

for example:
I do a SELECT and get 3 rows as result,
but one row contains a value, which make the
other rows worthless. and I won't get this results

thank's

sincerely
Martin

-
Martin Adler   CGI, Perl, PHP

Continum AG  Tel. +49 761 4794090
Bötzinger Straße 29a Fax. +49 761 4794099
79111 Freiburg i. Br. http://www.continum.net 
-



-- 
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] force no results

2002-06-24 Thread Jason Wong

On Monday 24 June 2002 22:47, Martin Adler wrote:
 Hi,

 is it possible to force mysql in a SELECT clause depend on a
 condition to give no results?

 for example:
 I do a SELECT and get 3 rows as result,
 but one row contains a value, which make the
 other rows worthless. and I won't get this results

Without knowing what your query looks like, I would have thought that you 
would construct the query to return the results that you would actually need!

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


/*
Giving money and power to governments is like giving whiskey and
car keys to teenage boys.
-- P.J. O'Rourke
*/


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




[PHP-DB] DB400 on AS/400

2002-06-24 Thread Mike Germain

I am trying to do a query on a database on an AS/400. The database is in
DB400 format which is simaluar to DB2. Can PHP access databases in DB400 via
ODBC or does it only work in DB2?
thx,
Mike




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




[PHP-DB] Re: force no results

2002-06-24 Thread Seth Yount

Have you tried using and ' NOT IN ' statement in your WHERE clause?
There are many comparison operators that you might find useful.  They 
are covered in 6.3.1.2 of the MySQL Manual, you may also follow this 
link :  http://www.mysql.com/doc/C/o/Comparison_Operators.html.

If you can't solve this problem through comparison operators, you may 
need to check and see how you are identifying your data results. 
Possible table joins or maybe even a ' LIKE ' statements might help.  I 
would have to have more information on your situation to really be of 
any help though

gl -- Seth

Martin Adler wrote:

 Hi,
 
 is it possible to force mysql in a SELECT clause depend on a
 condition to give no results?
 
 for example:
 I do a SELECT and get 3 rows as result,
 but one row contains a value, which make the
 other rows worthless. and I won't get this results
 
 thank's
 
 sincerely
 Martin
 
 -
 Martin Adler   CGI, Perl, PHP
 
 Continum AG  Tel. +49 761 4794090
 Bötzinger Straße 29a Fax. +49 761 4794099
 79111 Freiburg i. Br. http://www.continum.net
 -
 
 
 


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




[PHP-DB] never seen this before..

2002-06-24 Thread Jas

I am getting an error when inserting data into a mysql database table.  It
is telling me that there is a duplicate entry in the database everytime it
gets 10 records inserted to the table, if I flush the table and try it again
it works fine.  Is there some kind of limit on some tables?  Here is the
error php outputs once the table gets 10 records: Duplicate entry '10' for
key 1
Here is the code...
require '/home/web/b/bignickel.net/scripts/admin/db.php';
 $table = demo_sessions;
 $sql_insert = INSERT INTO $table (ipaddy,date) VALUES
('$ipaddy','$date') or die('Could not insert client info');
 $result = mysql_query($sql_insert,$dbh) or die(MYSQL_ERROR());

Any help on this would be great
TIA
Jas



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




[PHP-DB] Re: never seen this before..

2002-06-24 Thread user

TIA --


column in your table denotes your primary key? After that, how is it 
incremented? Is it auto or do you have some other form of it.  I think 
your code is correct so the error seems to be how the data ID is generated.

gl -- Seth

Jas wrote:

 I am getting an error when inserting data into a mysql database table.  It
 is telling me that there is a duplicate entry in the database everytime it
 gets 10 records inserted to the table, if I flush the table and try it again
 it works fine.  Is there some kind of limit on some tables?  Here is the
 error php outputs once the table gets 10 records: Duplicate entry '10' for
 key 1
 Here is the code...
 require '/home/web/b/bignickel.net/scripts/admin/db.php';
  $table = demo_sessions;
  $sql_insert = INSERT INTO $table (ipaddy,date) VALUES
 ('$ipaddy','$date') or die('Could not insert client info');
  $result = mysql_query($sql_insert,$dbh) or die(MYSQL_ERROR());
 
 Any help on this would be great
 TIA
 Jas
 
 
 


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




[PHP-DB] Re: never seen this before..

2002-06-24 Thread Jas

Here is the db table structure...
CREATE TABLE demo_sessions (
   id varchar(255) NOT NULL auto_increment,
   ipaddy varchar(255) NOT NULL,
   date varchar(255) NOT NULL,
   PRIMARY KEY (id)
);
Let me know if this is correct, I have a feeling that the varchar is my
problem but I could be wrong.
TIA
Jas

[EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 TIA --


 column in your table denotes your primary key? After that, how is it
 incremented? Is it auto or do you have some other form of it.  I think
 your code is correct so the error seems to be how the data ID is
generated.

 gl -- Seth

 Jas wrote:

  I am getting an error when inserting data into a mysql database table.
It
  is telling me that there is a duplicate entry in the database everytime
it
  gets 10 records inserted to the table, if I flush the table and try it
again
  it works fine.  Is there some kind of limit on some tables?  Here is the
  error php outputs once the table gets 10 records: Duplicate entry '10'
for
  key 1
  Here is the code...
  require '/home/web/b/bignickel.net/scripts/admin/db.php';
   $table = demo_sessions;
   $sql_insert = INSERT INTO $table (ipaddy,date) VALUES
  ('$ipaddy','$date') or die('Could not insert client info');
   $result = @mysql_query($sql_insert,$dbh) or die(MYSQL_ERROR());
 
  Any help on this would be great
  TIA
  Jas
 
 
 




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




RE: [PHP-DB] Re: never seen this before..

2002-06-24 Thread Cosby, Christopher

Must be an old or broken version of mysql.  I'm running 3.23.50 and it won't
even allow the `id' field to be a varchar(255).  Change it to int() and
watch the magic.

-Original Message-
From: Jas [mailto:[EMAIL PROTECTED]] 
Sent: Monday, June 24, 2002 1:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: never seen this before..


Here is the db table structure...
CREATE TABLE demo_sessions (
   id varchar(255) NOT NULL auto_increment,
   ipaddy varchar(255) NOT NULL,
   date varchar(255) NOT NULL,
   PRIMARY KEY (id)
);
Let me know if this is correct, I have a feeling that the varchar is my
problem but I could be wrong. TIA Jas

[EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 TIA --


 column in your table denotes your primary key? After that, how is it 
 incremented? Is it auto or do you have some other form of it.  I think 
 your code is correct so the error seems to be how the data ID is
generated.

 gl -- Seth

 Jas wrote:

  I am getting an error when inserting data into a mysql database 
  table.
It
  is telling me that there is a duplicate entry in the database 
  everytime
it
  gets 10 records inserted to the table, if I flush the table and try 
  it
again
  it works fine.  Is there some kind of limit on some tables?  Here is 
  the error php outputs once the table gets 10 records: Duplicate 
  entry '10'
for
  key 1
  Here is the code...
  require '/home/web/b/bignickel.net/scripts/admin/db.php';
   $table = demo_sessions;
   $sql_insert = INSERT INTO $table (ipaddy,date) VALUES 
  ('$ipaddy','$date') or die('Could not insert client info');
   $result = @mysql_query($sql_insert,$dbh) or die(MYSQL_ERROR());
 
  Any help on this would be great
  TIA
  Jas
 
 
 




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


 - - - - - - -  Appended by Scientific-Atlanta, Inc.  - - - - - - -  
This e-mail and any attachments may contain information which is confidential, 
proprietary, privileged or otherwise protected by law. The information is solely 
intended for the named addressee (or a person responsible for delivering it to the 
addressee). If you are not the intended recipient of this message, you are not 
authorized to read, print, retain, copy or disseminate this message or any part of it. 
If you have received this e-mail in error, please notify the sender immediately by 
return e-mail and delete it from your computer. 




[PHP-DB] Re: never seen this before..

2002-06-24 Thread Seth Yount

I believe your assumption is correct.  VARCHAR is not the best datatype 
suitable for indexing.  I understand why you want to utilize this type, 
so that you are not storing empty characters.  I am assuming that the id 
column is numerical in nature.  In that case, make the data type INT. 
This way it increments just a number and it only stores the amount of 
characters needed.

i.e.  : id INT NOT NULL auto_increment,

This should solve your problem, post again if not

gl -- Seth


Jas wrote:

 Here is the db table structure...
 CREATE TABLE demo_sessions (
id varchar(255) NOT NULL auto_increment,
ipaddy varchar(255) NOT NULL,
date varchar(255) NOT NULL,
PRIMARY KEY (id)
 );
 Let me know if this is correct, I have a feeling that the varchar is my
 problem but I could be wrong.
 TIA
 Jas
 
 [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
TIA --


column in your table denotes your primary key? After that, how is it
incremented? Is it auto or do you have some other form of it.  I think
your code is correct so the error seems to be how the data ID is

 generated.
 
gl -- Seth

Jas wrote:


I am getting an error when inserting data into a mysql database table.

 It
 
is telling me that there is a duplicate entry in the database everytime

 it
 
gets 10 records inserted to the table, if I flush the table and try it

 again
 
it works fine.  Is there some kind of limit on some tables?  Here is the
error php outputs once the table gets 10 records: Duplicate entry '10'

 for
 
key 1
Here is the code...
require '/home/web/b/bignickel.net/scripts/admin/db.php';
 $table = demo_sessions;
 $sql_insert = INSERT INTO $table (ipaddy,date) VALUES
('$ipaddy','$date') or die('Could not insert client info');
 $result = @mysql_query($sql_insert,$dbh) or die(MYSQL_ERROR());

Any help on this would be great
TIA
Jas




 
 


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




[PHP-DB] what the heck? (elementary question)

2002-06-24 Thread Matthew Crouch

this bit from my index page is giving me 2 headaches:
1. it isn't passing anything into the URL
2. the page that gets called (name.php) sits and tries to load
forever. it looks like it's even filling up my hard drive with data (?!)

Note: it does this (#2) even if I type in the URL with a variable and
value, like name.php?lastname=smith

?
printf (form method=\post\ action=\name.php?lastname=%s\,
$lastname);
?
div align=center
  input type=Text name=lastname size=75
  input type=Submit name=submit value=Search for Last Name
/div
  /form
/div


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




[PHP-DB] what the heck? update

2002-06-24 Thread Matthew Crouch


I changed method to GET and the value of $lastname seems to be getting
passed but so is $submit, with the value Search for Last Name as you might
expect. Probably this ain't the answer

Matthew Crouch wrote:

 this bit from my index page is giving me 2 headaches:
 1. it isn't passing anything into the URL
 2. the page that gets called (name.php) sits and tries to load
 forever. it looks like it's even filling up my hard drive with data (?!)

 Note: it does this (#2) even if I type in the URL with a variable and
 value, like name.php?lastname=smith

 ?
 printf (form method=\post\ action=\name.php?lastname=%s\,
 $lastname);
 ?
 div align=center
   input type=Text name=lastname size=75
   input type=Submit name=submit value=Search for Last Name
 /div
   /form
 /div


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




Re: [PHP-DB] MSSQL

2002-06-24 Thread William Fong

User setup depends on how you configured MS SQL.  IIRC, MS SQL defaults
(during installation) to use Windows user accounts.  MS SQL is a lot nicer
to work with IMO than MySQL, but I can't justify the $12k+ price tag for a
majority of my operations (unlimited Net license).

-w

--
William Fong - [EMAIL PROTECTED]
Phone: 626.968.6424 x210  |  Fax: 626.968.6877
Wireless #: 714.315.8954|  Wireless E-mail:


- Original Message -
From: Gerard Samuel [EMAIL PROTECTED]
To: php-db [EMAIL PROTECTED]
Sent: Friday, June 21, 2002 1:07 PM
Subject: [PHP-DB] MSSQL


 I just starting with mssql coming from a mysql background.
 Im looking for tutorials and such on how to get scripts working with php.
 The server is IIS 5 with php 4.2.1 and mssql 2000.  phpinfo() shows that
 mssql is recognised.
 Im not sure if I have to jump through hoops like how I did when I first
 started with mysql in setting up
 users for each database with mssql.  But any resources would be greatly
 appreciated.
 Meantime, Ill start with the manual and user feedback comments...
 Thanks

 --
 Gerard Samuel
 http://www.trini0.org:81/
 http://dev.trini0.org:81/



 --
 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 password

2002-06-24 Thread Page Works Web Solutions

Hi all,
   I have a Cobalt Raq 4 running Linux.  I've installed the .pkg file
RaQ3-RaQ4-MySQL-3.23.37-1.pkg  I can telnet into the server and I type
mysql, now I see that I'm in MySql, but when I type

bin/mysqladmin -password and put a password in, it just goes to the next
line with a - and a blinking cursor.  Help?

Shawn Hennessey


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




[PHP-DB] Re: what the heck? (elementary question)

2002-06-24 Thread Seth Yount

in you print statement you have ?lastname=%s, shouldn't that be '$s' 
denoting a variable being passed?  Try that out.

gl -- Seth

Matthew Crouch wrote:

 this bit from my index page is giving me 2 headaches:
 1. it isn't passing anything into the URL
 2. the page that gets called (name.php) sits and tries to load
 forever. it looks like it's even filling up my hard drive with data (?!)
 
 Note: it does this (#2) even if I type in the URL with a variable and
 value, like name.php?lastname=smith
 
 ?
 printf (form method=\post\ action=\name.php?lastname=%s\,
 $lastname);
 ?
 div align=center
   input type=Text name=lastname size=75
   input type=Submit name=submit value=Search for Last Name
 /div
   /form
 /div
 


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




Re: [PHP-DB] MySql password

2002-06-24 Thread Paul DuBois

At 14:58 -0400 6/24/02, Page Works Web Solutions wrote:
Hi all,
I have a Cobalt Raq 4 running Linux.  I've installed the .pkg file
RaQ3-RaQ4-MySQL-3.23.37-1.pkg  I can telnet into the server and I type
mysql, now I see that I'm in MySql, but when I type

bin/mysqladmin -password and put a password in, it just goes to the next
line with a - and a blinking cursor.  Help?

Shawn Hennessey

What's your PHP question?


mysqladmin is a shell command, you don't run it from within mysql.


--
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] what the heck? update

2002-06-24 Thread Cosby, Christopher

Try the PHP documentation, see if it helps.  If not, come back with a tiny
bit more detail.  The fact that `lastname' and `submit' are both being
passed to the next page is correct, you're not seeing things.  $submit is
just another variable in the world of PHP.

http://www.php.net/manual/en/language.variables.external.php

chris

-Original Message-
From: Matthew Crouch [mailto:[EMAIL PROTECTED]] 
Sent: Monday, June 24, 2002 2:59 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] what the heck? update



I changed method to GET and the value of $lastname seems to be getting
passed but so is $submit, with the value Search for Last Name as you might
expect. Probably this ain't the answer

Matthew Crouch wrote:

 this bit from my index page is giving me 2 headaches:
 1. it isn't passing anything into the URL
 2. the page that gets called (name.php) sits and tries to load 
 forever. it looks like it's even filling up my hard drive with data 
 (?!)

 Note: it does this (#2) even if I type in the URL with a variable and 
 value, like name.php?lastname=smith

 ?
 printf (form method=\post\ action=\name.php?lastname=%s\,
 $lastname);
 ?
 div align=center
   input type=Text name=lastname size=75
   input type=Submit name=submit value=Search for Last Name
 /div
   /form
 /div


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


 - - - - - - -  Appended by Scientific-Atlanta, Inc.  - - - - - - -  
This e-mail and any attachments may contain information which is confidential, 
proprietary, privileged or otherwise protected by law. The information is solely 
intended for the named addressee (or a person responsible for delivering it to the 
addressee). If you are not the intended recipient of this message, you are not 
authorized to read, print, retain, copy or disseminate this message or any part of it. 
If you have received this e-mail in error, please notify the sender immediately by 
return e-mail and delete it from your computer. 




[PHP-DB] got it, thanks

2002-06-24 Thread Matthew Crouch



Seth Yount wrote:

 in you print statement you have ?lastname=%s, shouldn't that be '$s'
 denoting a variable being passed?  Try that out.

 gl -- Seth

 Matthew Crouch wrote:

  this bit from my index page is giving me 2 headaches:
  1. it isn't passing anything into the URL
  2. the page that gets called (name.php) sits and tries to load
  forever. it looks like it's even filling up my hard drive with data (?!)
 
  Note: it does this (#2) even if I type in the URL with a variable and
  value, like name.php?lastname=smith
 
  ?
  printf (form method=\post\ action=\name.php?lastname=%s\,
  $lastname);
  ?
  div align=center
input type=Text name=lastname size=75
input type=Submit name=submit value=Search for Last Name
  /div
/form
  /div
 


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




[PHP-DB] brand new elementary question

2002-06-24 Thread Matthew Crouch

got my other one sorted out; thanks everyone.
now:
how do i get it so when you hit enter on the keyboard it's the same as
hitting the submit button with the mouse? When I hit enter, it clears
my form and reloads the current page.


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




[PHP-DB] Re: brand new elementary question

2002-06-24 Thread Seth Yount

initially I would look at your button type in the source code.  Their 
are two basic types of buttons, the ' submit ' and the ' clear form '.

If that doesn't work, post back

gl -- Seth

Matthew Crouch wrote:

 got my other one sorted out; thanks everyone.
 now:
 how do i get it so when you hit enter on the keyboard it's the same as
 hitting the submit button with the mouse? When I hit enter, it clears
 my form and reloads the current page.
 
 


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




Re: [PHP-DB] what the heck? (elementary question)

2002-06-24 Thread Steve Cayford


On Monday, June 24, 2002, at 01:52  PM, Matthew Crouch wrote:

 this bit from my index page is giving me 2 headaches:
 1. it isn't passing anything into the URL
 2. the page that gets called (name.php) sits and tries to load
 forever. it looks like it's even filling up my hard drive with data (?!)

 Note: it does this (#2) even if I type in the URL with a variable and
 value, like name.php?lastname=smith

 ?
 printf (form method=\post\ action=\name.php?lastname=%s\,
 $lastname);
 ?
 div align=center
   input type=Text name=lastname size=75
   input type=Submit name=submit value=Search for Last Name
 /div
   /form
 /div


Can you do a get and a post at the same time? Tacking the lastname 
onto the url as in action=\name.php?lastname=%s\ is using a get 
method, but your form is supposed to set lastname using the post method. 
Is there some reason you want your script to set one version of lastname 
and let the user type in a different version of lastname? If so try 
using the post method with an input type=hidden name=otherlastname 
value=$lastname.

-Steve


 --
 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] what the heck? (elementary question)

2002-06-24 Thread Martin Clifford

You can't have extensions to a filename from the action attribute, period.  You have 
to either use defined input fields, or hidden fields to pass value from one page to 
another.

And just as FYI, you don't need to use the printf() function in your situation, as 
it's best used when you need strict formatting for output, as in the case of using 
currency amounts, or other situations where decimal places are needed.

The easier way to write it would be simply:

echo form method=\post\ actoin=\name.php\;
echo input type=\hidden\ name=\lastname\ value=\$lastname\;

HTH

Martin

 Steve Cayford [EMAIL PROTECTED] 06/24/02 04:11PM 

On Monday, June 24, 2002, at 01:52  PM, Matthew Crouch wrote:

 this bit from my index page is giving me 2 headaches:
 1. it isn't passing anything into the URL
 2. the page that gets called (name.php) sits and tries to load
 forever. it looks like it's even filling up my hard drive with data (?!)

 Note: it does this (#2) even if I type in the URL with a variable and
 value, like name.php?lastname=smith

 ?
 printf (form method=\post\ action=\name.php?lastname=%s\,
 $lastname);
 ?
 div align=center
   input type=Text name=lastname size=75
   input type=Submit name=submit value=Search for Last Name
 /div
   /form
 /div


Can you do a get and a post at the same time? Tacking the lastname 
onto the url as in action=\name.php?lastname=%s\ is using a get 
method, but your form is supposed to set lastname using the post method. 
Is there some reason you want your script to set one version of lastname 
and let the user type in a different version of lastname? If so try 
using the post method with an input type=hidden name=otherlastname 
value=$lastname.

-Steve


 --
 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] got it, thanks

2002-06-24 Thread szii

Because it's not $s in the context of a printf() call.  It is %s to denote a
string replacement.

-Mike

- Original Message - 
From: Matthew Crouch [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 24, 2002 12:41 PM
Subject: [PHP-DB] got it, thanks


 
 
 Seth Yount wrote:
 
  in you print statement you have ?lastname=%s, shouldn't that be '$s'
  denoting a variable being passed?  Try that out.
 
  gl -- Seth
 
  Matthew Crouch wrote:
 
   this bit from my index page is giving me 2 headaches:
   1. it isn't passing anything into the URL
   2. the page that gets called (name.php) sits and tries to load
   forever. it looks like it's even filling up my hard drive with data (?!)
  
   Note: it does this (#2) even if I type in the URL with a variable and
   value, like name.php?lastname=smith
  
   ?
   printf (form method=\post\ action=\name.php?lastname=%s\,
   $lastname);
   ?
   div align=center
 input type=Text name=lastname size=75
 input type=Submit name=submit value=Search for Last Name
   /div
 /form
   /div
  
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


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




[PHP-DB] Re: brand new elementary question

2002-06-24 Thread Martin Clifford

If your form is up to standards, then hitting the enter key on any field, with the 
exception of textarea, should submit the form.  If you are using an image for your 
submit button via the input type=image tag, then you'd have to tab until on the 
image before hitting enter for it to work.

HTH

Martin

 Seth Yount [EMAIL PROTECTED] 06/24/02 03:58PM 
initially I would look at your button type in the source code.  Their 
are two basic types of buttons, the ' submit ' and the ' clear form '.

If that doesn't work, post back

gl -- Seth

Matthew Crouch wrote:

 got my other one sorted out; thanks everyone.
 now:
 how do i get it so when you hit enter on the keyboard it's the same as
 hitting the submit button with the mouse? When I hit enter, it clears
 my form and reloads the current page.
 
 


-- 
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] what the heck? (elementary question)

2002-06-24 Thread Cosby, Christopher

I don't want to start a tangent here, but the most accepted way for
generating HTML with PHP is to NOT generate HTML with PHP.  Thus, the
original code should be written like this:


:: BEGIN input.html ::
div style=position: relative; text-align: center;
 form method=post action=name.php
  input type=text name=lastname size=75
  input type=submit name = submit value=Search for Last Name
 /form
/p
:: END input.html ::

:: BEGIN name.php ::
?
/*
 * HTTP_POST variables from form:
 * 1) $lastname
 *
 * Access them with:
 * 1) $HTTP_POST_VARS[lastname]
 */
?
p
You searched for b?= $HTTP_POST_VARS[lastname] ?/b and something
happened.
/p
:: END name.php ::


As far as the POST/GET question, you technically can use POST and GET
methods simultaneously, but it's nasty.  For best results, stay away from
the register_globals functionality and use $HTTP_POST_VARS[] and
$HTTP_GET_VARS[] instead.

Last thing:
Go to WeSellBooksByTheMillions and buy a good PHP book for reference.  They
have lots of basics like this in them.  I prefer most anything from Wrox
Press (http://www.wrox.com/)

chris


 - - - - - - -  Appended by Scientific-Atlanta, Inc.  - - - - - - -  
This e-mail and any attachments may contain information which is confidential, 
proprietary, privileged or otherwise protected by law. The information is solely 
intended for the named addressee (or a person responsible for delivering it to the 
addressee). If you are not the intended recipient of this message, you are not 
authorized to read, print, retain, copy or disseminate this message or any part of it. 
If you have received this e-mail in error, please notify the sender immediately by 
return e-mail and delete it from your computer. 




[PHP-DB] Works with one server and not the other

2002-06-24 Thread Christine Clerc

Hi,

I want to populate two related tables : here is the code

include (connect.php);
$req=select * from tab where num='$mod';
$result=mysql_query($req,$db);

if ($ligne=mysql_fetch_array($result))

//if the data is already there do nothing
{continue;}
//otherwise put it in table 1
$req2=INSERT INTO tab (num) VALUES ('$mod');
$result2=mysql_query($req2,$db);

//and then add the relational element to table 2
$req4=INSERT INTO inter (id_tab) SELECT id_tab FROM 
tab WHERE num='$mod';
$result4=mysql_query($req4, $db);

The first part works fine on both servers (table 1)
Table 2 fills up fine on my machine but not on the server wher it is 
supposed to go !

Any idea ?

Christine


[PHP-DB] check two tables at same time?

2002-06-24 Thread Noah Spitzer-Williams

hey guys,

im trying to figure out a query that i can return rows from more than
one table at a time. for example, i have two identical tables in structure
and i want to return rows from both using one query. maybe this will help:

select * from table1 and table2 where condition='value'

is there any way to do this?

thanks!

- Noah

--
TradeMyTraffic! Web Services
http://www.trademytraffic.com




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




Re: [PHP-DB] check two tables at same time?

2002-06-24 Thread szii

SQL JOINs...

http://www.mysql.com/doc/J/O/JOIN.html

-Mike

- Original Message - 
From: Noah Spitzer-Williams [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 24, 2002 4:21 PM
Subject: [PHP-DB] check two tables at same time?


 hey guys,
 
 im trying to figure out a query that i can return rows from more than
 one table at a time. for example, i have two identical tables in structure
 and i want to return rows from both using one query. maybe this will help:
 
 select * from table1 and table2 where condition='value'
 
 is there any way to do this?
 
 thanks!
 
 - Noah
 
 --
 TradeMyTraffic! Web Services
 http://www.trademytraffic.com
 
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


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




Re: [PHP-DB] Works with one server and not the other

2002-06-24 Thread szii

MySQL doesn't support subselects.

Look up mysql_insert_id().  It'll return the ID of the last inserted record.

Or just break out the second INSERT statement into one SELECT 
and then the actual INSERT.

-Mike

- Original Message - 
From: Christine Clerc [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 24, 2002 2:48 PM
Subject: [PHP-DB] Works with one server and not the other


 Hi,
 
 I want to populate two related tables : here is the code
 
 include (connect.php);
 $req=select * from tab where num='$mod';
 $result=mysql_query($req,$db);
 
 if ($ligne=mysql_fetch_array($result))
 
 //if the data is already there do nothing
 {continue;}
 //otherwise put it in table 1
 $req2=INSERT INTO tab (num) VALUES ('$mod');
 $result2=mysql_query($req2,$db);
 
 //and then add the relational element to table 2
 $req4=INSERT INTO inter (id_tab) SELECT id_tab FROM 
 tab WHERE num='$mod';
 $result4=mysql_query($req4, $db);
 
 The first part works fine on both servers (table 1)
 Table 2 fills up fine on my machine but not on the server wher it is 
 supposed to go !
 
 Any idea ?
 
 Christine


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




Re: [PHP-DB] what the heck? (elementary question)

2002-06-24 Thread szii

- Original Message - 
From: Cosby, Christopher [EMAIL PROTECTED]
 I don't want to start a tangent here, but the most accepted way for
 generating HTML with PHP is to NOT generate HTML with PHP.  Thus, the
 original code should be written like this:

Huh?  .. most accepted way for generating ...is NOT generate..?
Brain fart?  =)

I will regularly use large echo style statements to generate HTML, especially
SELECT tags and result tables.

 As far as the POST/GET question, you technically can use POST and GET
 methods simultaneously, but it's nasty.  For best results, stay away from
 the register_globals functionality and use $HTTP_POST_VARS[] and
 $HTTP_GET_VARS[] instead.

Both of which are deprecated.  =(  _GET _POST are the new ones.

POST will allow larger form submits as well, like file uploads.  GET are for 
smaller and faster data sets.

 Go to WeSellBooksByTheMillions and buy a good PHP book for reference.  They
 have lots of basics like this in them.  I prefer most anything from Wrox
 Press (http://www.wrox.com/)

www.php.net
www.phpbuilder.com

RIP Computer Literacy bookstores after the Barnes and Noble acquisition.

-Mike



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




Re: [PHP-DB] Re: brand new elementary question

2002-06-24 Thread szii

Just a quick follow up...

from http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.1
  When there is only one single-line text input field in a form, the user agent 
should accept Enter in that field as a request to
submit the form. 


and a random link...

http://ppewww.ph.gla.ac.uk/~flavell/www/formquestion.html

'Luck.

-Mike

- Original Message -
From: Martin Clifford [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, June 24, 2002 1:56 PM
Subject: [PHP-DB] Re: brand new elementary question


 If your form is up to standards, then hitting the enter key on any field, with the 
exception of textarea, should submit the form.
If you are using an image for your submit button via the input type=image tag, 
then you'd have to tab until on the image before
hitting enter for it to work.

 HTH

 Martin

  Seth Yount [EMAIL PROTECTED] 06/24/02 03:58PM 
 initially I would look at your button type in the source code.  Their
 are two basic types of buttons, the ' submit ' and the ' clear form '.

 If that doesn't work, post back

 gl -- Seth

 Matthew Crouch wrote:

  got my other one sorted out; thanks everyone.
  now:
  how do i get it so when you hit enter on the keyboard it's the same as
  hitting the submit button with the mouse? When I hit enter, it clears
  my form and reloads the current page.
 
 


 --
 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] check two tables at same time?

2002-06-24 Thread Noah Spitzer-Williams

Mike,

I know quite a bit about joins and I'm not sure if they are the answer.
Basically I want to save myself two SQL statements.

I'd like to combine:
select * from table1 where cond=val
select * from table2 where cond=sameval

into one sql statement. the two tables are identical in structure thats
why i think there should be some way to do this.

Thanks!

 - Noah

--
TradeMyTraffic! Web Services
http://www.trademytraffic.com


[EMAIL PROTECTED] wrote in message
006601c21bd8$4b1fdb20$[EMAIL PROTECTED]">news:006601c21bd8$4b1fdb20$[EMAIL PROTECTED]...
 SQL JOINs...

 http://www.mysql.com/doc/J/O/JOIN.html

 -Mike

 - Original Message -
 From: Noah Spitzer-Williams [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, June 24, 2002 4:21 PM
 Subject: [PHP-DB] check two tables at same time?


  hey guys,
 
  im trying to figure out a query that i can return rows from more
than
  one table at a time. for example, i have two identical tables in
structure
  and i want to return rows from both using one query. maybe this will
help:
 
  select * from table1 and table2 where condition='value'
 
  is there any way to do this?
 
  thanks!
 
  - Noah
 
  --
  TradeMyTraffic! Web Services
  http://www.trademytraffic.com
 
 
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php




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




[PHP-DB] PHP in Database Fields..

2002-06-24 Thread Matthew Tedder


Question:

I want to put PHP code into database fields holding HTML text, how can I 
make it execute that PHP before sending to the browser??

Currently, I get the text from MySQL and print it The browser shows 
the PHP code mixed into the HTML.

Matthew


-- 
Anything that can be logically explained, can be programmed.

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




Re: [PHP-DB] PHP in Database Fields..

2002-06-24 Thread szii

exec() the query results.

-Mike

- Original Message - 
From: Matthew Tedder [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 24, 2002 2:31 PM
Subject: [PHP-DB] PHP in Database Fields..


 
 Question:
 
 I want to put PHP code into database fields holding HTML text, how can I 
 make it execute that PHP before sending to the browser??
 
 Currently, I get the text from MySQL and print it The browser shows 
 the PHP code mixed into the HTML.
 
 Matthew
 
 
 -- 
 Anything that can be logically explained, can be programmed.
 
 -- 
 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] PHP in Database Fields..

2002-06-24 Thread Matthew Tedder

On Monday 24 June 2002 09:21 pm, [EMAIL PROTECTED] wrote:
 exec() the query results.

I can't seem to get that to work...  Basically, I want to put my variables 
into the code in order to theme HTML code within data base fields.

Consider the following for example:

$glPageFG = #FF;
$mystr = centerfont color=$glPageFGThemed Text!/font/center;
print exec($mystr);// Doesn't work
exec($mystr);// Doesn't work
print $mystr;  // Doesn't work after an exec(), either..

The only part of the PHP reference guide I can check online at the moment is 
not telling me much, either..

Matthew


 -Mike

 - Original Message -
 From: Matthew Tedder [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, June 24, 2002 2:31 PM
 Subject: [PHP-DB] PHP in Database Fields..

  Question:
 
  I want to put PHP code into database fields holding HTML text, how
  can I make it execute that PHP before sending to the browser??
 
  Currently, I get the text from MySQL and print it The browser
  shows the PHP code mixed into the HTML.
 
  Matthew
 
 
  --
  Anything that can be logically explained, can be programmed.
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Anything that can be logically explained, can be programmed.

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




Re: [PHP-DB] PHP in Database Fields..

2002-06-24 Thread kodrik

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

   I want to put PHP code into database fields holding HTML text, how
   can I make it execute that PHP before sending to the browser??

I save the code into a file and save the url of the file into a database and
then just include that file into my code.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj0X0KYACgkQB+LNTWXM8xRhQQCcCAjQRcc6oq8QTTIBiq2PN/qN
2noAnAxue/MZM+3JC9YePkVBzbQQasme
=/jFr
-END PGP SIGNATURE-

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




Re: [PHP-DB] PHP in Database Fields..

2002-06-24 Thread szii

I'm sorry, brainfart.

Don't exec(), eval().

Apologies.

-Mike

- Original Message - 
From: Matthew Tedder [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, June 24, 2002 4:00 PM
Subject: Re: [PHP-DB] PHP in Database Fields..


 On Monday 24 June 2002 09:21 pm, [EMAIL PROTECTED] wrote:
  exec() the query results.
 
 I can't seem to get that to work...  Basically, I want to put my variables 
 into the code in order to theme HTML code within data base fields.
 
 Consider the following for example:
 
 $glPageFG = #FF;
 $mystr = centerfont color=$glPageFGThemed Text!/font/center;
 print exec($mystr);// Doesn't work
 exec($mystr);// Doesn't work
 print $mystr;  // Doesn't work after an exec(), either..
 
 The only part of the PHP reference guide I can check online at the moment is 
 not telling me much, either..
 
 Matthew
 
 
  -Mike
 
  - Original Message -
  From: Matthew Tedder [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, June 24, 2002 2:31 PM
  Subject: [PHP-DB] PHP in Database Fields..
 
   Question:
  
   I want to put PHP code into database fields holding HTML text, how
   can I make it execute that PHP before sending to the browser??
  
   Currently, I get the text from MySQL and print it The browser
   shows the PHP code mixed into the HTML.
  
   Matthew
  
  
   --
   Anything that can be logically explained, can be programmed.
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
 -- 
 Anything that can be logically explained, can be programmed.
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


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




[PHP-DB] Re: PHP in Database Fields..

2002-06-24 Thread Seth Yount

do you have an example of your text.  I came across a situation earlier 
where I had to build part of my SQL statement.  This statement depended 
on variables that were generated from PHP.

If you can give me an example of your code, I may be able to help

gl -- Seth

Matthew Tedder wrote:

 Question:
 
 I want to put PHP code into database fields holding HTML text, how can I 
 make it execute that PHP before sending to the browser??
 
 Currently, I get the text from MySQL and print it The browser shows 
 the PHP code mixed into the HTML.
 
 Matthew
 
 
 


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




[PHP-DB] Re: check two tables at same time?

2002-06-24 Thread user

You are correct in your statements.  your SQL statement would look like 
this...

$query = mysql_query(SELECT *
  FROM Table1, Table2
  WHERE Table1.Value = Table2.Value
 );

your Values could be the primary key of each table any other values that 
you would like to use to match rows.

gl -- Seth

Noah Spitzer-Williams wrote:

 hey guys,
 
 im trying to figure out a query that i can return rows from more than
 one table at a time. for example, i have two identical tables in structure
 and i want to return rows from both using one query. maybe this will help:
 
 select * from table1 and table2 where condition='value'
 
 is there any way to do this?
 
 thanks!
 
 - Noah
 
 --
 TradeMyTraffic! Web Services
 http://www.trademytraffic.com
 
 
 
 


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




Re: [PHP-DB] what the heck? (elementary question)

2002-06-24 Thread user

Keep with Christophers original statement.

It is more efficient to not have large echo values.

gl -- Seth

[EMAIL PROTECTED] wrote:

 - Original Message - 
 From: Cosby, Christopher [EMAIL PROTECTED]
 
I don't want to start a tangent here, but the most accepted way for
generating HTML with PHP is to NOT generate HTML with PHP.  Thus, the
original code should be written like this:

 
 Huh?  .. most accepted way for generating ...is NOT generate..?
 Brain fart?  =)
 
 I will regularly use large echo style statements to generate HTML, especially
 SELECT tags and result tables.
 
 
As far as the POST/GET question, you technically can use POST and GET
methods simultaneously, but it's nasty.  For best results, stay away from
the register_globals functionality and use $HTTP_POST_VARS[] and
$HTTP_GET_VARS[] instead.

 
 Both of which are deprecated.  =(  _GET _POST are the new ones.
 
 POST will allow larger form submits as well, like file uploads.  GET are for 
 smaller and faster data sets.
 
 
Go to WeSellBooksByTheMillions and buy a good PHP book for reference.  They
have lots of basics like this in them.  I prefer most anything from Wrox
Press (http://www.wrox.com/)

 
 www.php.net
 www.phpbuilder.com
 
 RIP Computer Literacy bookstores after the Barnes and Noble acquisition.
 
 -Mike
 
 
 


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