[PHP-DB] php|cruise - do unto others...

2003-10-20 Thread Becoming Digital
Anyone who's been on these lists for a few days is already familiar with CPT John W. 
Holmes.  He's probably helped each and every one of us more times than we can count, 
all without asking for a thing.  I think it's time we help him with something.

php|cruise is coming this March.  As of now, John isn't going and I think that's a 
huge loss.  He should probably be one of those presenting, but at the very least, I'd 
like him in our midst.  He certainly deserves it.

I'm asking all of you to join me in Operation Send Captain on the Cruise.  All it 
takes is a few minutes to PayPal a contribution to [EMAIL PROTECTED]  Donations of any 
size are welcome, and every little bit helps.  If enough of us chip in, John and his 
wife can get away for a bit, significantly reducing the chance that she'll cut off his 
PHP Mailing List privileges. ;)

For those who are wondering, this was my idea, not John's.  I did ask for his 
clearance and assured him that I'll take responsibility for any backlash.  If you 
don't like this idea, tell me, not him.  Thanks a lot. :)

Edward Dudlik
Those who say it cannot be done
should not interrupt the person doing it.

wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU






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



[PHP-DB] Re: [PHP] php|cruise - do unto others...

2003-10-20 Thread Becoming Digital
Thanks for the kinds words.  I'm glad this has been well received (so far).

To make a donation, simply login to PayPal and click the Send Money tab at the top 
of your screen.  Once there, put [EMAIL PROTECTED] in the Recipient's Email field 
and fill out the remaining fields to your liking. :)

Edward Dudlik
Those who say it cannot be done
should not interrupt the person doing it.

wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU



- Original Message - 
From: Jay Blanchard [EMAIL PROTECTED]
To: Becoming Digital [EMAIL PROTECTED]; PHP-DB [EMAIL PROTECTED]; 
php-general [EMAIL PROTECTED]
Sent: Monday, 20 October, 2003 15:09
Subject: RE: [PHP] php|cruise - do unto others...


[snip]
PayPal a contribution to [EMAIL PROTECTED]
[/snip]

Fabulous idea Ed, I wish I'd a thunk it for me. At the risk of seeming
ignorant (same risk I run each day by just getting out of bed) how
exactly do I PayPal a contribution to [EMAIL PROTECTED]? I have
made Paypal contributions before, but I've never seen (to my
recollection) one done directly before.

Thanks!

Jay

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



[PHP-DB] Re: [PHP] php|cruise - do unto others...

2003-10-20 Thread Becoming Digital
Donations are by no means required.  I just thought it time to really show John how 
much we appreciate his help.

I'm not sure how I could do so, but I wish I had the ability to require donations from 
mailing list folk.  That would be so cool!

Edward Dudlik
Those who say it cannot be done
should not interrupt the person doing it.

wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU



- Original Message - 
From: Didier McGillis [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, 20 October, 2003 15:32
Subject: Re: [PHP] php|cruise - do unto others...



I certain hope no one takes offense to this, John has been a great asset to 
this community and to this list, its not like its a required donation or 
anything like that, unlike my sons daycare, pay $200/wk and then fundraise 
for them.

From: Becoming Digital [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED], php-general 
[EMAIL PROTECTED]
Subject: Re: [PHP] php|cruise - do unto others...
Date: Mon, 20 Oct 2003 15:26:04 -0400

Thanks for the kinds words.  I'm glad this has been well received (so far).

To make a donation, simply login to PayPal and click the Send Money tab 
at the top of your screen.  Once there, put [EMAIL PROTECTED] in the 
Recipient's Email field and fill out the remaining fields to your liking. 
:)

Edward Dudlik
Those who say it cannot be done
should not interrupt the person doing it.

wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU



- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
To: Becoming Digital [EMAIL PROTECTED]; PHP-DB 
[EMAIL PROTECTED]; php-general [EMAIL PROTECTED]
Sent: Monday, 20 October, 2003 15:09
Subject: RE: [PHP] php|cruise - do unto others...


[snip]
PayPal a contribution to [EMAIL PROTECTED]
[/snip]

Fabulous idea Ed, I wish I'd a thunk it for me. At the risk of seeming
ignorant (same risk I run each day by just getting out of bed) how
exactly do I PayPal a contribution to [EMAIL PROTECTED]? I have
made Paypal contributions before, but I've never seen (to my
recollection) one done directly before.

Thanks!

Jay

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


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

-- 
PHP General 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] speeing up query and display...

2003-07-19 Thread Becoming Digital
You've got three queries, two of which are in while loops.  If you're calling up
3000 records, you may have as many as 3000 DB queries, possibly more.  That's
why things take forever.

Restructure your code, placing the queries outside the loops.  Then use
mysql_fetch_array() and loop through the result sets.  While you're at it, stop
closing out of PHP to write one character.  Simply enclose your echo/print text
with single quotes so that PHP knows not to evaluate it.

To start you off, I've done most of the later work.  I've also taken the liberty
of neatly formatting your code so that it's easier to follow.  Good luck with
the rest.

?php
$manufQuery = db_query(SELECT manufacturer FROM kcs_threads);
while ($manufResults = db_fetch($manufQuery))
echo 'option value='.$manufResults[manufacturer].'/option';

$threadQuery = db_query(SELECT id,colour,colourID FROM kcs_threads LIMIT 10);

while ($threadResults = db_fetch($threadQuery)) {
$threadselectQuery = db_query(SELECT * FROM kcs_patternthreads WHERE
pattern_index='$id');

while ($threadselectResult = db_fetch($threadselectQuery)) {
echo 'option value='.$threadResults[id].'';
if ($threadselectResult[thread_index] == $threadResults[id])
echo 'checked'.$threadResults[colour].'/option';
}
}
?

Edward Dudlik
Becoming Digital
www.becomingdigital.com


Did I help you?  Want to show your thanks?
www.amazon.com/o/registry/EGDXEBBWTYUU



