Re: [PHP-DB] ODBC

2002-02-02 Thread Mike Maltese

 From Windows Help:

 You can use Data Sources Open Database Connectivity (ODBC) to access data
 from a variety of database management systems. For example, if you have a
 program that accesses data in a SQL database, Data Sources (ODBC) will let
 you use the same program to access data in a Visual FoxPro database. To do
 this, you must add software components called drivers to your system. Data
 Sources (ODBC) helps you add and configure these drivers.

 The only thing you'll really need ODBC for on Windows with PHP is to work
 with an Access database, but why would you want to when MySQL and SQL
Server
 are faster?

 Mike

 - Original Message -
 From: Morten Nielsen [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, February 02, 2002 8:42 AM
 Subject: [PHP-DB] ODBC


  Hi,
  Could anybody explain to me what ODBC is. Should I install it with
mySQL.
 
  Thanks,
  Morten
 
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 



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





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




Re: [PHP-DB] MySQL

2002-02-04 Thread Mike Maltese

Go download PHPMyAdmin.


- Original Message -
From: Morten Nielsen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 04, 2002 8:34 AM
Subject: [PHP-DB] MySQL


 Hi,
 Is there an easy way to see the data in a table?
 I made a table that contains information about people. How do I see/change
 the contenst of the table?

 Thanks,
 Morten



 --
 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] cutting off zeros 10.00 to 10

2002-02-06 Thread Mike Maltese

I tested this and it seems to work:

$n = 1.90;

for($i=strlen($n);$i0;$i--){
if(substr($n,$i,1) == 0){
$n = substr($n,0,(strlen($n))-1);
}else{
break;
}
}

No charge...this time. =)

Regards,
Mike
- Original Message - 
From: Thomas Murphy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, February 06, 2002 5:12 AM
Subject: [PHP-DB] cutting off zeros  10.00 to 10


 Hallo,
 
 i was wondering if there is a built-in function in php that just cuts
 off not needed zeros from float-numbers (like changing 1.90 to 1.9
 or 10.00 to 10).
 I get this numbers from a mysql-database, perhaps there even is a
 mysql-function for this???
 
 thank you very much,
 Thomas Murphy
 
 -- 
 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] Query with numbers like 1, 3, 5..........

2002-02-07 Thread Mike Gohlke

? whatever... ?
table border=1
?
$qry = mysql_query(select * from tablename order by id);
while ( $ref1 = mysql_fetch_object($qry) ) {
$ref2 = mysql_fetch_object($qry)
?trtd$ref1-id nbsp;/tdtd$ref2-id nbsp;/td/tr?
}
?
/table

btw, the nbsp; is to keep the internal cell borders from not appearing 
using netscape.  (keeps it from being empty).

Hope this helps
Mike...

Raymond Lilleodegard wrote:

Hi again Rick! : )

It is because I am trying to list all products that I have in a  database
into a menu page. And I would like to have two products beside eachothers.
So... is it possible to get two datarows in one:

do {

} while (mysql_fetch_array() );

?? or is this a stupid way to do it?

Reagrds Raymond
- Original Message -
From: Rick Emery [EMAIL PROTECTED]
To: 'Raymond Lilleodegard' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, February 07, 2002 8:55 PM
Subject: RE: [PHP-DB] Query with numbers like 1, 3, 5..


Yes, but the question is why?

-Original Message-
From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 07, 2002 1:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Query with numbers like 1, 3, 5..


Hi!

Is there a way to get the rows with id's like 1, 3, 5, and so on or 2, 4,

6,

...?


Best regards Raymond



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


