Re: [PHP-DB] Printing Issue

2003-06-10 Thread Becoming Digital
This is more of an OS/application program than it is a PHP issue.  Besides, we
don't even know which program you're using so we couldn't help if we tried.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: birdto [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, 08 June, 2003 22:13
Subject: [PHP-DB] Printing Issue


Hi All,

I have a problem in printing database. I have drawn some data from the MySQL
and print to A4 paper. When the data are more than 1 page, it has to print
on other A4 paper. The problem is, I need the program to print the same
heading in every page. How can I do this?

Regards,
Berthold



--
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] special character in filename

2003-06-10 Thread Becoming Digital
I can't explain why addslashes() didn't work (incorrect placement in the script,
perhaps), but take a look at htmlspecialchars() and htmlentities().  They're
long shots, but they might help.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Ole Hornauer [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, 08 June, 2003 13:14
Subject: [PHP-DB] special character in filename


hi,

since i got my mp3 code somewhat working (was my fault, sorry guys), i
encountered another problem that i simply cant solve on my own.
im scanning mp3 files in a directory to put the data into a mysql
database.
everything works fine except that those files that have inverted commas
(maybe also other special characters?) as part of the filename are being
ignored by the script. i tried to use addslashes() but that didn't help
either. i included a test (echo $dir.$file) to see what exactly would be
inside the variables. but it looked ok.
could anybody give me a hint? i just dont get it.

here is my code. i included mphp3.php from http://res.crea-bmb.de/mphp3/
to scan for mp3 tags:

?
include(mphp3.php);

mysql_connect(192.168.100.12,user,password) or die (Keine
Verbindung moeglich);
mysql_select_db(mp3) or die (Die Datenbank existiert nicht);

scan_dir(mp3/);
echo Fertig;

function scan_dir($dir)
{
$handle = @opendir($dir);
while ($file = @readdir ($handle))
{
if (eregi(^\.{1,2}$,$file))
{
continue;
}

if(is_dir($dir.$file))
{
 scan_dir($dir.$file./);
}
else
{
$info = New mphp3(2);
 echo $dir.$file;
$info-load($dir.$file);
$abfrage =insert into mp3 (
  file,
  path,
  artist,
  title,
  album)
values (
 '$file',
 '$dir',
 '$info-v2_artist',
 '$info-v2_title',
 '$info-v2_album');;
mysql_query($abfrage);
}
}
@closedir($handle);
}
?

--
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] Count database-values

2003-06-10 Thread Robert Wanadoo
Hi everybody,

I've got a little problem, which I can't solve. It is as follow:
In my database I made a table with different fields.
One of the fields is named 'bedrag' and contains a numeric value like 15.47 or 78.16 
and so on.
If I want a value of the table I use in most cases the following code:

?
$squery = mysql_query(SELECT * FROM finance WHERE posneg = 'af',$db);
while($row = mysql_fetch_array($squery)) {

$bedrag = $row[bedrag];
echo $bedragbr;
}
?

In this case I receive a list like:
15.47
78.16
and so on...

So far no problems, but I want to count all these values. I tried with SUM but with 
the following code it doesn't work:

$squery = SELECT SUM(bedrag) AS Total FROM finance WHERE posneg = 'af';

any suggestions how to do? I want to store it in a variabele ($total) so I can echo 
it. (E.g.: $total = 93.63 in this case)

Thanx in advance,

Robert van der Mast



[PHP-DB] Re: I looking for OCI8 client library files.

2003-06-10 Thread Philippe Saladin
Soony [EMAIL PROTECTED] a écrit dans le message news:
[EMAIL PROTECTED]
 Hi, phpers..
 I looking for OCI8 client library files for using OCI function in PHP to
 control Oracle DB.

 I like any information about that.

Ask your dba (database administrator). If you have oracle, he would be able
to give you this oci8 client (located on the oracle cd).
Or, you can download from http://otn.oracle.com/software/content.html the
entire oracle 8 db (500 Mb!!). The oci8 client is inside of it. AFAIK, it is
impossible to find only the client.

Philippe



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



Re: [PHP-DB] forms with php/mysql

2003-06-10 Thread Philippe Rousselot
Thanks for your concern,

but I put there the files for people to look at and not the running ones. 
And as you can notice there are no passwd or username in the connection.php 
that I put in a non accessible folder fr security reasons.

Philippe


Le Lundi 9 Juin 2003 20:48, Matthew Moldvan a écrit :

 FYI, you should keep your connection.txt as connection.php so we can't all
 read the database password and host and put what we want in it. :)

 Regards,
 Matt.

 -Original Message-
 From: Philippe Rousselot [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 05, 2003 4:18 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] forms with php/mysql


 done

 you can find the files at

 www.alcatorda.com/jcp/test/files.html

 and try it at

 www.alctorda.com/jcp/test/enregistrer.php

 I am sure it is full of bad codding but it works.

 I just have to make it nice now.

 Philippe

 Le Jeudi 5 Juin 2003 06:15, Peter Beckman a écrit :
  1. Search the archives, they are here:

 http://www.php.net/mailing-lists.php

  2. If you aren't a coder, you probably cannot do what you ask; there

 aren't

  any pre-built simple systems that do exactly what you ask.  You could
  look on freshmeat.net or sourceforge.com, but I doubt you'd find what you
  are looking for.
 
  Peter
 
  On Thu, 5 Jun 2003, Philippe Rousselot wrote:
   Hi,
  
   I need for an association to create a form using php/mysql. If I can
   understand php, I am not a coder, so if someone had the code I need, I
   would really be greatful.
  
   I need :
  
   1. on a page someone identify himself or register to the service using
   a form where the person enter name, email(username) and password. 2.
   once registered, the person can access a secured zone containing a form
   3. the persone can fill the form, abandon half way and save the result,
   then come back and have the previously recorded information appearing
   again.
  
   all data need to be in a Mysql database.
  
  
   Thank you very much for your help.
  
   Philippe
  
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php

 ---

  Peter Beckman  Internet

 Guy

  [EMAIL PROTECTED]

 http://www.purplecow.com/

 ---


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


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



[PHP-DB] Third addition: 'Transfering variables'

2003-06-10 Thread André Sannerholt
Ok, now I have made a simple example of what I want:

My script is devided in a PHP and a HTML Part. I have kept out several
queries, connections, table-tags etc. in the HTML part. Just imagine there
are several entries in the select-tag that is named persona. What I want
is to keep all the entries in a particular box, in this case: of the
persona-option-box, AFTER the submit-button has been clicked and the page
has reloaded. I hope you understand now.

Regards and thanks,

André

//PHP Part
//If a person has been selected

if ($chg=='1') {

print Suchabfrage für ausgewählte Person;
$abfrage4 = select distinct Anschriften.ID as aid, Anschriften.PLZ as
aplz, Anschriften.STRASSE AS astrasse, Anschriften.HNR as ahnr from
Anschriften
inner join Master on Anschriften.ID=Master.A inner join Master as m on
Master.FN=m.fn
where m.NN = '$persona';

$ergebnis3=mysql_query($abfrage4) or die(Anfrage results1
fehlgeschlagen);



$abfrage42 = select distinct Firmennamen.ID as fid, Firmennamen.NAME as
fname from Firmennamen
inner join Master on Firmennamen.ID=Master.FN
inner join Master as m on Master.A=m.A
where m.NN='$persona';

$ergebnis32=mysql_query($abfrage42) or die(Anfrage results2
fehlgeschlagen);



$abfrage43 = select distinct Anschriften.ID as aid, Anschriften.PLZ as
aplz,
Anschriften.STRASSE AS astrasse, Anschriften.HNR AS ahnr FROM
Anschriften
INNER JOIN Master ON Anschriften.ID=Master.A
WHERE Master.NN = '$persona';

$ergebnis33=mysql_query($abfrage43) or die(Anfrage results3
fehlgeschlagen);



$abfrage44 = select distinct Firmennamen.ID as fid, Firmennamen.NAME as
fname from Firmennamen
inner join Master on Firmennamen.ID=Master.FN
where Master.NN='$persona';

$ergebnis34=mysql_query($abfrage44) or die(Anfrage results4
fehlgeschlagen);
}


//HTML Part

print form name='form1' method='post' action='$php_self'
select name='firmaa' size='5' class='Auswahl'
onChange=\this.form.chgf.value='1'; document.form1.submit() \
option value='0'k.A./option ;

while ($firm = mysql_fetch_array($ergebnis32, MYSQL_ASSOC)) {
if ($chgf=='1') {
$firma=$firm[fname];
}
unset($self);
if ($firmaa==$firm[fid]) {
$self='selected';
}

print option $self value='$firm[fid]'$firm[fname]/option;
}

while ($firm2 = mysql_fetch_array($ergebnis34, MYSQL_ASSOC)) {
if ($chgf=='1') {
$firma=$firm2[fname];
}

unset($self);
if ($firmaa==$firm2[fid]) {
 $self='selected';
}

print option $self value='$firm2[fid]'$firm2[fname]/option;

 }
 print /select

select name='persona' size='5' class='Auswahl'
onChange=\this.form.chg.value='1'; document.form1.submit()  \ 
option value='0'k.A./option;

while ($nsuche = mysql_fetch_array($ergebnis22, MYSQL_ASSOC)) {
unset ($selp);
if ($persona==$nsuche[pid]) {
$selp='selected';
}

print option $selp value='$nsuche[pid]'$nsuche[pvname] $nsuche[pname]
$nsuche[GEBURTSTAG]/option;

}

while ($nsuche2 = mysql_fetch_array($ergebnis23, MYSQL_ASSOC)) {
unset($selp);
if ($persona==$nsuche2[pid]) {
 $selp='selected';
}
print option $selp value='$nsuche2[pid]'$nsuche2[pvname]
$nsuche2[pname] $nsuche2[GEBURTSTAG]/option;
}