- Original Message -
From: Aaron Wolski [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, 19 July, 2003 13:29
Subject: [PHP-DB] speeing up query and display...


Hi Guys,

I have the following query which unfortunately has to grab all records
in a table (well over 3000) to display in a multiple select box.

Code:

?php

$manufQuery = db_query(SELECT manufacturer FROM
kcs_threads);
while ($manufResults = db_fetch($manufQuery)) {

?
option value=?php echo $manufResults[manufacturer];
?/option

?php

$threadQuery = db_query(SELECT id,colour,colourID FROM kcs_threads
LIMIT 10);
while ($threadResults = db_fetch($threadQuery)) {

$threadselectQuery = db_query(SELECT * FROM
kcs_patternthreads WHERE pattern_index='$id');
while ($threadselectResult =
db_fetch($threadselectQuery)) {

?
option value=?php echo $threadResults[id]; ? ?php
if ($threadselectResult[thread_index] == $threadResults[id]) echo
checked; ??php echo $threadResults[colour]; ?/option

?php

}
}
}

?

Can ANYONE see a way to speed up the query and displaying of the
results? Take a while on High Speed and WY to long on Dialup.

Thanks a lot

Aaron




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



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

2003-07-17 Thread Becoming Digital
I'm in the midst of a project for which I am using the osCommerce shopping cart
and I'm currently trying to find a merchant service and payment gateway that
will integrate smoothly with it.  I'm currently leaning towards payQuake
(http://www.payquake.com) as their fee structure is quite reasonable, but I'd
like to know what others have used.

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

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] osCommerce - which merchant service/payment gateway?

2003-07-17 Thread Becoming Digital
Thanks, Mike.  I should have specified that I'm in the States and accordingly
need a US-based gateway.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


Did I help you?  Want to show your thanks?
www.amazon.com/o/registry/EGDXEBBWTYUU



- Original Message -
From: mike karthauser [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, 17 July, 2003 10:11
Subject: Re: [PHP-DB] osCommerce - which merchant service/payment gateway?


on 17/7/03 3:07 pm, Becoming Digital at [EMAIL PROTECTED] wrote:

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

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

--
Mike Karthauser
Managing Director - Brightstorm Ltd

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

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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





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



Re: [PHP-DB] SELECT question

2003-07-07 Thread Becoming Digital
The internet is a wonderful resource.
http://www.mysql.com/doc/en/SELECT.html

Edward Dudlik
Becoming Digital
www.becomingdigital.com


Did I help you?  Want to show your thanks?
www.amazon.com/o/registry/EGDXEBBWTYUU 



- Original Message - 
From: Artoo [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, 04 July, 2003 12:08
Subject: [PHP-DB] SELECT question


What is the syntax for running a  SELECT command with multiple conditions?

Example  SELECT * FROM members WHERE user_id='$u_id' AND email='$email';

Thanks




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





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



Re: [PHP-DB] hmmm

2003-07-04 Thread Becoming Digital
We have found the only case when banning someone from the list for foul language
would be completely undesirable.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


Did I help you?  Want to show your thanks?
www.amazon.com/o/registry/EGDXEBBWTYUU



- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, 01 July, 2003 05:38
Subject: [PHP-DB] hmmm




YOU FUCKING SHIT!!! UNSUBSCRIBE MY EMAIL PLEASE !!! GOD VERDOMME !!!

UNSUBSCRIBE IT NOW,MOTHER FUCKER


BABI LOE BANGSAT LOE KONTOL LOE !!! SIKTIR GIT!!! YALLA!!!

HOER !!! GO AWAY FROM MY MAIL BOX WILL YA!!! FUCK SHIT U BASTARD MOTHER FUCKER
ASSHOLE !!!

PECUN LOE BABI LOE JANCUK !!!

--

--
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] should each php-script clean up it's mysql connections

2003-07-03 Thread Becoming Digital
 Therefore I wonder: Is it a good behavior to end connections or let every
 php-script clean up after it self in some way?

Actually, it's much better practice to use the correct variable names. :P
Cleaning up won't help you if the script is incorrect, so the benefit of
unsetting variables is limited, at least with regards to error control.  There
may be memory and/or storage benefits, but I am not aware of any that are
significant.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


Did I help you?  Want to show your thanks?
www.amazon.com/o/registry/EGDXEBBWTYUU



- Original Message -
From: anders thoresson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, 02 July, 2003 12:30
Subject: [PHP-DB] should each php-script clean up it's mysql connections


Hi,

 I just noticed something I haven't done before. I was writing this piece
of code:

 $articlequery = SELECT somestuff FROM sometable;
 $result = mysql_query($query);
 $row = mysql_fetch_row($result);

 But I didn't get the result I expected. Finally, I noticed that my new
querystring was $articlequery and not $query. The query saved to $query was
apperently some old query used in another php-script within my site.

 Therefore I wonder: Is it a good behavior to end connections or let every
php-script clean up after it self in some way?

--
anders thoresson

--
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: XML to MySQL

2003-07-03 Thread Becoming Digital
Search, please.
http://marc.theaimsgroup.com/?l=php-dbw=2r=1s=XML+MySQLq=b

Edward Dudlik
Becoming Digital
www.becomingdigital.com


Did I help you?  Want to show your thanks?
www.amazon.com/o/registry/EGDXEBBWTYUU 



- Original Message - 
From: Nabil [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, 03 July, 2003 02:39
Subject: [PHP-DB] Re: XML to MySQL


any one ??


Nabil [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Dear All ;

 I have an XML files like the following and i want to make an PHP code to
 insert it into my MySQL
 how can i read the nodes ot tages???  by the way i can export like this
file
 from PhpMyAdmin but i cann't dump it back...
 Thanks in advance
 Nabil

 ?xml version=1.0 encoding=windows-1252 ?
 - scs-dist
 - !--
  table dist   --
 - dist
   id1/id
   fnameMark/fname
   lnameSmith/lname
   companycompany1/company
   phone123456/phone
   governcity1/govern
   addressfirst street/address
   area12/area
 /dist





-- 
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] Testing code

2003-07-03 Thread Becoming Digital
It's not complicated at all!  MySQL and Apache both have install packages,
saving you any major work, and the PHP install in a breeze if you just follow
the instructions.

Here's a Google search to start you off:
http://www.google.com/search?q=Installing+MySQL+PHP+Apache+Windows

Here's an excellent tutorial
http://www.ricocheting.com/server

and another tutorial
http://www.hotscripts.com/PHP/Tips_and_Tutorials/Installing_PHP/

Edward Dudlik
Becoming Digital
www.becomingdigital.com


Did I help you?  Want to show your thanks?
www.amazon.com/o/registry/EGDXEBBWTYUU



- Original Message -
From: Matthew Moldvan [EMAIL PROTECTED]
To: 'Hugh Dickinson' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, 02 July, 2003 10:26
Subject: RE: [PHP-DB] Testing code


Yes, but it can be complicated ... you have to install MySQL (www.mysql.com)
and PHP (www.php.net) and web server software, such as Apache
(www.apache.org).

I recently setup a test server on Windows XP with little trouble ...

Good luck!

Regards,
Matthew Moldvan

System Administrator
Trilogy International, Inc.


-Original Message-
From: Hugh Dickinson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 02, 2003 6:07 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Testing code


Is it possible to test PHP and MySQL scripts and databases without being
registered on a web server?

--
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] converting function to class and function (object)

2003-07-03 Thread Becoming Digital
You shouldn't have a semicolon at the end of your class declaration/closing
bracket.  Also, I'm not sure if it would cause a problem, but try using standard
file extensions instead of things like .cls.  Lastly, just for sake of
readability, you might want to simplify your naming scheme; this was a chore to
read.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


Did I help you?  Want to show your thanks?
www.amazon.com/o/registry/EGDXEBBWTYUU



- Original Message -
From: ed anderson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, 02 July, 2003 08:34
Subject: [PHP-DB] converting function to class and function (object)


Dell 4500, mem 1g, disk 45g, mhz 2g, Mysql-3.23.54a-linux-i686, PHP-4.30,
httpd_2.0.44, moxilla 1.0.1


Can someone help converting a function to a class and function.

The included function in example 1 works as expected
but the include class and function in example 2 does not.
What can I do to fix this problem.

Note that example 1 executed 0f and 1f echos in addition
to all echos in the main(?) php script, where as example
2 stops after the main(?) php script echo 2 which means the
{include (./inc/tcb/tmtb_connect_tbc_db.cls);} statement
was parsed but had errors.


included Function for example 1

?php
# include (tmtb_connect_tbc_db.inc);
function connect_tbc_db()
{
echo  0f br;
  $tmtb_db = mysql_connect(localhost, root)
  or die (die tmtb_connect_tbc_db.inc mysql_connect $tmtb_db\n);
echo  1f br;
  mysql_select_db(tbc_db, $tmtb_db)
   or die (die tmtb_connect_tbc_db.inc mysql_select_db
$tmtb_db\n);
echo br tmtb_connect_tbc_db.inc return $tmtb_db br;
  return  $tmtb_db;
}
?


included Class and Function for example 2
?php
# include (tmtb_connect_tbc_db.cls);
class connect_tbc_db_cls
{
  var $tmtb_db = 0;
#
  function connect_tbc_db()
  {
echo  0f br;
 this-$tmtb_db = mysql_connect(localhost, root)
  or die (die tmtb_connect_tbc_db.cls mysql_connect
this-$tmtb_db\n);
echo  1f br;
#mysql_select_db(tbc_db, this-$tmtb_db)
#   or die ( die tmtb_connect_tbc_db.cls mysql_select_db
this-$tmtb_db\n);
echo br tmtb_connect_tbc_db.cls return this-$tmtb_db br;
 return  this-$tmtb_db;
  }
};
?

using Mozilla example 1 

htmlheadtitletmtb_r_select_html_3.php/title/head
body
tmtb_r_select_html_3.php BRBR
!-- including class and functionBRBR --
including functionBRBR
?php
## tmtb_connect_tbc_db.inc
echo  1 br;
#
#include (./inc/tcb/tmtb_connect_tbc_db.cls);
#echo  2 br;
#$a = new connect_tbc_db_cls();
#echo  3 br;
#$tmtb_db = $a-connect_tbc_db();
#echo  4 br;
#
include (./inc/tcb/tmtb_connect_tbc_db.inc);
echo  2 br;
$tmtb_db = connect_tbc_db();
echo  3 br;
## define_variables
include (./inc/tmr/dat_tmr_variables.inc);
include (./inc/html/html_variables.inc);
#
echo  4 br...br...br...br;
?
brbr
#
tmtb_r_select_html_3.php end BRBR
/body
/html

submit
http://127.0.0.1/tmtb_r_select_html_3.php
example 1 output follows
 tmtb_r_select_html_3.php
including function
1
2
0f
1f
tmtb_connect_tbc_db.inc return Resource id #3
3
4
...
snip
# tmtb_r_select_html_3.php end
end example 1

using Mozilla example 2 **
htmlheadtitletmtb_r_select_html_3.php/title/head
body
tmtb_r_select_html_3.php BRBR
including class and functionBRBR
!-- including functionBRBR --
?php
## tmtb_connect_tbc_db.inc
echo  1 br;
#
include (./inc/tcb/tmtb_connect_tbc_db.cls);
echo  2 br;
$a = new connect_tbc_db_cls();
echo  3 br;
$tmtb_db = $a-connect_tbc_db();
echo  4 br;
#
#include (./inc/tcb/tmtb_connect_tbc_db.inc);
#echo  2 br;
#$tmtb_db = connect_tbc_db();
#echo  3 br;
## define_variables
include (./inc/tmr/dat_tmr_variables.inc);
include (./inc/html/html_variables.inc);
#
echo  4 br...br...br...br;
?
brbr
#
tmtb_r_select_html_3.php end BRBR
/body
/html

submit
http://127.0.0.1/tmtb_r_select_html_3.php
example 2 output follows

tmtb_r_select_html_3.php

including class and function

1
2
end example 2

Thanks
ed anderson


--
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] non-GPL MySQL licenses PHP5

2003-07-01 Thread Becoming Digital
 So, why then not using the GPL for PHP. Soo many people are releasing their
 software under the GPL.

This just begs for the if everyone jumped off a bridge... question we've all
heard from our parents on at least one occassion.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


Did I help you?  Want to show your thanks?
www.amazon.com/o/registry/EGDXEBBWTYUU



- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, 01 July, 2003 12:30
Subject: Re: [PHP-DB] non-GPL MySQL licenses  PHP5


[EMAIL PROTECTED] (Rasmus Lerdorf) wrote in
news:[EMAIL PROTECTED]:

 On Tue, 1 Jul 2003, Nabil wrote:
 You need to purchase commercial non-GPL MySQL licenses:

   a.. If you distribute MySQL Software with your non open source
   software, b.. If you want warranty from MySQL AB for the MySQL
   software, c.. If you want to support MySQL development.
 So Why it is not supported with PHP5? and from where i can get the
 lib??

 I guess we need a FAQ.  I am getting tired of answering this.

 The GPL is not compatible with Apache/BSD-style licenses.  If you link
 a GPL'ed library into a non-GPL'ed application and then redistribute
 it, or if you incorporate the code into something and redistribute it,
 like we do, then you must put that something under the GPL.  And we
 don't want to put PHP under the GPL because that would mean you
 couldn't link it into Apache (which sort of defeats the purpose for
 most people) unless of course we also got the Apache guys to switch to
 the GPL.  This is why some people call the GPL a viral license.

So, why then not using the GPL for PHP. Soo many people are releasing their
software under the GPL.

Regards
Thomas

--
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] Rand() Emulation

2003-06-24 Thread Becoming Digital
 Im trying to figure out a way to emulate mysql's RAND() function to be
 cross database compatible via php.
 Has anyone done anything similar to this???

How about PHP's rand() function?
http://us2.php.net/manual/en/function.rand.php

Edward Dudlik
Becoming Digital
www.becomingdigital.com

Did I help you?  Want to show your thanks?
www.amazon.com/o/registry/EGDXEBBWTYUU 