Rick Emery [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

Yes, but the question is why?

-Original Message-
From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 07, 2002 1:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Query with numbers like 1, 3, 5..


Hi!

Is there a way to get the rows with id's like 1, 3, 5, and so on or 2, 4,

6,

...?


Best regards Raymond



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









Re: [PHP-DB] MySQL Result

2002-03-08 Thread Mike Maltese


mysql_affected_rows(int resource_id);

This will return the number of rows that were affected by the last
operation, so you could do something like this:

if(mysql_affected_rows($connection) == 1){
//insert, update or delete succeeded
}else{
//operation failed
}

- Original Message -
From: Chris Payne [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 07, 2002 7:34 PM
Subject: [PHP-DB] MySQL Result


 Hi there everyone,

 I have delete working perfectly by doing the following:

 include(connectionstart.php);

 mysql_query (DELETE FROM emaillist WHERE EMail = '$email'
 );

 However, how do I return a true or false flag whether the row was deleted
or
 not?  I basically need to know how to do a 0 or 1 I guess once the row has
 been deleted or if the specified email address wasn't found.

 Thanks for your help everyone.

 Chris


 --
 PHP Database Mailing List (http://www.php   /)
 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] Relational database

2002-03-21 Thread Mike Maltese

Try this:

SELECT Description, Impact, Isolation FROM ccsd NATURAL JOIN log

or

SELECT Description, Impact, Isolation FROM ccsd LEFT JOIN log USING(logccsd)

Just add on a WHERE conditional to get the required results if necessary.


- Original Message -
From: Ron [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 21, 2002 5:32 AM
Subject: [PHP-DB] Relational database


 I am trying to get fields from 2 different tables that have the same field
 name to pull the records from one table
 For example
 mysql_connect($DBhost,$DBuser,$DBpass) or die(Unable toconnect to
 database);
 @mysql_select_db($DBName) or die(Unable to select database $DBName);
 $sqlquery1 = mysql_query(SELECT Description, Impact, Isolation .
 FROM ccsd, log WHERE ccsd=log.logccsd);

 while ($query = mysql_fetch_array($sqlquery1)) {
  $CCSD = $query[CCSD];
  $Description = $query[Description];
  $Impact = $query[Impact];
  $Isolation = $query[Isolation];
 }
 This code is not working.help please.yes I am a newbie!



 --
 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] Build problem oci8

2002-03-26 Thread Mike Gahan

I have a problem building php with oci8. My environment:

AIX 4.3 / PHP 4.1.2 / Oracle 8.1.6

Using standard AIX cc compiler

Building cgi version of php

Configure:

./configure \
--enable-force-cgi-redirect \
--enable-discard-path \
--with-config-file-path=/usr/local/rlib \
--with-gd=/home/ccaamrg/build/gd-1.8.4 \
--with-png-dir=/home/ccaamrg/build/libpng \
--with-jpeg-dir=/home/ccaamrg/build/jpeg-6b \
--with-zlib-dir=/home/ccaamrg/build/zlib-1.1.4 \
--with-mysql=/home/ccaamrg/build/mysql \
--with-oci8=/nfs/ars-a/oracle/product/8.1.6

This works OK, and detects the correct oracle version:

...
checking for Oracle-OCI8 support... yes
checking Oracle Install-Dir... /nfs/ars-a/oracle/product/8.1.6
checking Oracle version... 8.1
...

but when I do the make, it bombs with:

/bin/sh /nfs/s2.c1/mysql0/ccaamrg/php-4.1.2/libtool --silent --mode=link cc -I. 
-I/nfs/s2.c1/mysql0/ccaamrg/php-4.1.2/ -I/nfs/s2.c1/mysql0/ccaamrg/php-4.1.2/main 
-I/nfs/s2.c1/mysql0/ccaamrg/php-4.1.2 -I/nfs/s2.c1/mysql0/ccaamrg/php-4.1.2/Zend 
-I/home/ccaamrg/build/gd-1.8.4/ -I/home/ccaamrg/build/mysql/include 
-I/nfs/ars-a/oracle/product/8.1.6/rdbms/public 
-I/nfs/ars-a/oracle/product/8.1.6/rdbms/demo 
-I/nfs/ars-a/oracle/product/8.1.6/network/public 
-I/nfs/s2.c1/mysql0/ccaamrg/php-4.1.2/ext/xml/expat  
-I/nfs/s2.c1/mysql0/ccaamrg/php-4.1.2/TSRM -g   -o php -export-dynamic  stub.lo 
libphp4.la 
ld: 0711-317 ERROR: Undefined symbol: .alloca
ld: 0711-317 ERROR: Undefined symbol: .OCIDescriptorAlloc
ld: 0711-317 ERROR: Undefined symbol: .OCIEnvInit
ld: 0711-317 ERROR: Undefined symbol: .OCIHandleAlloc
ld: 0711-317 ERROR: Undefined symbol: .OCICollTrim
ld: 0711-317 ERROR: Undefined symbol: .OCICollMax
ld: 0711-317 ERROR: Undefined symbol: .OCICollSize
ld: 0711-317 ERROR: Undefined symbol: .OCICollAssign
ld: 0711-317 ERROR: Undefined symbol: .OCIDateFromText
ld: 0711-317 ERROR: Undefined symbol: .OCICollAssignElem
ld: 0711-317 ERROR: Undefined symbol: .OCIStringAssignText
...

All these symbols are exported by libclntsh.a , the oracle supplied
shared library which is present in the configured oracle tree.

Now, I'm OK with make, but libtool is a bit of a mystery to me. I would
be very grateful if anyone out there can give me some hints to make this
work. Please copy your replies to my email.


-- 
Mike Gahan 
Education and Information Support Division
University College London
http://www.ucl.ac.uk/~ccaamrg/

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




[PHP-DB] PHP MySql

2002-04-02 Thread Mike Meighan

I need a good suggestion as I've been a Microsoft ASP developer but now
getting more into PHP. It appears there are some issues about session
ID's, cookies, and passing data from an NT box to PHP running on a Linux
box.

Would you folks reccommend I first stuff the data into the Linux box via
MySql (I currently have that working) and then when I pass a user from
the NT box into the Linux box, call that data from MySql to complete the
processing?  How well does holding a session ID work between NT and the
Linux box?

I was hoping to simply cookie the user while on the NT box and then
while on the Linux box using PHP call the cookied data. Do whatever
processing I need to do, then dump everything into MySql to complete
whatever it is that I have running.

Currently I found that I can pass smaller amounts of data via a link
with string as part of the link. 

Looking for suggestions.

Mike M.

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




Re: [PHP-DB] PHP MySql

2002-04-02 Thread Mike Meighan

Thanks, just as I had hit send on that messege, the thought of passing
the session ID via a querystring hit me.  I'm using linux for MySql and
Secure Server processing so as data is being collected from various
users while on the NT box, when it comes time for secure server type
transactions, I trust using the Linux box.

Shrock, Court wrote:
 
 You could store session vars that are set on the NT box in mssql and then
 pass them to the linux box with the session id in the querystring and then
 have the linux box verify and fetch the session data from the MSSQL
 server...problem solved.  www.freeTDS.org is where you can get the necessary
 libs to connect to an mssql server from a linux box.  TDS stands for Tabular
 Data Stream, the protocol developed for Sybase and used by mssql.
 
 You could also setup an odbc connection to the mysql database on the NT box,
 thereby bypassing the need for freeTDS.
 
 Either way, I recommend storing the data in a db..hope this helps


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




[PHP-DB] Re: mysql connection problem

2002-05-19 Thread Mike P

Sounds like you don't have privileges to access the server from the host
you're using.  You need to establish privileges in the appropriate mysql db
tables (user, db, host, etc) to allow access from the host from which you
are attempting to connect.


Christian Weilbach [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 hi
 i've added a new apache 2.0.35 server with an php 4.2.0 module to my
 machine, but always when this php-module tries to connect my mysql server
 (on the same machine) this error:

 Host 'weilbach' is not allowed to connect to this MySQL server

 appears. my other apache 1.3.23 server with php 4.1.2 works perfectly.
i've
 tried to use the same php.ini file but it doesn't help...
 i would be very happy if some one can help me

 christian weilbach





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




[PHP-DB] help with $_Get in form

2002-06-21 Thread Mike Germain

I'm trying to get a partnum field into a select statement but i'm not
getting anything passed into the varable. i'm sure it's a simple fix but i
can't find it.
thx
mike

html
head
Inventory Lookup
  meta name=GENERATOR content=W3e 2000
  title/title
/head
body

?php

$partnum=;
function get_partnum($partnum=) {
?
FORM ACTION=default.php METHOD=get

 PartNum:INPUT TYPE=TEXT NAME=partnum
 INPUT TYPE=submit VALUE=submit
/FORM


?php
}

$dsn=invfile;
$user= ;
$upasswd= ;

get_partnum();
#$partnum= $_get['partnum'];
echo $partnum;
$conn = odbc_connect($dsn,$user ,$upasswd, SQL_CUR_USE_ODBC );
echo conn: $conn; if ($conn = 0) { echo Error in connectionBR;
exit; } else { echo PConnection successful\n; };
$query = SELECT whs,loc,miprod,mndesc,onhand FROM npshrlib_prdinv1 where
miprod = '$partnum' ;
$result = odbc_exec($conn, $query);
odbc_result_all($result);


?
/body
/html



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




[PHP-DB] Question

2002-06-23 Thread Mike Tuller

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-23 Thread Mike Tuller

That would probably work, but only for what I want right now. If I ever
wanted to create a report of all the hard drives I have, it would become
more difficult.

I know I need to have a separate table in the database for the drives, but
am not sure if the foreign key should be drives in the computer table, or
computer in the drive table. I could just go ahead and work with it, but I
am the type that wants to learn the right way in the beginning, not figure
out later that I was doing it wrong. As far as normalization, ( In reply to
Duncan's post) I have been reading up on that, and so far it hasn't given me
the answer on this type of problem. Maybe what I am reading doesn't cover
that, so if you are talking about a particular document, let me know and I
will look at that.

 From: Chris Barnes [EMAIL PROTECTED]
 Date: Mon, 24 Jun 2002 05:03:53 +1000
 To: Php-Db \(E-mail\) [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Question
 
 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Question

2002-06-23 Thread Mike Tuller

That is where I am at. Which is better to use. Only need space for 4 drives
with the computers I currently use, but what if I purchase a server that
takes 16, and what other things might the future hold?

I think I will be better off having the drives separate and just match the
drives with the computer they are installed in. I know I am answering my own
question here, but it makes me feel more comfortable knowing that others
come up with the same solutions I do.

Thanks.

 From: Peter Lovatt [EMAIL PROTECTED]
 Date: Sun, 23 Jun 2002 22:24:32 +0100
 To: Mike Tuller [EMAIL PROTECTED], Chris Barnes
 [EMAIL PROTECTED], Php-Db (E-mail) [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Question
 
 Hi
 
 The correct way, IMHO, would be to consider the situation. The hard drives
 are a sub component of the computer. In which case the hard drive table
 should be a 'child' of the computer table.
 
 However the hard drives could be an item in their own right too.
 
 So if you want to consider the hard drive as an item, but to know which
 computer it is in then make HardDriveID the primary key of the hard drive
 table, and include ComputerID as a link field.
 
 If it is basically a component of the computer then make
 (ComputerID,HardDriveID) the primary key.
 
 In practice either will work as will
 
 Computer table
 {
 ComputerID(primary)
 Hard_drive_1
 Hard_drive_2
 Hard_drive_3
 ..
 Hard_drive_n
 
 }
 
 which is simpler, not good design, but probably OK if you are sure you will
 never have more than 'n' drives
 
 just my 2p worth
 
 Peter
 ---
 Excellence in internet and open source software
 ---
 Sunmaia
 www.sunmaia.net
 [EMAIL PROTECTED]
 tel. 0121-242-1473
 ---
 
 -Original Message-
 From: Mike Tuller [mailto:[EMAIL PROTECTED]]
 Sent: 23 June 2002 21:07
 To: Chris Barnes; Php-Db (E-mail)
 Subject: Re: [PHP-DB] Question
 
 
 That would probably work, but only for what I want right now. If I ever
 wanted to create a report of all the hard drives I have, it would become
 more difficult.
 
 I know I need to have a separate table in the database for the drives, but
 am not sure if the foreign key should be drives in the computer table, or
 computer in the drive table. I could just go ahead and work with it, but I
 am the type that wants to learn the right way in the beginning, not figure
 out later that I was doing it wrong. As far as normalization,
 
 In reply to
 Duncan's post) I have been reading up on that, and so far it
 hasn't given me
 the answer on this type of problem. Maybe what I am reading doesn't cover
 that, so if you are talking about a particular document, let me know and I
 will look at that.
 
 From: Chris Barnes [EMAIL PROTECTED]
 Date: Mon, 24 Jun 2002 05:03:53 +1000
 To: Php-Db \(E-mail\) [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Question
 
 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 Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 -- 
 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




Re: [PHP-DB] Re: Question

2002-06-26 Thread Mike Tuller

Thanks for all of the advice. I am learning, and want to learn the right
way, and all the advice given will benefit me greatly in the long run. I
wish there was an easier way to deal with relationships in MySql, but I am
sure that will come along in time.

Mike

 From: Tracker 1 [EMAIL PROTECTED]
 Date: Mon, 24 Jun 2002 01:57:17 -0700
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Re: Question
 
 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
 


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




[PHP-DB] Re: Changing leters to *

2002-07-03 Thread Mike Germain

Password Field: INPUT TYPE=PASSWORD
An INPUT element with `TYPE=PASSWORD' is a text field as above, except that
the value is obscured as it is entered. (see also: section Security
Considerations).

For example:

pName: input name=login Password: input type=password name=passwd

Bartosz Matosiuk [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 Hi
 I need to change letters to * in the form window (password) and I don't
know
 how. Mayby someone has got some ideas
 Thanks

 madsiuk ([EMAIL PROTECTED])





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




[PHP-DB] Re: Script to control mysql users?

2002-08-29 Thread Mike Tsapenko

You can use the following command sequence to add admin user:

shell mysql --user=root mysql
mysql GRANT ALL PRIVILEGES ON *.* TO admin@localhost
   IDENTIFIED BY 'some_password' WITH GRANT OPTION;
mysql GRANT ALL PRIVILEGES ON *.* TO admin@%
   IDENTIFIED BY 'some_password' WITH GRANT OPTION;
mysql FLUSH PRIVILEGES

You also can make a script executing this SQL-queries from root user.

--

Mike Tsapenko
Chief of Web-development Dept.
AlarIT
http://www.AlarIT.com


Leif K-Brooks [EMAIL PROTECTED] ???/ ? 
?: [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I need to add mysql users to some databases, but my dumb control panel
 (ensim) doesn't seem to have a feature to do that, and I'm nothing in
 the mysql database.  Does anyone have a script to let me add them
 automaticly if I supply it with the root password?




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




[PHP-DB] using php4 to connect to mysql (newbie question)

2002-11-20 Thread mike karthauser
hi,
I'm new to php and mysql and are trying to find some tutorials that i can
work through so i can get my head round connecting php4 to mysql.

I have been looking in all the usual places but keep finding php3 examples
and also examples using globals on..

The one i have been looking at is http://www.devarticles.com/art/1/23
All fine until it starts using globals...

My dev server is running php4.2.3 with globals off, mysql 3.23.52 on freebsd
4.7 stable.

Can anyone recommend any good tutorials for my query?

thanks
mikek
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




[PHP-DB] substituting for $id with globals off (newbie)

2002-11-20 Thread mike karthauser
Hi, thanks for earlier replies regarding php resources. I am currently
hitting a brick wall on the script below due to my lack of understanding of
php coupled with my lack of knowledge about globals.
 
I replaced $id with $_GET['id'] in line 5 which now allows the user to reach
the script to evaluate when presented with testpage.php?id=n. It now falls
over when it tries to run the query part :

WHERE id=$id

I tried to submit this instance with $_GET['id'] in the query which also
fails. In the $_GET['id'] where is the value for id now stored?
Can anyone see where i have gone wrong?

thanks
---
my source:

?PHP 
$db = mysql_connect(localhost, root);
mysql_select_db(bsdb1,$db);
// display individual record
if ($_GET['id']) { 
$result = mysql_query(SELECT * FROM address WHERE id=$id,$db);
$myrow = mysql_fetch_array($result);
printf(Name: %s\nbr, $myrow[name]);
printf(Address: %s\nbr, $myrow[address]);
printf(Home Number: %s\nbr, $myrow[hnum]);
printf(Work Number: %s\nbr, $myrow[wnum]);

} else { 
// show employee list
$result = mysql_query(SELECT * FROM address,$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
do { 
printf(a href=\%s?id=%s\%s/abr\n, $_SERVER['PHP_SELF'],
$myrow[id], $myrow[name]);
} while ($myrow = mysql_fetch_array($result));
} else { 
// no records to display
echo Sorry, no records were found!;
} 
} 
? 
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




[PHP-DB] inserting html into mysql tables

2002-11-21 Thread mike karthauser
hi, 
is there anything special i need to know in regards to creating a table to
hold html data? I am building a CMS for a site using php and mysql. The
various tables hold course information that the client wants to edit. I
imagine it will be a case of dropping the cleaned html source from
dreamweaver into a form box and posting it to the table.

What would a good varchar(?) be for say 5K of data?

cheers
mikek  
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




[PHP-DB] option selected

2002-11-25 Thread mike karthauser
I'm using the contents of a table to print an option list in another form to
allow me to cross reference the tables in my data.

? $result = mysql_query(SELECT * FROM category,$db);
printf(select name=\catcode\\n);
while ($myrow = mysql_fetch_array($result)) {
printf(option value=\%s\%s/option\n, $myrow[catcode],
$myrow[title]); 
}
printf(/select\n);
?

Once i have selected from the drop box the variable is submitted back to my
table and saved. 

When re-edit the data - the record already has a value for catcode which i
want to reflect within the drop box - in html it would be the addition of
selected=selected within the option.

Are there any recommended methods of doing this?
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




[PHP-DB] Re: Max execution time

2002-12-02 Thread Mike Mannakee
PHP meant Personal Home Page to the guy who originated it.  Later people
then decided to get cute and have redefined it to mean Php Hypertext
Preprocessor.  Take your pick.

As for the max execution time, you're fine as long as the script completes
what it's doing within the allotted time.  If your query takes longer, then
you're hosed, so the best bet is to set the max execution for long enough
that you're in no danger, like 10 minutes.

HTH

Mike


Radovan Radic [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi all

 (I post questions although i dont get answers, but i am trying. I must say
i
 dont give answers because i dont know much about php yet)

 I have problems with script exceedded time. Script is executing mssql
stored
 procedure which executes about 5-6 mins. I need to execute it and then get
 results in the file, but i allways get error about max execution time.
 Customers wouldnt complain if script is executing too long if they could
get
 the results. I know i can set max.execution.time from php with ini_set().
 But, i think i have read in the manual, that this directive doesnt affect
 script execution time if script is running query. So even if i set
 max_execution_time to 6mins could the script break? Could someone explain
it
 to me.

 Radovan
 PS. What means PHP?






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




[PHP-DB] I got this idea...

2002-12-04 Thread Mike Delorme
Hi!

I am knew around here, and a newcomer to PHP, but I know enough. I have =
this idea, and I have gone through all the ways that I know off to work =
it, but they dont work. I am a paintball player and I get fustrated =
because there are too many web sites out there that sell paintball =
marker, and gear and things. I would like to take them all, let a client =
search for a spacific thing, and have the search results come up with =
the url to that product, and list them by price. Now, the not-so-easy =
way would be to make a DB and put all the prices in and just list the by =
price. Except that would be a very hard, time consuming work. And, I =
would have to update the db often. I am sure there is an esyer way, but =
I dont know what it is. Thanks for your help!


Michael Delorme
www.hybridfusion.com



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




[PHP-DB] reversing a date stamp

2002-12-05 Thread mike karthauser
I'm using the below code as the basis for a client updateable news section..
I have variable called date which is set in the db as TIMESTAMP(6). When I
print it i get the date in the reverse order YYMMDD. What would be the best
way to display it in reverse based on my code below?

Thanks..

snip

$result = mysql_query(SELECT * FROM news,$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
do { 
printf(strong%s/strongbr\n, $myrow[title]);
printf(%s a href=\%s?id=%s\ class=\mailto\more /a [%s]p\n,
$myrow[summary], $_SERVER['PHP_SELF'], $myrow[id], $myrow[date]);
} while ($myrow = mysql_fetch_array($result));
} else { 
// no records to display
echo pSorry, no records were found!;
} 

/snip
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




[PHP-DB] Enlarging tables

2002-12-09 Thread mike karthauser
We have been entering data into a mysql table and it has got to id=127 and
then stopped us from entering anymore data.
When i built the table i must have specified the size wrong. Can anyone
recommend how to fix this?
regards
mikek
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




Re: [PHP-DB] Enlarging tables

2002-12-09 Thread mike karthauser
on 9/12/02 2:50 pm, Aaron Wolski at [EMAIL PROTECTED] wrote:

 What's your table structure looks like?

++--+--+-+-++
| Field  | Type | Null | Key | Default | Extra  |
++--+--+-+-++
| id | tinyint(4)   |  | PRI | NULL| auto_increment |
| bookcode   | varchar(20)  | YES  | | NULL||
| coursecode | varchar(10)  | YES  | | NULL||
| date   | date | YES  | | NULL||
| title  | varchar(255) | YES  | | NULL||
++--+--+-+-++


-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




Re: [PHP-DB] Enlarging tables

2002-12-09 Thread mike karthauser
on 9/12/02 2:58 pm, Hutchins, Richard at [EMAIL PROTECTED]
wrote:

 Premature clickage...
 
 Or you could use a mediumint or int. Just check the mysql manual and select
 the int type that suits the size of your db best.

Ta. Thats working now.

Thanks from a 3 week old newbie.
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




[PHP-DB] limiting field extraction to 40 characters

2002-12-11 Thread mike karthauser
I am using

? $result = mysql_query(SELECT * FROM courses,$db);
printf(select name=\coursecode\\n);
while ($myrow = mysql_fetch_array($result)) {

$l=$myrow['coursecode'];
?option value=?=$l;??=($_POST['coursecode']==$l)?'
selected=selected':;??=$myrow['title'];?/option?
}
printf(/select\n);
?

to generate a html optionselect. Unfortunately a few of my course titles
are really long and this effects the rendering of the optionselect
making it ultra wide.

Is there a way i can print only the first 40 characters of the title - even
though the full title lives in the db still (it is used throughout the
site)?

cheers
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




Re: [PHP-DB] limiting field extraction to 40 characters

2002-12-12 Thread mike karthauser
If i try the below in my query i get no results.

Ideally i would like to do this (not valid sql)

? $result = mysql_query(SELECT * FROM courses,$db);
printf(select name=\coursecode\\n);
while ($myrow = mysql_fetch_array($result)) {

$l=$myrow['coursecode'];
?option value=?=$l;??=($_POST['coursecode']==$l)?'
selected=selected':;??=$myrow['left(title,40)'];?/option?
}
printf(/select\n);
?


on 11/12/02 5:26 pm, Peter Beckman at [EMAIL PROTECTED] wrote:

 LEFT(str,len)
 Returns the leftmost len characters from the string str:
 
 mysql SELECT LEFT('foobarbar', 5);
 - 'fooba'
 
 This function is multi-byte safe.
 
 
 select left(coursecode,40) from courses



 On Wed, 11 Dec 2002, mike karthauser wrote:
 
 I am using
 
 ? $result = mysql_query(SELECT * FROM courses,$db);
 printf(select name=\coursecode\\n);
 while ($myrow = mysql_fetch_array($result)) {
 
 $l=$myrow['coursecode'];
 ?option value=?=$l;??=($_POST['coursecode']==$l)?'
 selected=selected':;??=$myrow['title'];?/option?
 }
 printf(/select\n);
 ?
 
 to generate a html optionselect. Unfortunately a few of my course titles
 are really long and this effects the rendering of the optionselect
 making it ultra wide.
 
 Is there a way i can print only the first 40 characters of the title - even
 though the full title lives in the db still (it is used throughout the
 site)?


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




[PHP-DB] CMS error

2002-12-16 Thread mike karthauser
I have a field in a news CMS that could contain  Infact most of the time it
does in the form of URL's etc. Getting the data initially into the database
is no problem - Infact MySQL shows has no toruble with it. The problem i am
getting is when i edit the data - basically loading into a form - textarea.
The data displays everything after the first  appears but in a small
textarea.
I have looked at addslashes() which insnt apropriate in this instance as the
text area has no problem with the slashes.
Is there an equivalent for  or am i worth substituting them for a character
when i load them into my edit field.
I can imagine this is a common probem in CMS - any suggestions on a quick
fix..?
cheers
mikek
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




Re: [PHP-DB] CMS error

2002-12-16 Thread mike karthauser
on 16/12/02 5:15 pm, mike karthauser at [EMAIL PROTECTED] wrote:

 I have a field in a news CMS that could contain  Infact most of the time it
 does in the form of URL's etc. Getting the data initially into the database
 is no problem - Infact MySQL shows has no toruble with it. The problem i am
 getting is when i edit the data - basically loading into a form - textarea.
 The data displays everything after the first  appears but in a small
 textarea.
 I have looked at addslashes() which insnt apropriate in this instance as the
 text area has no problem with the slashes.
 Is there an equivalent for  or am i worth substituting them for a character
 when i load them into my edit field.

then you find the answer. HTMLSpecialChars(). very handy.
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




[PHP-DB] keyword search a mysql database.

2002-12-18 Thread mike karthauser
I'm looking for tips and tricks in how to approach building a keyword search
over an number of fields in a courses database.

I know how i can search for one word at a time, but i am not sure on how i
would approach searching via a defined string.

Anyone got any good pointers for doing this/ or some tutorial that i can
read though?

Thanks..

BTW kettles on if anyone wants a brew..
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




Re: [PHP-DB] keyword search a mysql database.

2002-12-19 Thread mike karthauser
on 18/12/02 5:47 pm, Adam Voigt at [EMAIL PROTECTED] wrote:

 $searchstring = $_POST[searchfor];
 $searchstring = str_replace( ,%,$searchstring);
 
 mssql_query(SELECT id FROM table WHERE field LIKE '$searchstring';);

I've modified my query to

$result = mysql_query(SELECT coursecode, title FROM courses WHERE title
LIKE '$tsearch' ORDER BY title,$db);

Where $tsearch is my search string.

I'm not getting any results from this though

What i am trying to achieve is to look in title and produce a result if the
string appears.

so searching for 'Training Course will find results like
Training Course 1
Training Course 2
Training Course n, etc.

Is LIKE the best way to do this or should i be using wildcards?
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




[PHP-DB] Searching DB and Printing Results

2002-12-30 Thread Mike Delorme




Hi,

I have a table in DB Music that looks a little mike this:

TABLE NAME
_
SONG NAMESONG LYRICS
|   | |  |
|   | |  |
|   | |  |
|   | |  |
|   | |  |
|   | |  |
|   | |  |
|   | |  |
|   | |  |
|   | |  |
|___| |__|

In each row of SONG NAME is the name of a song and the corisponding lyrics 
are in the next colum. What I would like to do is set up a search in wich 
the client can enter a sequence of words. The search searches the DB table 
TABLE NAME and looks for the word sequence in the table. The printed results 
are the song name and a link to the lyrics. Can this be done? And how can it 
be done?

Thanks,
Michael Delorme
www.HybridFusion.com

_
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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



[PHP-DB] PHP/MySQL

2003-01-04 Thread Mike C
Hi,

I hope someone can help me with this.

I am trying to modify this portion of a script so that I can upload 
photos (MacOSX 10.2.3) but keep the file names intact. At the moment 
everything works fine except that when I upload photos, the script 
changes the name of the file I just uploaded to a new filename 
(sequentially) based on the database 'id' number to 1.gif, 2.gif, 
3.gif and so on.

I need to be able to keep the filename as it is (05-01.gif, 23-02.gif 
etc) when I upload it!

//
		// Insert the photo details into the database
		//

		$result = mysql_query(INSERT INTO photo

	(id,galleryid,title,size_in_MB,person,filename,description) 
VALUES

	('','$galleryid','$title','$size_in_MB','$person','$filename', 
'$description')
			);

		//
		// Retrieve the ID of the photo
		//

		$result = mysql_query(SELECT * FROM photo
			WHERE galleryid = '$galleryid'
			AND title = '$title'
			AND description = '$description');
		$id = mysql_result($result,0,id);

		//
		// Generate a filename for the file
		//

		$filename = $id.$format;

		//
		// Alter the database record to point to the correct
		// filename.
		//

		$result = mysql_query(UPDATE photo SET filename = '$filename'
WHERE id = '$id');

		//
		// Move the thumbnail and full-sized photo to the 
correct filesystem
		// location.
		//

		copy ($photo,$filepath/$galleryid/photos/$id.$format);
		copy 
($thumbnail,$filepath/$galleryid/thumbnails/$id.$format);

		//
		// Print out a Success message to the user.
		//

Regards
Mike
--
--
Mike C
Macintosh Support Specialist
University of Otago (ITS)
Dunedin
NEW ZEALAND
http://www.otago.ac.nz
--

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



[PHP-DB] preventing page from resubmitting when refreshing page

2003-01-09 Thread mike karthauser
I have a page that has a form on the first part that posts to itself and
dumps the contents of the form into a database.

All this is well and good - I'm using

if ($_POST['submit']) {


}

to detect the submission and everything is doing as it should.

Thing is if you refresh the page that displays the results it then posts to
the database again. I've tried some error trapping but in the same way the
page hold the post variables it just redoes what it has done rather than re
running the script.

Is there something i can do on browser refresh to prevent this or prevent my
mysql database from duplicating the records?

any help would be appreciated.

cheers
mikek
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




[PHP-DB] Remnant data from previous queries when using mysql_fetch_array...

2003-02-05 Thread Mike Hilty
Hello,
I am a novice PHP dev having a strange issue with mysql_fetch_array.
For some reason, it is keeping data from previous queries in the array, and
displaying it in the web page.
My development platform is Win2k SP2, Apache 1.3.23, PHP 4.3.0,
MySQL-MAX 3.23.47-nt.
Here is the code that I am using:

?php
// open database connection
$connection = mysql_connect(localhost, username, password) or die (Unable
to
connect!);

// select database
mysql_select_db(vendorNameChange) or die (Unable to select database!);

// generate and execute query
$query = select * from changelog where changedBy = '$changedBy' or
vendorNumber = '$vendorNumber'
or oldName like '$oldName' or newName like '$newName' or newVendorNumber =
'$newVendorNumber';
$result = mysql_query($query) or die (Error in query: $query.  .
mysql_error());

if ($row = mysql_fetch_array($result)) {

do {
print buOld vendor number/u: /b;
print $row[vendorNumber];
print br;
snip
/snip
} while($row = mysql_fetch_array($result));

} else {print Sorry, no records were found!;}

// close database connection
mysql_close($connection);

?

I am looking for a way to initialize the array, and display only the
data returned from the current query on the page.  Any help with this would
be greatly appreciated.

Thanks,
Mike Hilty






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




Re: [PHP-DB] Remnant data from previous queries when using mysql_fetch_array...

2003-02-06 Thread Mike Hilty
Okay, I figured out that the issue is not due to the PHP code, but by the
query I'm using against the MySQL DB...

What I need to know is how to structure the code where the query is based
off of fields filled in by the user.  I would like to structure the query
where if the user provides a value for vendorNumber, and leaves the rest of
the fields blank, the query would be select * from changeLog where
vendorNumber = '$vendorNumber';

The current query, when run in MySQL Control Center, gives the same behavior
as on the website.

Would I have to write this portion of the code in javascript, or some other
client side scripting language to get the dynamic query built?

Thanks,
Mike Hilty

John W. Holmes [EMAIL PROTECTED] wrote in message
002b01c2cd7a$2a86d9a0$7c02a8c0@coconut">news:002b01c2cd7a$2a86d9a0$7c02a8c0@coconut...
  I am a novice PHP dev having a strange issue with
 mysql_fetch_array.
  For some reason, it is keeping data from previous queries in the
 array,
  and
  displaying it in the web page.
  My development platform is Win2k SP2, Apache 1.3.23, PHP 4.3.0,
  MySQL-MAX 3.23.47-nt.
  Here is the code that I am using:
 
  ?php
  // open database connection
  $connection = mysql_connect(localhost, username, password) or die
 (Unable
  to
  connect!);
 
  // select database
  mysql_select_db(vendorNameChange) or die (Unable to select
 database!);
 
  // generate and execute query
  $query = select * from changelog where changedBy = '$changedBy' or
  vendorNumber = '$vendorNumber'
  or oldName like '$oldName' or newName like '$newName' or
 newVendorNumber =
  '$newVendorNumber';
  $result = mysql_query($query) or die (Error in query: $query.  .
  mysql_error());
 
  if ($row = mysql_fetch_array($result)) {
 
  do {
  print buOld vendor number/u: /b;
  print $row[vendorNumber];
  print br;
  snip
  /snip
  } while($row = mysql_fetch_array($result));
 
  } else {print Sorry, no records were found!;}
 
  // close database connection
  mysql_close($connection);
 
  ?
 
  I am looking for a way to initialize the array, and display only
 the
  data returned from the current query on the page.  Any help with this
  would
  be greatly appreciated.

 $row = array();

 will initialize the $row variable to an empty array. Or you can use
 unset($row) to just get rid of it entirely.

 The problem isn't with mysql_query(), it's just that $row is retaining
 data from a previous loop in your script.

 ---John W. Holmes...

 PHP Architect - A monthly magazine for PHP Professionals. Get your copy
 today. http://www.phparch.com/





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




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

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

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

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

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

Can you connect as php from the prompt?

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

-- 
Mike

Registered Linux User #247123

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

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




[PHP-DB] Re: Question about replacing large textfields

2003-02-14 Thread Mike Hilty
Wart,
You can use Horde and Giapeto to achieve this.  Giapeto is a Horde
component that is written to give end users the ability to create and modify
web sites through their web browser.
You can obtain Horde and Giapeto from http://www.horde.org.  You will
have to obtain both from their public CVS server (since Giapeto is not quite
released code yet)

Thanks,
Mike Hilty

Wart Van Ingen [EMAIL PROTECTED] wrote in message
153E04744A5AD5118FC900306E001A7202159561@FMEMAIL1">news:153E04744A5AD5118FC900306E001A7202159561@FMEMAIL1...
 Hi there,

 I'm looking for a way to let people without any knowledge of coding
replace
 large fields of text and images on their website.
 Is there anyone who knows some way to do this with MySQL and PHP ? Maybe
 someone knows where I can find an online
 tutorial about this?

 Thanks a bunch




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




[PHP-DB] Site Help

2003-02-18 Thread Mike Delorme
Hello!

My name is Mike and I have no clue what I am doing. I have basic skills in PHP, but 
for some reson I cant bring them together to make the web program that I need. I would 
like to make a product site. When a client searches for product 6, the program goes to 
sites listed in an array, aite a, b, c, d, and e, grabs product 6 and the information 
needed from that page, then displays a picture, price, link, etc. I need someone who 
is willing to talk with me outside this mailing list. Is there any way this can be 
done?

Thanks for your time,
Mike Delorme
www.entityweb.com


Re: [PHP-DB] SESSIONS

2003-02-26 Thread mike karthauser
on 26/2/03 12:58 pm, MaN at [EMAIL PROTECTED] wrote:

 And also use $_POST[SUBMIT] or set register_globals On

Just use $_POST[SUBMIT]

register_globals was turned off for security reasons. You are compromising
the security of your system if you turn it back on.
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



[PHP-DB] How to page results?

2003-03-06 Thread mike karthauser
We've been working on a news section for our site which allows us to find
news stories - dump them in a mysql db, list the summaries in a page and
then link to a full version of the story.

The bit i'm having trouble with is how to list the results so we can set up
multi pages of content and link them via a simple

Previous | 1 2 3 4 5 | Next

type of scenario.

I got a query thus

$result2=mysql_num_rows($result);

to count our results. Does anyone have any pointers on what to do next?

Cheers
mikek

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



Re: [PHP-DB] Don't Understand

2003-03-12 Thread mike karthauser
on 12/3/03 12:01 pm, Snijders, Mark at [EMAIL PROTECTED] wrote:

 on www.marksnijders.com and www.nederlandmobiel.nl i use those scripts (php
 and the GD functions ) for automatically changing the file size...

Yeah but GD's server side...

Unless they have something installed on their client machine then you're
going to have to do it server side.

Your script will upload and then resize.
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



Re: [PHP-DB] Does Php support Flash files ?

2003-03-18 Thread mike karthauser
on 18/3/03 8:44 am, rajni arya at [EMAIL PROTECTED] wrote:

Does PHP supprots Flash files on Open BSD platform ?

Is that flash as in macromedia? What do you want PHP to do to the files?
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



Re: [PHP-DB] Does Php support Flash files ?

2003-03-18 Thread mike karthauser
on 18/3/03 11:19 am, rajni arya at [EMAIL PROTECTED] wrote:

 Actually i want to use animated gif file but php doesn't support gif files
 so, i thought of replacing it with flash file.
 yes, fash is as in macromedia with extenstion of .swf.

For what though? Are you wanting to create it on the fly or are you looking
to link to it in the PHP?

You can link flash to php and import variables using action script.

I am unsure what you are trying to achieve as your questions are a little
vague. Plus this is a database list.
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



Re: [PHP-DB] Passing variable with previous next

2003-03-19 Thread mike karthauser
on 19/3/03 9:32 am, Achieve IT at [EMAIL PROTECTED] wrote:

 $company_name = $HTTP_POST_VARS['company_name'];

You also need $address_region = $HTTP_POST_VARS['address_region'];

Else you arent going to be able to pick up the variable or its value.

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



[PHP-DB] Is the query I need even possible?

2003-03-19 Thread Mike Mannakee
I have a table that looks like this:

page_idvisitor_idtimestamp
...
13   20030101060522
58   20030101060512
26   20030101060634
73   20030101060651
35   20030101060612  -- Earliest
record with this visitor id
85   20030101060738
21  5   20030101060759
15   20030101060810
75   20030101060827 -- Last record
with this visitor id
510 20030101060944
16   20030101061002
... etc


What I want to select is the PAGE_ID of the EARLIEST record and the PAGE_ID
of the LAST record, for each distinct visitor_id.  I cannot figure out how
to do this without multiple, very slow sql calls.

Currently I'm getting it like this:

SELECT DISTINCT(visitor_id) FROM (table)

Then going through each row with:

SELECT page_id FROM (table) WHERE visitor_id = '$visitor_id'  ORDER BY
date_time ASC LIMIT 1

to get the first and then:

SELECT page_id FROM (table) WHERE visitor_id = '$visitor_id'  ORDER BY
date_time DESC LIMIT 1

to get the last.

There must be an easier way I'm not seeing.  This, on the scale of thousands
of visitors, takes forever.  Is there any other way to do it?

TIA,

Mike





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



[PHP-DB] Re: Thumbnails

2003-03-19 Thread Mike Mannakee
What you'd be looking at there would be a custom script.  Have a look at the
image functions of PHP.  It can be done, but I think you'll find it easiest
to figure it out and write it yourself.

Mike


Miguel brás [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi there gents,

i looked all web for a good script to create a image thumbnail at the time I
make the upload to server and DB.

I mean, i have a form with some fields. One of it is the imagepath. I store
here the image path so i can display the full image on a third page. Now
what i want is to create a thumbnail, save it on the server and also save
the path on DB so i can get it on a query on the second page before
displaying the full image.

Any script or tip out there?
Thx
Miguel



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



[PHP-DB] Not seeing whats wrong with code

2003-03-19 Thread Mike Delorme
Hello,

I am trying to write a script that conects to mysql, then SHA database. Then I need to 
list ALL the rows of table members. It sais there is a error on line 18. The while 
statement is on line 18, and I cant firgure out whats wrong with it:

?
$host = localhost;
$uname = sniper;
$pass = starcraft;
$database = SHA;
$tablename = members;
$connect = mysql_connect ($host, $uname, $pass); 
$select = mysql_select_db ($database);
$query = SELECT * from $tablename;
$result = mysql_query ($query)
while ($row = mysql_fetch_row($result))
{
$row
}
?

Thanks,
Mike Delorme

Re: [PHP-DB] Including Details in MySQL longer than 255 characters

2003-03-20 Thread mike karthauser
on 20/3/03 6:11 pm, Adam Venturella at [EMAIL PROTECTED] wrote:

 Anyway if someone could point me in the right direction I would be very
 appreciative.

Change your column type to TEXT rather than varchar(255)

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



[PHP-DB] Fwd: FW: Prayer Wheel

2003-03-21 Thread Mike Delorme







From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],   
 [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],  
  [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Fwd: FW: Prayer Wheel
Date: Fri, 21 Mar 2003 23:40:51 EST




_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail
---BeginMessage---







From: Cronin,Raelene L. [EMAIL PROTECTED]
To: [EMAIL PROTECTED],Martinson,Brenda 
[EMAIL PROTECTED],Collins,Catherine M. 
[EMAIL PROTECTED],Devanney,Darcey J. 
[EMAIL PROTECTED],Hunter,Debra J. 
[EMAIL PROTECTED],Cruser,Suzanne D. 
[EMAIL PROTECTED],Lawrence,Richard 
[EMAIL PROTECTED],Annelli,Elaine 
[EMAIL PROTECTED],Kempton,Elizabeth 
[EMAIL PROTECTED],[EMAIL PROTECTED],Hickey,Kathleen E. 
[EMAIL PROTECTED],Rice,Mary B. 
[EMAIL PROTECTED],[EMAIL PROTECTED],Alexander,Maureen A. 
[EMAIL PROTECTED],Eckels,Maureen M. 
[EMAIL PROTECTED],[EMAIL PROTECTED],Paradis,Paul E. 
[EMAIL PROTECTED],[EMAIL PROTECTED],Ireland,Stella 
[EMAIL PROTECTED],Grassman,Susan Louise 
[EMAIL PROTECTED],Frazier, Brenda 
[EMAIL PROTECTED],[EMAIL PROTECTED],Christine Gill 
[EMAIL PROTECTED],[EMAIL PROTECTED],Kristin Leigh 
[EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: FW: Prayer Wheel
Date: Thu, 20 Mar 2003 10:59:22 -0500









Please send this on after a short prayer.
Prayer wheel for our soldiers...please don't break it
  Prayer Wheel Lord, hold our troops in your loving hands.
  Protect them as they protect us. Bless them
  and their families for the selfless acts they
  perform for us in our time of need. I ask this
  in the name of Jesus, our Lord and Savior.
  Amen.
  Prayer Wheel:
  When you receive this, please stop for a moment
  and say a prayer for our ground troops being deployed.
  There is nothing attached This can be very
  powerful Just send this to all the people in
  your address book. Do not stop the wheel, please
  Of all the gifts you could give a US Soldier,
  Prayer is the very best one.




_
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail



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

[PHP-DB] Gathering data from a database

2003-03-22 Thread Mike Delorme
I have been having this problem for a while now, and I cant figure it out. the code is:
?
$host = localhost;
$uname = sniper;
$pass = starcraft;
$database = sha;
$tablename = members;
$connect = mysql_connect ($host, $uname, $pass); 
$select = mysql_select_db ($database);
$query = SELECT * from $tablename;
$result = mysql_query ($query, $connect);

while ($row = mysql_fetch_array($result))
{
print_r( $row );
echo mysql_error();
}
?

mysql has an error on line 19. Line 19 is while ($row = mysql_fetch_array($result)). 
What am I doing wrong?


Thanks for your help,
Mike

[PHP-DB] DB CODEING HELP!!!!!

2003-03-23 Thread Mike Delorme
this is bugging me. I have tried everything and I cant develop the code without an 
error. Can someone plese write me simple code that will go through a table and print 3 
collums of that table? I cant figure it out

Re: [PHP-DB] Resize pictures and store with MySQL

2003-03-30 Thread Mike Brum
Just to illustrate how you'd go about doing this:

- User uploads image  description
- You resize image with GD functions (look at imagecopyresized())
- Store URL and description to the mySQL table you made

It's a very simple thing to do once you organize your file structure where
you're going to be storing the images. To retrieve them, you just need to
know the image's ID and query based upon that. From there, you can access
the image's URL or caption as you need.

You can very easily create a script to display the images by querying the DB
for X entries and displaying them per page.

What you're basically describing is the functionality that MANY blogs have.
You can probably find some free scripts online with a minimum amount of
searching.

-Mike

-Original Message-
From: Frank McIsaac [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 30, 2003 12:26 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Resize pictures and store with MySQL


Hi.  I want to use PHP and MySQL to help make it easier to put
pictures on a website.  What I want to do is make a page that allows the
client to submit a picture (or a bunch of pictures) and a caption for
each picture to me via a form of some sort.  Then, once the file gets
here, I would like it to resize the photo to a preset size and store it
with it's caption.  Is this possible?  If so, is there also a way to get
php to dynamically design a web page with each of these photos (complete
with their captions) on it?  I am using PHP 4.2 and MySql 3.23.  Thanks
in advance for any help.

Frank



--
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] mail()

2003-03-31 Thread Mike Delorme
Can this fucktion be use to mail the submited content of a form? If so how?



Thanks for your time,
Mike Delorme

[PHP-DB] Posting the results of a query to an email

2003-06-11 Thread mike karthauser
Hi,
I have been building up a store which now has catalogue and persistant
shopping cart which I now want to submit the results (the order) to an email
for processing.

I have a mysql db called 'cart' that holds:

Cart_id, cookie_id, item_id, and quantity.


I have a 'products' table which contains:

item_id, item_code, item_title, item_price  etc.


I want to select  item_code, qty from cart where cookie_id =
$_COOKIE[cartId]

//the above select needs work

And then email these to the client which I would do using php's mail
function.

I'm currently trying to work out how to extract the contents of the cart,
convert the item_id to its item_code from products and then dump the results
to an email..

Can anyone provide me with some help in where to start.

thanks

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



Re: [PHP-DB] Posting the results of a query to an email

2003-06-11 Thread mike karthauser
on 11/6/03 4:09 pm, mike karthauser at [EMAIL PROTECTED] wrote:

 I want to select  item_code, qty from cart where cookie_id =
 $_COOKIE[cartId]
 
 //the above select needs work
 
 And then email these to the client which I would do using php's mail
 function.

Partially answering my own question:

$result = mysql_query(select ITEM_CODE, ITEM_TITLE from cart inner join
products on cart.item_id = products.ITEM_ID where cart.cookie_id = ' .
GetCartId() . ' order by products.ITEM_TITLE asc, $db);

This then gives me a result set. What would be the best way to extract the
results to an emailable format, given that there could be one or many items
in the cart table?

Thanks
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



Re: [PHP-DB] hiding db password

2003-06-12 Thread mike karthauser
on 12/6/03 3:31 pm, Sallee, Helen at [EMAIL PROTECTED] wrote:

 ?php
 putenv(TWO_TASK=ORCL2);
 putenv(ORACLE_HOME=/u01/home/oracle/product/9.2.0);
 $conn = OCILogon(USER1,USER1PASS);
 $query = OCIParse($conn,select * from state);
 OCIExecute($query);
 ?
 
 Thank you

Use an include file buried below your site root with

$user=USER1;
$pass=USER1PASS;

Then you should be able to do:

Include/path/to/pass.inc.php;
snip
$conn = OCILogon($user,$pass);

Which is more secure.

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



Re: [PHP-DB] hiding db password

2003-06-12 Thread mike karthauser
on 12/6/03 3:48 pm, CPT John W. Holmes at [EMAIL PROTECTED] wrote:

 From a web server perspective, though, this is
 safer because if the web server ever broke and started serving PHP pages
 as plain text (been there, done that), then at least no one can get to your
 include file through your web server.

That is what I meant by more secure. Putting files below webroot prevents
webusers from getting at them.
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



[PHP-DB] Selecting unique values from a db

2003-06-18 Thread mike karthauser
Being thick today: 

How do I select unique values from a table? Eg I have a image upload script
that writes the name of the file to a db when it uploads. As we may need to
upload the image several times, my db is full up with several rows with same
titles..

Eg:

img db

id  |   title   |   short-title |
-
1   |   pie.jpg |   pie |
2   |   pie.jpg |   pie |
3   |   pie2.jpg|   pie2|
_

How do I get results as

SELECT * FROM img WHERE ?? ORDER BY title

Results
-
1   |   pie.jpg |   pie |
3   |   pie2.jpg|   pie2|
_


Many thanks/

mikek
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



Re: [PHP-DB] Selecting unique values from a db

2003-06-18 Thread mike karthauser
on 18/6/03 12:20 pm, John W. Holmes at [EMAIL PROTECTED] wrote:

 Not really a PHP question...

This is a php db list though.
 
 SELECT DISTINCT title FROM ...

Thanks for this.

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



RE: [PHP-DB] Renaming all pages to .php

2003-06-19 Thread Mike Brum
You can easily add the .php extension to any .htm(l) page that you have
with no worries as long as you have PHP installed and configured
properly. 

The only problem is that page load will be SLIGHTLY slower since PHP
will search all .php pages for PHP code to evaluate. Upon finding none,
it will simply return the HTML to the requester. But note that this is a
tiny bit longer than your web server just serving the page without
passing it through PHP.

Naming all files index.XXX will be a good idea. Though realize that
some people might link directly to the file itself (which can sometimes
become visible with different browsers and different activities). But
none-the-less, it will work for most users if they do decide to bookmark
the folder.

-M

-Original Message-
From: David Blomstrom [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 19, 2003 10:14 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Renaming all pages to .php

I'd like to get some feedback from this forum. Do you agree that a page 
without php functions or server side includes can be put online with
either 
a .htm or .php function? If I never add a php function to a page with a 
.php extension, could that cause some kind of problems?

Also, I'm thinking of naming all my pages index and sticking them
inside 
folders. That way, visitors can reach a page by typing in 
www.geobop.com/birds/ , whether the full URL is 
www.geobop.com/birds/index.htm or www.geobop.com/birds/index.php  Is
this a 
good plan, or do you see any problems?

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] Session error?

2003-06-23 Thread Mike Brum
Just put the full path of the dir.

For instance I placed mine at C:\php\session to keep things separated.

-M

-Original Message-
From: Tim Winters [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 23, 2003 12:31 PM
To: 'CPT John W. Holmes'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Session error?

Thanks John,

So is that address relative to the physical machine or is it relative to
the directory where the php files are contained.

Tim Winters
Creative Development Manager
Sampling Technologies Incorporated

1600 Bedford Highway, Suite 212
Bedford, Nova Scotia
B4A 1E8
www.samplingtechnologies.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Office: 902 450 5500
Cell: 902 430 8498
Fax:: 902 484 7115


-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] 
Sent: June 23, 2003 11:40 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Session error?

 Warning: session_start() [ http://www.php.net/function.session-start
 function.session-start]:
 open(/tmp\sess_bf0c0a0a020087aa573e357a2553f828, O_RDWR) failed: No
such
 file or directory (2) in C:\Program Files\Apache
 Group\Apache2\htdocs\MailOrderDynamic\c.php on line 6

The default session.save_path in php.ini is set to /tmp. It appears
you're
on a windows machine and probably do not have a c:\tmp directory. Either
create one (if that's where you want to store your session files) or
change
the path in php.ini to some other folder that exists. Ensure the Apache
user
has permission to write to the folder you specify, also.

The other errors are caused by the output of your first error.

---John Holmes...


-- 
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] ideas for Affiliate Program.....

2003-06-24 Thread mike karthauser
on 24/6/03 4:59 pm, Kieu D. Trang at [EMAIL PROTECTED] wrote:

 Have anyone ever done anything similar and have other suggestions?  I am
 working on it, but is still looking for better ways of doing it...  thanks
 in advance..

You want to look on sourceforge for a project called php affiliate. I think
that should save you some time ;-)

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



Re: [PHP-DB] Accessing MySql using Flash while using PHP as themiddleware

2003-06-25 Thread mike karthauser
on 25/6/03 4:15 pm, Ron Allen at [EMAIL PROTECTED]
wrote:

 Does anybody have an idea how-to use Flash and PHP to access a MySql
 database. I know how to use PHP and mysql with no problem to pull info, but
 with Flash I am struggling.

Look on flashkit.com


-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



[PHP-DB] AAAAGGGGHHH!!! Help!!

2003-07-11 Thread Mike Mannakee
I am running a query in mysql :

SELECT DISTINCT (id) AS visitor_id,
MAX(date_time) AS last,
MIN(date_time) AS first,
UNIX_TIMESTAMP( MAX(date_time)) -
UNIX_TIMESTAMP( MIN(date_time)) AS diff
FROM visitors, pixeldata_
WHERE
visitors.created  DATE_SUB( CURRENT_DATE, INTERVAL 1 HOUR )
AND
id = pixeldata_.remote
GROUP BY
visitors.id

The idea behind the WHERE clause is to only get results from the last hour.
I have used this construct successfully in dozens of other queries.
However, the results here are giving me every single visitor in the table.
Regardless of when created.

In other words that part of the WHERE clause is not working.  Does anybody
see any problem in the sql that I'm not seeing??  This is driving me nuts.

Mike







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



Re: [PHP-DB] osCommerce - which merchant service/payment gateway?

2003-07-17 Thread mike karthauser
on 17/7/03 3:07 pm, Becoming Digital at [EMAIL PROTECTED] wrote:

 I'm sorry for going slightly off-topic, but I'm sure many of you have
 experience
 with this issue.  Every shopping cart *does* use a database, after all, and
 I'm
 sure someone else will find this useful, too.  Thanks a lot.

http://www.protx.com/ provide a gateway for oscommerce. Its in the
contributions section. Easy to install and the cheapest gateway we;ve seen.

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



[PHP-DB] Insert/Update help needed

2003-07-17 Thread Mike Baerwolf
Hello all,

I've been able to get the below to work pretty much. The only problem I 
have is when there is an apostrophe in the data of one of the fields 
like (You're the One).  When this occurs nothing gets updated or 
inserted(tried both).  I've done other things from forms 
inserting/updating with data that contained apostrophes and never had a 
problem.  This is my first attempt at inserting/updating from a string 
match.
Any help would be appreciated.

$grab = preg_match_all(/(([\w]+)[^]*)(.*)(\/\\2)/, $file, $matches);

$a_1 = $matches[3][48];
$a_2 = $matches[3][49];
$a_3 = $matches[3][50];
$sql = UPDATE charts SET artist='$a_1' , song='$a_2' , label='$a_3' 
WHERE charts_id=1 or die(mysql_error());
   if ($result = mysql_query($sql)){

Here is my table structure:
charts_id(tinyint(3),NOT NULL)
artist(varchar(150),NULL)
song(varchar(100),NULL)
label(varchar(75),NULL)
Thanks in advance,
Mike


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


RE: [PHP-DB] Renaming .htm pages to .php

2003-08-03 Thread Mike Brum
If you change you Apache configs, it wouldn't create a problem with
.htm pages that don't use any PHP, but the pages will still be sent
through the PHP parser.

If you don't have a very high-traffic site and there's no other sites on
the box, then you probably won't see any real performance hit - but
understand that if you do start getting a ton of traffic, every .htm
page will be parsed for PHP content. Even if none is found, there is
some CPU cycles burned in that initial parsing.

-Original Message-
From: David Blomstrom [mailto:[EMAIL PROTECTED] 
Sent: Sunday, August 03, 2003 9:49 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Renaming .htm pages to .php

So if I understand you correctly, I can turn a page into a .php page 
through one of two methods:

1. Change the extension to .php
2. Instruct Apache to treat .htm extensions as .php extensions.

That sounds really interesting. Would that create any problems with
pages 
that I never use .php functions on? Or if I have websites on my computer

that don't use php?

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] a bandwitch question

2003-08-05 Thread mike karthauser
on 5/8/03 12:20 pm, JeRRy at [EMAIL PROTECTED] wrote:

 So top frame loads:
 
 http://localhost/blah.php
 
 And the bottom frame loads:
 
 http://www.getpaid2reademails.com/ (example)
 
 Now does the localhost generate the bandwitch for that
 visit from the bottom frame aswell or only the top
 frame?

They are separate. Localhost knows nothing about the bottom frame as it is
only loaded by the frameset when it is client side.

It behaves the same way as if you had 2 browser windows open pulling in the
two URLs.

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



[PHP-DB] Help needed with variable scoping? or mysql problem

2003-08-14 Thread Mike Klein
I've been using JSP for some time now, and thought I'd write a couple of
rdbms explorers (flat tables, simple master/detail paradigm) using other
technologies, like PHP, Cocoon, etc. Well...it's been fun. I have more
working than not. But now I am hung up. I am getting wierd results in a php
script when I simply change the order of some mysql calls.

I'm using php-4.3.2, rh9, and mysql 3.23.

My error is the following (the first line above the Warning below is a dump
of parameters to the showMaster function which is what's bombing):

conn=Resource id #3 databaseName=info tableName=movies fieldName=title
fieldValue=36th Chamber
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource in /foo/bar/mywebsite/private/database.php on line 107

Line 107 is the first mysql_num_rows call below.

function showMaster($conn, $databaseName, $tableName, $fieldName,
$fieldValue)
{
echo conn=$conn\n;
echo databaseName=$databaseName\n;
echo tableName=$tableName\n;
echo fieldName=$fieldName\n;
echo fieldValue=$fieldValue\n;

This code fails when placed here==
$result = mysql_query(SELECT * FROM $tableName where
$fieldName='$fieldValue', $conn);
$numRows = mysql_num_rows($result);
if(mysql_num_rows($result) == 1)
{
showDetail($conn, $databaseName, $tableName, $fieldName,
$fieldValue, $result);
exit;
}
echo numRows=$numRows\n;


$fields = mysql_list_fields($databaseName, $tableName, $conn);
$numFields = mysql_num_fields($fields);
echo TABLE border=1 width=100%\n;
echo tr;
for($i = 0; $i  $numFields; $i++)
{
printf(td%s/td, mysql_field_name($fields, $i));
}
echo /tr;

The SAME code succeeds when placed here!==
$result = mysql_query(SELECT * FROM $tableName where
$fieldName='$fieldValue', $conn);
$numRows = mysql_num_rows($result);
if(mysql_num_rows($result) == 1)
{
showDetail($conn, $databaseName, $tableName, $fieldName,
$fieldValue, $result);
exit;
}
echo numRows=$numRows\n;


while($myrow = mysql_fetch_array($result))
...rest of method...
}

Any ideas on why this is? When I move the lines above (from
$result=...to...echo 'numRows') down a few lines to just before the
mysql_fetch_array, then everything works. Whazzup?!?


mike klein



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



[PHP-DB] Multiple checkboxes

2003-08-14 Thread Mike Baerwolf
Hello,

I'm trying to get the values from a form post with multiple checkboxes 
checked . Here is what I have,

if ($row = mysql_fetch_array($result));

do {
input type=checkbox name=class_id[] value=$row[class_id] $row[name]

 }while ($row = mysql_fetch_array($result));
and when submitted

if ($class_id) {
foreach($class_id as $varName)
print Variable: $varName\n;
}
All I get from this is Invalid argument supplied for foreach().  From 
what I could find doing a google search was to create an array using 
class_id[] and the above foreach().

Thanks in advance for any help!
Mike
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Maximum execution time of 30 seconds exceeded

2003-08-14 Thread Mike Brum
Why is it important that you recycle old PINs? This is most likely eating
up the most time in your script execution.

My suggestion would be to either 

A) just keep creating a new one and ignore ones when a child leaves or 

B) create a 2nd, much smaller table available_pins and when a child
leaves, insert their former PIN into this table. Then upon executing the new
student script, you check the available_pin table for rows  0. If so, use
the first one. If not, give them a new one.

Good luck.

-M

-Original Message-
From: Michael Cortes [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 11, 2003 2:57 PM
To: Ben Lake
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Maximum execution time of 30 seconds exceeded


I do have an auto_increment for the record id.  But that is just a way for
me 
to uniquely id the record.  Student numbers, barcodes, etc can change.

The reason I am using the do/while loop is:   Every student is getting a 
4digit pin for library, cafeteria and network access.  It has to be unique 
and we have been assigning a different range of numbers per building/grade.

There are various procedural reasons for this.  I have verified that I am 
identifying the new student correctly and going into the do/while loop with
a 
variable that holds the correct starting number for the appropriate pin 
range.  It's then just a matter of trying consecutive numbers till I find an

available pin.  The pin may be available because a student left the school
or 
because it's next available at the end of the line.

Anyway, I was not aware I could pick and choose my ranges in an
AUTO_INCREMENT 
field.

I appreciate any thoughts you may have.  Thanks.


On Monday 11 August 2003 02:41 pm, you wrote:
 Why don't you use an AUTO_INCREMENT field in your table to define a 
 unique number?

 Ben

 -Original Message-
 I had a do while loop such as

 do {
   mysql_query ($qupdate, $link);
   $rslterror=mysql_error($link);
   $number++
 } while ($rslterror!=null);

 Anyway, I fixed my dumb mistake.  If anyone would like to help me with 
 a better one, maybe you can tell me if I am doing my do while 
 correctly. It's only running through once, not getting a succesful 
 insert  and dropping out.

 Thanks


-- 

Michael Cortes
Fort LeBoeuf School District
34 East Ninth Street
PO Box 810
Waterford PA 16441-0810
814.796.4795

-- 
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] Help needed with variable scoping? or mysql problem

2003-08-23 Thread Mike Klein
Oh yeah that's the ticket!

I'd forgotten that I'd removed the mysql_select_db statement when doing
some earlier 'cleanup'. It just so happens that a few of the mysql metadata
calls (like listing fields/etc.) were inadvertently setting the db...but
only for a brief period of time...wierd.

As I mentioned, I just started using php yesterday, so I'm still learning
some tips/tricks.

But...to php's credit, I gotten a fairly functional rdbms
explorer/browser/editor going in under a day. I had initially planned on
'hardcoding' some rdbms master/detail forms, but after doing just one of
them, and seeing the plethora of mysql calls available, I decided to
genericize the code, and now it's a general explorer/etc. for all of my
databases. Seems pretty speedy too.

Now I just need to add result set 'scrolling'. Returning 2000 records is not
nice...


thanks buddy...



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 14, 2003 8:10 AM
To: Mike Klein
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Help needed with variable scoping? or mysql
problem



best way to tell is to place .'or die(mysql_error())' after any call to
mysql_query() to see what mysql is complaining about.  personally I
sometimes declare the query first so i can echo that as well after the
msyql_error() function, so i can see the query that has just been
excecuted.  helpful with dynamic queries.

$qry = SELECT * FROM $tableName where $fieldName='$fieldValue';
$result = mysql_query($qry, $conn) or die(mysql_error() . $qry);

hth
jeff



  Mike Klein
  [EMAIL PROTECTED]To:
[EMAIL PROTECTED]
  rg  cc:
   Subject:  [PHP-DB] Help
needed with variable scoping? or mysql problem
  08/14/2003 08:58
  AM






I've been using JSP for some time now, and thought I'd write a couple of
rdbms explorers (flat tables, simple master/detail paradigm) using other
technologies, like PHP, Cocoon, etc. Well...it's been fun. I have more
working than not. But now I am hung up. I am getting wierd results in a php
script when I simply change the order of some mysql calls.

I'm using php-4.3.2, rh9, and mysql 3.23.

My error is the following (the first line above the Warning below is a dump
of parameters to the showMaster function which is what's bombing):

conn=Resource id #3 databaseName=info tableName=movies fieldName=title
fieldValue=36th Chamber
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource in /foo/bar/mywebsite/private/database.php on line 107

Line 107 is the first mysql_num_rows call below.

function showMaster($conn, $databaseName, $tableName, $fieldName,
$fieldValue)
{
echo conn=$conn\n;
echo databaseName=$databaseName\n;
echo tableName=$tableName\n;
echo fieldName=$fieldName\n;
echo fieldValue=$fieldValue\n;

This code fails when placed here==
$result = mysql_query(SELECT * FROM $tableName where
$fieldName='$fieldValue', $conn);
$numRows = mysql_num_rows($result);
if(mysql_num_rows($result) == 1)
{
showDetail($conn, $databaseName, $tableName, $fieldName,
$fieldValue, $result);
exit;
}
echo numRows=$numRows\n;


$fields = mysql_list_fields($databaseName, $tableName, $conn);
$numFields = mysql_num_fields($fields);
echo TABLE border=1 width=100%\n;
echo tr;
for($i = 0; $i  $numFields; $i++)
{
printf(td%s/td, mysql_field_name($fields, $i));
}
echo /tr;

The SAME code succeeds when placed here!==
$result = mysql_query(SELECT * FROM $tableName where
$fieldName='$fieldValue', $conn);
$numRows = mysql_num_rows($result);
if(mysql_num_rows($result) == 1)
{
showDetail($conn, $databaseName, $tableName, $fieldName,
$fieldValue, $result);
exit;
}
echo numRows=$numRows\n;


while($myrow = mysql_fetch_array($result))
...rest of method...
}

Any ideas on why this is? When I move the lines above (from
$result=...to...echo 'numRows') down a few lines to just before the
mysql_fetch_array, then everything works. Whazzup?!?


mike klein



--
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] Populating an array from mysql db

2003-08-28 Thread mike karthauser
I have a course booking system that allows the client to add courses and
then specify how long they run for. The admin system I have built allows the
client to add up to 30 dates for each instance of the course and these are
adding to a database row in the form date1, date2, date3, daten etc.

What I am trying to achieve now is to extract this data into an array so I
can count how many dates have been added and to display the dates.

If the course runs for eg. 2 days - values of date1 and date2 would be
populated as date1=2003-09-01, date2=2003-09-02 - all other dates would be
default to -00-00 and I wish to ignore these.

I'm trying to work out how to set up a loop to extract positive dates from
my db so I end up with

$bookdate[0] = '2003-09-01';
$bookdate[1] = '2003-09-02'; etc

Can anyone provide me with some help in this extraction?

Thanks in advance.

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ

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



Re: [PHP-DB] Populating an array from mysql db

2003-08-28 Thread mike karthauser
on 28/8/03 1:09 pm, [EMAIL PROTECTED] at [EMAIL PROTECTED]
wrote:

 
 I'd worry about the empty dates after. and use something like.
 
 $qry = select date1, date2 from table;
 $result = mysql_query($qry) or die(mysql_error());
 while ($rs = mysql_fetch_row($result)) {
 //this array could be built a number of ways, one is
 $bookdate[] = array($rs[0],$rs[1]);
 }
 
 if i've not misunderstood, that should work

Thanks for this - I ended up rehashing my query to this:

?
$result = mysql_query(SELECT * FROM dates WHERE bookcode = '$bookcode'
ORDER BY date1,$db);


// loop to populate array

$myrow = mysql_fetch_array($result);

$i = 1;
while ($i = '30') {

if ($myrow['date'.$i]  '-00-00')
{
$bookdate[]=$myrow['date'.$i];
}


$i++;  /* the printed value would be
$i before the increment
(post-increment) */
}

//end loop

$result2 = count ($bookdate);

if ($result2 == 0)
  {
echo pThis course booking runs for 0 days/pp;
 }
  else if ($result2 == 1)
  {
echo pThis course booking runs for b1/b day on the following
date:/Pp;
  }
  else {
echo pThis course booking runs for b$result2/b days on the
following dates: /pp;
  }

function print_dates ($bookdate)
{foreach ($bookdate as $display_date) {
$date = $display_date;
$dv[0] = substr($date, 8, 2);
$dv[1] = substr($date, 5, 2);
$dv[2] = substr($date, 0, 4);
$display_date = implode (-,$dv) ;

print(span class=\divider\$display_date/spanbr);
}
} 

print_dates($bookdate);

?

Which does what I need. The tricky bit was the //loop

cheers
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ

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



Re: [PHP-DB] Populating an array from mysql db

2003-08-28 Thread mike karthauser
on 28/8/03 5:00 pm, CPT John W. Holmes at [EMAIL PROTECTED] wrote:

 Thanks for this - I ended up rehashing my query to this:
 
 ?
 $result = mysql_query(SELECT * FROM dates WHERE bookcode = '$bookcode'
 ORDER BY date1,$db);
 
 
 // loop to populate array
 
 $myrow = mysql_fetch_array($result);
 
 $i = 1;
 while ($i = '30') {
 
 if ($myrow['date'.$i]  '-00-00')
 
 You're making PHP do some extra work here. You're testing to see if one
 string is greater than another... how can strings be greater than or less
 than? Why don't you just check for $myrow['date'.$i] != '-00-00' ??

Thanks. I'll make your change.

Ta. 

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ

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



[PHP-DB] md5() and mysql

2003-08-29 Thread Mike Baerwolf
Hello,

I'm looking at using md5() and mysql for user auth to some of the data 
in a table. I found the following on the php md5 manual page,

$query = INSERT INTO user VALUES ('DummyUser',md5('DummyPassword'));

$password = md5($password);
$query = SELECT * FROM user WHERE username='DummyUser' AND 
password='DummyPassword';

I see that nobody will be able to view the password once it's in the 
database, but I'm thinking that the plain text password is sent to and 
from the server and someone might be able to snoop the plain text 
password. Is that right?

Thanks for the help,
Mike
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] $PHP_SELF does not work with all browsers

2003-09-15 Thread mike karthauser
on 15/9/03 1:46 pm, Alain Barthélemy at [EMAIL PROTECTED] wrote:

 http://localhost/~webpage/?chosenLettre=65 /// where is $PHP_SELF 

Try using $_SERVER['PHP_SELF']
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ

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



[PHP-DB] Why varying functionality across php db apis for db metadata?

2003-09-16 Thread Mike Klein
For example, php mysql library supports list_dbs and list_tables commands as
well as getting table metadata. MySQL sql also 'natively' supports these
commands (show databases, show tables, describe tableName).

Why not similar commands for Oracle, SQLServer, etc.? These are simply
selects against certain system tables, no?


mike klein

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



Re: [PHP-DB] Re: Why varying functionality across php db apis for db metadata?

2003-09-17 Thread Mike Klein
Jason Wong wrote:

 On Wednesday 17 September 2003 18:46, pete M wrote:
 
Mike Klein wrote:

For example, php mysql library supports list_dbs and list_tables commands
as well as getting table metadata. MySQL sql also 'natively' supports
these commands (show databases, show tables, describe tableName).

Why not similar commands for Oracle, SQLServer, etc.? These are simply
selects against certain system tables, no?

Go and ask M$ and Oracle..
 
 
 I doubt whether they have anything to do with it (although it's nice to blame 
 everything on M$), but rather it is author(s) of the particular DB extensions 
 who you have to thank for the current inconsistencies.
 
 I think some move is being made to make the commands consistent across the 
 different DBs. Eg the names of the postgresql functions are being changed to 
 match those of the mysql functions.
 

I've been so impressed with the capabilities of php in general, that I
am a little surprised more effort wasn't made at consistency from the
get go...something ala jdbc or whatever.

Other php db libs I've seen don't offer common database metadata
functions, only wrappers for basic functionality.

You need the metadata functions when writing query tools/browsers/etc.

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



[PHP-DB] Free php-based mysql browser/query tool available for download...

2003-09-17 Thread Mike Klein
Sorry it's for mysql only...but this merely reflects the current state 
of php's database support...especially regarding functions for 
retrieving database metadata.

Current support is for pointclick browsing and simple queries. I will 
be adding support for joins, calculated columns, and more in the coming 
weeks.

As this was my first php project (don't use this as a reason to not 
download...it works fine) I would appreciate greatly any feedback 
regarding shortcuts, innefficiencies, bugs, etc.

For downloading instructions and a demo, please see:

http://www.vxappliance.com/developers/shareware/databaseExplorers

Personally I use phpMyAdmin or the mysql cmdline (like everybody else) 
for admin tasks, but I wanted a simple front-end for the rest of my 
website without all of phpMyAdmin's baggage (ui and otherwise).

mike klein

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


[PHP-DB] JOIN across db's in MySQL

2003-09-18 Thread Mike Tallroth
In the big scheme of things, I need several functions to be performed by a
web interface / database system.  In an attempt to maintain some sense of
order, I'm hoping to divide common data into a seperate MySQL database away
from the function specific data.  For example, I need to do project
allocation and vendor quality tracking.  These functions are generally
unrelated but call on similar data (people in the group).

My plan was to create a MySQL database called admin which contained
people, customers, locations, addresses, etc, and seperate databases for
each of the other functions projectallocation, vendorquality, etc.

The problem I'm seeing is that there is no clean way of creating queries
across database boundaries.  Does PHP support this and I'm not seeing it?
Does anyone know of third party code that accomplishes this manually?  Am
I out in left field on my desire to setup the database structure this way?

thanks,

--
Mike Tallroth
Engineering Supervisor
Test DesignCenter
Plexus Technology Group
Neenah, WI
mike.tallroth @plexus.com
920-751-5418

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



Re: [PHP-DB] JOIN across db's in MySQL

2003-09-18 Thread Mike Tallroth
Thanks, I found the post from John Holmes and was able to reconstruct the
query in mysql.  But when I transferred that over to php and try to extract
an associative array from each record, I found that only one column came out
instead of two.

By simply changing the query from:
$query = select t1.name, t2.name from test1.table1 t1 join test2.table2
t2 on t1.id = t2.id;
to:
$query = select t1.name as first, t2.name as last from test1.table1 t1
join test2.table2 t2 on t1.id = t2.id;
the associative array worked as desired.

I suspect what was happening originally was both columns when extracted from
the result and placed into the array were both stored under the index
name.  By changing them to have unique field names as first and as
last allowed two different indexes.  Perhaps there is a way of extracting
data from the query result that will allow redundant names, but I don't know
what that is.


thanks for the help,
Mike


Jeffrey N Dyke [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 i asked this same question once and somehwere in the archives is a post by
 John Holmes that shows an example of how mysql allows db joins.  its from
 last month i believe

 http://marc.theaimsgroup.com/?l=php-db

 but in short, mysql does support this using . db.table.field

 hth
 Jeff



   Mike Tallroth
   [EMAIL PROTECTED]To:
[EMAIL PROTECTED]
   exus.comcc:
Subject:  [PHP-DB] JOIN
across db's in MySQL
   09/18/2003 10:47
   AM






 In the big scheme of things, I need several functions to be performed by a
 web interface / database system.  In an attempt to maintain some sense of
 order, I'm hoping to divide common data into a seperate MySQL database
away
 from the function specific data.  For example, I need to do project
 allocation and vendor quality tracking.  These functions are generally
 unrelated but call on similar data (people in the group).

 My plan was to create a MySQL database called admin which contained
 people, customers, locations, addresses, etc, and seperate databases for
 each of the other functions projectallocation, vendorquality, etc.

 The problem I'm seeing is that there is no clean way of creating queries
 across database boundaries.  Does PHP support this and I'm not seeing it?
 Does anyone know of third party code that accomplishes this manually?
Am
 I out in left field on my desire to setup the database structure this way?

 thanks,

 --
 Mike Tallroth
 Engineering Supervisor
 Test DesignCenter
 Plexus Technology Group
 Neenah, WI
 mike.tallroth @plexus.com
 920-751-5418

 --
 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] UPDATE part of a column

2003-09-23 Thread mike karthauser
on 23/9/03 1:03 pm, Shaun at [EMAIL PROTECTED] wrote:

 1. How can I clean the table, so for example changing:
   Ashfield Business CentreBR The Idlewells PrecinctBR
 Sutton-in-AshfieldBR
   to:
   Ashfield Business Centre, The Idlewells Precinct, Sutton-in-Ashfield,
 
 2, Is there a way to make sure the data is 'clean' before entering into the
 table?

Do something like this:

$pagetext=ereg_replace( BR, ,$pagetext);

To strip the BRs 


-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ

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



Re: [PHP-DB] faster imagecreatefromjpeg

2003-10-17 Thread mike karthauser
on 17/10/03 3:57 pm, Georgescu Vlad at [EMAIL PROTECTED] wrote:

 i need to replace the using of imagecreatefromjpeg($jpgpath) with
 something more faster
 
 PS: the image to load has: 198 MB (208,603,887 bytes)


Why not resize the image using photoshop first? Any app resizing 200Mb
images are going to take ages.
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ

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



[PHP-DB] mysql field comparison to multiple variables

2003-10-24 Thread Mike Baerwolf
Hello,

I trying to put together a sql statement that will pull records based on 
 a date field.  I can't figure out how to compare the date field to 
multiple php variables. Something like this,

WHERE date_field != $date_1 OR $date_2 OR $date_3 etc. etc.

Thanks for the help.

Mike

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


[PHP-DB] select inside a while loop

2003-11-27 Thread Mike Baerwolf
Hello,

I have two mysql tables songs and artists. They look like this:

CREATE TABLE `artists` (
  `artist_id` int(10) unsigned NOT NULL auto_increment,
  `artist_name` varchar(100) default NULL,
  `artist_img` varchar(50) default NULL,
  PRIMARY KEY  (`artist_id`),
  UNIQUE KEY `artist_name` (`artist_name`),
  KEY `artist_id` (`artist_id`)
) TYPE=MyISAM;
CREATE TABLE `songs` (
  `song_id` int(11) NOT NULL auto_increment,
  `song_title` tinytext,
  `artist_id` tinytext,
  PRIMARY KEY  (`song_id`)
) TYPE=MyISAM;
Currently I have the artist_id in the songs table setup has a text field 
with artist names in them temporarily. First I want to select all the 
artist_ids(with the names) and find the artist_id for that name in the 
artist table. Then update the artist_id in the song table with the 
artist_id in the artist table. Then convert the artist_id in the song 
table to int.

So with all that said here is what i have done that doesn't work,

$result = mysql_query(SELECT artist_id FROM songs,$db) or 
die(mysql_error());

  if ($row = mysql_fetch_row($result)){
  do {
$artist_name = $row[artist_id];
$result_1 = mysql_query(SELECT artist_id,artist_name FROM
artists WHERE artist_name = '$artist_name',$db);
$row_1 = mysql_fetch_array($result_1);
print $row_1[artist_id]-$row_1[artist_name];
}while ($row = mysql_fetch_array($result));
  } 
I haven't even been able to get to the update part. I'm pretty sure the 
above fails because of the var $artist_name after the first run through.
Any help would be appreciated.

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


Re: [PHP-DB] PhpmyAdmin from external computers

2003-12-04 Thread mike karthauser
 However, when i connect to that computer from my windows computer and go to
 the phpmyadmin url it wont let me do anything.  Ive set all the priveleges
 to allow full access in every way, but it still wont let me access it

What error do you get?

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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



Re: [PHP-DB] PhpmyAdmin from external computers

2003-12-04 Thread mike karthauser
 I  goto http://serverIP/phpmyadmin/index.php  - and it logs me
 inautomatically as localhost, i can see the database lists on the side panel
 etc.
 
 I click on a database or create a new database and the login screen comes
 up.
 
 I try entering the root password and username, but it just comes up with :
 
 #1045 - Access denied for user: '[EMAIL PROTECTED]' (Using password: NO)
 
 and ive tried with a blank  password as well.
 
 I have the auth_type in config.inc.php (PhpMyAdmin) set to 'config' and the
 username and password for mysql is in their respective places.

Logging in as root with no password remotely is not good. Try making another
user logged in locally with user and password, then try that from remote.


-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ

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



Re: [PHP-DB] PHP/DB speed

2003-12-22 Thread mike karthauser
 On 56K the page would probably either 1) timeout on
 the way you have it currently or 2) only display part
 of the page/form and not read the whole page
 correctly.
 
 I dunno give us the URL, I am sure someone is on
 dialup to give it a wurl.

Try the url with web analyzer
http://www.websiteoptimization.com/services/analyze/

This is by far the most useful dev tool I have found recently. Saves
touching dial ups for testing..
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ

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



Re: [PHP-DB] INSERT into 2 different tables??

2003-12-23 Thread mike karthauser
 Just wana ask is it possible to have only one form and when i submit, it
 should INSERT data into 2 diff tables??
 Hope u get my idea...

It is possible. You just need to do 2 single inserts to one to each table.

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ

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



Re: [PHP-DB] Re: php mail() question

2003-12-23 Thread mike karthauser
 What does this do?  Well I added PRE and /PRE for
 a testing purpose.
 
 It returns in the textarea PRE/PRE ...
 
 So it's skipping the HtmlSpecialChars code.  Why?

Change this:

echo textarea name='headers' cols='250'
rows='5'PRE,HtmlSpecialChars($headers[$line]),/PRE/textarea';

For

echo textarea name='headers' cols='250'
rows='5'PRE.HtmlSpecialChars($headers[$line])./PRE/textarea';

Which should display.

-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ

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



[PHP-DB] Re: Associated popup menu (php/mysql)

2004-02-05 Thread Mike S.
Actually, there is a way to do this with PHP.  It may not be the best
method, but it is possible.  You could do it with one single source file,
or multiple.

With a single source file you could do something like this:
The first time through would display the first popup with valid choices. 
Form action would post the results of the popup to the same page.  Now you
have a variable with a value from the first popup.  You can then display
your second popup choices based on the first.  And so on for any remaining
popups.

With multiple source files:
The first page displays the first popup. Form action would post the
results to the next page.  As with the first method, you now have a
variable with a value from the first popup.  Display your second popup
choices based on the first.  And so on...

Pro:  You don't need to learn Javascript.
Con:  The web page is redrawn for each new popup selection - not seamless
like a pure Javascript solution may be.

Using multiple source files may help you keep load time down as well as
make it easier to maintain.  It's a matter of personal choice, I think.

If you don't program Javascript, this is one method you may consider -
though I would encourage anyone writing web pages to learn Javascript. It
can be a real lifesaver!  :-)

With either method (PHP or Javascript), you'll probably want to code in
some way for the user to go back and re-select the first popup, i.e. start
over.

Sorry, I don't have sample code.  I haven't had a need for this type of
popups yet, but I have a project coming up soon that probably will.  If I
get a chance to code up a sample, I'll make it available.

Good luck.

:Mike S.
:Austin TX

On Thu February 5 2004 7:33pm, Micah Stevens wrote:

 Javascript is client side programming, PHP is server side and unable to
 control actions and make decisions on what's happening in the browser
 except  in a 'third person' manner.

 Simply put, you can't do this with PHP.

 On Thu February 5 2004 5:21 pm, alb_shop wrote:
 Hello all,

 I've been searching for hours and cannot find the answer or sample in
 in any forum.

 What is the best method (any sample or help would be appreciated), to
 associate popup menus in a form. Choosing the first popup menu (Main
 categorie) should provide to me the results for the second popup menu
 (subcategory).

 Ie : Countries -- states

 I know that javascript can do this sort of things, but I would like to
 use only php. Is that possible ?

 I have two tables in mysql: Countries  states that can be associated
 by id_country.

 Thank you


---
Sent: February 6, 2004, 12:09 am

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



[PHP-DB] Re: Form doesnt write to database

2004-02-07 Thread Mike S.
 Dear friends,
 Form doesn't write to mysql database. I have pasted code of mysal
 table structure,html form and php script. Any comments, please.

 // create the SQL statement
 $sql = INSERT INTO testtable values ('{'', $_POST['testField']}','
 {'', $_POST['testFielda']}','{'', $_POST['testFieldb']}','{'',
 $_POST['testFieldd']}','
 {'', $_POST['testFieldc']}','{'', $_POST['testFielde']}');

I tried your code on my system and got an error of 'incorrect number of
parameters'.  That's when I realized you need NULL as the first
parameter in your values.  I didn't see in the MySQL docs where it
requires the NULL, but in one of the examples, it was there.

Insert NULL as the first parameter and it should work.

I also got a parse error because of the '{' and '}' symbols around your
$_POST variables.  I changed it to:

$sql = INSERT INTO testtable values ( NULL, '.$_POST['testField'].',
'.$_POST['testFielda'].', '.$_POST['testFieldb'].',
'.$_POST['testFieldd'].', '.$_POST['testFieldc'].',
'.$_POST['testFielde'].' );

and got a working solution.

Suggestion: You could try using the mysql_errno() and mysql_error()
functions.  Print them out after your failed statement and you'll see
why the mysql call failed.

Example:
  print Error # .mysql_errno(). - .mysql_error().BR\n;

will print the error number and message.  This will give you some idea
of what went wrong.

Good coding practice dictates that you check for an error condition
after mysql calls [using mysql_errno()] and handle any errors
appropriately.

If you don't already have it, you'll want a list of the error codes and
their meanings.  You can find it in the mysql source code
Docs/mysqld_error.txt file.  If you can't find that right now, copy this
web page I whipped up right now:

   http://web.netmask.com/2004/02/mysql-error-codes.html

or, if you prefer a flat, text file:

   http://web.netmask.com/2004/02/mysql-error-codes.txt



Good luck!

:Mike S.
:Austin TX


---
Sent: February 7, 2004, 6:48 pm

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



[PHP-DB] Creating HTML objects from Oracle DB data @ runtime

2004-03-01 Thread mike calcagno
I have a project where I am writing a web app version of out medical
laboratory software. I will be connecting to an oracle db and ordering tests
on patients. I will need to create multiple checkboxes at runtime depending
on the data in the db. I will then need to submit all of the checked
checkboxes and save them to the database.

any help is appreciated.

Thanks,
Mike C.
[EMAIL PROTECTED]

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



[PHP-DB] undefined function from mysql_connect again

2004-03-01 Thread Mike Ni
Hey everyone,


I am having a tough time with MySQL API/Linux and I 
heard othes had the same issue a few days ago.

I keep getting error message undefined fnction while
calling mysql_connect. Did anyone find out what was
causing this?


Thanks!
MIke

__
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools

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



[PHP-DB] MySql PHP API

2004-03-01 Thread Mike Ni
Hey everyone,


Does anyone outhere is running Apache/Linux/PHP/Mysql?

I am having hard time with MYSQL PHP API. Apache/PHP
simply would not recognize any cmysql function call
such as mysql_connect.

I have recompile the php with mysql extension and th
problem continue tobe there. 

I run the phpifo and it work.
In smuuary:

* Beside Mysql, PHP seems to be working including
phpino
* According to phpinfo( ), it suuport mysql. Yet,
wouldn't recognize the functin call


Plese let me know if you have any thought.

Thanks!

__
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools

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



<    1   2   3   4   >