print/select

 input type='submit' name='akt2' value='Suchen'
 input type='submit' name='akt' value='Eintragen'
 input type='submit' name='akt4' value='Löschen'
 input type='submit' name='akt3' value='Zuruuml;cksetzen'
 input type='hidden' name='chga' value='0'
 input type='hidden' name='chgf' value='0'
 input type='hidden' name='chg' value='0'
 input type='hidden' name='namep' value='$namep'
 input type='hidden' name='firmap' value='$firmap'
 input type='hidden' name='abfragetest' value='$qtest'
 input type='hidden' name='ergebnis23' value='$ergebnis23'

/form;

//**





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



Re: [PHP-DB] Count database-values

2003-06-10 Thread Becoming Digital
 So far no problems, but I want to count all these values.
 I tried with SUM but with the following code it doesn't work:

 $squery = SELECT SUM(bedrag) AS Total FROM finance WHERE posneg = 'af';

 any suggestions how to do? I want to store it in a variabele ($total)
 so I can echo it. (E.g.: $total = 93.63 in this case)

If you want the total, you need to do something like the following:

$query = SELECT SUM(bedrag) AS Total FROM finance WHERE posneg = 'af';
$result = mysql_query( $query );
$total = mysql_fetch_array( $result );
$total = $total['Total'];

You had forgotten to pull the data out of your result set.  It's a common
mistake. :)

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Robert Wanadoo [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, 09 June, 2003 11:40
Subject: [PHP-DB] Count database-values


Hi everybody,

I've got a little problem, which I can't solve. It is as follow:
In my database I made a table with different fields.
One of the fields is named 'bedrag' and contains a numeric value like 15.47 or
78.16 and so on.
If I want a value of the table I use in most cases the following code:

?
$squery = mysql_query(SELECT * FROM finance WHERE posneg = 'af',$db);
while($row = mysql_fetch_array($squery)) {

$bedrag = $row[bedrag];
echo $bedragbr;
}
?

In this case I receive a list like:
15.47
78.16
and so on...

So far no problems, but I want to count all these values. I tried with SUM but
with the following code it doesn't work:

$squery = SELECT SUM(bedrag) AS Total FROM finance WHERE posneg = 'af';

any suggestions how to do? I want to store it in a variabele ($total) so I can
echo it. (E.g.: $total = 93.63 in this case)

Thanx in advance,

Robert van der Mast




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



[PHP-DB] ODBC and error management

2003-06-10 Thread Nico Sabbi


Hi,

reading both the documentation and the MARC I found two serious
misbehaviours:

1) it seems that it's impossible to tell a query that is correct but has no
records
from a query which is syntactically wrong (and consequently has no records);

or at least it seems to be impossibile to distinguish these two cases
without using odbc_num_rows, which is buggy itself
(because it loses in generality, so can't be used).

2) when using myodbc the string returned by odbc_errormsg() is always
non-sense: it doesn't contain
the real error msg returned by the db-server, but

unixODBC][MySQL][ODBC 3.51 Driver][mysqld-3.23.56-Max-log]Option value
changed to default static cursor

that obviously doesn't say anything useful.


Is there a way to workaround, or even better to solve, these problems?

Thanks,
Nico








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



Re: [PHP-DB] Count database-values

2003-06-10 Thread Becoming Digital
I screwed up my own code.  Silly me.  It should read:

$query = SELECT SUM(bedrag) AS Total FROM finance WHERE posneg = 'af';
$result = mysql_query( $query );
while ( $total = mysql_fetch_array( $result ) )
{
$total = $total['Total'];
}

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: Becoming Digital [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, 10 June, 2003 06:43
Subject: Re: [PHP-DB] Count database-values


 So far no problems, but I want to count all these values.
 I tried with SUM but with the following code it doesn't work:

 $squery = SELECT SUM(bedrag) AS Total FROM finance WHERE posneg = 'af';

 any suggestions how to do? I want to store it in a variabele ($total)
 so I can echo it. (E.g.: $total = 93.63 in this case)

If you want the total, you need to do something like the following:

$query = SELECT SUM(bedrag) AS Total FROM finance WHERE posneg = 'af';
$result = mysql_query( $query );
$total = mysql_fetch_array( $result );
$total = $total['Total'];

You had forgotten to pull the data out of your result set.  It's a common
mistake. :)

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Robert Wanadoo [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, 09 June, 2003 11:40
Subject: [PHP-DB] Count database-values


Hi everybody,

I've got a little problem, which I can't solve. It is as follow:
In my database I made a table with different fields.
One of the fields is named 'bedrag' and contains a numeric value like 15.47 or
78.16 and so on.
If I want a value of the table I use in most cases the following code:

?
$squery = mysql_query(SELECT * FROM finance WHERE posneg = 'af',$db);
while($row = mysql_fetch_array($squery)) {

$bedrag = $row[bedrag];
echo $bedragbr;
}
?

In this case I receive a list like:
15.47
78.16
and so on...

So far no problems, but I want to count all these values. I tried with SUM but
with the following code it doesn't work:

$squery = SELECT SUM(bedrag) AS Total FROM finance WHERE posneg = 'af';

any suggestions how to do? I want to store it in a variabele ($total) so I can
echo it. (E.g.: $total = 93.63 in this case)

Thanx in advance,

Robert van der Mast




-- 
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] ODBC and error management

2003-06-10 Thread George Pitcher
Nico,

I'm using MyODBC to query MySQL (because my client want's it to work in
Access, and I don't and this leaves the least amount of code to change).

I don't get an error message if the result is empty (no records). I do a
while loop and add to a counter and if the counter 1 then its empty
otherwise I display the results. I do get the errors though when the query
is 'bad' - contains errors.

I'm running mine on both WinNT and  Win2K with identical results.

Hope this helps.

George

 -Original Message-
 From: Nico Sabbi [mailto:[EMAIL PROTECTED]
 Sent: 10 June 2003 12:01 pm
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] ODBC and error management




 Hi,

 reading both the documentation and the MARC I found two serious
 misbehaviours:

 1) it seems that it's impossible to tell a query that is correct
 but has no
 records
 from a query which is syntactically wrong (and consequently has
 no records);

 or at least it seems to be impossibile to distinguish these two cases
 without using odbc_num_rows, which is buggy itself
 (because it loses in generality, so can't be used).

 2) when using myodbc the string returned by odbc_errormsg() is always
 non-sense: it doesn't contain
 the real error msg returned by the db-server, but

 unixODBC][MySQL][ODBC 3.51 Driver][mysqld-3.23.56-Max-log]Option value
 changed to default static cursor

 that obviously doesn't say anything useful.


 Is there a way to workaround, or even better to solve, these problems?

 Thanks,
   Nico








 --
 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: What is the maximum number of rows per table ?

2003-06-10 Thread Becoming Digital
If you look closely, you'll see that the max size is related to the max number
of rows.  I'm almost sure that you're running into a conflict with the size more
than the row count.  Also stated in the manual is that v3.23 only supports table
sizes of 4GB, but the default max is set to 2GB.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Martin Waite [EMAIL PROTECTED]
To: MySQL List [EMAIL PROTECTED]
Sent: Tuesday, 10 June, 2003 07:30
Subject: What is the maximum number of rows per table ?


Hi,

I can't find any mention of this in the MySQL manual. It discusses
the maximum file size, but what I want to know is if there
is some limitation (perhaps in the index file format) on
the number of rows a MyISAM or INNODB table can hold ?

regards,
Martin


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]





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



[PHP-DB] Remote ODBC

2003-06-10 Thread Ettore Sparvieri
Hi to all.

How i connect to remote ODBC with php?

Tnx to all!!

[PHP-DB] Remote ODBC

2003-06-10 Thread Ettore Sparvieri
Hi to all.

How i connect to remote ODBC with php?

Tnx to all!!

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



[PHP-DB] array fill/sort question

2003-06-10 Thread Snijders, Mark
hi,

I'm working on a ipaddres/subnet programm

now i have a talbe with a lot of information about ip-addresses

i'm having this query:

SELECT s_id, subnet_name,subnetaddr,subnetmask,dnsdomain, location, contact,
ccn FROM subnets

the subnetaddr field looks like this : 100.20.20.1  and is ofcourse a
varchar field

BUT before displaying it on the screen i have to sort it by subnetaddr and
then show it

but i have to sort it as integer, so i use the php-function ip2long();

so you get a decimal...

so what i have to do:

do the query make a decimal field of the 'subnetaddr' put it in an array,
sort it and display it


BUT how can i put ALL of the fields in the query in an array, sort it, and
then display it?

please help me, I can't work it out :(

thanks, Mark



Re: [PHP-DB] array fill/sort question

2003-06-10 Thread Kieu D. Trang
hi,

you can add the ip2long() function into your SELECT statement and have
an ORDER BY clause at the end like this...

SELECT s_id, subnet_name, ip2long('subnetaddr'), subnetmask,dnsdomain,
location, contact, ccn FROM subnets ORDER BY subnetaddrr;

hope it helps.
KD


On Tue, 10 Jun 2003, Snijders, Mark wrote:

 hi,

 I'm working on a ipaddres/subnet programm

 now i have a talbe with a lot of information about ip-addresses

 i'm having this query:

 SELECT s_id, subnet_name,subnetaddr,subnetmask,dnsdomain, location, contact,
 ccn FROM subnets

 the subnetaddr field looks like this : 100.20.20.1  and is ofcourse a
 varchar field

 BUT before displaying it on the screen i have to sort it by subnetaddr and
 then show it

 but i have to sort it as integer, so i use the php-function ip2long();

 so you get a decimal...

 so what i have to do:

 do the query make a decimal field of the 'subnetaddr' put it in an array,
 sort it and display it


 BUT how can i put ALL of the fields in the query in an array, sort it, and
 then display it?

 please help me, I can't work it out :(

 thanks, Mark



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



Re: [PHP-DB] array fill/sort question

2003-06-10 Thread Becoming Digital
I might be overlooking something, but can't you just do this?

$query = SELECT s_id, subnet_name,subnetaddr,subnetmask,dnsdomain,
location, contact, ccn FROM subnets ORDER BY subnetaddr;


If you can't, you can sort the array like this.

?
$query = SELECT s_id, subnet_name,subnetaddr,subnetmask,dnsdomain,
location, contact, ccn FROM subnets;
$results = mysql_query( $query );