- Original Message - 
From: Gerard Samuel [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Tuesday, 24 June, 2003 02:56
Subject: [PHP-DB] Rand() Emulation


Im trying to figure out a way to emulate mysql's RAND() function to be
cross database compatible via php.
Has anyone done anything similar to this???

Thanks


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





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



Re: [PHP-DB] Rand() Emulation

2003-06-24 Thread Becoming Digital
 Ultimately, my goal is to emulate mysql's -
 SELECT * FROM TABLE ORDER BY RAND() LIMIT (X)

 for other databases that do not support RAND().

Which are those?

 To me the idea above would work, but it hinges on if that rand column,
 doesn't have gaps.

Use your table's primary key, assuming there is one.  This saves creating what
is otherwise unncessary data, but you'll still face gaps if records are
deleted.

Edward Dudlik
Becoming Digital
www.becomingdigital.com

Did I help you?  Want to show your thanks?
www.amazon.com/o/registry/EGDXEBBWTYUU


- Original Message -
From: Gerard Samuel [EMAIL PROTECTED]
To: Doug Thompson [EMAIL PROTECTED]
Cc: Becoming Digital [EMAIL PROTECTED]; PHP-DB
[EMAIL PROTECTED]
Sent: Tuesday, 24 June, 2003 12:19
Subject: Re: [PHP-DB] Rand() Emulation


Im probably not making myself clear.
Ultimately, my goal is to emulate mysql's -
SELECT * FROM TABLE ORDER BY RAND() LIMIT (X)

for other databases that do not support RAND().  So using variations of
php's rand(), wouldn't make sense,
as it only picks one value out of a range of values, that are numerical
in nature.

But here is an idea, that Im thinking about, but haven't gotten to the
code as yet.
1.  In the tables that I want random values from, create a rand
column, that contains incremental numerical values for each row.
2.  select the the maximum number from the rand column.
3.  Assume that there are no gaps between 0 and this max number.
4.  Create an array of numbers with values between 0 and max number.
5.  Use array_rand() to randomly choose (x) values from the array
created in step 4.  (I may choose maybe
a 1 or 2 values more than whats required, just in case of gaps between 0
and max number in step 3).
6.  Use these randomly choosen values to select from the database as
random rows.

So hopefully its a bit clearer what Im striving for.
To me the idea above would work, but it hinges on if that rand column,
doesn't have gaps.
If you see room for improvement, or have another idea, or if Im talking
gibberish then by all means.

Thanks.

Doug Thompson wrote:

An incredible interpretation of

quote
If called without the optional min, max arguments rand() returns a
pseudo-random value between 0 and RAND_MAX. If you want a random number between
5 and 15 (inclusive), for example, use rand (5, 15).
/quote

Doug






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



Re: [PHP-DB] strange query problem

2003-06-23 Thread Becoming Digital
 $query = INSERT INTO $lcstage (id, .$fieldNames.) VALUES
 (.$clientID.,.$values.);

 The finishing querystring, if printed lookks like this:
[snip]

Have you actually tested the output of each variable?  If $clientID and $values
are equivalents of $_POST['clientID'] and $_POST['values'], it's no surprise
that things don't work as expected.  Those variables are arrays, not strings.
You need to use implode on both to get the strings needed by the script above.

Edward Dudlik
Becoming Digital
www.becomingdigital.com

Did I help you?  Want to show your thanks?
www.amazon.com/o/registry/EGDXEBBWTYUU


- Original Message -
From: Jamie Saunders [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, 23 June, 2003 05:17
Subject: [PHP-DB] strange query problem


Hi,

I'm having a problem with a database query, where the script is simply
inserting some data into an empty table. The following code creates the
query string to be used, the values are all gathered from an html form:

$query = INSERT INTO $lcstage (id, .$fieldNames.) VALUES
(.$clientID.,.$values.);

The finishing querystring, if printed lookks like this:

INSERT INTO myfamily (id, fathers, mothers, brothers, sisters,
grandfathers, grandmothers, ggrandfathers, ggrandmothers, aunts, uncles,
godparents) VALUES
(36,'1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1')

However, I get a database error every time informing me the query could not
be performed.  To test the query I've pasted the printed query string into
phpMyAdmin and it works first time every time.  So if there's nothing wrong
with the query string or the database, what else could be causing this
error?

--
Jamie Saunders
Media Architect
[EMAIL PROTECTED]



--
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 PHP, MySql

2003-06-22 Thread Becoming Digital
Check out the below:
http://us4.php.net/manual/en/features.persistent-connections.php
http://us4.php.net/manual/en/function.mysql-pconnect.php

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: Peter Goggin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, 22 June, 2003 10:13
Subject: [PHP-DB] Re PHP, MySql


I have a web site interfacing to a mysql databases which eventually may have
a large number of users. Should I use persistent coneconnection mode or let
each screen make and drop a connection ?
Where will I find guide lines on this?


Is this the correct list for this question?

Regards


Peter Goggin


-- 
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] Two-column display of data, second method

2003-06-20 Thread Becoming Digital
That was actually my primary point of optimization.  Unfortunately, I've been
feeling a bit lazy, so I didn't bother going into things. :)

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, 20 June, 2003 10:39
Subject: RE: [PHP-DB] Two-column display of data, second method


You could always use the % operand

snip
$cols_wanted = 2;
if(($faculty_found % $cols_wanted) == 0) {
// Then do a TR
echo 'tr';
} else {
// Then it's the first column, and don't end the row
}
/snip

This also simplifies it so that you can decide to use three, four or five
columns, just by changing the $cols_wanted variable




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


 -Original Message-
 From: Becoming Digital [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 19, 2003 5:01 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Two-column display of data, second method


 Nice job.  There's a fair bit of room for optimization, but
 unless your data
 sets are very large, it's probably not necessary.  However,
 if you're compulsive
 (as I tend to be), you'll optimize every bit of code to the
 best of your
 abilities.  And yes, I know I'm crazy. ;P

 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com


 - Original Message -
 From: David Shugarts [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, 19 June, 2003 17:43
 Subject: [PHP-DB] Two-column display of data, second method


 When I went looking for a script that would give me a
 two-column layout that
 would list my faculty members in two roughly equal columns,
 alphabetized
 down the first column and then the second, I did not find
 such a script.
 [There was indeed a two-column script, but it fed the data
 row-by-row.]

 I wrote this one and am glad to share it. The math statements
 could surely
 be condensed, but I was using them to confirm the results. This script
 either creates two equal columns if the total number of items
 is even, or it
 makes the first column the longer if the total number of items is odd.

 --Dave Shugarts


 ?php

 /* *** Now selects the Faculty names ** */

 $sql =SELECT FirstName, Middle, LastName
 FROM $table_name
 ORDER BY LastName, FirstName;


 /* ** Now passes the result of the search ** */

 $faculty_result = @mysql_query($sql, $connection) or die(Error #.
 mysql_errno() . :  . mysql_error());

 $faculty_found = @mysql_num_rows($faculty_result);
 $faculty_half = $faculty_found / 2;
 $faculty_round = round($faculty_found / 2);
 $faculty_remain = $faculty_found - $faculty_round;


 echo table border=0

 trtd colspan=2 align=centerb
 Two-Column header
 /bbr/td/tr

 trtd width=49%\n;

 for ($rownum = 1; $rownum = $faculty_round; $rownum++)

 {
 $row = mysql_fetch_array($faculty_result);


 $FirstName=$row['FirstName'];
 $Middle=$row['Middle'];
 $LastName=$row['LastName'];

 $faculty_block = 
 font class=facultydoc
 $FirstName $Middle $LastName
 /font
 br
 ;

 echo $faculty_blockbr;
 }

 echo /tdtd\n;


 for ($rownum = 1; $rownum = $faculty_remain; $rownum++)

 {
 $row = mysql_fetch_array($faculty_result);


 $FirstName=$row['FirstName'];
 $Middle=$row['Middle'];
 $LastName=$row['LastName'];

 $faculty_block = 
 font class=facultydoc
 $FirstName $Middle $LastName
 /font
 br
 ;

 echo $faculty_blockbr;
 }

 echo /td/trbr/table;

 ?


 --
 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] MySQL editor

2003-06-19 Thread Becoming Digital
 mysqlmanager (www.ems-hitech.com) is by far the best I've used. 

They've changed the name to Navicat now.  It really is fantastic software.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: Michael Scappa [EMAIL PROTECTED]
To: Angelo Zanetti [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, 19 June, 2003 10:33
Subject: Re: [PHP-DB] MySQL editor


Not free, but mysqlmanager (www.ems-hitech.com) is by far the best I've
used. A free alternative (although not quite as featured) is probably
Mysqlcc

-Mike

- Original Message - 
From: Angelo Zanetti [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 19, 2003 4:40 AM
Subject: [PHP-DB] MySQL editor


Hi all.

I need to get a program (interface) for MySQL, I was using MySQL Front but
they've discontinued its use.

Any suggestions.

thanx in advance

-Angelo



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





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



Re: [PHP-DB] MySQL editor

2003-06-19 Thread Becoming Digital
Sorry, I mistyped.  Navicat was previously known as MySQL Studio.  Both are very
nice packages.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Becoming Digital [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, 19 June, 2003 11:02
Subject: Re: [PHP-DB] MySQL editor


 mysqlmanager (www.ems-hitech.com) is by far the best I've used.

They've changed the name to Navicat now.  It really is fantastic software.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Michael Scappa [EMAIL PROTECTED]
To: Angelo Zanetti [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, 19 June, 2003 10:33
Subject: Re: [PHP-DB] MySQL editor


Not free, but mysqlmanager (www.ems-hitech.com) is by far the best I've
used. A free alternative (although not quite as featured) is probably
Mysqlcc

-Mike

- Original Message -
From: Angelo Zanetti [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 19, 2003 4:40 AM
Subject: [PHP-DB] MySQL editor


Hi all.

I need to get a program (interface) for MySQL, I was using MySQL Front but
they've discontinued its use.

Any suggestions.

thanx in advance

-Angelo



--
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] Fw: php-db Digest 17 Jun 2003 06:02:39 -0000 Issue 1886

2003-06-19 Thread Becoming Digital
 Any added spyware or so ?

I believe someone sent a few attachments to the list.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, 19 June, 2003 12:35
Subject: [PHP-DB] Fw: php-db Digest 17 Jun 2003 06:02:39 - Issue 1886


The digest files are coming as attachments 

Attachmnts are very light (just 900 bytes or some  2 or 4 Kb.

This one carries a whooping 46 KB.

Any added spyware or so ?

Thanks

Raf



- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, June 17, 2003 3:02 AM
Subject: php-db Digest 17 Jun 2003 06:02:39 - Issue 1886






-- 
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: PLS Advise, Highlighted Text from a Query

2003-06-18 Thread Becoming Digital
Oops!  I sent this to the wrong list last night.  This is what happens when
we answer emails @ 4:18 AM...

 4- I want when echo the return $row[address] to highlight the entered
 keyword (that the user has entered in the search form) in the output with a
 different font backcolor or by just another color... to let the user see
 what he was searching for

?
$length = strlen( $keyword );
$position = strpos( $row[address], $keyword );
$row[address] = substr_replace( $row[address],
span class=\yourclass\$keyword/span,
$position,
$length );
?

You must specify 'yourclass' in a stylesheet, obviously.  While this is not
nearly as eloquent as Cristian's suggested use of regular expressions, it seems
better suited to your level of experience.  As they say, if you need to ask...

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: nabil [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, 18 June, 2003 10:11
Subject: [PHP-DB] Re: PLS Advise, Highlighted Text from a Query


Yes please that is what i want.. if it possible to give em the code..
thanks in advance for you and for George Pitcher


Cristian Marin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Yes it is posible using the preg_replace substituing the text with /bthe
 text/b or to what ever you want.

 If you are not advanced in php you could do it with substr_replace()
 function.

 The first solution is more dificult to be used but you have the advantage
 you can search for each word used in the %search_words% and highlight them
 even if they are not positioned in the same order in the text searched.
(But
 in this case you have to use the MySQL 'match against' with the full text
 indexing in place of like).

  The result is something like this: http://www.interakt.ro/search.php. Try
 searching 'mysql adodb'

 If this is what you want I can help you with a code block



 --
 -
 Cristian MARIN - Developer
 InterAKT Online (www.interakt.ro)
 Tel: +4021 312.53.12
 Tel/Fax:  +4021 312.51.91
 [EMAIL PROTECTED]
 Nabil [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Dear all,
 
  1- I have a form with an input text : keyword
  2- the field address is in my MySQL as TEXT field.
  3- I select * from db where address like '%keyword%'
  4- I want when echo the return $row[address] to highlight the entered
  keyword (that the user has entered in the search form) in the output
with
 a
  different font backcolor or by just another color... to let the user see
  what he was searching for
  5- and if it possible to echo how accurate (percentage) the return rows
 has
  fit his search...
 
  Please Advise how to do it...
 
 





-- 
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: PLS Advise, Highlighted Text from a Query

2003-06-18 Thread Becoming Digital
 what about the percentage how much accurate the result returned??

Let's see... Since you're on the list, I'll give you a discounted rate of
$80.00/hr.  I accept Credit Cards, Money Orders, PayPal, and cash.

Seriously, you can't expect us to do your work for you.  I know quite little
about string manipulation, yet I managed to put that script together for you in
a few minutes.  All it took was a glimpse at the manual...

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: nabil [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, 18 June, 2003 10:39
Subject: Re: [PHP-DB] Re: PLS Advise, Highlighted Text from a Query


Edward , what about the percentage how much accurate the result returned??


Becoming Digital [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Oops!  I sent this to the wrong list last night.  This is what happens
when
 we answer emails @ 4:18 AM...

  4- I want when echo the return $row[address] to highlight the entered
  keyword (that the user has entered in the search form) in the output
with a
  different font backcolor or by just another color... to let the user see
  what he was searching for

 ?
 $length = strlen( $keyword );
 $position = strpos( $row[address], $keyword );
 $row[address] = substr_replace( $row[address],
 span class=\yourclass\$keyword/span,
 $position,
 $length );
 ?

 You must specify 'yourclass' in a stylesheet, obviously.  While this is
not
 nearly as eloquent as Cristian's suggested use of regular expressions, it
seems
 better suited to your level of experience.  As they say, if you need to
ask...

 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com


 - Original Message -
 From: nabil [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, 18 June, 2003 10:11
 Subject: [PHP-DB] Re: PLS Advise, Highlighted Text from a Query


 Yes please that is what i want.. if it possible to give em the code..
 thanks in advance for you and for George Pitcher


 Cristian Marin [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Yes it is posible using the preg_replace substituing the text with
/bthe
  text/b or to what ever you want.
 
  If you are not advanced in php you could do it with substr_replace()
  function.
 
  The first solution is more dificult to be used but you have the
advantage
  you can search for each word used in the %search_words% and highlight
them
  even if they are not positioned in the same order in the text searched.
 (But
  in this case you have to use the MySQL 'match against' with the full
text
  indexing in place of like).
 
   The result is something like this: http://www.interakt.ro/search.php.
Try
  searching 'mysql adodb'
 
  If this is what you want I can help you with a code block
 
 
 
  --
  -
  Cristian MARIN - Developer
  InterAKT Online (www.interakt.ro)
  Tel: +4021 312.53.12
  Tel/Fax:  +4021 312.51.91
  [EMAIL PROTECTED]
  Nabil [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
   Dear all,
  
   1- I have a form with an input text : keyword
   2- the field address is in my MySQL as TEXT field.
   3- I select * from db where address like '%keyword%'
   4- I want when echo the return $row[address] to highlight the
entered
   keyword (that the user has entered in the search form) in the output
 with
  a
   different font backcolor or by just another color... to let the user
see
   what he was searching for
   5- and if it possible to echo how accurate (percentage) the return
rows
  has
   fit his search...
  
   Please Advise how to do it...
  
  
 
 



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

2003-06-17 Thread Becoming Digital
A question was raised on the MySQL list about implementing transactions with
PHP.  I had planned on them for an upcoming project but I'd yet to figure out
how I'd coordinate things.

The original author's solution (slightly altered) was to make an array with all
the queries and loop through them, setting a boolean flag and exiting the loop
if a query fails.  Testing for the value of the flag would execute a commit or
rollback according to its value.

I think this is a decent solution, but I'm wondering what some of you are using.
A search of the Classes Repository yielded only one class, the comments for
which are written in Spanish.  I've included a link below for those who are
interested.
http://promoxy.mirrors.phpclasses.org/browse.html/file/3077.html

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] Best way to pass multiple selections to a DB

2003-06-17 Thread Becoming Digital
 Can anyone enlighten me as to some techniques for transferring information
 from a multiple select list box to mySQL.

Not knowing how you need to insert the values (multiple entries, values in
multiple fields), I would generate an array of the selections and loop through,
either running individual queries or building your multi-value query string.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Creative Solutions New Media [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Tuesday, 17 June, 2003 14:52
Subject: [PHP-DB] Best way to pass multiple selections to a DB


Hello,

Can anyone enlighten me as to some techniques for transferring information
from a multiple select list box to mySQL.

Someone recommended something about using join tables for this (which I have
no idea how to set up).

Thanks

Tim Winters
Manager, Creative Development
Sampling Technologies Incorporated (STI)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
W: 902 450 5500
C:  902 430 8498




--
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] Select Statement with output in different colors.

2003-06-17 Thread Becoming Digital
Here's a slight alteration to Peter's code in case someone isn't familiar with
switch statements.  Ooh, such a bad pun, as if there's any other kind.

?
$query = 'SELECT * FROM table
$mysql_result = mysql_query($query, $link);

while($row = mysql_fetch_array($mysql_result))
{
switch ($row[event] )
{
case event_one:
$bg = 'blue'
break;
case event_two:
$bg = 'red'
break;
case event_three:
$bg = 'green'
break;
default:
$bg = 'white'
}
print 'tr bgcolor='.$bg.'
tdda da da nbsp;/td
/tr';
}// end while
?


Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Peter Lovatt [EMAIL PROTECTED]
To: Christopher Lyon [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, 17 June, 2003 17:42
Subject: RE: [PHP-DB] Select Statement with output in different colors.


Try this

$query = 'SELECT * FROM table
$mysql_result = mysql_query($query, $link);

while($row = mysql_fetch_array($mysql_result))
{


 switch ($row[event] )
 {
 case event_one:
$bg = 'blue'
 break;
 case event_one:
$bg = 'red'
 break;
 case event_one:
$bg = 'green'
 break;
 default:
$bg = 'white'

 }


 print 'tr bgcolor='.$bg.'
 tdda da da nbsp;/td
/tr';


 }// end while




HTH

Peter



-Original Message-
From: Christopher Lyon [mailto:[EMAIL PROTECTED]
Sent: 17 June 2003 22:35
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select Statement with output in different colors.


I have a php script that does some select statements, on mysql, and
outputs that to a table. I would like to change the color of the table
row depending upon one of the fields. The select statements are from a
syslog database that I have and I would like to highlight key events by
changing the colors for that row. Example would be MAJOR, yellow and
INFO, green. Does anybody have any examples of how to do this?




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



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





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



[PHP-DB] setting session variables via a form

2003-06-16 Thread Becoming Digital
Despite my best efforts, I can't seem to set session variables via a basic form.
I'm trying to use a button to alter display settings, which should be a simple
task, but apparently it is not.  Here's the code I'm working with.

?
if( (!isset( $_POST['view_details'] ))  ($_SESSION['item_details'] != yes) )
{
print form method=\post\;
print input type=\button\ name=\view_details\ value=\View
Descriptions\ /;
print /form;
}
else
$_SESSION['item_details'] = yes;
?


My session I have tried a number of different solutions, including removing
session_start() from its calling function and various things I might otherwise
overlook.  I'm sure that I'm overlooking something easy but I can't figure out
what it is.  The session variable simply isn't being set, as confirmed by
printing its value (and by things not working!).  Thanks a lot for any and all
suggestions.

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] setting session variables via a form

2003-06-16 Thread Becoming Digital
 maybe try the invers (anyways you havn't defined an action-attribute -
 maybe this is a problem?):

Not declaring an action attribute automatically makes the form submit to itself.
When a URL query string is involved, this works much better than
$_SERVER['PHP_SELF'], which reduces the URL to its basic format.


 'input  name=view_details type=hidden value=yes'.
 'input type=submit value=View Descriptions'.

That helped, to a degree.  The submit button was key to getting the form to
register (hiding the button) but it's still not registering the session
variable.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: .ma [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Monday, 16 June, 2003 11:57
Subject: Re: [PHP-DB] setting session variables via a form


hi

maybe try the invers (anyways you havn't defined an action-attribute -
maybe this is a problem?):

if(!isset($_SESSION['item_details']) || (
isset($_SESSION['item_details']  $_SESSION['item_details']) {
echo 'form name=myForm method=post
action='.basename($_SERVER['PHP_SELF']).''.
'input  name=view_details type=hidden value=yes'.
'input type=submit value=View Descriptions'.
'/form';
else
$_SESSION['item_details'] = 'yes';

hope i understood you right and this helps?

.ma

e: [EMAIL PROTECTED]
w: http://www.abendstille.at

# life would be easier if i knew the source code

Am Montag, 16.06.03 um 17:16 Uhr schrieb Becoming Digital:

 Despite my best efforts, I can't seem to set session variables via a
 basic form.
 I'm trying to use a button to alter display settings, which should be
 a simple
 task, but apparently it is not.  Here's the code I'm working with.

 ?
 if( (!isset( $_POST['view_details'] ))  ($_SESSION['item_details']
 != yes) )
 {
 print form method=\post\;
 print input type=\button\ name=\view_details\
 value=\View
 Descriptions\ /;
 print /form;
 }
 else
 $_SESSION['item_details'] = yes;
 ?


 My session I have tried a number of different solutions, including
 removing
 session_start() from its calling function and various things I might
 otherwise
 overlook.  I'm sure that I'm overlooking something easy but I can't
 figure out
 what it is.  The session variable simply isn't being set, as confirmed
 by
 printing its value (and by things not working!).  Thanks a lot for any
 and all
 suggestions.

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



Re: [PHP-DB] setting session variables via a form

2003-06-16 Thread Becoming Digital
It's always something obvious.  I was not checking the session variable's value
at the correct point in the script, hence the display was not being altered by
its results.  I've managed to get my code to display properly now, but I can't
retain state between queries.

My reason for using session variables was to ensure that a user's viewing
selection (with or without details) was retained.  However, when I reload the
page with a new URL query string (for a different catalogue section), the view
settings revert to no details.  This also occurs when reloading the page with
the same query string.  Again, I'm sure it's something obvious but I just can't
seem to figure it out.  What stupid mistake am I making this time?  Thanks
again.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Becoming Digital [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Monday, 16 June, 2003 13:49
Subject: Re: [PHP-DB] setting session variables via a form


 Are you certain that you have issued the session_start() call at the
 beginning of the page?

100%.  I went so far as to move session_start() before every other element on
the page, even removing it from my include file and directly inserting it into
the actual page.

 Furthermore, your register_globals setting will have some impact on your
 syntax.

Mike answered that part quite nicely.  I just realized that I had
register_globals = On, but that is now changed and I still have the same result.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Hutchins, Richard [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Monday, 16 June, 2003 12:07
Subject: RE: [PHP-DB] setting session variables via a form


Edward,

Are you certain that you have issued the session_start() call at the
beginning of the page? According to the session stuff on PHP.NET, you need
to make sure you have session_start() at the top of the page before you do
anything else with the session. For example, I have on one of my simpler
pages:

session_start();
session_register(isRegistering);

$_SESSION[isRegistering] = true;

header(Location: http://mywebsite.php;); /* Redirect browser */

Furthermore, your register_globals setting will have some impact on your
syntax.

See http://us3.php.net/manual/en/ref.session.php

Hope that helped.

Rich

 -Original Message-
 From: .ma [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 16, 2003 11:57 AM
 To: PHP-DB
 Subject: Re: [PHP-DB] setting session variables via a form


 hi

 maybe try the invers (anyways you havn't defined an
 action-attribute -
 maybe this is a problem?):

 if(!isset($_SESSION['item_details']) || (
 isset($_SESSION['item_details']  $_SESSION['item_details']) {
 echo 'form name=myForm method=post
 action='.basename($_SERVER['PHP_SELF']).''.
 'input  name=view_details
 type=hidden value=yes'.
 'input type=submit value=View
 Descriptions'.
 '/form';
 else
 $_SESSION['item_details'] = 'yes';

 hope i understood you right and this helps?

 .ma

 e: [EMAIL PROTECTED]
 w: http://www.abendstille.at

 # life would be easier if i knew the source code

 Am Montag, 16.06.03 um 17:16 Uhr schrieb Becoming Digital:

  Despite my best efforts, I can't seem to set session
 variables via a
  basic form.
  I'm trying to use a button to alter display settings, which
 should be
  a simple
  task, but apparently it is not.  Here's the code I'm working with.
 
  ?
  if( (!isset( $_POST['view_details'] )) 
 ($_SESSION['item_details']
  != yes) )
  {
  print form method=\post\;
  print input type=\button\ name=\view_details\
  value=\View
  Descriptions\ /;
  print /form;
  }
  else
  $_SESSION['item_details'] = yes;
  ?
 
 
  My session I have tried a number of different solutions, including
  removing
  session_start() from its calling function and various
 things I might
  otherwise
  overlook.  I'm sure that I'm overlooking something easy but I can't
  figure out
  what it is.  The session variable simply isn't being set,
 as confirmed
  by
  printing its value (and by things not working!).  Thanks a
 lot for any
  and all
  suggestions.
 
  Edward Dudlik
  Becoming Digital
  www.becomingdigital.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 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] addslashes, stripslashes, htmlspecialchars

2003-06-13 Thread Becoming Digital
The functions you're wondering about are designed for dealing with inserting
user input into a database.  If you have a form in which someone can enter text,
you need to process the input with addslashes() in case the user input contains
quotes.  htmlspecialchars() and htmlentities() have similar uses.

If your webpage broke because a hyperlink in the database included quotes, you
need to either manually add slashes to the text in the database or re-write your
form processing script to include addslashes() and insert the data again.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Steve B. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, 13 June, 2003 19:22
Subject: [PHP-DB] addslashes, stripslashes, htmlspecialchars


Hi this is about PHP commands even though has mysql too.
I go to mysql board when I find one they said MySQL is not necessarily PHP
driven and if I want
PHP specific questions to go to a PHP list.

How do you deal with forms, db storage of the data and calling it up in a form
to edit?

The online tutorials I have covered to not address this except with addslashes
on one of them.
My web page broke when I added a hyperlink in the description because of the '

Previously:
used .asp and always set the db in a way similar to parameters? in MySQL
Sometimes I did urlencode() on a get string to make the spaces and other
characters work.

tried addslashes and noticed it does add them, right in the db.
Is this the standard? add and remove slashes?
other thing confusing me is the htmlentities which may do this better?

Thanks,
Steve


__
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] Login session - browser/computer? problem

2003-06-12 Thread Becoming Digital
If it works for everyone else but not your boss, guess where the problem is?
His security settings probably have something to do with it.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Dewi Wahyuni [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, 12 June, 2003 03:20
Subject: [PHP-DB] Login session - browser/computer? problem


My boss can't seem to login at all through his laptop to my website.

The login process is as follows: from the index.php the person login goes to
handler/login.php which checks with the databae, if the user is authorized then
put a session variable called loginid and redirect the website to a page
in.php with a welcome  display.

The in.php checks whether the session loginid is empty or exists to identify
whether the user has logged in.

It works fine in all the desktops in my office but one of my bosses tried to
access it with his laptop and it keeps saying wrong password.

Our IE version and OS is the same. (XP and IE  7.10)

Code for login


$sql = SELECT * from Login where loginname='$loginname' and
loginpass=ENCODE('$password','');

  $result = mysql_query($sql);

   if ($myrow = mysql_fetch_array($result))
   {
 session_start();

 $_SESSION[loginid] = $loginname;
   header(blabla);
   }
?

My boss's problem is when he logged in the page got to in.php but in.php says he
is not logged in yet. Which means he is authorized, but the session data could
not be retrieved by in.php in his computer.

I checked and the cache timeout is 180 (default) cache limiter is empty and
domain is empty

Regards,

Dewi



Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005

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





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



Re: [PHP-DB] PHP Paging

2003-06-12 Thread Becoming Digital
 How can I do paging in PHP?

Search the list archives or use one of the paginating classes in the repository.
This came up just last week.
http://marc.theaimsgroup.com/?l=php-dbw=2r=1s=pagingq=b

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: F-A-W® [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, 12 June, 2003 07:19
Subject: [PHP-DB] PHP Paging


Hi all,

I have some data that need to be shown in pages.

How can I do paging in PHP?

Any code snippet or links are welcome.

Thanks

FAW


-
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



Re: [PHP-DB] How can I get the number of entries retrieved by aSELECT - FROM

2003-06-12 Thread Becoming Digital
 The PHP SELECT FROM below (before snip) listed the expected data.
 Is there a way to get the digit 3 into a PHP variable

$data = mysql_result($result,1,name));


 How do I trap or collect or save the digit 3 generated the
 mysql SELECT COUNT(*) statement below?

Same as above.  Store it in a PHP variable and retrieve it later.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: ed anderson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, 12 June, 2003 17:58
Subject: [PHP-DB] How can I get the number of entries retrieved by a SELECT -
FROM


Dell 4500, mem 1g, disk 45g, mhz 2g, Mysql-3.23.54a-linux-i686, PHP-4.30,
httpd_2.0.44



1. How do I trap or collect or save the digit 3 generated the
   mysql SELECT COUNT(*) statement below?

2. The PHP SELECT FROM below (before snip) listed the expected data.
   Is there a way to get the digit 3 into a PHP variable?

SELECT h_id, name FROM tbtm # displays
  WHERE h_id=1# three
 OR h_id=2   # lines
 OR h_id=3;  # of data

SELECT COUNT(*) FROM tbtm   # displays
  WHERE h_id='1'# the
 OR h_id='2'# digit
 OR h_id='3';   # three

+--+
| COUNT(*) |
+--+
|3 |
+--+
1 row in set (0.00 sec)



 The next PHP is the same as the SELECT FROM above.
?php
 $result = mysql_query( SELECT h_id, name, FROM tbtm
  WHERE h_id='1'
 OR h_id='2'
 OR h_id='3',
 $tmtb_db);
#
 printf(ID: %sbr\n,  mysql_result($result,1,h_id));
 printf(name: %sbr\n,mysql_result($result,1,name));
 snip   snip
#
?


Thanks

[EMAIL PROTECTED]


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





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



Re: [PHP-DB] PHP web templates?

2003-06-11 Thread Becoming Digital
The second two sites are almost definitely Nuke jobs.  You could take a glimpse
at the code and you'd know right away.

If you want some good nuke theme sites, check phpnuke.org for resources, or do a
Google search.  One of my favourites (from when I had to use nuke for a project)
is mtechnik.net.

I won't burn you this time, but try to make sure your future posts to this
list are actually related to database stuff.  Thanks.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Steve B. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, 11 June, 2003 17:44
Subject: [PHP-DB] PHP web templates?


Hi I'm working on the site http://www.handheldwarez.com
I really like these sites style of table cells and borders etc...
http://tribes.sierra.com/
http://www.planetrenegades.com/modules.php?name=Web_Linksl_op=MostPopular
http://www.tribes2maps.com/

I've seen PHP nuke templates and am thinking that is what these sites are?

Does anyone have a favorite open source template spot?
I'd like a nice metal look like those sites.
In the past I took graphics from php nuke free site and make my own
tablecell.php that prints nice boxes.
That is in use at http://www.northcountyrc.com if you wonder what I'm talking
about.

Please don't burn me I'm newb and have little art skill but decent photoshop
knowledge.

Any help, links is much appreciated thanks!



-
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



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



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



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



[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



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



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



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



Re: [PHP-DB] how to update field without using UPDATE query?

2003-06-09 Thread Becoming Digital
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



Re: [PHP-DB] how to update field without using UPDATE query? you arekidding?

2003-06-09 Thread Becoming Digital
I'm sorry, but that is the most confusing question I've heard in some time.

The operating system has nothing to do with your ability to update the DB.  That
is a user permissions issue.  If you're referring to PHP as Linux, I can see
where the confusion came from.

I'd like to help you.  So I can attempt to do that, let's see the ASP code
you're trying to convert to PHP.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Steve B. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, 09 June, 2003 22:14
Subject: Re: [PHP-DB] how to update field without using UPDATE query? you are
kidding?


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] incrementing values

2003-06-07 Thread Becoming Digital
AUTO_INCREMENT
http://www.mysql.com/doc/en/example-AUTO_INCREMENT.html

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: Merlin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, 03 June, 2003 17:56
Subject: [PHP-DB] incrementing values


Hi there,

is there a function in mysql to increment a value inside a field? I am
always doing this with php, just thought this might be really usefull?!

Thanx,

Merlin



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





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



Re: [PHP-DB] problem with insert query

2003-06-07 Thread Becoming Digital
Try this.  I made some minor syntax changes and added some error reporting.
While it may not fix things, it might help you figure out what's wrong.

?
$mails=file(mails.txt);
$number_of_mails = count($mails);

for ($i=0; $i$number_of_mails; $i++)
{
$link = @ mysql_connect(localhost)
or die( mysql_error() );
$db = mysql_select_db(me2resh00, $link);
$query = insert into recipients (recipient_name, recipient_email) values
(\friend\, \.$mails[$i].\);
$result = mysql_query($query);
if ($result)
echo mysql_affected_rows(). affected.;
}
?

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Ahmed Abdelaliem [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, 07 June, 2003 08:15
Subject: [PHP-DB] problem with insert query


hi
i am wrote a script to read e-malis from a file and insert it into the
tables of database
i get error when i write it
here is the code
can anyone tell me what is wrong?

?
$mails=file(mails.txt);
$number_of_mails = count($mails);

for ($i=0; $i$number_of_mails; $i++){

 @ $db = mysql_connect(localhost);
mysql_select_db(me2resh00);
$query = insert into recipients (recipient_name, recipient_email) values
('friend', '.$mails[$i].');
$result = mysql_query($query);
if ($result)
echo mysql_affected_rows(). affected.;

   }
 ?


here is the error that i get

Parse error: parse error in enter.php on line 9


and line 9 is

$query = insert into recipients (recipient_name, recipient_email) values
('friend', '.$mails[$i].');

_
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus


--
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] Possible to store arrays in mySQL withoutexplode()/implode()

2003-06-07 Thread Becoming Digital
Not that I'm aware of, but why don't you give it a shot.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: Jakob Mund [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, 07 June, 2003 09:04
Subject: [PHP-DB] Possible to store arrays in mySQL without explode()/implode()


is it possible to store an array in mySQL without using implode() /
explode(), like this:

$stuff['blob'] = string;
$stuff['hm'] = G-string;

mysql_query(INSERT INTO table VALUES ($stuff));

and if, who must the mysql table be defined ?

thx
Jakob 'iNstinct' Mund



-- 
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] Seccond addition: 'Transfering variables'

2003-06-06 Thread Becoming Digital
Entries from what?  Do you have a code example of what you're working with now?
Believe it or not, most of us would rather read through it than guess what
you're trying to accomplish.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Andr Sannerholt [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, 06 June, 2003 17:51
Subject: [PHP-DB] Seccond addition: 'Transfering variables'


Ok, the thing I accually want to do is to keep all the entries in one
specific selection-option-box after the form has been submitted. I hope that
is enough of explanation, because I cannot expect from you to go through my
whole project...

Regards, Andr



--
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] Displaying groups from SELECT

2003-06-06 Thread Becoming Digital
Thanks, Grhan, but I think I needed to explain things better.  As is generally
a good idea, the categories are referenced in the product table by ID, not name.
Additionally, this is something along the lines of what I already had.  I was
trying to use only one query and make PHP do the remaining work.

Here's the code I'm currently using, which I should have posted in the first
place.

?
$query = SELECT * FROM categories;
$result = mysql_query( $query );
$rows = mysql_num_rows( $result );

print ul\n;

while ( $cats = mysql_fetch_array( $result ) )
{
print li .$cats[cat_name] ./li;

$queryB = SELECT prod_name FROM products
WHERE prod_cat= .$cats[cat_id];
$resultB = mysql_query( $queryB );
print ul;

while ( $items = mysql_fetch_array( $resultB ) )
{
print li .$items[prod_name] ./li;
}

 print /ul;
}

print /ul;
?

The more I think about it, the more it seems like I'll just have to use two
queries.  I just didn't want to do so bcs the second query will run at least
four times and it seemed inefficient.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Grhan zen [EMAIL PROTECTED]
To: Becoming Digital [EMAIL PROTECTED]
Cc: PHP-DB [EMAIL PROTECTED]
Sent: Friday, 06 June, 2003 23:07
Subject: Re: [PHP-DB] Displaying groups from SELECT


On Fri, 2003-06-06 at 21:49, Becoming Digital wrote:
 I'm wearing the stupid hat today, so please pardon this.  I know I must be
 overlooking something.

 I have a small catalogue with two tables (categories, products) from which I'm
 trying to display items.  I'm trying to print the contents as below without
 using two queries, but I'm having a difficult time with it.

 cat1
 prod1
 prod2
 cat2
 prod1
 prod2
 etc.

 I think this came up fairly recently, but I cannot for the life of me figure
out
 what search terms would answer this question.  As you can see from the message
 subject, I don't even know how to refer to my problem.  Thanks a lot for all
 your help.

 Edward Dudlik
 Becoming Digital
 www.becomingdigital.com


  Hi Ed,
 The magic word is DISTINCT :)

 $query=SELECT DISTINCT(category) AS cat_name FROM table_name;
 $result=mysql_query($query);
 print ul;
 while ($row=mysql_fetch_array($result)) {
print li.($row[cat_name]).;
$query1=SELECT productname FROM tablename WHERE
category=.($row[cat_name]).;
$result1=mysql_query($query1);
while ($row1=mysql_fetch_array($result1)) {
   print li.($row1[productname]).;
}
print /ul;
}

print /ul;


I hope this helps..





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



Re: [PHP-DB] PHP Problem

2003-06-06 Thread Becoming Digital
Please post the code you are trying to use so that we can try to find the
problem.  Without data, we can't tell you where things went wrong.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Ramesh PAtel  [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, 07 June, 2003 01:12
Subject: [PHP-DB] PHP Problem


Hi All

Hi i install PHP4.3 and apache2 now i create one page for PHP Info
i use ?php phpinfo();?
i show all info on web page .

But Problem is here

When i create one page for Connect Database on PostgreSQL.it not work.
mean Postgresql work well i test it. i thing PHP Command problem.

Please help where is Problem. in PHP Configuration or Apache Configuration.

Ramesh Patel

[EMAIL PROTECTED]


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





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



Re: [PHP-DB] PHP/Mysql Script help.

2003-06-05 Thread Becoming Digital
I debugged the code and there were a slew of errors.  I've fixed all but one,
which I can't correct bcs I don't know the intention.  Most of the errors came
from improper syntax, a problem which could have been avoided by using
consistent code formatting.  I chose to do that for you as well and have
included the code below.

As for the error I could not correct, it involves the final elseif() statement.
The way your code was written, you had two 'else' statements, which is an
obvious violation.  I corrected that by changing the first (before the select
statement) to an elseif(), but I do not know the condition.  Once you enter it,
the code should work smoothly.


?php

require(racesetup.php);

$con = mysql_connect($host, $user, $pass) or die(mysql_error());

mysql_select_db($db, $con) or die(mysql_error());

// display individual record
if ($id)
{
error_reporting(E_ALL);

$result = mysql_query(SELECT * FROM nuke_race WHERE id=$id,$con) or
die(mysql_error());

$myrow = mysql_fetch_array($result) or die(mysql_error());

printf (bRace:/b %s\nbr, $myrow[race]);

echo br;

printf(bDescription:/b %s\nbr, $myrow[racetxt]);

echo br;
echo brh3a href=\javascript:history.go(-1)\Back/a/h3;
}

elseif ($_Post['letter'])
{
if ($_Post['letter'])
{
$result = mysql_query(SELECT * FROM nuke_race WHERE race LIKE
$_Post['letter']%,$con) or die(mysql_error());
if ($myrow = mysql_fetch_array($result))
{   // display list if there are records to display
do {
printf(a href=\%s?id=%s\%s/abr\n, $PHP_SELF,
$myrow[id], $myrow[race]);
}
while ($myrow = mysql_fetch_array($result));
}
}
}

//NO CONDITION LISTED!!
elseif ()
{
echo form name=\letter\ method=\post\ action=\races.php\

  .   pPick a letter to begin your search/p
  .   p 
  . select name=\select\
  .   option value=\a\A/option
  .   option value=\b\B/option
  .   option value=\c\C/option
  .   option value=\d\D/option
  .   option value=\e\E/option
  .   option value=\f\F/option
  .   option value=\g\G/option
  .   option value=\h\H/option
  .   option value=\i\I/option
  .   option value=\j\J/option
  .   option value=\k\K/option
  .   option value=\L\L/option
  .   option value=\m\M/option
  .   option value=\n\N/option
  .   option value=\o\O/option
  .   option value=\p\P/option
  .   option value=\q\Q/option
  .   option value=\r\R/option
  .   option value=\s\S/option
  .   option value=\t\T/option
  .   option value=\u\U/option
  .   option value=\v\V/option
  .   option value=\w\W/option
  .   option value=\x\X/option
  .   option value=\y\Y/option
  .   option value=\z\Z/option
  . /select
  .   /p
  .   p 
  . input type=\Submit\ name=\submit\ value=\Enter
information\
  .   /p
  . /form
  .;
}

else
// no records to display
echo Sorry, no records were found!;

?


Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Fulco of Scarborough [EMAIL PROTECTED]
To: 'PHP-DB' [EMAIL PROTECTED]
Sent: Thursday, 05 June, 2003 00:25
Subject: Re: [PHP-DB] PHP/Mysql Script help.


I have still been getting errors, so here goes again.



I am attempting to design a script that presents the user with a form with
26 letters to choose from.  When they pick a letter I want it to take them
to a list of all the entries in my database that begin with the letter they
selected in link form.  When they click on the term, I want it to pull up
the info for that entry.



I have made some changes and added some error checking:



?php



require(racesetup.php);

$con = mysql_connect($host, $user, $pass) or die(mysql_error());



mysql_select_db($db, $con) or die(mysql_error());



// display individual record



if ($id) {

error_reporting(E_ALL);

   $result = mysql_query(SELECT * FROM nuke_race WHERE id=$id,$con) or
die(mysql_error());



   $myrow = mysql_fetch_array($result) or die(mysql_error());



   printf(bRace:/b %s\nbr, $myrow[race]);

  echo br;

   printf(bDescription:/b %s\nbr, $myrow[racetxt]);

  echo br;

  echo brh3a href=\javascript:history.go(-1)\Back/a/h3;




} elseif ($_Post['letter']) {

if ($_Post['letter']) {

$result = mysql_query(SELECT * FROM nuke_race WHERE race LIKE
$_Post['letter']%,$con) or die(mysql_error());

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



  // display list if there are records to display



  do {



printf(a href=\%s?id=%s\%s/abr\n, $PHP_SELF, $myrow[id],
$myrow[race]);



  } while ($myrow = mysql_fetch_array($result));



;

}

else  {

echoform name=\letter\ method=\post\ action=\races.php\

  .   pPick a letter to begin your search/p

  .   p

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

2003-06-05 Thread Becoming Digital
 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.

Yes and no.  I agree that someone without coding experience (or a desire to
learn) cannot tackle this problem, but what Philippe has requested is a simple
user authentication system with sessions, of which there are many.  Still,
customization to fit his system will require an understanding of the code, which
will likely prove problematic.

To the poster, check out the PHP Classes Repository for a number of
authentication classes.  Don't expect them to work if you don't understand the
code, though.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Peter Beckman [EMAIL PROTECTED]
To: Philippe Rousselot [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, 05 June, 2003 00:15
Subject: Re: [PHP-DB] forms with php/mysql


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



Re: [PHP-DB] Cookie issue

2003-06-05 Thread Becoming Digital
It's probably an issue with security settings in IE6, not your code.  

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: Marie Osypian [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Thursday, 05 June, 2003 11:30
Subject: RE: [PHP-DB] Cookie issue


To add to this message:

We are having problems with people using IE 6.0.  They appear to sign-in and
then are returned to the sign-in screen over and over.  This doesnt happen
to all that use the site.

Thanks in advance

-Original Message-
From: Marie Osypian [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 10:03 AM
To: PHP-DB
Subject: [PHP-DB] Cookie issue


We are having complaints on our site about users not being able to log-in
and we feel it maybe related to the setting of cookie.  Here is the code
used.  Can anyone give me insight.


/* some standard var's or other things like srand */
srand((double)microtime() * 100);
$includes_root  = $DOCUMENT_ROOT/includes;
$encoded_url= urlencode($REQUEST_URI);

if($_COOKIE[cookie_check] != Y)
{
setcookie(cookie_check, Y, strtotime(+5 years), /,
$HTTP_HOST, 0);
}

if($_COOKIE[current_surfer_id] ==  AND $_COOKIE[cookie_check] ==
Y)
{
$current_surfer_id = rand(0, 16777215);

setcookie(current_surfer_id, $current_surfer_id, strtotime(+5
years), /, $HTTP_HOST, 0);
}



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

2003-06-05 Thread Becoming Digital
It appears to me that you have REGISTER GLOBALS set to OFF.  If that's the case,
you need to pre-pend each of your variables with $HTTP_POST_VARS or $_POST.  If
you're not concerned about the security issues raised by leaving globals on,
simply change that one item in your php.ini file.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Ahmed Abdel-Aliem [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, 04 May, 2003 20:06
Subject: [PHP-DB] problem


hi again,
i use php/mysql and i have a form to enter data into tables insiede the
database
the problem is when i click the submit botton it gives me that 1 row is
affected and when i check the database with phpmyadmin i find that all the
data processed in the new row is empty, so can anyone please tell me where
is the problem?
here is the insert script :
?
$name = addslashes($name);
$type = addslashes($type);
$date = addslashes($date);
$link = addslashes($link);
$cds = addslashes($cds);
$rate = addslashes($rate);
$cast = addslashes($cast);
$downloader = addslashes($downloader);
$downloaderlink = addslashes($downloaderlink);
@ $db = mysql_connect(localhost);
mysql_select_db(egycds);
$query = insert into newdvd (name, type, date, link, cds, rate, cast,
downloader, downloaderlink, subtitle) values ('.$name.', '.$type.', '
$date.', '.$link.', '.$cds.', '.$rate.', '.$cast.', '.$downloader.
', '.$downloaderlink.', '.$subtitle.');
$result = mysql_query($query);
if ($result)
 echo mysql_affected_rows(). affected.;

?





i use ISS on windows xp professional and i face many problem with php.ini so can
anyone send me a modified one for the last version of php to avoid all these
errors !!


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



Re: [PHP-DB] runing local programs with php

2003-06-05 Thread Becoming Digital
What's the purpose of your script?  You can take a look at the command line
functions in the manual, though I don't know if they work in a Windows
environment.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: carol [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, 04 June, 2003 01:15
Subject: [PHP-DB] runing local programs with php


Hy all,


How can I run program on a client machine using a php script.
For example paint or acces. which are runing on client machine.
TKS



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



Re: [PHP-DB] while - if problem

2003-06-05 Thread Becoming Digital
You don't have a closing bracket on your while() loop and you should not have
the else comments bracketed.  Try this:

while($cols=ifx_fetch_row($eventQuery))
{
 if (($cols['s_acro']=='CF') || ($cols[s_acro]=='PF'))
   {
$r_away['sport']='1';
$r_home['sport']='1';
$s_lt='PS';
$t_lt='TP';
   }

  elseif (($cols['s_acro']=='PB') || ($cols['s_acro']=='CB'))
   {
$r_away['sport']='2';
$r_home['sport']='2';
$s_lt='PS';
$t_lt='TP';
   }

  elseif ($cols['s_acro']=='B')
   {
$r_away['sport']='3';
$r_home['sport']='3';
$s_lt='ML';
$t_lt='TM';
   }

  else
$r_away['sport']='4';
$r_home['sport']='4';
$s_lt='ML';
$t_lt='TM';
}


Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Earl [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Wednesday, 04 June, 2003 15:44
Subject: [PHP-DB] while - if problem


Hey guys, I've got a problem with this piece of code
it is skipping the contents of the if and elseif statements and only printing
the else values, even though the if or one of the elseif statements might be
true.
what could possibly be the problem??



$eventQuery=ifx_query('select * from eventtable'
  .' where e_date = today '
  .' and e_status in (O,C) '
   .' and out_id is not null '
  .' order by s_acro, e_acro ',$db) or die (ifx_error());

while($cols=ifx_fetch_row($eventQuery))
 {
 if (($cols['s_acro']=='CF') || ($cols[s_acro]=='PF'))
   {
$r_away['sport']='1';
$r_home['sport']='1';
$s_lt='PS';
$t_lt='TP';
   }

  elseif (($cols['s_acro']=='PB') || ($cols['s_acro']=='CB'))
   {
$r_away['sport']='2';
$r_home['sport']='2';
$s_lt='PS';
$t_lt='TP';
   }

  elseif ($cols['s_acro']=='B')
   {
$r_away['sport']='3';
$r_home['sport']='3';
$s_lt='ML';
$t_lt='TM';
   }

  else   {
$r_away['sport']='4';
$r_home['sport']='4';
$s_lt='ML';
$t_lt='TM';
   }


output is always:  4, ML, TM


thanks in advance




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



Re: [PHP-DB] Printing date as 04-06-03

2003-06-05 Thread Becoming Digital
print date(m-d-y);

http://us3.php.net/manual/en/function.date.php

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Steve B. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, 04 June, 2003 17:58
Subject: [PHP-DB] Printing date as 04-06-03


Hi all,
M-D-Y with leading 0 is how I would like to print dates at my exciting web page.
I am trying DATE_FORMAT and my provider locked up?? :(=

How would you print this?
thx
steve
http://www.aifiles.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





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



Re: [PHP-DB] Reserve Username while Confirming Signup

2003-06-03 Thread Becoming Digital
You don't need PostgreSQL for transactions.  InnoDB tables in MySQL will work
just fine.

I do agree that this begs for a transaction setup.  The transactions will
confirm the transfer of everything from the temp to regular table.  Then use a
timestamp in conjunction with a sweeper script to remove all entries in the
temp table more than 7 days old.  I think that's a fair time for someone to
confirm their information and it allows easily a scheduled operation.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Boa Constructor [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, 03 June, 2003 00:00
Subject: Re: [PHP-DB] Reserve Username while Confirming Signup


Sounds like ya wanna use a database that supports transactions, PostgreSQL
supports it.  I'm kinda new to this so I'd check it out but I think this
could be what yer after.

Cheers,

Graeme :)

- Original Message -
From: Dewi Wahyuni [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, June 03, 2003 4:47 AM
Subject: [PHP-DB] Reserve Username while Confirming Signup


 Hi All,

 I have a sign up page and when the user submit, it goes to a confirmation
page, before the person actually submits.

 The confirmation page stores the username and password in the Session
variable and the submit page stores it into the database by getting it from
the session. The rest of the information (eg. address) is resubmited via
hidden input type.

 The question is : I want to reserve the username for the person(say A)
while he/she is in the confirmation page and perhaps going back to edit some
stuff. What is the best way to do that?


 I tried putting it in my database in a Logintemp table. With the same
fields as the Login table. When the user submits, the Logintemp contents is
moved to the Login table.

 The problem is what if while A is staring at the screen the computer
hangs. How do I know if he/she closes the page altogether. I need to delete
the contents of Logintemp since it was not moved to Login.

 Is there any other better way to do this?


 
 Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
 http://login.mail.lycos.com/r/referral?aid=27005

 --
 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] Dealing with ENUM fields

2003-06-03 Thread Becoming Digital
This is for another menu project that I'm working on.  The restaurant has a
large list of daily specials, all of which fit into one of four categories
(lunch, dinner, pizza, dessert).  Because the data will never mix (no need for
joins or unions), I wanted to keep the specials categories separate from the
regular menu item categories.  Because there are only four specials categories
and they are static, I thought ENUM would work best.  Your opinions?

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Lisi [EMAIL PROTECTED]
To: Becoming Digital [EMAIL PROTECTED]; PHP-DB
[EMAIL PROTECTED]
Sent: Monday, 02 June, 2003 06:40
Subject: Re: [PHP-DB] Dealing with ENUM fields


What's the application? What are the issues with using ENUM verses
something else?

-Lisi

At 05:32 AM 6/2/03 -0400, Becoming Digital wrote:
Thanks to both Heilo and Lisi.  These scripts should make things easier.

Is it safe to assume that we are in agreement about the use of an ENUM
field for
this application?

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: heilo [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Monday, 02 June, 2003 05:11
Subject: Re: [PHP-DB] Dealing with ENUM fields


Hi!

there is a much shorter way to do this (which works with ENUM and SET):


$qry = 'SHOW COLUMNS FROM `gruzilla_content` LIKE module';
$res = mysql_query($qry);
if(mysql_num_rows($res)0)
{
 $row = mysql_fetch_row($res);
 $pattern = #(enum|set)\('(.+?)'\)#i;
 $replace = '\\2';
 $row[1] = preg_replace($pattern, $replace, $row[1]);
 $options = explode(',', $row[1]);
}

$options now contains every value of the enum. I think there is also a
possibility to do this within a query - but currently i do not find the
script on my HD :) - so this is a nice workaround!

.ma


Lisi [EMAIL PROTECTED] [EMAIL PROTECTED] 11:53 Uhr:

  I am forwarding this useful function someone once sent to the list that I
  use often.
 
  Hope this fits your needs.
 
  -Lisi
 
 
  -Original Message-
  From: Russ [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, June 26, 2002 7:47 PM
  To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
  Subject: RE: [PHP-DB] Populating a dropdown list with ENUM values...
 
 
  G'day Scott:
 
  I wrote this function to do just what you're atfer:
  You may need to mess with it for you're own needs - but go for your
  life!
 
  //function: enum_select() - automatically generate an HTML select
  menu from a MySQL ENUM field
  //1). takes a table name: '$table'
  //2). a name for the menu '$name'
  //3). a CSS class
  function enum_select($table,$name,$class) {
  $sql = SHOW COLUMNS FROM $table;
  $result = mysql_query($sql);
  $select = select name=\$name\ class=\$class\\n\t;
  while($myrow = mysql_fetch_row($result)){
$enum_field = substr($myrow[1],0,4);
if($enum_field == enum){
 global $enum_field;
 $enums = substr($myrow[1],5,-1);
 $enums = ereg_replace(',,$enums);
 $enums = explode(,,$enums);
 foreach($enums as $val) {
  $select .= option
  value=\$val\$val/option\n\t;
  }//end foreach
  }//end if
  }//end while
  $select .= \r/select;
  return $select;
  }//end function
 
 
  All the best.
  Russ
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

Matthias Steinböck
Email: [EMAIL PROTECTED]
Web: http://www.abendstille.at

Frühabendliches Webdesign.
--
Im Übrigen sind wir der Meinung, dass
unsere Gesellschaft Gabel-diskriminierend
Löffel verwendet. Alle Macht den Gabeln!


--
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] remote commands thought www

2003-06-02 Thread Becoming Digital
Link is bad.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Jim [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, 01 June, 2003 23:24
Subject: [PHP-DB] remote commands thought www


Hey,

Where are some actual examples on url commands, ect
www.blah.com/modules.phpCOMMANDS.

Would really like to know the upload and download and run commands.

thanks


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



Re: [PHP-DB] query string

2003-06-02 Thread Becoming Digital
Check out http://www.php.net/manual/en/ref.url.php

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Ian Fingold [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, 01 June, 2003 23:20
Subject: Re: [PHP-DB] query string


Sorry I don't think I explained very well... heres my situation...

I have a mysql database set up... I have a user table with 2
fields...team_name and fant_week.

What I want to do is, depending on who is logged in, I want my link to
change the value of 'team' to the logged in members team name, like wise for
the week.

For example..
if gorno is logged in and his team is called fun team the link will
reflect his team and look like this...
fant_stnd3.php?week=1team=fun team

or if say... billbo is logged in and his team is called silly team the
link will look like this
fant_stnd3.php?week=1team=silly team

but again, my problem is that it's cutting off the team value when there is
a space in the string..



Grhan zen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Sun, 2003-06-01 at 22:26, Ian Fingold wrote:
  I'm trying to build a query string for one of my links.. for example...
  fant_stnd3.php?week=1team=fun%20team
 
  I need to be able to grab the values of 'week' and 'team' from an array,
I
  can do that no problem, but when the code runs it cuts off the value if
  there is a space in the string. so instead of putting fun team in the
  query string it cuts it off and just puts.. fun 
 
  So my question, is there a function or any way to prevent this from
  happening?
 
  thanks.

Hi Ian,
  I have no idea what you are trying to do.. Well if you are getting
 those values from a URL, $week and $team variables in your php script
 should have the values in them.. In later versions of PHP, they will be
 _POST['week'] and _POST['team'] or _GET['week'] or _GET['team']
 depending on which method is used.. You don't need to parse the URL and
 run them through an array.. :)
   Gurhan




--
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] Dealing with ENUM fields

2003-06-02 Thread Becoming Digital
I have a field in my database for which there are only four potential values
and, as such, I would like to use an ENUM field.  However, I can't find an easy
way to load the values of this field into a select form element.  Is there a
simple method for doing this or are the only solutions fairly complex?  I'm
simply trying to avoid using another table since it will contain only four
elements.  Thanks.

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] Dealing with ENUM fields

2003-06-02 Thread Becoming Digital
Thanks to both Heilo and Lisi.  These scripts should make things easier.

Is it safe to assume that we are in agreement about the use of an ENUM field for
this application?

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: heilo [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]
Sent: Monday, 02 June, 2003 05:11
Subject: Re: [PHP-DB] Dealing with ENUM fields


Hi!

there is a much shorter way to do this (which works with ENUM and SET):


$qry = 'SHOW COLUMNS FROM `gruzilla_content` LIKE module';
$res = mysql_query($qry);
if(mysql_num_rows($res)0)
{
$row = mysql_fetch_row($res);
$pattern = #(enum|set)\('(.+?)'\)#i;
$replace = '\\2';
$row[1] = preg_replace($pattern, $replace, $row[1]);
$options = explode(',', $row[1]);
}

$options now contains every value of the enum. I think there is also a
possibility to do this within a query - but currently i do not find the
script on my HD :) - so this is a nice workaround!

.ma


Lisi [EMAIL PROTECTED] [EMAIL PROTECTED] 11:53 Uhr:

 I am forwarding this useful function someone once sent to the list that I
 use often.

 Hope this fits your needs.

 -Lisi


 -Original Message-
 From: Russ [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 26, 2002 7:47 PM
 To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Populating a dropdown list with ENUM values...


 G'day Scott:

 I wrote this function to do just what you're atfer:
 You may need to mess with it for you're own needs - but go for your
 life!

 //function: enum_select() - automatically generate an HTML select
 menu from a MySQL ENUM field
 //1). takes a table name: '$table'
 //2). a name for the menu '$name'
 //3). a CSS class
 function enum_select($table,$name,$class) {
 $sql = SHOW COLUMNS FROM $table;
 $result = mysql_query($sql);
 $select = select name=\$name\ class=\$class\\n\t;
 while($myrow = mysql_fetch_row($result)){
   $enum_field = substr($myrow[1],0,4);
   if($enum_field == enum){
global $enum_field;
$enums = substr($myrow[1],5,-1);
$enums = ereg_replace(',,$enums);
$enums = explode(,,$enums);
foreach($enums as $val) {
 $select .= option
 value=\$val\$val/option\n\t;
 }//end foreach
 }//end if
 }//end while
 $select .= \r/select;
 return $select;
 }//end function


 All the best.
 Russ

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


Matthias Steinböck
Email: [EMAIL PROTECTED]
Web: http://www.abendstille.at

Frühabendliches Webdesign.
--
Im Übrigen sind wir der Meinung, dass
unsere Gesellschaft Gabel-diskriminierend
Löffel verwendet. Alle Macht den Gabeln!


--
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] functions IN the database.

2003-05-31 Thread Becoming Digital
Forgive me if I'm overlooking something, but why not just use a class?

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: Rolf Brusletto [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, 30 May, 2003 17:10
Subject: [PHP-DB] functions IN the database.


*This message was transferred with a trial version of CommuniGate(tm) Pro*
Hey all -

I'm curious if anybody has ever setup the logic to put php functions 
into a database here is my thinkin on it, hopefully I can get some 
suggestions on the benefits, downsides, etc.

(in mysql)

CREATE TABLE `functions` (`functionId` INT (5)  UNSIGNED DEFAULT '0' NOT 
NULL AUTO_INCREMENT,
`functionData` TEXT NOT 
NULL,
`functionDesc` TEXT, 
PRIMARY KEY(`functionId`), UNIQUE(`functionId`));

INSERT INTO functions(functionData, functionDesc)
VALUES('function echoNumber($number)
{ echo $number; }',
 'This function echos out a given $number');

(in php)
$sql = SELECT functionData
FROM functions;
$query = mysql_query($sql);
while($functionData = mysql_fetch_assoc($query)) {
eval $functionData[functionData];
};

This in theory **should initiate the given functions listed in the 
functions table, has anybody used anything like this? I have a two sites 
that I NEED to use the same functions and this is the first thing that 
comes to mind, plus it would allow for  gui editing  of or creating 
functions via a secured webpage.

Thanks on advance!

Rolf Brusletto
http://www.phpexamples.net


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





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



Re: [PHP-DB] Multiple inserts revisited

2003-05-30 Thread Becoming Digital
Yes, it does what I want, but perhaps not what I described.  My goal was to find
a way to add values to the actual query, which this does nicely.  Yours, thank
you very much, is even nicer. :)

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Ford, Mike [LSS] [EMAIL PROTECTED]
To: 'Becoming Digital' [EMAIL PROTECTED]; PHP-DB
[EMAIL PROTECTED]
Sent: Thursday, 29 May, 2003 08:00
Subject: RE: [PHP-DB] Multiple inserts revisited


 -Original Message-
 From: Becoming Digital [mailto:[EMAIL PROTECTED]
 Sent: 28 May 2003 23:38

 My other option, as I saw it, was to loop through the items,
 appending value
 data to the query text with each iteration.  If that seems
 cryptic, here's a
 basic idea of what I mean.

 ?
 $query = INSERT INTO specials VALUES (
 foreach ( $specials as $item ) {
 $query = substr_replace( $query, $item., , strlen( $query ) );
 }
 $query = substr_replace( $query, ), strlen( $query )-2 );
 ?

 If $specials was an array with the values spec1, spec2, and
 spec3, the final
 value of $query would be:
 INSERT INTO specials VALUES (spec1, spec2, spec3)

I'm actually slightly dubious that this query *does* do what you want, but if
you've double-checked it and it does, then this is a somewhat more compact way
of producing it:

  $query = INSERT INTO specials VALUES ( . implode(',', $specials) . ')'

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] - Shopping cart software

2003-05-30 Thread Becoming Digital
osCommerce
http://www.oscommerce.com

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: Mignon Hunter [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, 29 May, 2003 16:47
Subject: [PHP-DB] - Shopping cart software


Can anyone recommend shopping cart software; does not have to be open
source.  I need to set up pretty fast and be able to calculate the
different sales tax for anywhere, USA.  (International should be ok).

Already have cc processor lined up.

Any suggestions would be appreciated.

Thx

-- 
M Hunter


-- 
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] User auth system

2003-05-30 Thread Becoming Digital
Searching is good for you, just like exercise. :)

If you check the archives, you'll see a lot of posts recommending you visit the
PHP Classes Repository or the PEAR site.  If you're not sure where they are,
refer back to the first line.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Ronan Chilvers [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, 30 May, 2003 04:14
Subject: [PHP-DB] User auth system


Hi folks

Does anyone know of an OS user authentication and management framework (OS cos I
want to study the code!!!).  I'm in the process of putting together some
definitions and specs for an open source php/mysql project and need to develop a
robust and flexible user auth / validation system modelled somewhat on the linux
permissions model.

Does anyone know of a project that has a really good, secure user system?

Cheers

Ronan
e: [EMAIL PROTECTED]
t: 01903 739 997
w: www.thelittledot.com

The Little Dot is a partnership of
Ronan Chilvers and Giles Webberley

--
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] hotornot functionality

2003-05-29 Thread Becoming Digital
I agree with both Peter and Mengü, in a manner of speaking.  Assuming you want
visitors to return, I think it's best to use sessions and cookies so that
they're not served the same image twice.  Passing that information between pages
is easy with Peter's method.  Mengü's technique (albeit slightly altered) would
work well at storing that information for future use.

Storing this information is *very* important.  If users keep seeing the same
images, they won't return.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: Peter Beckman [EMAIL PROTECTED]
To: Matthew Horn [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, 28 May, 2003 10:29
Subject: Re: [PHP-DB] hotornot functionality


Uh, why not just do this:

input type='hidden' name='lastid' value='1930'

Then on the next page, you can get the id.  Or geez, it's gonna be there
anyway -- after you do the insert/update of your vote, just pass that ID to
the function that displays the page.

function display($x) {
if (!empty($x['vote'])) {
db_query(insert into vote (pid,vote) values
(.$x['thisid'].,.$x['vote'].));
}
$r = db_query(select * from pictures order by rand() limit 1);
$row = mysql_fetch_array($r); // sure, do error checking if you want
beginpage($x['thisid'],$x['vote']);
votebar($row['pid']);
echo img src='.$row['imgurl'].';
endpage();
}

assuming beginpage is responsible for displaying the last image you voted
on.

Peter

On Wed, 28 May 2003, Matthew Horn wrote:

 I am toying with the idea of implementing functionality similar to the
hotornot.com site -- for a different purpose, mind you, but the same kind of
user experience. Here's what it does:

 1. A picture is served up.
 2. User clicks on a radio button scale from 1 to 10 to rate the picture.
 3. The page refreshes. The rating is re-computed with the user's rating for
the original picture. The original picture becomes that last rated pic, and a
new one is served up.
 4. The user can cycle through as many pictures this way as they want.

 I have MySQL and PHP to work with.

 What I am trying to do is figure out the best approach to implementing it.
Specifically, when the user clicks on the radio button, that triggers the form
submit via JavaScript. The form submit updates the database with the rating and
then fetches the next row.

 The problem that occurred to me as I was putting together a prototype is:

 I don't want the user to get the entire result set of all the images in the
database at once. I really want them to get just the two images (the one they
just rated and the one they are about to rate). Is there a way to remember the
last row they selected and then use that number to fetch the next one on the
subsequent request? I can keep recycling hidden form fields with a number, which
should work ok, but the problems come up when they reach the last row.

 Anyway, just looking to see if you folks have some ideas. I would prefer to
roll my own rather than use one of the available hotornot-style PHP scripts to
do this.

 

 Matthew J. Horn

 --
 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] Multiple inserts revisited

2003-05-29 Thread Becoming Digital
The subject would lead you to believe that this is a check the archives post.
Worry not, I already did.  Besides, this is more informative than anything.

I'm working on a catalogue (menu, really) admin page from which a client will
set their daily specials.  My design calls for the user to select the day's
special items (already in the DB) with checkboxes.  Submitting the form will set
the selected items as the day's specials by inserting the item_id and date into
another table.  (This is done so that previous specials may be recalled later.
I don't see a need for it but the client requested the feature).

Regardless whether the items are inserted or simply updated, I was stuck on how
best to perform the operation.  My initial thought was to create an array of the
selected items and loop through it to insert or update the various items.
However, I don't like running nearly a dozen queries to perform the operation,
something this would entail.

My other option, as I saw it, was to loop through the items, appending value
data to the query text with each iteration.  If that seems cryptic, here's a
basic idea of what I mean.

?
$query = INSERT INTO specials VALUES (
foreach ( $specials as $item ) {
$query = substr_replace( $query, $item., , strlen( $query ) );
}
$query = substr_replace( $query, ), strlen( $query )-2 );
?

If $specials was an array with the values spec1, spec2, and spec3, the final
value of $query would be:
INSERT INTO specials VALUES (spec1, spec2, spec3)

This provides precisely what I need and reduces things to one query.  Let it be
noted that the actual script would be a bit more complex (associative arrays)
but the general structure is there.

I know that there have been a few multiple insert questions posted to the list
lately so perhaps this will prove helpful to those who asked.  If not, than
perhaps some of you can point out flaws in my design, should there be any.
Thanks for your time.

Edward Dudlik
Becoming Digital
www.becomingdigital.com






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