while ( $iptable = mysql_fetch_array( $result ) ) {
$iptable['subnetaddr'] = ip2long( $iptable['subnetaddr'] );
}
?

You can subsequently sort the array for the desired result.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: Snijders, Mark [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, 10 June, 2003 08:55
Subject: [PHP-DB] array fill/sort question


hi,

I'm working on a ipaddres/subnet programm

now i have a talbe with a lot of information about ip-addresses

i'm having this query:

SELECT s_id, subnet_name,subnetaddr,subnetmask,dnsdomain, location, contact,
ccn FROM subnets

the subnetaddr field looks like this : 100.20.20.1  and is ofcourse a
varchar field

BUT before displaying it on the screen i have to sort it by subnetaddr and
then show it

but i have to sort it as integer, so i use the php-function ip2long();

so you get a decimal...

so what i have to do:

do the query make a decimal field of the 'subnetaddr' put it in an array,
sort it and display it


BUT how can i put ALL of the fields in the query in an array, sort it, and
then display it?

please help me, I can't work it out :(

thanks, Mark




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



[PHP-DB] Re: MySQL CONNECTION PROBlem2

2003-06-10 Thread nabil
but when i used mysql_error()  i got : sorry database not found

as my dbconnect.php file includes

?
mysql_connect(192.168.0.111 , root , password) or die(SORRY CANNOT
CONNECT) ;
mysql_select_db(kt) or
die(sorry database not found);
?

and the user table of mysql database :
#
# Dumping data for table `user`
#

INSERT INTO user VALUES ('localhost', 'root', '', 'Y', 'Y', 'Y', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y');
INSERT INTO user VALUES ('%', 'root', '', 'N', 'N', 'N', 'N', 'N', 'N', 'N',
'N', 'N', 'N', 'Y', 'N', 'N', 'N');
INSERT INTO user VALUES ('localhost', '', '', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y');
INSERT INTO user VALUES ('%', '', '', 'N', 'N', 'N', 'N', 'N', 'N', 'N',
'N', 'N', 'N', 'N', 'N', 'N', 'N');

so it has the '%' value so it can be accessed by any host.!!!1

any comment ???


Cristian Marin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
You don't have the rights to connect to the MySQL server with
[EMAIL PROTECTED] You have to add this user to the mysql users table and to
allow him to do the needed actions. Also you have to modify the hosts table.
--
-
Cristian MARIN
InterAKT Online (www.interakt.ro)
+4021 411 2610
[EMAIL PROTECTED]

  Nabil [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
  Sorry , when i put the IP instead of localhost  i got the error...







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



Re: [PHP-DB] MySQL CONNECTION PROblem

2003-06-10 Thread nabil
but when i used mysql_error()  i got : sorry database not found

as my dbconnect.php file includes

?
mysql_connect(192.168.0.111 , root , password) or die(SORRY CANNOT
CONNECT) ;
mysql_select_db(kt) or
die(sorry database not found);
?

and the user table of mysql database :
#
# Dumping data for table `user`
#

INSERT INTO user VALUES ('localhost', 'root', '', 'Y', 'Y', 'Y', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y');
INSERT INTO user VALUES ('%', 'root', '', 'N', 'N', 'N', 'N', 'N', 'N', 'N',
'N', 'N', 'N', 'Y', 'N', 'N', 'N');
INSERT INTO user VALUES ('localhost', '', '', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y');
INSERT INTO user VALUES ('%', '', '', 'N', 'N', 'N', 'N', 'N', 'N', 'N',
'N', 'N', 'N', 'N', 'N', 'N', 'N');

so it has the '%' value so it can be accessed by any host.!!!1

any comment ???


John W. Holmes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
  i have the dbconnect.php as :
  //
  ?php
  mysql_connect(192.168.0.111 , root , pass) or
  die (Couldn't connect to database);
  mysql_select_db(DatabaseName) or
  die(sorry database not found);
  ?
  ///
  when i  put localhost instead of the IP address of my machine (localy)
 i
  got
  the following error...
 
  Warning: mysql_num_rows(): supplied argument is not a valid MySQL
 result
  resource in c:\inetpub\wwwroot\kt\superv_list.php on line 5
  No Data Found..
 
  what is my problem, this was a test to connect to my database on the
 same
  machine . but i replaced the localhost with my machine IP address..
 do i
  have to put a domain name instead of an IP if i want to connect to a
  remote
  server on the internert?

 Your query failed. Use mysql_error() to find out why.

 ---John W. Holmes...

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

 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] how to update field without using UPDATE query? youare kidding?

2003-06-10 Thread Robert Twitty
In order o update fields without using a UPDATE statement you
have to use a cursor.  In general, this is how ADO (the technology used by ASP)
performs its updates in the manner you outlined below.  There are no
extensions bundled with PHP of which I am aware that allow you to update
data via a cursor.

-- bob

On Mon, 9 Jun 2003, Steve B. wrote:

 Hi
 in asp it lets me say
 ~get a record into dbrec which is a database object.
 dbrec['field1'] = 'wow'
 dbrec.update;

 is there no way to do this in linux?
 thats lame if it is then that means my 25 web sites have to be re-written to work on 
 Linux.


 --- Becoming Digital [EMAIL PROTECTED] wrote:
  I assume you lack update permissions, which means you probably don't have the
  other permissions necessary to change data.  Assuming you actually do, you could
  use REPLACE or DELETE followed by INSERT.
 
  Edward Dudlik
  Becoming Digital
  www.becomingdigital.com
 
 
  - Original Message -
  From: Steve B. [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, 09 June, 2003 19:29
  Subject: [PHP-DB] how to update field without using UPDATE query?
 
 
  how to update field without using UPDATE query?
 
  I open the db at a certain ID then set
  $dbrec['field'] = new value
  How do you update the db?
  Thanks
  -steve
 
 
 
  -
  Do you Yahoo!?
  Free online calendar with sync to Outlook(TM).
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


 __
 Do you Yahoo!?
 Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
 http://calendar.yahoo.com

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




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



RE: [PHP-DB] how to update field without using UPDATE query? you are kidding?

2003-06-10 Thread Mark
I assume that dbrec is an object. There are many classes you can get
in PHP that handle database management and manipulation. Check out
www.phpclasses.org. I believe everyone's frustration is that the
question was not asked properly, you confused PHP with Linux, you
insulted the OS of choice for most users here, and you use Winblows.

Just find a class that hides all the code from you so you don't have
to think about how the update works.

The you can do something like:

dbrec = new DBClass();
$dbrec-field1='wow';
$dbrec-update();

--- Steve B. [EMAIL PROTECTED] wrote:
 It sounds like you are crying John.
 Perhaps you know this function?
 I'm trying to learn PHP holmes.
 Keep the insults to yourself and help out if you know the answer.
 
 --- John W. Holmes [EMAIL PROTECTED] wrote:
   in asp it lets me say
   ~get a record into dbrec which is a database object.
   dbrec['field1'] = 'wow'
   dbrec.update;
   
   is there no way to do this in linux?
   thats lame if it is then that means my 25 web sites have to be
  re-written
   to work on Linux.
  
  Okay, you're still confused. This has nothing to do with Linux.
 It's PHP
  vs. ASP. ASP has provided you a function to use instead of making
 an
  UPDATE query yourself. Learn some PHP so you can write your own
 update()
  query. Don't cry because someone hasn't done it for you already. 
  
  ---John W. Holmes...
  
  Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E
  
  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
  
 
 
 __
 Do you Yahoo!?
 Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
 http://calendar.yahoo.com
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



[PHP-DB] Is this query even possible?

2003-06-10 Thread Susan Ator
 This is what I am trying to do:
 
   if ($FUNC==(USERPOST) || $FUNC==(MODU)) {
   $sql = UPDATE newdacs
   SET emailfwd='$emailfwd',
   mformat='$mformat',
   filter_code='$filter_code'
   if ($FUNC=='USERPOST') {
   ,unote='$unote'
   }
   WHERE user_id='$user_id';
   $set_newdacs_result = mysql_query($sql) or print
 mysql_error();
   }
 
 There are several more queries like this which is why I want to avoid
 duplicating the code since there are only 1 or 2 differences between them
 depending on function call.
 
 This is the error I am getting:
 
   You have an error in your SQL syntax near 'if (USERPOST=='USERPOST')
 { ,unote='' } WHERE user_id='2'' at line 5
 
 Is what I am attempting possible or am I spinning my wheels?
 
 susan

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



[PHP-DB] mcrypt decryption problem

2003-06-10 Thread mark hurty
I have been trying to set encryption using the mcrypt module. 
Everything seems to work, until the decrypt step, where only the first 
8 characters of the encrypted string are decrypted. Here's the code I'm 
using to encrypt:

$mcrypt_key = 24 character key goes here;
$mcrypt_module = mcrypt_module_open(MCRYPT_TripleDES, , 
MCRYPT_MODE_CBC, );
srand ((float) microtime() * 100);
$mcrypt_iv = mcrypt_create_iv(mcrypt_get_iv_size($mcrypt_module), 
MCRYPT_RAND);
mcrypt_generic_init ($mcrypt_module, $mcrypt_key, $mcrypt_iv);
$art = mcrypt_generic($mcrypt_module, $art);
$art = base64_encode($art);
$mcrypt_iv = base64_encode($mcrypt_iv);
mcrypt_generic_end ($mcrypt_module);
The data is stored in a mySQL database, then retrieved later.

To decrypt:

$mcrypt_key = 24 character key goes here;
$mcrypt_module = mcrypt_module_open(MCRYPT_TripleDES, , 
MCRYPT_MODE_CBC, );
$art = base64_decode($art);
$mcrypt_iv = base64_decode($mcrypt_iv);
mcrypt_generic_init ($mcrypt_module, $mcrypt_key, $mcrypt_iv);
$art = mdecrypt_generic($mcrypt_module, $art);
mcrypt_generic_end ($mcrypt_module);
Only the first 8 characters of the encrypted string are decrypted 
properly.

--
mark hurty  |  [EMAIL PROTECTED]  |  309.764.0911
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Is this query even possible?

2003-06-10 Thread Matthew Moldvan
I would say something like the following would work better:

if($FUNC==USERPOST || $FUNC==MODU)
{
$sql .= UPDATE newdacs;
$sql .= SET emailfwd='$emailfwd',;
$sql .= mformat='$mformat',
$sql .= filter_code='$filter_code';
if($FUNC=='USERPOST')
$sql .= , unote='$unote';
$sql .= WHERE user_id='$user_id';

$result = mysql_query($sql) or die('mysql error #'.mysql_errno.':
'mysql_error());
}

Try that ... also look into www.php.net under string manipulation for other
options.

Regards,
Matthew Moldvan
 
System Administrator
Trilogy International, Inc.

-Original Message-
From: Susan Ator [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 11:18 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] Is this query even possible?


 This is what I am trying to do:
 
   if ($FUNC==(USERPOST) || $FUNC==(MODU)) {
   $sql = UPDATE newdacs
   SET emailfwd='$emailfwd',
   mformat='$mformat',
   filter_code='$filter_code'
   if ($FUNC=='USERPOST') {
   ,unote='$unote'
   }
   WHERE user_id='$user_id';
   $set_newdacs_result = mysql_query($sql) or print
 mysql_error();
   }
 
 There are several more queries like this which is why I want to avoid
 duplicating the code since there are only 1 or 2 differences between them
 depending on function call.
 
 This is the error I am getting:
 
   You have an error in your SQL syntax near 'if (USERPOST=='USERPOST')
 { ,unote='' } WHERE user_id='2'' at line 5
 
 Is what I am attempting possible or am I spinning my wheels?
 
 susan

-- 
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] Is this query even possible?

2003-06-10 Thread Hutchins, Richard
Yup, Matthew's right. I definitely forgot the other $sql. = that needs to go
in front of the WHERE clause.

Question for Matthew though:

Is this:
   $sql .= UPDATE newdacs;
   $sql .= SET emailfwd='$emailfwd',;
   $sql .= mformat='$mformat',
   $sql .= filter_code='$filter_code';

Pretty much the same as this:
  $sql = UPDATE newdacs
  SET emailfwd='$emailfwd',
  mformat='$mformat',
  filter_code='$filter_code';

I mean, the line breaks in the second example won't cause the query to bomb,
will they? I agree that using the $sql .= is cleaner, but the other way
isn't wrong, is it?

Rich

 -Original Message-
 From: Matthew Moldvan [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 10, 2003 11:33 AM
 To: 'Susan Ator'; '[EMAIL PROTECTED]'
 Subject: RE: [PHP-DB] Is this query even possible?
 
 
 I would say something like the following would work better:
 
 if($FUNC==USERPOST || $FUNC==MODU)
 {
   $sql .= UPDATE newdacs;
   $sql .= SET emailfwd='$emailfwd',;
   $sql .= mformat='$mformat',
   $sql .= filter_code='$filter_code';
   if($FUNC=='USERPOST')
   $sql .= , unote='$unote';
   $sql .= WHERE user_id='$user_id';
 
   $result = mysql_query($sql) or die('mysql error 
 #'.mysql_errno.':
 'mysql_error());
 }
 
 Try that ... also look into www.php.net under string 
 manipulation for other
 options.
 
 Regards,
 Matthew Moldvan
  
 System Administrator
 Trilogy International, Inc.
 
 -Original Message-
 From: Susan Ator [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 10, 2003 11:18 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP-DB] Is this query even possible?
 
 
  This is what I am trying to do:
  
  if ($FUNC==(USERPOST) || $FUNC==(MODU)) {
  $sql = UPDATE newdacs
  SET emailfwd='$emailfwd',
  mformat='$mformat',
  filter_code='$filter_code'
  if ($FUNC=='USERPOST') {
  ,unote='$unote'
  }
  WHERE user_id='$user_id';
  $set_newdacs_result = mysql_query($sql) or print
  mysql_error();
  }
  
  There are several more queries like this which is why I 
 want to avoid
  duplicating the code since there are only 1 or 2 
 differences between them
  depending on function call.
  
  This is the error I am getting:
  
  You have an error in your SQL syntax near 'if 
 (USERPOST=='USERPOST')
  { ,unote='' } WHERE user_id='2'' at line 5
  
  Is what I am attempting possible or am I spinning my wheels?
  
  susan
 
 -- 
 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-DB] Ignoring specific values in an inner join query?

2003-06-10 Thread André Sannerholt
Hi everybody.

How to let mysql ignore specific values in an inner join query? In this case
I want it to ignore Null-Values!

$abfrage3=select distinct Anschriften.ID as aid, Anschriften.PLZ as aplz,
Anschriften.STRASSE as astrasse, Anschriften.HNR as ahnr from Anschriften
inner join Master on Anschriften.ID=Master.A
inner join Master as m on Master.FN=m.FN
inner join Personen on m.NN=Personen.ID
where Personen.Name like '%$name%';

Regards

André



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



RE: [PHP-DB] Is this query even possible?

2003-06-10 Thread Matthew Moldvan
Keep in mind the code I sent is untested ...  and I realized some errors
when I pasted it into a PHP page.  Corrections are below.

As for the line breaks, I've used SQL formatted that way before and it
hasn't cause me any problems.

Regards,
Matt.

Corrections: $sql .= mformat='$mformat', should have a trailing ;
 $result = mysql_query($sql) or die('mysql error
#'.mysql_errno.': 'mysql_error()); should have a . before mysql_error());

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 11:42 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Is this query even possible?


Yup, Matthew's right. I definitely forgot the other $sql. = that needs to go
in front of the WHERE clause.

Question for Matthew though:

Is this:
   $sql .= UPDATE newdacs;
   $sql .= SET emailfwd='$emailfwd',;
   $sql .= mformat='$mformat',
   $sql .= filter_code='$filter_code';

Pretty much the same as this:
  $sql = UPDATE newdacs
  SET emailfwd='$emailfwd',
  mformat='$mformat',
  filter_code='$filter_code';

I mean, the line breaks in the second example won't cause the query to bomb,
will they? I agree that using the $sql .= is cleaner, but the other way
isn't wrong, is it?

Rich

 -Original Message-
 From: Matthew Moldvan [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 10, 2003 11:33 AM
 To: 'Susan Ator'; '[EMAIL PROTECTED]'
 Subject: RE: [PHP-DB] Is this query even possible?
 
 
 I would say something like the following would work better:
 
 if($FUNC==USERPOST || $FUNC==MODU)
 {
   $sql .= UPDATE newdacs;
   $sql .= SET emailfwd='$emailfwd',;
   $sql .= mformat='$mformat',
   $sql .= filter_code='$filter_code';
   if($FUNC=='USERPOST')
   $sql .= , unote='$unote';
   $sql .= WHERE user_id='$user_id';
 
   $result = mysql_query($sql) or die('mysql error 
 #'.mysql_errno.':
 'mysql_error());
 }
 
 Try that ... also look into www.php.net under string 
 manipulation for other
 options.
 
 Regards,
 Matthew Moldvan
  
 System Administrator
 Trilogy International, Inc.
 
 -Original Message-
 From: Susan Ator [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 10, 2003 11:18 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP-DB] Is this query even possible?
 
 
  This is what I am trying to do:
  
  if ($FUNC==(USERPOST) || $FUNC==(MODU)) {
  $sql = UPDATE newdacs
  SET emailfwd='$emailfwd',
  mformat='$mformat',
  filter_code='$filter_code'
  if ($FUNC=='USERPOST') {
  ,unote='$unote'
  }
  WHERE user_id='$user_id';
  $set_newdacs_result = mysql_query($sql) or print
  mysql_error();
  }
  
  There are several more queries like this which is why I 
 want to avoid
  duplicating the code since there are only 1 or 2 
 differences between them
  depending on function call.
  
  This is the error I am getting:
  
  You have an error in your SQL syntax near 'if 
 (USERPOST=='USERPOST')
  { ,unote='' } WHERE user_id='2'' at line 5
  
  Is what I am attempting possible or am I spinning my wheels?
  
  susan
 
 -- 
 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Is this query even possible?

2003-06-10 Thread Ford, Mike [LSS]
 -Original Message-
 From: Susan Ator [mailto:[EMAIL PROTECTED]
 Sent: 10 June 2003 16:18
 
  This is what I am trying to do:
  
  if ($FUNC==(USERPOST) || $FUNC==(MODU)) {
  $sql = UPDATE newdacs
  SET emailfwd='$emailfwd',
  mformat='$mformat',
  filter_code='$filter_code'
  if ($FUNC=='USERPOST') {
  ,unote='$unote'
  }
  WHERE user_id='$user_id';
  $set_newdacs_result = mysql_query($sql) or print
  mysql_error();
  }

Well, you're burying a PHP conditional inside what should be the SQL query,
which ain't gonna work very well.  Try separating it out -- two possible
ways are to (i) use the ?: conditional operator, like this:

$sql = UPDATE newdacs
.  SET emailfwd='$emailfwd'
. ,mformat='$mformat'
. ,filter_code='$filter_code'
. ($FUNC=='USERPOST' ? ,unote='$unote' : '')
.  WHERE user_id='$user_id';

or (ii) a fully-blown if(), like this:

$sql = UPDATE newdacs
.  SET emailfwd='$emailfwd'
. ,mformat='$mformat'
. ,filter_code='$filter_code';
if ($FUNC=='USERPOST'):
$sql .= ,unote='$unote'
endif;
$sql .=  WHERE user_id='$user_id';

There are probably umpteen other ways of approaching this -- use whatever
floats your boat! ;)


Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 



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



RE: [PHP-DB] Count database-values

2003-06-10 Thread Ford, Mike [LSS]
 -Original Message-
 From: Becoming Digital [mailto:[EMAIL PROTECTED]
 Sent: 10 June 2003 12:15
 
 I screwed up my own code.  Silly me.  It should read:

Surely your first attempt is the right one?  There's only ever going to be 1 Total, so 
why waste a while loop trying to read more than one result row?
 
 $query = SELECT SUM(bedrag) AS Total FROM finance WHERE 
 posneg = 'af';
 $result = mysql_query( $query );
 while ( $total = mysql_fetch_array( $result ) )
 {
 $total = $total['Total'];
 }
 
 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com
 
 
 - Original Message - 
 From: Becoming Digital [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, 10 June, 2003 06:43
 Subject: Re: [PHP-DB] Count database-values
 
 
  So far no problems, but I want to count all these values.
  I tried with SUM but with the following code it doesn't work:
 
  $squery = SELECT SUM(bedrag) AS Total FROM finance WHERE 
 posneg = 'af';
 
  any suggestions how to do? I want to store it in a 
 variabele ($total)
  so I can echo it. (E.g.: $total = 93.63 in this case)
 
 If you want the total, you need to do something like the following:
 
 $query = SELECT SUM(bedrag) AS Total FROM finance WHERE 
 posneg = 'af';
 $result = mysql_query( $query );
 $total = mysql_fetch_array( $result );
 $total = $total['Total'];
 

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] Is this query even possible?

2003-06-10 Thread Susan Ator
See, this is why I cringe when I hear the management say 'No open source.
There's no support'.

You guys are great. It works a treat. (I ended up going with the conditional
operator)

Thanks!

susan

-Original Message-
From: Matthew Moldvan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 11:50 AM
To: 'Hutchins, Richard'; '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Is this query even possible?


Keep in mind the code I sent is untested ...  and I realized some errors
when I pasted it into a PHP page.  Corrections are below.

As for the line breaks, I've used SQL formatted that way before and it
hasn't cause me any problems.

Regards,
Matt.

Corrections: $sql .= mformat='$mformat', should have a trailing ;
 $result = mysql_query($sql) or die('mysql error
#'.mysql_errno.': 'mysql_error()); should have a . before mysql_error());

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 11:42 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Is this query even possible?


Yup, Matthew's right. I definitely forgot the other $sql. = that needs to go
in front of the WHERE clause.

Question for Matthew though:

Is this:
   $sql .= UPDATE newdacs;
   $sql .= SET emailfwd='$emailfwd',;
   $sql .= mformat='$mformat',
   $sql .= filter_code='$filter_code';

Pretty much the same as this:
  $sql = UPDATE newdacs
  SET emailfwd='$emailfwd',
  mformat='$mformat',
  filter_code='$filter_code';

I mean, the line breaks in the second example won't cause the query to bomb,
will they? I agree that using the $sql .= is cleaner, but the other way
isn't wrong, is it?

Rich

 -Original Message-
 From: Matthew Moldvan [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 10, 2003 11:33 AM
 To: 'Susan Ator'; '[EMAIL PROTECTED]'
 Subject: RE: [PHP-DB] Is this query even possible?
 
 
 I would say something like the following would work better:
 
 if($FUNC==USERPOST || $FUNC==MODU)
 {
   $sql .= UPDATE newdacs;
   $sql .= SET emailfwd='$emailfwd',;
   $sql .= mformat='$mformat',
   $sql .= filter_code='$filter_code';
   if($FUNC=='USERPOST')
   $sql .= , unote='$unote';
   $sql .= WHERE user_id='$user_id';
 
   $result = mysql_query($sql) or die('mysql error 
 #'.mysql_errno.':
 'mysql_error());
 }
 
 Try that ... also look into www.php.net under string 
 manipulation for other
 options.
 
 Regards,
 Matthew Moldvan
  
 System Administrator
 Trilogy International, Inc.
 
 -Original Message-
 From: Susan Ator [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 10, 2003 11:18 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP-DB] Is this query even possible?
 
 
  This is what I am trying to do:
  
  if ($FUNC==(USERPOST) || $FUNC==(MODU)) {
  $sql = UPDATE newdacs
  SET emailfwd='$emailfwd',
  mformat='$mformat',
  filter_code='$filter_code'
  if ($FUNC=='USERPOST') {
  ,unote='$unote'
  }
  WHERE user_id='$user_id';
  $set_newdacs_result = mysql_query($sql) or print
  mysql_error();
  }
  
  There are several more queries like this which is why I 
 want to avoid
  duplicating the code since there are only 1 or 2 
 differences between them
  depending on function call.
  
  This is the error I am getting:
  
  You have an error in your SQL syntax near 'if 
 (USERPOST=='USERPOST')
  { ,unote='' } WHERE user_id='2'' at line 5
  
  Is what I am attempting possible or am I spinning my wheels?
  
  susan
 
 -- 
 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 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] Is this query even possible?

2003-06-10 Thread Ford, Mike [LSS]
 -Original Message-
 From: Matthew Moldvan [mailto:[EMAIL PROTECTED]
 Sent: 10 June 2003 16:50
 
 As for the line breaks, I've used SQL formatted that way before and it
 hasn't cause me any problems.

It's a matter of preference, but I prefer to keep my query strings as lean as possible 
-- bear in mind that this version:

 $sql = UPDATE newdacs
 SET emailfwd='$emailfwd',
 mformat='$mformat',
 filter_code='$filter_code';

will include not only the linebreaks but also all the leading whitespace on every line.

Personally, I like the technique of breaking my query up logically onto multiple 
lines, but I also prefer not to include unnecessary whitespace in the constructed 
query.  In addition, it seems to me that the repetitive inclusion of $sql .=  on 
every line is not only distracting but also slightly inefficient, as you perform a 
concatenation and assignment for every line -- by using the form I showed in my 
previous response, you can reduce this to just a concatenation per line, and a single 
assignment:

$sql = UPDATE newdacs
  . SET emailfwd='$emailfwd',
  . mformat='$mformat',
  . filter_code='$filter_code';

Of course, this is all completely IMHO, and I wouldn't say that any of the other ways 
of doing it is absolutely wrong.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



[PHP-DB] Authentication Classes

2003-06-10 Thread Becoming Digital
I need an authentication class for an upcoming project so I took a trip over to
the Repository.  Unfortunately, the ratings system appears to be down (or no one
uses it) and it's a bit difficult to determine which of the 40 offerings is
best.  Rather than play the trial and error game, I'm soliciting your opinions
in the hope that I might save some time for myself and for others who face this
decision in the future.

If it's not too much to ask, please include subjective information about why you
like the class, it's pros and cons, and if there's anything you would change.  I
plan on publishing a list of those that are recommended and it is my belief that
this information would make the list more useful.  Thanks a lot for your time,
and if you're on the US East Coast, enjoy the nice weather.  We deserve our two
days a month!

Edward Dudlik
Becoming Digital
www.becomingdigital.com




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



Re: [PHP-DB] Count database-values

2003-06-10 Thread Becoming Digital
Unfortunately, I can't, despite my best efforts, get the data to display unless
it's put inside a loop.  If anyone can tell me how to, I'd just for joy.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Ford, Mike [LSS] [EMAIL PROTECTED]
To: 'Becoming Digital' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, 10 June, 2003 11:54
Subject: RE: [PHP-DB] Count database-values


 -Original Message-
 From: Becoming Digital [mailto:[EMAIL PROTECTED]
 Sent: 10 June 2003 12:15

 I screwed up my own code.  Silly me.  It should read:

Surely your first attempt is the right one?  There's only ever going to be 1
Total, so why waste a while loop trying to read more than one result row?

 $query = SELECT SUM(bedrag) AS Total FROM finance WHERE
 posneg = 'af';
 $result = mysql_query( $query );
 while ( $total = mysql_fetch_array( $result ) )
 {
 $total = $total['Total'];
 }

 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com


 - Original Message -
 From: Becoming Digital [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, 10 June, 2003 06:43
 Subject: Re: [PHP-DB] Count database-values


  So far no problems, but I want to count all these values.
  I tried with SUM but with the following code it doesn't work:
 
  $squery = SELECT SUM(bedrag) AS Total FROM finance WHERE
 posneg = 'af';
 
  any suggestions how to do? I want to store it in a
 variabele ($total)
  so I can echo it. (E.g.: $total = 93.63 in this case)

 If you want the total, you need to do something like the following:

 $query = SELECT SUM(bedrag) AS Total FROM finance WHERE
 posneg = 'af';
 $result = mysql_query( $query );
 $total = mysql_fetch_array( $result );
 $total = $total['Total'];


Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

--
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] Count database-values

2003-06-10 Thread Hutchins, Richard
Edward,

Have you considered trying mysql_result()?

It appears that your query is going to always return a single piece of data:
Total. So you essentially have an array with only a single element. If you
did this:

$total = mysql_result($result,0);

You'll get the value of the item at index 0 (the first position in an array)
of the $result array stored in the $total variable.

Details are here:
http://us3.php.net/manual/en/function.mysql-result.php

The page also makes reference to other high-performance options, but since
you're only grabbing a single item and if you use the index number instead
of the column name as the documentation recommends, the performance should
be just fine.

Hope this helps.

Rich

 -Original Message-
 From: Becoming Digital [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 10, 2003 12:50 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Count database-values
 
 
 Unfortunately, I can't, despite my best efforts, get the data 
 to display unless
 it's put inside a loop.  If anyone can tell me how to, I'd 
 just for joy.
 
 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com
 
 
 - Original Message -
 From: Ford, Mike [LSS] [EMAIL PROTECTED]
 To: 'Becoming Digital' [EMAIL PROTECTED]; 
 [EMAIL PROTECTED]
 Sent: Tuesday, 10 June, 2003 11:54
 Subject: RE: [PHP-DB] Count database-values
 
 
  -Original Message-
  From: Becoming Digital [mailto:[EMAIL PROTECTED]
  Sent: 10 June 2003 12:15
 
  I screwed up my own code.  Silly me.  It should read:
 
 Surely your first attempt is the right one?  There's only 
 ever going to be 1
 Total, so why waste a while loop trying to read more than one 
 result row?
 
  $query = SELECT SUM(bedrag) AS Total FROM finance WHERE
  posneg = 'af';
  $result = mysql_query( $query );
  while ( $total = mysql_fetch_array( $result ) )
  {
  $total = $total['Total'];
  }
 
  Edward Dudlik
  Becoming Digital
  www.becomingdigital.com
 
 
  - Original Message -
  From: Becoming Digital [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, 10 June, 2003 06:43
  Subject: Re: [PHP-DB] Count database-values
 
 
   So far no problems, but I want to count all these values.
   I tried with SUM but with the following code it doesn't work:
  
   $squery = SELECT SUM(bedrag) AS Total FROM finance WHERE
  posneg = 'af';
  
   any suggestions how to do? I want to store it in a
  variabele ($total)
   so I can echo it. (E.g.: $total = 93.63 in this case)
 
  If you want the total, you need to do something like the following:
 
  $query = SELECT SUM(bedrag) AS Total FROM finance WHERE
  posneg = 'af';
  $result = mysql_query( $query );
  $total = mysql_fetch_array( $result );
  $total = $total['Total'];
 
 
 Cheers!
 
 Mike
 
 -
 Mike Ford,  Electronic Information Services Adviser,
 Learning Support Services, Learning  Information Services,
 JG125, James Graham Building, Leeds Metropolitan University,
 Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
 Email: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211
 
 --
 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] Ignoring specific values in an inner join query?

2003-06-10 Thread Gary . Every
$abfrage3=select distinct Anschriften.ID as aid, 
Anschriften.PLZ as aplz,
Anschriften.STRASSE as astrasse, Anschriften.HNR as ahnr from 
Anschriften
inner join Master on Anschriften.ID=Master.A
inner join Master as m on Master.FN=m.FN
inner join Personen on m.NN=Personen.ID
where Personen.Name like '%$name%'
AND whatever_field_you_want IS NOT NULL
AND whatever_other_field IS NOT NULL;




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


 -Original Message-
 From: Andr Sannerholt [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 10, 2003 10:42 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Ignoring specific values in an inner join query?
 
 
 Hi everybody.
 
 How to let mysql ignore specific values in an inner join 
 query? In this case
 I want it to ignore Null-Values!
 
 $abfrage3=select distinct Anschriften.ID as aid, 
 Anschriften.PLZ as aplz,
 Anschriften.STRASSE as astrasse, Anschriften.HNR as ahnr from 
 Anschriften
 inner join Master on Anschriften.ID=Master.A
 inner join Master as m on Master.FN=m.FN
 inner join Personen on m.NN=Personen.ID
 where Personen.Name like '%$name%';
 
 Regards
 
 André
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


Re: [PHP-DB] Count database-values

2003-06-10 Thread Becoming Digital
I love when things go completely over my head for no apparent reason.  I have an
incredible talent for missing the obvious.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Hutchins, Richard [EMAIL PROTECTED]
To: 'Becoming Digital' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, 10 June, 2003 13:14
Subject: RE: [PHP-DB] Count database-values


Edward,

Have you considered trying mysql_result()?

It appears that your query is going to always return a single piece of data:
Total. So you essentially have an array with only a single element. If you
did this:

$total = mysql_result($result,0);

You'll get the value of the item at index 0 (the first position in an array)
of the $result array stored in the $total variable.

Details are here:
http://us3.php.net/manual/en/function.mysql-result.php

The page also makes reference to other high-performance options, but since
you're only grabbing a single item and if you use the index number instead
of the column name as the documentation recommends, the performance should
be just fine.

Hope this helps.

Rich

 -Original Message-
 From: Becoming Digital [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 10, 2003 12:50 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Count database-values


 Unfortunately, I can't, despite my best efforts, get the data
 to display unless
 it's put inside a loop.  If anyone can tell me how to, I'd
 just for joy.

 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com


 - Original Message -
 From: Ford, Mike [LSS] [EMAIL PROTECTED]
 To: 'Becoming Digital' [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Tuesday, 10 June, 2003 11:54
 Subject: RE: [PHP-DB] Count database-values


  -Original Message-
  From: Becoming Digital [mailto:[EMAIL PROTECTED]
  Sent: 10 June 2003 12:15
 
  I screwed up my own code.  Silly me.  It should read:

 Surely your first attempt is the right one?  There's only
 ever going to be 1
 Total, so why waste a while loop trying to read more than one
 result row?

  $query = SELECT SUM(bedrag) AS Total FROM finance WHERE
  posneg = 'af';
  $result = mysql_query( $query );
  while ( $total = mysql_fetch_array( $result ) )
  {
  $total = $total['Total'];
  }
 
  Edward Dudlik
  Becoming Digital
  www.becomingdigital.com
 
 
  - Original Message -
  From: Becoming Digital [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, 10 June, 2003 06:43
  Subject: Re: [PHP-DB] Count database-values
 
 
   So far no problems, but I want to count all these values.
   I tried with SUM but with the following code it doesn't work:
  
   $squery = SELECT SUM(bedrag) AS Total FROM finance WHERE
  posneg = 'af';
  
   any suggestions how to do? I want to store it in a
  variabele ($total)
   so I can echo it. (E.g.: $total = 93.63 in this case)
 
  If you want the total, you need to do something like the following:
 
  $query = SELECT SUM(bedrag) AS Total FROM finance WHERE
  posneg = 'af';
  $result = mysql_query( $query );
  $total = mysql_fetch_array( $result );
  $total = $total['Total'];
 

 Cheers!

 Mike

 -
 Mike Ford,  Electronic Information Services Adviser,
 Learning Support Services, Learning  Information Services,
 JG125, James Graham Building, Leeds Metropolitan University,
 Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
 Email: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

 --
 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-DB] mysql_connect error

2003-06-10 Thread Sparky Kopetzky
Good afternoon!

I have Apache w/php installed on one server. I have mysql installed on a windows 
machine. I keep getting this error 
'Call to undefined function: mysql_connect()' in my php script. Now, according to what 
the Redhat RPM is telling me about php-mysql is that I have to have mysql RUNNING on 
the web server just so I can talk to the other windows server. That doesn't make any 
darned sense!!! PHP runs perfectly on the web server until it hits the mysql code.

What am I missing here as I'm REALLY dumb when it comes to Linux.

Robin E. Kopetzky
Black Mesa Computers/Internet Services
www.blackmesa-isp.net



Re: [PHP-DB] mysql_connect error

2003-06-10 Thread CPT John W. Holmes
PHP was not compiled with MySQL support. Re-compile.

---John Holmes...

- Original Message - 
From: Sparky Kopetzky [EMAIL PROTECTED]
To: PHP DB Group [EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 3:35 PM
Subject: [PHP-DB] mysql_connect error


Good afternoon!

I have Apache w/php installed on one server. I have mysql installed on a
windows machine. I keep getting this error
'Call to undefined function: mysql_connect()' in my php script. Now,
according to what the Redhat RPM is telling me about php-mysql is that I
have to have mysql RUNNING on the web server just so I can talk to the other
windows server. That doesn't make any darned sense!!! PHP runs perfectly on
the web server until it hits the mysql code.

What am I missing here as I'm REALLY dumb when it comes to Linux.

Robin E. Kopetzky
Black Mesa Computers/Internet Services
www.blackmesa-isp.net



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



Re: [PHP-DB] mysql_connect error

2003-06-10 Thread Sparky Kopetzky
Says right here from phpinfo under configure command:

'--with-mysql=shared,/usr'

So it HAS to be in there...

Robin

- Original Message -
From: CPT John W. Holmes [EMAIL PROTECTED]
To: Sparky Kopetzky [EMAIL PROTECTED]; PHP DB Group
[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 13:48
Subject: Re: [PHP-DB] mysql_connect error


 PHP was not compiled with MySQL support. Re-compile.

 ---John Holmes...

 - Original Message -
 From: Sparky Kopetzky [EMAIL PROTECTED]
 To: PHP DB Group [EMAIL PROTECTED]
 Sent: Tuesday, June 10, 2003 3:35 PM
 Subject: [PHP-DB] mysql_connect error


 Good afternoon!

 I have Apache w/php installed on one server. I have mysql installed on a
 windows machine. I keep getting this error
 'Call to undefined function: mysql_connect()' in my php script. Now,
 according to what the Redhat RPM is telling me about php-mysql is that I
 have to have mysql RUNNING on the web server just so I can talk to the
other
 windows server. That doesn't make any darned sense!!! PHP runs perfectly
on
 the web server until it hits the mysql code.

 What am I missing here as I'm REALLY dumb when it comes to Linux.

 Robin E. Kopetzky
 Black Mesa Computers/Internet Services
 www.blackmesa-isp.net




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



Re: [PHP-DB] mysql_connect error

2003-06-10 Thread Rasmus Lerdorf
You have to load the extension in your php.ini file.  eg.

 extension=mysql.so

-Rasmus

On Tue, 10 Jun 2003, Sparky Kopetzky wrote:

 Good afternoon!

 I have Apache w/php installed on one server. I have mysql installed on a windows 
 machine. I keep getting this error
 'Call to undefined function: mysql_connect()' in my php script. Now, according to 
 what the Redhat RPM is telling me about php-mysql is that I have to have mysql 
 RUNNING on the web server just so I can talk to the other windows server. That 
 doesn't make any darned sense!!! PHP runs perfectly on the web server until it hits 
 the mysql code.

 What am I missing here as I'm REALLY dumb when it comes to Linux.

 Robin E. Kopetzky
 Black Mesa Computers/Internet Services
 www.blackmesa-isp.net



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



[PHP-DB] Execute a mySql sript file directly from PHP

2003-06-10 Thread Gustavo Del Castillo Meza
Hi,
I need to execute a very large script file on my hosting server, i dont
have shell access and the file is too large to execute using phpMyAdmin. I
wonder if i could upload the file by FTP and then execute it with a php
script directly, without opening the file and go thru every line.





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



Re: [PHP-DB] Execute a mySql sript file directly from PHP

2003-06-10 Thread Jason Wong
On Wednesday 11 June 2003 04:21, Gustavo Del Castillo Meza wrote:

 I need to execute a very large script file on my hosting server, i dont
 have shell access and the file is too large to execute using phpMyAdmin. I
 wonder if i could upload the file by FTP and then execute it with a php
 script directly, without opening the file and go thru every line.

You can try:

  upload file
  chmod so it is executable
  then exec() it from another php page

May not work if your host has safe mode enabled.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
How much does it cost to entice a dope-smoking UNIX system guru to Dayton?
-- Brian Boyle, UNIX/WORLD's First Annual Salary Survey
*/


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



[PHP-DB] Date Formatting in PHP

2003-06-10 Thread David Shugarts
 


I have a simple need to reformat a variable coming in as $DatePick, brought
forward from a MySQL select in the format:

2003-11-18

I need to convert it to the format

November 18, 2003

I am trying to avoid having to mess with the MySQL select statement, as the
output is being passed through several documents. So I need to do it within
PHP.

I tried making a conversion like

$DayReport = date (F d, Y, $DatePick);

But the value of $DayReport is neither correct nor does it change when
$DatePick changes. For instance, in this example, the $DatePick value of
2003-11-18 gets converted to December 31, 1969.

TIA

Dave Shugarts



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



Re: [PHP-DB] Date Formatting in PHP

2003-06-10 Thread Frank Keessen
Hi David,

Try this one:

?
function formatDate($val)
{
 setlocale (LC_ALL, '');
 $arr = explode(-, $val);
 return strftime (%A %e %B %Y, mktime (0, 0, 0, $arr[1], $arr[2],
$arr[0]));
}

echo formatDate($DatePick);
?

Regards,

Frank
- Original Message - 
From: David Shugarts [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 11:23 PM
Subject: [PHP-DB] Date Formatting in PHP





 I have a simple need to reformat a variable coming in as $DatePick,
brought
 forward from a MySQL select in the format:

 2003-11-18

 I need to convert it to the format

 November 18, 2003

 I am trying to avoid having to mess with the MySQL select statement, as
the
 output is being passed through several documents. So I need to do it
within
 PHP.

 I tried making a conversion like

 $DayReport = date (F d, Y, $DatePick);

 But the value of $DayReport is neither correct nor does it change when
 $DatePick changes. For instance, in this example, the $DatePick value of
 2003-11-18 gets converted to December 31, 1969.

 TIA

 Dave Shugarts



 -- 
 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] Date Formatting in PHP

2003-06-10 Thread John R Wunderly
At 05:23 PM 6/10/2003 -0400, David Shugarts wrote:


I have a simple need to reformat a variable coming in as $DatePick, brought
forward from a MySQL select in the format:
2003-11-18

I need to convert it to the format

November 18, 2003
try the dice-n-slice method.  use substr and concatenation to build 
$DayReport from the current value of $DatePick.

I am trying to avoid having to mess with the MySQL select statement, as the
output is being passed through several documents. So I need to do it within
PHP.
I tried making a conversion like

$DayReport = date (F d, Y, $DatePick);

But the value of $DayReport is neither correct nor does it change when
$DatePick changes. For instance, in this example, the $DatePick value of
2003-11-18 gets converted to December 31, 1969.
TIA

Dave Shugarts



--
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] Date Formatting in PHP

2003-06-10 Thread CPT John W. Holmes
 I have a simple need to reformat a variable coming in as $DatePick,
brought
 forward from a MySQL select in the format:

 2003-11-18

 I need to convert it to the format

 November 18, 2003

$f_date = date('F d, Y',strtotime($db_date));

---John Holmes...


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



Re: [PHP-DB] MySQL CONNECTION PROblem

2003-06-10 Thread George Patterson
On Tue, 10 Jun 2003 16:47:26 +0300
nabil [EMAIL PROTECTED] wrote:

 but when i used mysql_error()  i got : sorry database not found
 
 as my dbconnect.php file includes
 
 ?
 mysql_connect(192.168.0.111 , root , password) or die(SORRY
 CANNOT CONNECT) ;
 mysql_select_db(kt) or
 die(sorry database not found);
 ?

Nabil, 

Try changing the last line statement to  
mysql_select_db(kt) or die(sorry database not found. mysql_error());

This will show what the error really is. 

Example, You have created the database haven't you?? 
Try using the mysql client to connect from the web server to the mysql
server.

George Patterson

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



[PHP-DB] Help Please!! Oracle/PHP connection

2003-06-10 Thread Y Al Hinai
Hey guys,
 
I would really appriciate it if someone can direct me with this problem.
 
On my laptop I have:  Windows XP Professional, Oracle 9i Database, Oracle Client 
Software, PHP4.3.1, and Apache server.
 
PHP and Apache work fine.  Oracle i9 by itslef works fine too.  However when i tried 
to connect from PHP to Oracle using the following code:
 
---Code Start-
?php
$user =netuser;
$upasswd =netuser;
$dsn =CSSD;
$conn = odbc_connect($dsn,$user,$upasswd);
echo  conn:  $conn;
if  ($conn  =  0)  {
echo  Error  in  connectionBR;
exit;
  }
else  {
echo  PConnection  successful\n;
  }
odbc_Close($conn);
?
Code End--
 
I get the following error:
 
xxError Start 
Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no 
default driver specified, SQL state IM002 in SQLConnect in C:\Documents and 
Settings\Administrator\My Documents\php\project\php14.tmp on line 5
conn: Error in connection
xxError End 
 
I have already set up the ODBC by going to Administrative Tools - Data Sources (ODBC) 
- User DSN - and added an Oracle in OraHome92 driver for my database.
 
Please help me out guys.  This is for my Master's Thesis project.
 
Appriciated,
 
Yousef
 
 


-
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

RE: [PHP-DB] Help Please!! Oracle/PHP connection

2003-06-10 Thread Matthew Moldvan
Have you tried the built in Oracle functions in PHP?

http://us3.php.net/oracle

oracle_logon() may be useful here ...

Let me know if it works out for you.

Regards,
Matt.

-Original Message-
From: Y Al Hinai [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 8:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Help Please!! Oracle/PHP connection


Hey guys,
 
I would really appriciate it if someone can direct me with this problem.
 
On my laptop I have:  Windows XP Professional, Oracle 9i Database, Oracle
Client Software, PHP4.3.1, and Apache server.
 
PHP and Apache work fine.  Oracle i9 by itslef works fine too.  However when
i tried to connect from PHP to Oracle using the following code:
 
---Code Start-
?php
$user =netuser;
$upasswd =netuser;
$dsn =CSSD;
$conn = odbc_connect($dsn,$user,$upasswd);
echo  conn:  $conn;
if  ($conn  =  0)  {
echo  Error  in  connectionBR;
exit;
  }
else  {
echo  PConnection  successful\n;
  }
odbc_Close($conn);
?
Code End--
 
I get the following error:
 
xxError Start 
Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name not
found and no default driver specified, SQL state IM002 in SQLConnect in
C:\Documents and Settings\Administrator\My Documents\php\project\php14.tmp
on line 5
conn: Error in connection
xxError End 
 
I have already set up the ODBC by going to Administrative Tools - Data
Sources (ODBC) - User DSN - and added an Oracle in OraHome92 driver for
my database.
 
Please help me out guys.  This is for my Master's Thesis project.
 
Appriciated,
 
Yousef
 
 


-
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

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



[PHP-DB] Re: Authentication Classes

2003-06-10 Thread Manuel Lemos
Hello,

On 06/10/2003 01:10 PM, Becoming Digital wrote:
I need an authentication class for an upcoming project so I took a trip over to
the Repository.  Unfortunately, the ratings system appears to be down (or no one
uses it) and it's a bit difficult to determine which of the 40 offerings is
best.  Rather than play the trial and error game, I'm soliciting your opinions
in the hope that I might save some time for myself and for others who face this
decision in the future.
If it's not too much to ask, please include subjective information about why you
like the class, it's pros and cons, and if there's anything you would change.  I
plan on publishing a list of those that are recommended and it is my belief that
this information would make the list more useful.  Thanks a lot for your time,
and if you're on the US East Coast, enjoy the nice weather.  We deserve our two
days a month!


There are a few solutions for you to try here:

http://www.phpclasses.org/browse.html/class/21.html



--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Re: Authentication Classes

2003-06-10 Thread Becoming Digital
Sorry, Manuel, but you must have missed the first paragraph of my post.  I was
hoping to narrow down the 40 classes from the repository to those that are top
quality.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Manuel Lemos [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, 10 June, 2003 20:13
Subject: [PHP-DB] Re: Authentication Classes


Hello,

On 06/10/2003 01:10 PM, Becoming Digital wrote:
 I need an authentication class for an upcoming project so I took a trip over
to
 the Repository.  Unfortunately, the ratings system appears to be down (or no
one
 uses it) and it's a bit difficult to determine which of the 40 offerings is
 best.  Rather than play the trial and error game, I'm soliciting your
opinions
 in the hope that I might save some time for myself and for others who face
this
 decision in the future.

 If it's not too much to ask, please include subjective information about why
you
 like the class, it's pros and cons, and if there's anything you would change.
I
 plan on publishing a list of those that are recommended and it is my belief
that
 this information would make the list more useful.  Thanks a lot for your time,
 and if you're on the US East Coast, enjoy the nice weather.  We deserve our
two
 days a month!


There are a few solutions for you to try here:

http://www.phpclasses.org/browse.html/class/21.html



--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/


--
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] Re: Authentication Classes

2003-06-10 Thread Manuel Lemos
Hello,

On 06/10/2003 09:37 PM, Becoming Digital wrote:
Sorry, Manuel, but you must have missed the first paragraph of my post.  I was
hoping to narrow down the 40 classes from the repository to those that are top
quality.
 I know. There is a rating system in the site that would help you to 
find the most appreciated, but since it was introduced only in the 
beginning of the month, there are not yet enough ratings for any to give 
you accurate values.

What you may want to do is to go in the pages of each of the classes 
that from the descriptions seem to do what you want. Then you can check 
which are the most popular checking their downloads ranking in their pages.


I need an authentication class for an upcoming project so I took a trip over
to

the Repository.  Unfortunately, the ratings system appears to be down (or no
one

uses it) and it's a bit difficult to determine which of the 40 offerings is
best.  Rather than play the trial and error game, I'm soliciting your
opinions

in the hope that I might save some time for myself and for others who face
this

decision in the future.

If it's not too much to ask, please include subjective information about why
you

like the class, it's pros and cons, and if there's anything you would change.
I

plan on publishing a list of those that are recommended and it is my belief
that

this information would make the list more useful.  Thanks a lot for your time,
and if you're on the US East Coast, enjoy the nice weather.  We deserve our
two

days a month!


There are a few solutions for you to try here:

http://www.phpclasses.org/browse.html/class/21.html


--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] T_String?

2003-06-10 Thread Jorge L.
I am getting the following error:
Parse error: parse error, unexpected T_STRING in C:\Program Files\Apache 
Group\Apache2\htdocs\view.php on line 4

On line:
$result = mysql_query(select * from guestbook) or die (mysql_error());
And I have no idea where the T_STRING is coming from. I know this is 
probably some little detail that I am over looking, but I would appreciate 
any help.

_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail

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


Re: [PHP-DB] T_String?

2003-06-10 Thread Leif K-Brooks
The little detail is the lack of quotes around your query.

Jorge L. wrote:

I am getting the following error:
Parse error: parse error, unexpected T_STRING in C:\Program 
Files\Apache Group\Apache2\htdocs\view.php on line 4

On line:
$result = mysql_query(select * from guestbook) or die (mysql_error());
And I have no idea where the T_STRING is coming from. I know this is 
probably some little detail that I am over looking, but I would 
appreciate any help.

_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] Date Formatting in PHP

2003-06-10 Thread David Shugarts


This worked perfectly, is very simple for me to use, and I would never have
come upon it in 10,000 years of trying. Thanks!

Thanks also to everyone who offered ideas.

 $f_date = date('F d, Y',strtotime($db_date));


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



[PHP-DB] Now, how about Roman Numerals?

2003-06-10 Thread David Shugarts


Second poser today:

How to use either a MySQL select statement or PHP to produce a roman
numeral, starting from an arabic (INT) number in a database?

TIA

Dave Shugarts



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



Re: [PHP-DB] Re: Authentication Classes

2003-06-10 Thread olinux
the pear LiveUser project is a pretty cool package. 
it offers a couple different levels of permissioning
and options for authentication. If you use pear you
should be able to get the examples setup in @
15minutes. if not, pear install is rather simple.

LiveUser project page
http://projects.21st-hq.de/liveuser

LiveUser Pear page
http://pear.php.net/package-info.php?pacid=126

olinux


--- Becoming Digital [EMAIL PROTECTED] wrote:
 Sorry, Manuel, but you must have missed the first
 paragraph of my post.  I was
 hoping to narrow down the 40 classes from the
 repository to those that are top
 quality.
 
 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com
 

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



Re: [PHP-DB] Now, how about Roman Numerals?

2003-06-10 Thread Becoming Digital
With a rather complex class.  There is no built-in function for developing roman
numerals from their arabic counterparts, nor is there anything in the Classes
Repository.  Perhaps you can be the first to develop one. :)

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: David Shugarts [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, 10 June, 2003 22:40
Subject: [PHP-DB] Now, how about Roman Numerals?




Second poser today:

How to use either a MySQL select statement or PHP to produce a roman
numeral, starting from an arabic (INT) number in a database?

TIA

Dave Shugarts



--
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] Re: Authentication Classes

2003-06-10 Thread Becoming Digital
 What you may want to do is to go in the pages of each of the classes
 that from the descriptions seem to do what you want. Then you can check
 which are the most popular checking their downloads ranking in their pages.

That's not a bad idea.  I was, admittedly, hoping to avoid that, but it was not
out of laziness.

I'm trying to develop a model of what makes a good user authentication system.
Obviously, the foundation of any good system is successfully identifying users,
but what differentiates one system from another?  I think I'm on my own here,
but the quest must go on! ;)

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Manuel Lemos [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, 10 June, 2003 20:51
Subject: Re: [PHP-DB] Re: Authentication Classes


Hello,

On 06/10/2003 09:37 PM, Becoming Digital wrote:
 Sorry, Manuel, but you must have missed the first paragraph of my post.  I was
 hoping to narrow down the 40 classes from the repository to those that are top
 quality.

  I know. There is a rating system in the site that would help you to
find the most appreciated, but since it was introduced only in the
beginning of the month, there are not yet enough ratings for any to give
you accurate values.

What you may want to do is to go in the pages of each of the classes
that from the descriptions seem to do what you want. Then you can check
which are the most popular checking their downloads ranking in their pages.


I need an authentication class for an upcoming project so I took a trip over

 to

the Repository.  Unfortunately, the ratings system appears to be down (or no

 one

uses it) and it's a bit difficult to determine which of the 40 offerings is
best.  Rather than play the trial and error game, I'm soliciting your

 opinions

in the hope that I might save some time for myself and for others who face

 this

decision in the future.

If it's not too much to ask, please include subjective information about why

 you

like the class, it's pros and cons, and if there's anything you would change.

 I

plan on publishing a list of those that are recommended and it is my belief

 that

this information would make the list more useful.  Thanks a lot for your time,
and if you're on the US East Coast, enjoy the nice weather.  We deserve our

 two

days a month!



 There are a few solutions for you to try here:

 http://www.phpclasses.org/browse.html/class/21.html


--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/


--
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] Re: Authentication Classes

2003-06-10 Thread Manuel Lemos
Hello,

On 06/11/2003 12:33 AM, Becoming Digital wrote:
What you may want to do is to go in the pages of each of the classes
that from the descriptions seem to do what you want. Then you can check
which are the most popular checking their downloads ranking in their pages.


That's not a bad idea.  I was, admittedly, hoping to avoid that, but it was not
out of laziness.
I'm trying to develop a model of what makes a good user authentication system.
Obviously, the foundation of any good system is successfully identifying users,
but what differentiates one system from another?  I think I'm on my own here,
but the quest must go on! ;)
I have not tried the packages to give an opinion, but this package seems 
to do what you want and is the top downloaded of those in the same category:

Class: phpSecurityAdmin
http://www.phpclasses.org/phpsecurityadmin


--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Re: Authentication Classes

2003-06-10 Thread Becoming Digital
Thanks to everyone who's tried to help me with this.  I think I'm on the right
track now.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Manuel Lemos [EMAIL PROTECTED]
To: Becoming Digital [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, 10 June, 2003 23:39
Subject: Re: [PHP-DB] Re: Authentication Classes


Hello,

On 06/11/2003 12:33 AM, Becoming Digital wrote:
What you may want to do is to go in the pages of each of the classes
that from the descriptions seem to do what you want. Then you can check
which are the most popular checking their downloads ranking in their pages.


 That's not a bad idea.  I was, admittedly, hoping to avoid that, but it was
not
 out of laziness.

 I'm trying to develop a model of what makes a good user authentication
system.
 Obviously, the foundation of any good system is successfully identifying
users,
 but what differentiates one system from another?  I think I'm on my own here,
 but the quest must go on! ;)

I have not tried the packages to give an opinion, but this package seems
to do what you want and is the top downloaded of those in the same category:

Class: phpSecurityAdmin
http://www.phpclasses.org/phpsecurityadmin



--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/





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



[PHP-DB] Re: Now, how about Roman Numerals?

2003-06-10 Thread Hugh Bothwell
David Shugarts [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Second poser today:

 How to use either a MySQL select statement or PHP to produce a roman
 numeral, starting from an arabic (INT) number in a database?


In PHP:


function RomanDigit($dig, $one, $five, $ten) {
switch($dig) {
case 0:return ;
case 1:return $one;
case 2:return $one$one;
case 3:return $one$one$one;
case 4:return $one$five;
case 5:return $five;
case 6:return $five$one;
case 7:return $five$one$one;
case 8:return $five$one$one$one;
case 9:return $one$ten;
}
}

function IntToRoman($num) {
if (($num  1) || ($num  3999))
return(No corresponding Roman number!);

$m = $num / 1000;
$c = ($num % 1000) / 100;
$x = ($num % 100) / 10;
$i = $num % 10;

return(
 RomanDigit($m, 'M', '', '')
.RomanDigit($c, 'C', 'D', 'M')
.RomanDigit($x, 'X', 'L', 'C')
.RomanDigit($i, 'I', 'V', 'X')
);
}


--
Hugh Bothwell [EMAIL PROTECTED] Kingston ON Canada
v3.1 GCS/E/AT d- s+: a- C+++ L+$ P+ E- W+++$ N++ K? w++ M PS+
PE++ Y+ PGP+ t-- 5++ !X R+ tv b DI+++ D-(++) G+ e(++) h-- r- y+




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



Re: [PHP-DB] Re: Now, how about Roman Numerals?

2003-06-10 Thread Becoming Digital
Very nice work, Hugh.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: Hugh Bothwell [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, 11 June, 2003 00:55
Subject: [PHP-DB] Re: Now, how about Roman Numerals?


David Shugarts [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Second poser today:

 How to use either a MySQL select statement or PHP to produce a roman
 numeral, starting from an arabic (INT) number in a database?


In PHP:


function RomanDigit($dig, $one, $five, $ten) {
switch($dig) {
case 0:return ;
case 1:return $one;
case 2:return $one$one;
case 3:return $one$one$one;
case 4:return $one$five;
case 5:return $five;
case 6:return $five$one;
case 7:return $five$one$one;
case 8:return $five$one$one$one;
case 9:return $one$ten;
}
}

function IntToRoman($num) {
if (($num  1) || ($num  3999))
return(No corresponding Roman number!);

$m = $num / 1000;
$c = ($num % 1000) / 100;
$x = ($num % 100) / 10;
$i = $num % 10;

return(
 RomanDigit($m, 'M', '', '')
.RomanDigit($c, 'C', 'D', 'M')
.RomanDigit($x, 'X', 'L', 'C')
.RomanDigit($i, 'I', 'V', 'X')
);
}


--
Hugh Bothwell [EMAIL PROTECTED] Kingston ON Canada
v3.1 GCS/E/AT d- s+: a- C+++ L+$ P+ E- W+++$ N++ K? w++ M PS+
PE++ Y+ PGP+ t-- 5++ !X R+ tv b DI+++ D-(++) G+ e(++) h-- r- y+




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