Re: [PHP-DB] password in md5 to connect to mysql instead of clear password

2005-02-28 Thread Jason Wong
On Monday 28 February 2005 18:44, Simon Rees wrote:
 On Sunday 27 February 2005 20:53, Micah Stevens wrote:
  I think about as safe as you can get is by putting the connection
  data out of the served directory, somewhere that's not directly
  accessable, and concentrate on system integrity. (security wise)

 A refinement of this technique is available on Unix boxes to which you
 have root access.
 Create a simple program that can read data about passwords etc. from a
 file. Create a file that can be read by the program you've written with
 the 'secrets' you want to keep secure in it. Make this file owned and
 readable only by root.
 Set the program owned by root, executable by everyone and suid.

If you don't need the flexibility of the custom program and would rather 
make use of existing infrastructure:

http://marc.theaimsgroup.com/?l=php-generalm=110137778213700w=2

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] password in md5 to connect to mysql instead of clear password

2005-02-28 Thread Jason Wong
On Monday 28 February 2005 19:33, Simon Rees wrote:

 You said in that post: Set default MySQL user and password in your
 virtual host container. Then connect to MySQL without specifying user
 and password.

 Presumably the file which contains the virtual host directive is
 readable by the process the webserver is running as - if not how does
 this work? 

When Apache starts up it does so as root and thus has the necessary 
privileges to read those files. After it has read all its config files it 
drops root privileges and assumes which whichever user you have 
configured httpd to run as.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] password in md5 to connect to mysql instead of clear password

2005-02-26 Thread Jason Wong
On Sunday 27 February 2005 07:11, Micah Stevens wrote:
 Well, yes, but as my key is never transmitted from client to server,
 it's safer. ;)

 I encrypt a connect request with my private key, which is can be
 unencrypted by the public key, but the server knows it's me because
 only the private key can make the encryption. The message is sent over
 the network, but none of the tools to create it or read it are.

The original question was concerning that if someone somehow had access to 
the file which stored the connections details then they would be able to 
use it to connect to the mysql server. Now if someone somehow had access 
to your key then it's game over for you. Unless you password protected 
your key which -- would be extremely impractical.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] password in md5 to connect to mysql instead of clear password

2005-02-25 Thread Jason Wong
On Saturday 26 February 2005 04:16, Micah Stevens wrote:

 I was just thinking that a better way to do this is with a
 public/private key set. Then it would be secure, but as someone else
 mentioned, you'd have to patch the source to make it work.

How would it be safer? Correct me if I'm wrong: if I have access to your 
key then I can connect.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] accessing mysql on non default port - windows

2005-02-05 Thread Jason Wong
On Sunday 06 February 2005 04:58, Jeff wrote:
 Hi.  I need to access mysql from windows to *nix on both the default
 port of 3306 and a secondary port of 3307.  php.ini states that win32
 will only pay attention to MYSQL_PORT. 

Just specify the port you want to use in mysql_connect().

 Is there a way to change the
 value of that constant without compiling my own version of php on
 win32. 

I think you're misunderstanding what those comments are saying. If you 
don't specify a port in mysql_connect() then PHP will try to use what is 
defined by mysql.default_port in php.ini. If mysql.default_port is not 
defined *then* it will start loking at other places (as detailed in the 
comments).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] accessing mysql on non default port - windows

2005-02-05 Thread Jason Wong
On Sunday 06 February 2005 07:59, Jeff wrote:

 Thats what i thought as well, but each time i attempt to use the port
 in mysql_connect, i.e. 'localhost:3307' or if i change the
 mysql.default_port = 3307  and just use 'localhost' in the server
 argument, i get

OK, but my understanding was that your mysql server is on *nix, and your 
problem was accessing it from a windows client. So you should not be 
using localhost?

 Warning: mysql_connect(): Client does not support authentication
 protocol requested by server; consider upgrading MySQL client - this
 using php 4.3.10, unfortunately i don't have the option of running 5.

This error has nothing (AFAICS) to do with the use port being used. The 
fact that you're getting this error indicates that the port being used is 
in fact correct and you have successfully managed to connect to the 
server. Google  the error message.

 Of course the *nix client works like a champ, but from all the
 searching, it seems that the constant MYSQL_PORT is a compile time
 argument.  

Yes, but like I said, if you specify a port then whatever MYSQL_PORT is 
irrelevant because it doesn't come into play.

 Have you succesfully connected from a php/mysql client to a mysql
 server running on 330[not 6]

All the time!

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] Storing JPEGS in MySQL

2005-02-02 Thread Jason Wong
On Thursday 03 February 2005 05:59, A Wood wrote:

 The image is resized like this, and as I say, this far its working fine...
 imagecopyresampled($image, $contents, 0, 0, 0, 0, $newxsize, $newysize,
 $orig_x, $orig_y);

 I then try to put it in the DB by passing the variable $image straight
 into an SQL query.  is that correct?

No, $image is the image resource handle ...

 The script executes fine with no errors, and there's something being put
 in the LONGBLOB field of the DB (Resource ID #3 it says when I look at
 it).

... and it this particular case your image resource handle has an ID of 3.

What you need is output buffering and imagejpeg(). If you're still stuck check 
out the umpteen working examples and tutorials available somewhere.

 The type field is set correctly by the upload script and is image/jpeg

 Again this script runs without errors but doesnt produce anything.

Yep, because you haven't stored anything resembling an image in the DB!

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] Table from an array?

2005-02-02 Thread Jason Wong
On Thursday 03 February 2005 05:41, Chris Payne wrote:

 Is it possible to create a database table from the first line of a CSV
 file? What I mean is, how would you create the table columns based on the
 CSV files columns? 

Parse the first line and extract the column names, construct a suitable SQL 
statement to create table?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] Auto Responses?

2005-01-23 Thread Jason Wong
On Sunday 23 January 2005 23:40, JeRRy wrote:
  I do support you too,  Jerry. People should either
  somehow exclude
  'php-db'/other mailing lists to be auto-replied to
  or they must keep
  off their auto-replies with themselves.

 Yes most mail systems allows you to exclude certain
 domains from getting a auto response.  Or if they own
 their own server they can do the same.

More specifically, smart autoresponders will not respond to mailing lists, 
bounces, etc.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] Auto Responses?

2005-01-23 Thread Jason Wong
On Monday 24 January 2005 02:13, Samar wrote:
 On Mon, 24 Jan 2005 01:56:03 +0800, Jason Wong [EMAIL PROTECTED] wrote:
  More specifically, smart autoresponders will not respond to mailing
  lists, bounces, etc.

 If they are some kind of extensions or plug-ins to email clients, I
 guess you could put up some more info on them to enlighten all of us
 and these out of office and on vacation to Hawai people.  :)

This is getting way off topic. I don't use any autoresponders on my mail 
client so I can't give any advice there (but I'm sure google can). I only use 
autoresponders on my mailserver. These look at the headers of the incoming 
mail to determine whether an autoresponse is appropriate. The autoresponders 
will also limit the number of autoresponses so that if eg your friend sends 
you 100 mails, they will not be told 100 times that you're having a whale of 
a time in Hawaii, it will only frustrate them and foment envy :).

So if your autoresponder doesn't have at least those 2 features, complain 
loudly, or find a better one (or a better mail client).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] mysql - image storing

2005-01-18 Thread Jason Wong
On Tuesday 18 January 2005 19:30, mel list_php wrote:

[snip]

 $donnees=stripslashes($row[donnees_binaires]);

[snip]

 -I tried different combinations with addslashes/stripslashes, trim in case
 of spaces, mysql_real_escape_string...

I haven't looked at your code in detail but stripslashes() should never be 
used on data retrieved from the DB (that is assuming your data was inserted 
correctly in the first place).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] mysql - image storing

2005-01-18 Thread Jason Wong
On Wednesday 19 January 2005 01:51, [EMAIL PROTECTED] wrote:
Jason, can you explain why stripslashes should not be used on data
  taken from the db? when you store data in the db i thought it was good
  practice to addslashes, when you retrieve from the db, you will need
  to use stripslashes to remove the extra \

 If I may step in...

 Assuming a MySQL db, using mysql_escape_string obviates the need for using
 either stripslashes or addslashes for db inserts and selects. I'm not sure
 of the underlying mechanism, but if you use mysql_escape_string on a
 string, the  \'s and' s, etc... all get escaped automagically before
 the insert. If you then take a look at the inserted data using the mysql
 client, you will see that the full unescaped text has been inserted. So
 there is no need to use stripslashes when selecting it out.

Additionally, it should be noted that whether you need to use stripslashes() 
on data retrieved from the database depends on the setting of 
magic_quotes_runtime. The recommended setting is to have it disabled which 
means you do not need stripslashes().

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] ssh tunneling with phpmyadmin

2005-01-10 Thread Jason Wong
On Tuesday 11 January 2005 11:39, Graham Anderson wrote:
 is it possible to ssh tunnel with phpmyadmin
 I want to access my remote db [on shared server] from my phpmyadmin on
 my laptop
 my ISP wonderfully disabled phpmyadmin's relational features :(

 seems a bit hard to find the info so I thought I would ask here :)
 I am using Mac OS X if it matters

Assuming you're able to SSH into the server from your laptop then run this on 
your laptop:

  ssh -fN [EMAIL PROTECTED] -L 13306:127.0.0.1:3306

Then configure your laptop's copy of phpmyadmin to access MySQL using address 
127.0.0.1 and port 13306.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] Trying to connext to MySQL with PEAR

2005-01-06 Thread Jason Wong
On Thursday 06 January 2005 23:41, Jason Davis wrote:
 Hi all I am new to PHP and am trying to connect to mysql for the first
 time. 

In that case I strongly suggest that you at least vaguely familiarise yourself 
with using the basic PHP-native mysql_*() functions first. Go through the 
examples in the manual, learn how to:

- connect to the server
- select a database
- perform some simple queries
- retrieve the results of the queries
- handle errors

Whilst doing that you will have also confirmed whether your connection 
parameters (username/password/hostname/dbname) are correct.

 I get activity on the mysql monitor when I run it,  

What is this monitor? Doesn't it give any clearer indication of what is 
failing? Because this ...

 but get the following error.
 DB Error: connect failed

... seems to be an error produced by your Pear DB class and isn't very 
informative at all. If you do the above and use mysql_error() you'll get a 
more precise error message.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] MySQL Auto PK

2005-01-06 Thread Jason Wong
On Friday 07 January 2005 02:29, Andrew Kreps wrote:

 This would be a great place for a stored procedure, but I don't know
 if I can recommend running MySQL 5 to you.  The most platform-safe way
 I can think of is to get a count(*) of the number of rows with today's
 date, add 1 to it, and stick that number on the end of the string
 you've created to insert into a varchar field.  It's an extra query
 per insert, but it'd do the job.

Don't forget to WRITE lock the table before counting, and only unlock after 
inserting the new id.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] Trying to connext to MySQL with PEAR

2005-01-06 Thread Jason Wong
On Friday 07 January 2005 03:12, Ford, Mike wrote:
 Oh dear, as a fully-paid-up pedant, I'm afriad I can't resist this one:

I'm afraid it's afraid ... :-)

 Doesn't affect the answer, but this occurrence of 'effect' should be
 'affect'. ;)

Yeah and it annoys me too when people mix up you're and your, and just to 
annoy the Americans, it's ensure and not insure!

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] $_GET of array variables

2005-01-05 Thread Jason Wong
On Thursday 06 January 2005 07:02, Jochem Maas wrote:

 now lets sing together: If in doubt print it out! :-)

Hey, you're using my trademark without my permission :)

google  If in doubt print it out

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] str_replace question

2005-01-05 Thread Jason Wong
On Thursday 06 January 2005 09:38, Chris Payne wrote:

 Im having a weird problem and Im not sure why, if I try to replace WHERE
 AND with just WHERE it wont do it, but if I try to replace WHERE or AND by
 themselves it WILL do it, but I cannot replace BOTH of them from a single
 string, is something wrong below?

 $additionalsql = str_replace(WHERE AND, WHERE, $additionalsql);

The code looks OK. Most likely that $additionalsql DOES NOT contain what you 
think it contains -- check case, check space.

 Basically Im trying to replace WHERE AND with just WHERE as Im building 
 a
 very complex SQL query and its a difficult one, and I have a solution that
 works perfectly but I need this to work in order to do it.

I'm pretty sure a simple if-clause somewhere would prevent the extraneous AND 
from appearing in $additionalsql.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] Removing first word from a string?

2005-01-03 Thread Jason Wong
On Tuesday 04 January 2005 10:46, Chris Payne wrote:

 I am building a dynamic MySQL query for a project I am working on, but
 there are instances where it products WHERE AND instead of WHERE city etc
 .. due to the nature of the system I am developing.  My question is, how
 can I remove the FIRST  AND from a string if it is present, but leave 
 all
 other AND statements in the string?

 I would really appreciate any help on this.  I can do a find and replace on
 a string no problem, but just want it to be removed IF it is the FIRST word
 in the string.

You can use preg_replace(), but the better solution would be to revise your 
logic so that you produce correctly formed SQL in the first place.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP-DB] semi-newbie | php, mysql RH Enterprise

2005-01-01 Thread Jason Wong
On Saturday 01 January 2005 23:26, Evan Cooch wrote:

 OK, so I do a bit of reading, and see that maybe what I should do is
 explicitly tell PHP where mysql is, during compilation. On this machine,
 whereis mysql yields

 mysql: /usr/bin/mysql /usr/lib/mysql /usr/include/mysql /usr/share/mysql
 /usr/share/man/man1/mysql.1.gz

 OK, so the mysql binary is in /usr/bin, and the library files are in
 /usr/lib. So, I try a recompile of PHP, using

 ./configure  --with-apxs2=/wwwroot/bin/apxs  --with-mysql=/usr/lib/mysql

 But, this bombs during configure - I get the following error message:

 configure: error: Cannot find MySQL header files under /usr/lib/mysql

 OK, so I try again, this time using --with-mysql=/usr/bin/mysql - no luck.
 Same message.

You need to install the mysql-devel package.

 So, how do I either (i) compile PHP (or tweak php.ini) to tell it to look
 in /var/lib/mysql for the mysql.soc file, or (2) tell mySQL to put the
 mysql.sock file somewhere else (like, presumably, /tmp, so PHP can find
 it)?

Did you actually look in your php.ini? Because there is an entry there just 
for this purpose.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
I'm all for computer dating, but I wouldn't want one to marry my sister.
*/

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



Re: [PHP-DB] semi-newbie | php, mysql RH Enterprise

2005-01-01 Thread Jason Wong
On Sunday 02 January 2005 00:14, Evan Cooch wrote:

 You need to install the mysql-devel package.

 Hmmm...OK. Why? (just for my understanding). Again, never had this problem
 with RH7.3...

The same situation exists with RH7.3 (and probably most/every version of Red 
Hat Linux), it's just probably that you never came across it. For reference, 
under Red Hat, most PHP extensions that you may wish to compile will require 
that you install the corresponding extension-devel package.

 I did, and saw several (many!) options related to mySQL, but wasn't sure
 what to do with them. The one that seems most related to the 'socket' issue
 is

 ; Default socket name for local MySQL connects.  If empty, uses the
 built-in ; MySQL defaults.
 mysql.default_socket =

 Do I simply change this to

 mysql.default_socket=/var/lib/mysql

That should point to the socket _file_ that is used by RH's implementation of 
MySQL. Do a locate/find mysqld.sock.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
I'm also pre-POURED pre-MEDITATED and pre-RAPHAELITE!!
*/

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



Re: [PHP-DB] semi-newbie | php, mysql RH Enterprise

2005-01-01 Thread Jason Wong
On Sunday 02 January 2005 05:44, Evan Cooch wrote:
 Jason Wong made several helpful suggestions to my earlier query - alas, non
 of them have panned out.

That's because you have more problems than you know. Basically it mostly boils 
down to RH putting things in non-default places.

 As per his suggestion, I went into php.ini and changed the default mysql
 socket to

  mysql.default_socket =/var/lib/mysql/mysql.sock

 Then, I rebooted the system, since I'm guessing changes to php.ini aren't
 dynamic (like everything else that parses a config file isn't).

Hmm, I see you're used to the Windows philosphy of rebooting everytime you 
move your mouse so that the changes can take effect. All you need do is 
restart Apache.

 But, this didn't work.  Two possible answers:

[snip]

 2) but, perhaps its simply because changes to php.ini aren't being read.

That explains why your changes to mysql.default_socket have no effect.

 In 
 fact, this might also be the case:  when I run info.php, I get the
 following for the mySQL bits:

 Active Persistent Links0
 Active Links0
 Client API version3.23.49
 MYSQL_MODULE_TYPEbuiltin
 MYSQL_SOCKET/tmp/mysql.sock
 MYSQL_INCLUDEno value
 MYSQL_LIBS   no value

 So, I have a look at the top bits from the info.php output. It tells me
 that the Configuration File (php.ini) Path is /usr/local/lib. Not /etc.
 But, copying php.ini from /etc to /usr/local/lib doesn't seem to have done
 the trick.

The output from phpinfo() will give the definitive location for where PHP 
expects to find its php.ini. Did you restart webserver? Search php-general 
archives for more info about php.ini.

 So, something more fundamental. And (tada) I think its because I have two
 versions of PHP on the machine. The old one (4.3.2-19ent) that comes with
 RH Enterprise, and the version I compiled from the PHP 4.3.10 tarball. I
 can confirm that I have 2 binaries.

 So, suggestions? I'm total confused by all this. I don't want to use 4.3.2,
 since its got a number of security issues that were corrected with
 4.3.10.  Should I simply re-install, but try to make sure PHP is NOT
 loaded, and then do it manually myself from the tarball? Or is there a way
 I can get everything to work with the 4.3.10 installation, and ignore the
 older 4.3.2?

Although not strictly necessary it is however strongly recommended that you do 
remove RH's PHP, and if you're feeling brave I suggest removing Apache too 
and install both from source, just follow the instructions in manual. And 
while you're at it you might as well ditch RH's MySQL and install MySQL's own 
RPMs. That way you can keep on top of all the updates that RH7.3 won't be 
having.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Using words to describe magic is like using a screwdriver to cut roast beef.
  -- Tom Robbins
*/

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



Re: [PHP-DB] semi-newbie | php, mysql RH Enterprise

2005-01-01 Thread Jason Wong
On Sunday 02 January 2005 04:55, Evan Cooch wrote:
   OK, so I try again, this time using --with-mysql=/usr/bin/mysql - no
   luck. Same message.
 
 You need to install the mysql-devel package.

 Actually, turns out it is installed already. So, that suggestion won't take
 care of the problem.

You're specifying the incorrect directory, it needs to point to the _header_ 
files which in the case of RH is simply

  --with-mysql=/usr

[Bonus tip, most extensions which needs a library will most likely be 
specified in the same way, ie /usr]

NB no matter which MySQL library you use (whether the PHP-bundled one or the 
MySQL one) it will have no bearing on your socket problem.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
I WILL NOT TEASE FATTY
I WILL NOT TEASE FATTY
I WILL NOT TEASE FATTY
I WILL NOT TEASE FATTY

 Bart Simpson on chalkboard in episode 5F05
*/

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



Re: [PHP-DB] how to connect new html page in PHP.

2004-12-25 Thread Jason Wong
On Saturday 25 December 2004 16:32, Zareef Ahmed wrote:

 $header=from:[EMAIL PROTECTED] \n\r\n\r;

The newlines should be \r\n and not \n\r.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Time goes, you say?
Ah no!
Time stays, *we* go.
  -- Austin Dobson
*/

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



Re: [PHP-DB] php4 + sqlite - quoting stuff

2004-12-25 Thread Jason Wong
On Saturday 25 December 2004 16:15, Peter Jay Salzman wrote:

 There's something I'm not groking about php's syntax.  When I look at how
 you're supposed to quote stuff in sqlite for php4:

  sqlite_query( $handle, 
   INSERT INTO course VALUES (
' . sqlite_escape_string($termcode). ',
' . sqlite_escape_string($semester). ',
' . sqlite_escape_string($course)  . ',
' . sqlite_escape_string($course_desc) . ',
' . sqlite_escape_string($college) . ',
' . sqlite_escape_string($reference)   . '
   )
  ) or die(Error bravo in query:  .
   sqlite_error_string(sqlite_last_error($handle)));

 it makes me want to cry.  Php should be prettier than Perl, not uglier.  We
 have single quotes, double quotes and a string quote function.

Perhaps if you understood what that oneliner was doing then you would 
appreciate it that a similar statement in any language would look, similar.

 How am I supposed to parse this?

How do you mean? It's PHP's job to parse.

 What's the purpose for all this quoting? 

OK for the SQL statement you need to construct a string that looks something 
like:

  INSERT INTO course VALUES ('valueoftermcode', ...)

The significant part is that you have single-quotes inside that string. so to 
make things easier for yourself you use double-quotes as your string 
delimiter:

  INSERT INTO course VALUES ('valueoftermcode', ...)

Now you could have used single-quotes as your string delimiter but then you 
would have had to escape the single-quotes that appear inside your string so 
it would look something like this mess:

  'INSERT INTO course VALUES (\'valueoftermcode\', ...)'

 And is there a _nicer_ way of doing this?

Yes, don't do oneliners. Rewrite like so:

  $sql_termcode = sqlite_escape_string($termcode);
  $sql_semester = sqlite_escape_string($semester);
  ...

  $sql = INSERT INTO course VALUES ('$sql_termcode', '$sql_semester', ...);
  sqlite_query( $handle, $sql) or die(Error bravo in query [$sql]:  .
sqlite_error_string(sqlite_last_error($handle)));

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
It's no use crying over spilt milk -- it only makes it salty for the cat.
*/

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



Re: [PHP-DB] how to connect new html page in PHP.

2004-12-25 Thread Jason Wong
On Saturday 25 December 2004 17:07, Zareef Ahmed wrote:
 On Sat, 25 Dec 2004 16:41:40 +0800, Jason Wong [EMAIL PROTECTED] wrote:
  On Saturday 25 December 2004 16:32, Zareef Ahmed wrote:
   $header=from:[EMAIL PROTECTED] \n\r\n\r;
 
  The newlines should be \r\n and not \n\r.

 Does it really make a diffrence?

Yes. Some of the security problems with Outlook stems from MS's strict 
non-compliance with the standards. And it takes just as much effort doing it 
incorrectly by using '\n\r' as it does doing it correctly using '\r\n' :)

Also if there is only a single header in $header then there is no need for 
'\r\n' at all. You only need it to separate multiple headers, and even then 
you should not use two sets of them, ie:

correct: \r\n
  incorrect: \r\n\r\n

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
The solution to a problem changes the nature of the problem.
  -- Peer
*/

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



Re: [PHP-DB] fopen

2004-12-23 Thread Jason Wong
On Thursday 23 December 2004 16:36, Yemi Obembe wrote:

 How can I get the file name of the home page of a url I opened with fopen()
  this way:

 $handle = fopen(http://www.example.com/;, r);

 ?

You can't. 

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
I'm wet!  I'm wild!
*/

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



Re: [PHP-DB] _POST, _GET, _REQUEST not working

2004-12-22 Thread Jason Wong
On Thursday 23 December 2004 03:12, Keane, Warren A FIN:EX wrote:

 You are a sharp one but alas that is not my real code. The real code for
 displaying var1 and var2 is:

Is there any reason why you originally posted bogus code and not your real 
code? When you post code, please make sure it's verbatim and is the actual 
code that you're having problems with.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
System going down in 5 minutes.
*/

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



Re: [PHP-DB] Redhat-MySQL Issues

2004-12-21 Thread Jason Wong
On Tuesday 21 December 2004 12:29, Nathan Mealey wrote:

 I am trying to get PHP (4.3.2) to connect to MySQL 4.1.8 on a Redhat AS
 3.0 server.

 I ran the command: up2date php-mysql

 And on the initial run-through, PHP connected to MySQL no problem. But
 then I changed something in the PHP.ini and the next time I ran a PHP
 to Mysql script, I got the following error message:
  Fatal error: Call to undefined function: mysql_connect()

 All I changed in the PHP.ini was the include path.

My guess is that that is not what you changed (or not the only thing you 
changed). If you're pretty sure that 'include_path' was the only thing you 
changed then just revert it back to what it was before.

 What could have happened? 

It doesn't know about your MySQL extension. You could have a look at the 
'extension_dir' setting to whether you had changed that accidently.

 I am so in the dark on how to fix this! 

If all else fails, extract a fresh copy of php.ini from one of the RPMs. Or 
ask someone on the RH mailing lists to send you one.

Oh, and next time you edit php.ini, make a backup!

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Sattinger's Law:
 It works better if you plug it in.
*/

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



Re: [PHP-DB] Looping within a string?

2004-12-16 Thread Jason Wong
On Friday 17 December 2004 10:33, Chris Payne wrote:

 Im having to send an email with looped results, but Im having problems. 
 I can send an email no problem, and this code works OUTSIDE of the string,
 but not inside, can anyone see what is going wrong?

Please explain what you are doing. A string is a string. Code doesn't execute 
inside a string. What else are you doing to the string?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Pardon this fortune.  Database under reconstruction.
*/

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



Re: [PHP-DB] Looping within a string?

2004-12-16 Thread Jason Wong
On Friday 17 December 2004 11:24, Chris Payne wrote:

Please do not top post.

 Well basically I have a list of items and their prices etc . which have
 to be sent via email, so I need to store the data in a string.  I THOUGHT I
 could execute the loop with all the elements (Such as table rows etc ...)
 inside a string, but I was wrong, so how can I store the data PLUS the
 table data into a string?

By 'data' I assume you mean data from the database and by 'table data' I 
assume you mean the HTML markup to output a table?

  $text = '';
  while ($row = mysql_fetch_array($sql_resultc)) {
$text .= 'some html markup' . $row['id'] . 'more html';
  }

Now stick $text somewhere in the body of your mail.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
 Professor: Oh, dear. She's stuck in an infinite loop and he's an idiot. 
   Well, that's love for you.
*/

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



Re: [PHP-DB] date conversions

2004-12-15 Thread Jason Wong
On Thursday 16 December 2004 14:00, neil wrote:

 I am needing to convert a d/m/y date such as 30/11/2004 into the format
 that mysql can use ie. 2004-11-20

 If I try the following:

 $testdate=30/11/2004;
 echo date(Y-m-d, strtotime($testdate));

 the result is - 2006-06-11

 I can't find any other function apart from strtotime to do this.

Use the string functions to manipulate it into the required format, explode() 
is one approach. If you're desperate search the archives, hundreds of 
variations of code to do this have been posted in the past. But it might be 
quicker to write your own than to hit upon the appropriate keywords to search 
for.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
If practice makes perfect, and nobody's perfect, why practice?
*/

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



Re: [PHP-DB] stumped-mail and database

2004-12-07 Thread Jason Wong
On Tuesday 07 December 2004 19:15, Stuart Felenstein wrote:
 --- Jason Wong [EMAIL PROTECTED] wrote:

Please be explicit, do you mean this what you get?:

  What happens when you do this:
 
  $to = $rsVendorJobs-fields('Conmail');
Call to a member function on a non-object

  echo $to;
Nothing, as $to is undefined (or ill-defined)

  echo $rsVendorJobs-fields('Conmail');
The contents of 'Conmail'

  $to = $rsVendorJobs-fields('Conmail');
Call to a member function on a non-object

  echo $to;
Nothing, as $to is undefined (or ill-defined)


Also just to be certain that you *are* running those lines of code change the 
echo $to, to echo Before $to  echo After $to or something.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
hard, adj.:
 The quality of your own data; also how it is to believe those
 of other people.
*/

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



Re: [PHP-DB] Checkboxes on repeat regions

2004-12-06 Thread Jason Wong
On Monday 06 December 2004 20:39, Stuart Felenstein wrote:

 --- Jason Wong [EMAIL PROTECTED] wrote:
  I'm not sure what you mean exactly by intended use
  checkboxes.

 Intended use - I generate a list (via a repeat region)
 of records.  Each item on the list has an associated
 checkbox. If I put a check in the box, do a $_POST I
 expect on the next page where Ive set up the correct
 parameters, to see the selected record only.

OK, so your intended use is to see the selected record(s?) (based on the 
checkboxes selected). Now your problem is not with the see selected record 
bit (I'm pretty sure you've got that sussed out), it is with how do I handle 
checkboxes. See below.

 Probably, but then again all questions posted here
 could be derived from the manual.

I would guess that 80% of the questions on the list could be answered with 
_direct_ reference to the manual(s). By direct reference I mean either 
searching the manual for the 1 or 2 _obvious_ keywords or looking in the 
_obvious_ section of the manual. For example, some people have asked how do 
I escape strings before inserting them into a mysql database, well one of 
the obvious place would be to look at the mysql section of the php manual, 
and if the asker had done that they would have seen that there are functions 
called mysql_real_escape_string() and mysql_escape_string(). That's why 
people should RTFM first, before even thinking of posting to the list!

Anyway ...

 So I set the value of the check box to:
 th height=38 scope=rowinput type=checkbox
 name=checkbox value=?php echo
 $rsRes-Fields('Rese'); ?/th

... there's your problem, all your checkboxes have the same name. PHP is not 
smart enough to automatically put them into an array, so if you check more 
than one checkbox PHP will either keep the first checkbox or the last 
checkbox (I don't know the exact behaviour (and don't care) but you can 
easily do some tests to find out should you wish).

 While it returns from the correct field it is not
 returning the correct record.  I read somewhere to
 name checkbox as an array.  checkbox[]
 Perhaps this is what I need to do.

Indeed, that is what the manual hints at, and what the articles will tell you 
to do.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Okay ... I'm going home to write the I HATE RUBIK's CUBE HANDBOOK FOR
DEAD CAT LOVERS ...
*/

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



Re: [PHP-DB] php5 and mysql_connect

2004-12-06 Thread Jason Wong
On Monday 06 December 2004 22:46, Norland, Martin wrote:

 No, PHP5 does indeed have some new (and different) functions for mysql,
 but it supports (properly, nothing old about it) the normal mysql
 functions as well.  The change for PHP5 is that it no longer enables
 mysql functions by default (you need to now compile it with
 --with-mysql), and it no longer bundles the client libraries.

AFAIK no version of PHP ever did compile with mysql by default. You *had* to 
use --with-mysql if you wanted mysql support. The choice was whether to use 
the bundled library (the default if you didn't specify a directory with 
--with-mysql) or some other library.

 From http://www.faqts.com/knowledge_base/view.phtml/aid/22154

   - MySQL support.  There has been some confusion with regards to the
 disabling of MySQL by default in PHP 5.  This simply means that in
 order to use MySQL you must explictly use --with-mysql just like
 you do with most every other extension. 

If this is where you got the above from, then maybe you would like to point 
out to them that it is incorrect (not that it matters to people using PHP5 -- 
but people using PHP4 might wonder why they don't have mysql support when it 
is supposed to be enabled by default).

Actually, reading it again, it doesn't explicitly say the versions of PHP 
older than PHP5 enabled by mysql by default. Maybe it is your interpretation 
and reading between the lines which led to your above statement :)

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
ultima netgod: My calculator has more registers than the x86, and
 -thats- sad
*/

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



Re: [PHP-DB] php5 and mysql_connect

2004-12-06 Thread Jason Wong
On Monday 06 December 2004 23:54, Norland, Martin wrote:

 Sorry this got a little toasty, but it sure felt like a blind attack,
 since the most cursory of checks revealed my statements true.

I'm sorry if you felt that that was an attack. Your honour, in my defence, I 
confess that I haven't really read the Installation section of the MySQL 
functions chapter of the manual since sometime near the end of the PHP 3 
development cycle. And I've always relied on ./configure --help to show me 
what the defaults are for the particular version of PHP I'm installing. In 
light of the mitigating circumstances I declare this a mistrial :)

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
BOFH Excuse #346:

Your/our computer(s) had suffered a memory leak, and we are waiting for them 
to be topped up.
*/

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



Re: [PHP-DB] Use of 'as' name in where sub-clause

2004-12-01 Thread Jason Wong
On Wednesday 01 December 2004 17:53, Ross Honniball wrote:

 If someone can give me a good reason why this is so, it will stop it
 annoying me so much.

I'm sure someone on the _MYSQL_ list will give you a jolly good reason or two.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Optimism is the content of small men in high places.
  -- F. Scott Fitzgerald, The Crack Up
*/

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



Re: [PHP-DB] PHP-HTML-select deny

2004-12-01 Thread Jason Wong
On Wednesday 01 December 2004 20:50, PHPDiscuss - PHP Newsgroups and mailing 
lists wrote:
 Hi, what can i do, where users can't select and copy my text from web-page.

Don't display any text. If they can see it they can copy it. If you're really 
determined, then use images instead of text. What are you trying to prevent?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Jacquin's Postulate on Democratic Government:
 No man's life, liberty, or property are safe while the
 legislature is in session.
*/

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



Re: [PHP-DB] PHP-HTML-select deny

2004-12-01 Thread Jason Wong
On Thursday 02 December 2004 00:37, denys wrote:

 wouldn't it be possible to display the text in a form text area and put
 it state to disabled ?
 But if someone really want your text he just have to rewrite it...

sigh

View source  copy  paste

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
It doesn't matter what you do, it only matters what you say you've
done and what you're going to do.
*/

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



Re: [PHP-DB] Using a loop on a result destroys array??

2004-11-24 Thread Jason Wong
On Wednesday 24 November 2004 20:31, Mark Benson wrote:

 From the above code,

Actually the above code would result in a parse error. There are no 
where-loops in PHP but there are while-loops. This is not being pedantic. If 
you're going to post code, make sure it's verbatim by using copy and paste 
your actual code. You want people to focus on your real problem and not on 
the mistakes you made in transcribing your actual code into your post.

 loop 2 returns a blank array, the output is simply 
 Array (). If I remove the loop (by commentiung it out) that extracts
 $crab the mysql $result array is suddenly full of the correct values. It
 seems to me that loop 1 is destroying or somehow not resetting $result.
 Very odd...

mysql_data_seek() is what you need. Or you can consider storing the results 
into an array the first time round then you can read results from the array 
whenever next you need it.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Business is a good game -- lots of competition and minimum of rules.
You keep score with money.
  -- Nolan Bushnell, founder of Atari
*/

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



Re: [PHP-DB] Using a loop on a result destroys array??

2004-11-24 Thread Jason Wong
On Wednesday 24 November 2004 23:02, Mark Benson wrote:

 You want people to focus on your real problem and not on
 the mistakes you made in transcribing your actual code into your post.

 I actually write (rather badly it would seem!) theoretical examples

Please don't construct theoretical examples. 

 that would (or in this case wouldn't!!) end in the same situation as the
 problem in my code (as I see it).

It's hard enough writing code that works without having to mess around with 
writing theorectical code that:

  doesn't work in the exactly the same fashion as another piece of code

Construct a stripped-down, bare-bones, *working* example that illustrates your 
problem. (Working in the sense that it is free from syntax and other errors 
that are not the focus of the problem).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Teachers have class.
*/

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



Re: [PHP-DB] PHP / Javascript question

2004-11-15 Thread Jason Wong
On Tuesday 16 November 2004 11:03, Chris Payne wrote:

 BUT because the tickboxes information is stored in a PHP Array called del[]
 I am having major problems getting it to work.  Does anyone know how to
 determine with javascript if any boxes are ticked, when the name for the
 box is an Array such as del[] ???

manual  PHP and HTML

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Stone's Law:
 One man's simple is another man's huh?
*/

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



Re: [PHP-DB] mysqldump

2004-11-09 Thread Jason Wong
On Tuesday 09 November 2004 17:59, Aaron Todd wrote:
 I have created a PHP script that looks like:

 ?php
   $filename = /var/www/html/db_backup_ . date(n-j-y)..sql;
   exec('mysqldump -u * -p* database  $filename');
 ?

 For some reason this doesnt work and I cant figure out why.  There is no
 error that comes back.  When I run the mysqldump command from the server
 console it produces the file fine.  I have read a few other posts out there
 about this same thing which resulted in the location the file was being
 saved.  But I have gone through my server and found nothing.  Does anyone
 have any suggestions for regarding this.

Try using double quotes.

Also just like performing SQL queries, it's a very good idea to build up the 
command you want executed, store it in a string ($cmd), then echo it to see 
whether it looks good, then exec($cmd).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Save the bales!
*/

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



Re: [PHP-DB] mysqldump

2004-11-09 Thread Jason Wong
On Tuesday 09 November 2004 19:12, Aaron Todd wrote:

Please do not top post (google  top post).

 I tried the double quotes but that didn't seem to matter. 

It does matter. 

 I also put the 
 command string in a variable and then am running the variable with exec.
 Still it doesnt work.

Splitting it up into 2 steps is to aid in debugging.

 $filename = /home/virtual/site341/fst/var/www/html/db_backup_ .
 date(n-j-y)..sql;
 $command = /home/virtual/site341/fst/usr/bin/mysqldump -u * -p*
 database  $filename;
 echo $command;

If what is being echoed looks OK then

 exec($command);

make use of the extra arguments to exec() (see manual) so that you can see 
what's being output.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
If you can survive death, you can probably survive anything.
*/

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



Re: [PHP-DB] Re: [EMAIL PROTECTED] November 2, 2004

2004-11-02 Thread Jason Wong
On Tuesday 02 November 2004 08:04, GH wrote:
 However, when other countries are in trouble or need something... who
 do they turn to? America

No country or government acts unless it is in their interests (perceived or 
otherwise) to do so. 

 Therefore everyone in the world has an interest in what happens in the
 american body politic just as Americans have an interest in what
 happens to the British Prime Minister and in parts of the British body
 politic.

It would be interesting if the rest of the world was able to partake in the 
American presidential elections. With the level of anti-incumbent president 
feelings around the world there'll soon be an ex-president.

It would be even more interesting to see what would happen if the upcoming 
Iraqi elections results in an anti-American pro-Islamist government. Would it 
then still be the beacon of hope that current administration keep 
espousing?

Now can we go back to discussing php and databases.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Fools ignore complexity.  Pragmatists suffer it.
Some can avoid it.  Geniuses remove it.
-- Perlis's Programming Proverb #58, SIGPLAN Notices, Sept.  1982
*/

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



Re: [PHP-DB] How to get unique entries?

2004-11-02 Thread Jason Wong
On Tuesday 02 November 2004 22:24, Chris Payne wrote:

 Im listing entries by date in a dropdown box, but on some days there are
 7-8+ dates the same, but I just need it to display each date ONCE in the
 dropdown, but for the life of me I cant remember the command to use to do
 this, can anyone please remind me?  I know it was dead simple, but cant
 remember the command.

google  sql unique

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
It is Fortune, not Wisdom, that rules man's life.
*/

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



Re: [PHP-DB] can i display an image _directly_ from postgres db storage?

2004-11-01 Thread Jason Wong
On Tuesday 02 November 2004 03:36, P. George wrote:
 i know that postgres has a raw binary datatype called bytea for storing
 pictures and whatnot, but i'm having trouble finding an example of
 displaying an image on a web page with php that is pulled directly from
 the database?

 is this possible?

Yes.

 if so, how?

Tutorials that shows how to upload and store image/binary files in a database 
also usually shows how to retrieve them (and in the case of images, also how 
to display them).

One function you'll find useful is

  imagecreatefromstring()

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
There are a lot of lies going around and half of them are true.
  -- Winston Churchill
*/

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



Re: [PHP-DB] Problems with mysql_num-rows()

2004-10-31 Thread Jason Wong
On Sunday 31 October 2004 18:32, Arne Essa Madsen wrote:
 I have the following problem:

 This one does not work:
  $query = SELECT * from user where name='$userid' and
 pass=password('$password');

print $query;

   $result = mysql_query($query, $link);

Use mysql_error().

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
An honest tale speeds best being plainly told.
  -- William Shakespeare, Henry VI
nly
*/

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



Re: [PHP-DB] Something wierd with time() and curdate()

2004-10-31 Thread Jason Wong
On Sunday 31 October 2004 22:45, Bobo Wieland wrote:
 There is something wierd going on over here...

 I have a date field, datum, in mysql that I cast to a timestamp and check
 against time(). If the datum value is more than one day old the table finds
 a new random row and sets the datum field to CURDATE(). Now, this has
 worked for two years now, but today the script suddenly finds a new random
 row each time the script is run... 

Would this line have anything to with it? If not, post some concise code (see 
below).

 mysql_data_seek($result, rand(0,$rows));


 I've notice this just after 11 pm today. 
 As I can see from some debugging time() allways returns a higher value than
 the timestamp + 86400... Have I missed something in this script for the
 last couple of years or is there a bug somewhere? Could it have something
 to do with the fact that we turned the time back one hour last night?

 This is the code btw:

Please *try* to isolate the problem and post CONCISE code which sufficiently 
illustrates your problem. For example (for this particular problem) if you 
suspect PHP is calculating the dates incorrectly then a few lines of code 
showing the date calculations would be sufficient. If you suspect MySQL is 
the culprit then a single query would be sufficient.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
There are things that are so serious that you can only joke about them
- Heisenberg
*/

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



Re: [PHP-DB] printer dialouge box

2004-10-30 Thread Jason Wong
On Saturday 30 October 2004 12:33, balwantsingh wrote:
 how i can open the printer dialouge box of browser in PHP.  pls. help.

You don't because you can't.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
It is a profitable thing, if one is wise, to seem foolish.
  -- Aeschylus
*/

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



Re: [PHP-DB] PHP Javascript

2004-10-30 Thread Jason Wong
On Saturday 30 October 2004 12:33, balwantsingh wrote:

 can anybody guide me how to embed php script into javascript. 

You can't.

 actually i am 
 using a function in  javascript and want that when this fuctions is called
 than some values to be stored in php session so that the values can be
 displayed in next page.

You can pass values from client-side using Javascript either via the URL 
($_GET) or form ($_POST) or cookies ($_COOKIE).  You can't manipulate the 
session variables directly.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Defeat is worse than death because you have to live with defeat.
  -- Bill Musselman
*/

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



Re: [PHP-DB] MySQL backup software

2004-10-27 Thread Jason Wong
On Wednesday 27 October 2004 13:57, Perry, Matthew (Fire Marshal's Office) 
wrote:
 Does anyone know a free MySQL backup program to schedule regular backups?

  www.mysql.com

  google  mysql mailing list

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Sigh.  I like to think it's just the Linux people who want to be on
the leading edge so bad they walk right off the precipice.
(Craig E. Groeschel)
*/

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



Re: [PHP-DB] Implementing search in a database driven website

2004-10-26 Thread Jason Wong
On Wednesday 27 October 2004 03:11, Vinayakam Murugan wrote:
 Thanks, Robby. This worked. However I wasn't able to get any
 documentation on the siU parameters used in the command as in

  $string= preg_replace('style[^]*.*/style'siU,'',$string);

 Any pointers.

manual  Regular Expression Functions (Perl-Compatible)  Pattern Modifiers 

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
General Protection Fault!  [ Ignore ]  [ Reboot ]  [ Install Linux ]

   -- From a Slashdot.org post
*/

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



Re: [PHP-DB] How to send a SID in a security way

2004-10-22 Thread Jason Wong
On Saturday 23 October 2004 01:00, Bart Baaten wrote:

 The session ID will always remain inside the session as long as you're in
 the session. http://www.php.net/manual/en/function.session-id.php
 You don't have to 'send' it, it's already there.

And to 'stay in the session', the session id has to be propagated from page to 
page whether by cookies, URL or form. In other words you *have* to send it 
one way or another.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Eating chocolate is like being in love without the aggravation.
*/

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



Re: [PHP-DB] how to connect to dbase

2004-10-15 Thread Jason Wong
On Friday 15 October 2004 19:11, Swapan Mazumdar wrote:
 I can't believe this, my problem doesn't attract any attention.
 But I am quite sure that everybody else besides me has more experience
 than me in this specific field.
 Anyone pl, is my question absurd or just impossible.

I may be wrong, but I can't believe that dbase is exactly popular amongst php 
users. Its lack of popularity could explain the lack of response.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
But scientists, who ought to know
Assure us that it must be so.
Oh, let us never, never doubt
What nobody is sure about.
-- Hilaire Belloc
*/

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



Re: [PHP-DB] DB will INSERT wont UPDATE..error in code?

2004-10-12 Thread Jason Wong
On Wednesday 13 October 2004 04:08, Matthew Kiehne wrote:

 database, however when i want to update the SQL query returns an output
 like this 'SQL statement = UPDATE badges
 (staff,ttlpst,mnthpst,ttlicon,mnthicon) VALUES
 ('1','1','1','/ribbons','/ribbons') WHERE fid=2' but when i try to pull the
 information from the database it hasnt updated, can someone help me out
 with this...im not sure why it wouldnt update even though the statement
 looks correct.

I don't see how you get the above output when $sql is defined like so:

  $sql = UPDATE badges SET staff = '.$HTTP_POST_VARS[staff].' ttlpst =
 '.$HTTP_POST_VARS[ttlpst].' mnthpst = '.$HTTP_POST_VARS[mnthpst].'
 ttlicon = '.$HTTP_POST_VARS[ttlicon].' mnthicon =
 '.$HTTP_POST_VARS[mnthicon].' WHERE fid = $fid;

echo $sql;

Make use of mysql_error().

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
There are three things I always forget.  Names, faces -- the third I
can't remember.
-- Italo Svevo
*/


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



Re: [PHP-DB] DB will INSERT wont UPDATE..error in code?

2004-10-12 Thread Jason Wong
Please do not top-post.

On Wednesday 13 October 2004 10:26, Matthew Kiehne wrote:
 sorry this is the output i meant to post
 SQL statement = UPDATE badges SET staff = '1' ttlpst = '1' mnthpst = '1'
 ttlicon = '/trophies' mnthicon = '/ribbons' WHERE fid = 61

 and this is the error i getyet i still cant for the life of me find a
 problem

 Update query = UPDATE badges SET staff = '1' ttlpst ='1' mnthpst = '1'
 ttlicon = 'trophies' mnthicon = 'medals' WHERE fid = 61Query3 failed: You
 have an error in your SQL syntax near 'ttlpst ='1' mnthpst = '1' ttlicon =
 'trophie' at line 3

If you look up the manual entry for UPDATE, you'll find that you're missing 
the commas separating the columns.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
I'm free -- and freedom tastes of reality.
-- The Who
*/

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



Re: [PHP-DB] Don't mean to be repetitive - Session Variables

2004-10-11 Thread Jason Wong
On Monday 11 October 2004 16:47, Stuart Felenstein wrote:
 I can't seem to figure this out.
 Right now I'm still trying to get the multi page form
 down.
 For the facts, running php 4.3.8, apache 1.3.x
 Register Globals are enabled

If you don't have a specific reason for this to be enabled you should disable 
it.

 So I'm starting the pages with:
 ?php
 session_start();
 ?

 Now since this is a form, the user creates the value
 for the variable, so within the form:

 input name=myname type=text id=myname
 value=?php echo $_SESSION['myname']; ?

 Question 1: is this enough to register the session
 variable ?

No. You should read (repeatedly if necessary)

  manual  Session Handling Functions

and try out the examples and understand what's going on.

Executive summary:

do not enable register_globals
$_SESSION['variable'] = 'something'; // to register a session variable

 If I send this form action post to a page where I
 have:
 ?php
 session_start();
 ?.
 ..
 ?php
 echo \$myname = .$myname.br/;
 ?

$myname is taken straight from your form, and because you have enabled 
register_globals it is available in the GLOBAL scope. That has nothing to do 
with your sessions.

 The variable print out fine.
 BUT - if I add another page between first and
 printout,
 echo \$myname = .$myname.br/; - returns nothing

1) understand the paragraph above
2) realise that at no stage have you actually registered any session variables
3) realise that you have not propagated $myform from page2 to page3 either 
through a form or through the URL

hence $myname is not available on page3.

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



Re: [PHP-DB] Don't mean to be repetitive - Session Variables

2004-10-11 Thread Jason Wong
On Monday 11 October 2004 19:42, Stuart Felenstein wrote:
 I think I found the correct way.  By registering the
 session variable in the next page is how they take.
 Form Page 1 -
 collect user input
 Form Page 2 -
 $_SESSION['name'] = $POST['myane'];

 This sound right?

Yes (aside from the typos above).

 I'm not sure if
 A) in the field area do i keep the value set as
 value=?php echo $_SESSION['MyName']; ? or is
 that where my mistake is happening ?

At this point $_SESSION['MyName'] is not defined (not registered, and even if 
it was registered you have nothing to put in it just yet) and hence setting 
your field value to it is meaningless.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
When you say I wrote a program that crashed Windows, people just stare at
you blankly and say Hey, I got those with the system, *for free*.
*/

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



Re: [PHP-DB] PHP compile error: Cannot find mysql header files

2004-10-10 Thread Jason Wong
On Monday 11 October 2004 09:49, andy wrote:

First, read manual  MySQL Functions

Second, decide whether you want to compile using the bundled MySQL library. If 
so the above tells all you need to know. If not you need to install the devel 
package for MySQL.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Be frank and explicit with your lawyer ... it is his business to confuse
the issue afterwards.
*/

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



Re: [PHP-DB] Addslashes / DB Sort

2004-09-27 Thread Jason Wong
On Tuesday 28 September 2004 02:49, Ed Lazor wrote:

 I'm using PHP to retrieve user input and store it in MySQL.  PHP's
 addslashes function is used on data going into the database

Use the more specific mysql_escape_string() (or friend) instead.

 and PHP's
 stripslashes function is being used on data coming from the database.

You're not supposed to use stripslashes() on data coming from the database -- 
read up on addslashes() and also search manual for magic quotes.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
The best way to hold a man is in your arms
-- Murphy's Laws on Sex n18
*/

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



Re: [PHP-DB] Question on Registration Method

2004-09-26 Thread Jason Wong
On Sunday 26 September 2004 19:45, Stuart Felenstein wrote:

 While I'm okay with mine, not completely satisfied.
 I'd like to change it to the type where like above the
 username and password is sent via email, but with the
 addition of a link in the email whereby the user must
 click on link to be activated.  You probably have
 seen this, but to spell it out - even though they have
 the user name and password it somehow is not good
 enough to login with until this activation takes
 place.

Can someone please enlighten me on what extra security this method provides 
over and above the following more simple methods:

- Send user a system generated password with which they can login and 
subsequently change.

- Send user an activation link which once clicked on would activate them and 
allow them to choose a password.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Believe everything you hear about the world; nothing is too impossibly bad.
-- Honor'e de Balzac
*/

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



Re: [PHP-DB] Question on Registration Method

2004-09-26 Thread Jason Wong
On Monday 27 September 2004 03:01, Stuart Felenstein wrote:
 How are they any different?

 I'm seeing the same thing as your method.

These two methods are separate:

  - Send user a system generated password with which
  they can login and
  subsequently change.

OR

  - Send user an activation link which once clicked on
  would activate them and
  allow them to choose a password.

What is the advantage in sending someone a password AND making them click on a 
link to activate?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
A countryman between two lawyers is like a fish between two cats.
-- Ben Franklin
*/

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



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

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

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

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

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

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

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

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



Re: [PHP-DB] New to the list

2004-08-29 Thread Jason Wong
Please use a _descriptive_ subject.

On Sunday 29 August 2004 19:35, Stuart Felenstein wrote:

 So, I dug around more and see for behaviour like this,
 typically you would need to use javascript.  The
 examples I've found are exactly what I want, only they
 use preformatted values and not the database / tables
 I wish to use.

Have php pull the data required, have php output the appropriate javascript 
code using the pulled data _instead_ of the 'preformatted values'.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Ada is PL/I trying to be Smalltalk.
-- Codoso diBlini
*/

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



Re: [PHP-DB] letting a table name be a constant

2004-08-23 Thread Jason Wong
On Tuesday 24 August 2004 08:18, Ben Galin wrote:

 You're right.  It doesn't run.  I retyped instead of copy-and-paste'd;
 that's a typo.

Please, when you post code make sure they're verbatim by using copy  paste. 
That way people can focus on your actual problem rather than on your typos.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
The Marines:
The few, the proud, the dead on the beach.
*/

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



Re: [PHP-DB]different heading

2004-08-19 Thread Jason Wong
On Thursday 19 August 2004 18:28, balwantsingh wrote:

 now my problem is that by default column name (of mysql table) is displayed
 as heading

You are in control of the HTML that goes into the webpage. You don't have to 
use the column names returned from the mysql query. So where's the problem?

If you insist, you can use something like:

  SELECT clumsy_column_name AS goodname FROM ...

Refer to MySQL documentation for more info.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Left to themselves, things tend to go from bad to worse.
*/

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



Re: [PHP-DB] Check Boxes

2004-08-18 Thread Jason Wong
On Wednesday 18 August 2004 20:07, Ford, Mike [LSS] wrote:

 $sql = 'SELECT ' . implode(', ', $chkboxes) . 'FROM form';
 
  Just note that with either solution, someone can post a value of *
  FROM table WHERE 1# and see everything in any table in your database.

 I was waiting for someone to come in with a security warning, but knew that
 whoever it was would express it much better than I could ;) -- so, a gold
 medal to John!!

The trouble is that it's a never ending task. Almost every question concerning 
sql queries and accepting info from POST, GET etc have security implications 
if data is not sanitised. Where do you begin? Where do you end?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Everything is worth precisely as much as a belch, the difference being
that a belch is more satisfying.
-- Ingmar Bergman
*/

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



Re: [PHP-DB] Tricky MySQL / php Script

2004-08-18 Thread Jason Wong
On Thursday 19 August 2004 09:23, Vern wrote:

 Basically what I'm trying to say is this. The following is my url:

 mypage.php?photoID=uploads/1052367746.jpguserID=215

  photoID =  uploads/1052367746.jpg
  userID   =  215

 I want to point to a record in a recordset.
 That records id is  uploads/1052367746.jpg
 However, I want to return all records for the userID 215.

 How do I point my recordset at that file in the recordset so that the user
 can go to the next and previous records in that recordset based on the
 user's id?

Assuming you have already created your 'recordset':

  loop through recordset looking for 'photoID'
  when found, use mysql_data_seek() to grab the previous and next records

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
No problem is so formidable that you can't walk away from it.
 -- C. Schulz
*/

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



Re: [PHP-DB] SMTP

2004-08-17 Thread Jason Wong
On Tuesday 17 August 2004 16:31, [EMAIL PROTECTED] wrote:
 I was guided to contact isp for smtp, however their configuration is
 applicable to outlook express.

John Holmes has already advised you to look on pear.php.net and 
www.phpclasses.org.

 How do I download my own smtp server for my machine.to configure with my
 php script.

 Any guidance,please.

Setting up an SMTP server is beyond the scope of this list (and indeed off 
topic). And even if you do successfully setup a mailserver, then depending on 
you internet connnection you may not be able to send mail anyway (your ISP 
may have blocked port 25) - thus you are forced to send your mail through 
your ISP's SMTP server.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
All things are either sacred or profane.
The former to ecclesiasts bring gain;
The latter to the devil appertain.
-- Dumbo Omohundro
*/

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



Re: [PHP-DB] SMTP

2004-08-16 Thread Jason Wong
On Tuesday 17 August 2004 14:07, John Holmes wrote:

  In the Outgoing mail (SMTP): field, change the number that displays to
  587.

 I guess 587 is the name of AOL's outgoing SMTP server for you? Change
 the below line in php.ini to reflect that, then.

  [mail function]
  ; For Win32 only.
  SMTP = localhost

 SMTP = 587

I believe the 587 is the port number to use.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
I have made this letter longer than usual because I lack the time to
make it shorter.
-- Blaise Pascal
*/

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



Re: [PHP-DB] I'm not getting any mailing list messages

2004-08-12 Thread Jason Wong
On Friday 13 August 2004 03:06, Peter Ellis wrote:
 nothing's been sent to it?  This is not a heavy traffic list.  I get
 maybe 4-5 messages a day from this one.

sarcam
  that's because all the php-db questions (and more) are handled over
  at php-general
/sarcasm

To the OP, if you want to check whether any messages have been posted to the 
list then have a look at the archives. Messages to the list will appear in 
the archives almost immediately.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
25. Nobody was using that file /vmunix, were they?

--Top 100 things you don't want the sysadmin to say
*/

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



Re: [PHP-DB] Re: Exporting Data From MySQL Using PHP

2004-08-09 Thread Jason Wong
On Tuesday 10 August 2004 11:34, Peter Ellis wrote:

 It has been my experience that you sometimes need to do backquotes (`)
 in MySQL queries when cutting/pasting into PHP -- it's the same key as
 the tilde (~) on my keyboard.  Try:

 $result = mysql_query(SELECT e_mail FROM subscriptionsdatabase WHERE
 `discipleship_mailing_list_e_mail_subscription` LIKE 'on');

The backticks (`) are only needed if:

(a) your column names uses (MySQL) reserved words (eg names of the builtin 
functions etc)

(b) you have spaces in your column names

Both (a) and (b) are rather bad and shouldn't really be used. Just use 
'friendly' column names and backticks will not be necessary.

 That should work.  I've always used the equal sign instead of LIKE, but
 that seems to be a matter of preference.

It is not a matter of preference, = and LIKE have different purposes. Refer to 
manual and/or some SQL tutorial for details.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Why won't you let me kiss you goodnight?  Is it something I said?
-- Tom Ryan
*/

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



Re: [PHP-DB] Last monday query question

2004-08-06 Thread Jason Wong
On Friday 06 August 2004 05:33, Adrian Madrid wrote:
 How do you select all articles from last monday on (and that I can use
 that query today and always too)? I've been trying to figure out how to
 do this query but so far all I can do is create a /very /long query and
 it doesn't seem to work all the time. Any ideas?

Use strtotime() and maybe PHP's other date/time functions then plug into your 
query.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Slous' Contention:
If you do a job too well, you'll get stuck with it.
*/

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



Re: [PHP-DB] Re: sendmail

2004-08-04 Thread Jason Wong
On Wednesday 04 August 2004 20:47, Aaron Todd wrote:

 I dont know how to be more specific.  It just doesnt work.  There is no
 error.  The program runs and sometimes it sends the email and sometimes it
 doesnt.  I've looked at all the log files that I know about and havent seen
 anything that looks like an email error.  

all the log files that I know about does not tell us anything at all. Please 
state *which* log files you looked at.

 Is there any other
 troubleshooting that I can do to get more information on what I am doing?

The most useful thing to look at would be the mail logs. That would tell you 
whether a mail was injected into the queue.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Tact is the ability to tell a man he has an open mind when he has a
hole in his head.
*/

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



Re: [PHP-DB] Re: LAMP

2004-08-03 Thread Jason Wong
On Tuesday 03 August 2004 14:14, Lester Caine wrote:

 I want LAFP but LAPP seems still to be more popular on Linux.

 WHY does everybody run lemming like after MySQL. It STILL has to catch
 up with the better FREE database engines ;)

It depends on your needs. For simple storage of data (involving few 
relationships) then MySQL is more than sufficient and a tried and tested 
solution. This probably covers the vast majority of the data storage needs of 
web apps. No sense in going for a DB with features you're never ever going to 
use and is probably slower to boot.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Experience is what you get when you didn't get what you wanted.
*/

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



Re: [PHP-DB] Re: LAMP

2004-08-03 Thread Jason Wong
On Tuesday 03 August 2004 15:34, Lester Caine wrote:

  It depends on your needs. For simple storage of data (involving few
  relationships) then MySQL is more than sufficient and a tried and tested
  solution. This probably covers the vast majority of the data storage
  needs of web apps. No sense in going for a DB with features you're never
  ever going to use and is probably slower to boot.

 Ever tried?

What? To use features that I'm never ever going to use? Or?

 I have always used Interbase and now Firebird. It has useful things like
 triggers and stored procedures. These are implemented in the database
 engine, so do not need all the miles of additional code I find in many
 MySQL examples that are provided.

If your app can benefit from triggers and stored procedures then, yes, 
Firebird might be a good choice for you. But try selling the advantges of 
Firebird over MySQL to someone who just wants a simple database to store data 
for their guestbook.

Just because someone wants MySQL it doesn't automatically make them a lemming. 
Their rationale for using MySQL could include:

 - MySQL being adequate for their needs
 - An app they want to use only supports MySQL
 - Their host only supports MySQL

 SQLite is a different matter and the obvious new base for beginners, but
 for real applications ...

Use Postgresql!

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
The rate at which a disease spreads through a corn field is a precise
measurement of the speed of blight.
*/

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



Re: [PHP-DB] Re: LAMP

2004-08-03 Thread Jason Wong
On Wednesday 04 August 2004 02:10, Lester Caine wrote:
 Gary Every wrote:
  The answer to that is SPEED. Nothing short of Oracle comes even
  close

 You must have a big cheque book.
 I get just as fast a system without having to pay a penny over the cost
 of the hardware ;)

Hmm, if I'm not mistaken, I think he means that *unless* you have a big cheque 
book to pay for Oracle then MySQL is the next fastest thing around.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
I saw Lassie.  It took me four shows to figure out why the hairy kid never
spoke. I mean, he could roll over and all that, but did that deserve a series?
*/

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



Re: [PHP-DB] Enabling LDAP support

2004-08-02 Thread Jason Wong
On Monday 02 August 2004 21:27, Philip Thompson wrote:

 Sorry to bug you again. But I thought I would throw this out here again
 and see if anyone has any input. It would be greatly appreciated.

Yes, second time you post about this problem, yet ...

 I am running PHP on a Windows 2000 Server, and I need to enable LDAP
 support. So I have viewed the
 http://us3.php.net/manual/en/ref.ldap.php page on how to get LDAP
 running. However, I have run into a snag.

... you're still keeping it a secret as to what your snag is.

 I have copied the two required .dlls (libeay32  ssleay32) into the
 system folder. I also put the configuration option 'ldap.max_links =
 -1' in my php.ini file. Is there anything else I need to add to the
 .ini file? I tried uncommenting the extension for php_ldap.dll,
 thinking that that might make it work... but it didn't.

So HOW didn't it work? 

 Anyone have any suggestions b/c I'm stuck?

1) post some *concise* code that illustrates your problem

2) state exactly what and how it is not working

3) post any error messages that you get (having first made sure that FULL 
error reporting is enabled).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Hello again, Peabody here...
-- Mister Peabody
*/

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



Re: [PHP-DB] Re: form results to email

2004-07-31 Thread Jason Wong
On Saturday 31 July 2004 23:25, Vincent Jordan wrote:

 I have tried to add some html such as strong$firstname $lastname
 /strong...; however when I do this there is nothing displated in
 the email message.

google  html mime message

Or look on www.phpclasses.org 

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
The world does not revolve on an axis
-- Murphy's Laws on Sex n52
*/

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



Re: [PHP-DB] Empty query result

2004-07-26 Thread Jason Wong
On Tuesday 27 July 2004 00:57, Philip Thompson wrote:

 Here's my function:

 function getMysqlSelectResultForUsername($identifier, $userName, $link)
 {
  $queryResult = mysql_query(select $identifier from theTable where
 username = '$userName', $link);

  if (!($queryResult = mysql_result($queryResult, 0))) {
  session_register('_selectIdentifierFromTheTable');
  header(location:error.php);
  exit;
  }

  return $queryResult;
 }

 Here's the code that calls it:

 $hall = getMysqlSelectResultForUsername('buildingID', $_userName,
 $link);
 $roomNum = getMysqlSelectResultForUsername('roomNum', $_userName,
 $link);
 $phone1 = getMysqlSelectResultForUsername('phone1', $_userName, $link);
 $phone2 = getMysqlSelectResultForUsername('phone2', $_userName, $link);
 $lastLogin = getMysqlSelectResultForUsername('lastLogin', $_userName,
 $link);

What you're doing is extremely inefficient. You could do in a single query 
what you're currently doing in 5 queries. Use a query like:

  SELECT col1, col2, col3, coln, FROM table WHERE colx = 'something'

Then use mysql_fetch_row() or siblings to get the column contents.

 If the mysql_result($queryResult, 0) returns zero/nothing, then it goes
 to the 'error.php' page. However, I just want it to move on. For
 example, if there is no 'phone2' given in the database, I want it to
 just assign $phone2 to zero/nothing, not go to the error page.

Well you wrote the code so that it will go to the error page.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
If little green men land in your back yard, hide any little green women
you've got in the house.
-- Mike Harding, The Armchair Anarchist's Almanac
*/

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



Re: [PHP-DB] DB access failure...

2004-07-24 Thread Jason Wong
On Saturday 24 July 2004 15:24, \[php\]Walter wrote:

 That's what I thought. so I tried this test using PHP functions...

mysql_connect($db_host, $db_user, $db_pass)

 I get this...

 Warning: mysql_connect(): Unknown MySQL Server Host 'db.torres.ws'

Well that sounds like something, somewhere is not using the system's DNS 
resolve mechanism. As I don't have a Windows box handy I'm afraid I cannot 
help you.

 Sometimes things are not done for practical purposes.

Right.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Who is General Failure and why is he reading my hard disk ?
Microsoft spel chekar vor sail, worgs grate !!
(By [EMAIL PROTECTED], Felix von Leitner)
*/

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



Re: [PHP-DB] DB access failure...

2004-07-23 Thread Jason Wong
On Saturday 24 July 2004 10:25, \[php\]Walter wrote:

 So, your saying that if the name is in the HOSTS file and it still does not
 work I should not try anything further and just use the IP?

Does:

  ping hostname.as.listed.in.hosts.file

correctly resolves to the IP address as listed in the HOSTS file? If it does 
then you probably haven't setup the permissions correctly in MySQL. You need 
to use the GRANT command to allow connections from [EMAIL PROTECTED] See 
MySQL docs for info.

If your IP address is not going to change over time then for practical 
purposes there will be no difference whether you connect using IP address or 
hostname.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
It is not every question that deserves an answer.
-- Publilius Syrus
*/

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



Re: [PHP-DB] What's wrong with this QUERY??

2004-07-22 Thread Jason Wong
On Friday 23 July 2004 10:57, Harry G wrote:

 I have a database with members details and PK is id.

 $thing = [EMAIL PROTECTED];

 $query = SELECT id, email, familyname FROM members WHERE email=$thing;

  $query = SELECT id, email, familyname FROM members WHERE email='$thing';

Please refer to some SQL primer to learn the basics of SQL.

 $result = mysql_query($query);

Look at the examples in the manual to see how you can incorporate error 
checking into your code. In particular look at mysql_error().

 If i do a query where id=$thing.
 and $thing=20;
 this works fine and I get the desired result. But what is wrong with the
 other one, when I do search for the email address??

Because your 'id' column is numeric and 'email' column is text. Text columns 
needs their values enclosed by quotes.

 The email address does exist exactly as quoted above in the email field
 in my members table but still doesn't produce any results.

mysql_error() would let you know that there was an error in your query.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
I don't wish to appear overly inquisitive, but are you still alive?
*/

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



Re: [PHP-DB] Wait Statement... ?

2004-07-20 Thread Jason Wong
On Tuesday 20 July 2004 16:56, ..: GamCo :.. wrote:

 ok, i added the sleep() function in my page. what i'm basically doing is :-

 i have a .php page where people log-in from. from there i send the form to
 another .php page that actually checks the login and registers a session
 with the username and password as session variables. then on the page that
 actually does the validation, i have something that says : validating
 login... sleep 1 funtion. then, i have another line that says validation
 successfull... sleep 1 function and then i have another line that says
 redirecting... with sleep 1 function and then header redirects to the
 actual logged-in.php file. the redirect and validation works perfectly as
 well as the sleep functions, but it now doesn't display the validating
 login... blah blah blah stuff which is done in normal html code...

WHy don't you just validate the login and be done with? Why wait 1 second, 
another second, ... ?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
There are no accidents whatsoever in the universe.
-- Baba Ram Dass
*/

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



Re: [PHP-DB] howto get PK id after INSERT??

2004-07-20 Thread Jason Wong
On Tuesday 20 July 2004 19:49, Vincent Jordan wrote:
 I think I got it correct got the most part. I am having a problem with
 the urlencode function I believe.

 On page CustomerAddNew1.php ( page than handles form data ) im using:

 $last_id = mysql_query(SELECT LAST_INSERT_ID() from customerinfo);

mysql_query() returns a resource id.

 $last_id = urlencode ($last_id);
 header(Location: UserMain.php?custid='$last_id');

So the above is meaningless.

Please check the previous responses where you have been pointed to a more 
appropriate function to use.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
It's multiple choice time...

What is FORTRAN?

a: Between thre and fiv tran.
b: What two computers engage in before they interface.
c: Ridiculous.
*/

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



Re: Re[2]: [PHP-DB] Wait Statement... ?

2004-07-20 Thread Jason Wong
On Wednesday 21 July 2004 05:00, Pablo M. Rivas wrote:

sleep() is the brute deffense of the brute force attack...
You can make a script that opens simultaneous attacks

One thing to bear in mind is that sleep() will hog resources and can lead to 
DOS.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
He's dead, Jim.
-- McCoy, The Devil in the Dark, stardate 3196.1
*/

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



Re: [PHP-DB] Concurrent rutines

2004-07-20 Thread Jason Wong
You have started a new thread by taking an existing posting and replying to
it while you changed the subject.

That is bad, because it breaks threading. Whenever you reply to a message,
your mail client generates a References: header that tells all recipients
which posting(s) your posting refers to. A mail client uses this information
to build a threaded view (tree view) of the postings.

With your posting style you successfully torpedoed this useful feature; your
posting shows up within an existing thread it has nothing to do with.

Always do a fresh post when you want to start a new thread. To achieve this,
click on New message instead of Reply within your mail client, and enter
the list address as the recipient. You can save the list address in your
address book for convenience.

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



Re: [PHP-DB] howto get PK id after INSERT??

2004-07-19 Thread Jason Wong
On Tuesday 20 July 2004 10:09, Vincent Jordan wrote:

 Is there a way to get the ID (custid PK UNIQUE AUTO_INCREMENT) from
 mysql after INSERT then pass to final page using urlencode to pull cust
 record?

manual  MySQL Functions

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
I used to think that the brain was the most wonderful organ in
my body.  Then I realized who was telling me this.
-- Emo Phillips
*/

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



Re: [PHP-DB] DB access failure...

2004-07-19 Thread Jason Wong
On Tuesday 20 July 2004 13:16, \[php\]Walter wrote:
 I have a mySQL DB running on an NT server.

 $db_host   = 'db.myserver.net';

 Now, if I change $db_host to the machine IP, it works fine.

If db.myserver.net does not resolve to a sensible IP address add it to your 
HOSTS file. Or setup your DNS properly. Or just use the IP address.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
If you think something is important, no one else will. 
-- Murphy's Laws for Researchers n2
*/

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



Re: [PHP-DB] Help. Mysql Query optimisation not very clever?

2004-07-16 Thread Jason Wong
On Saturday 17 July 2004 09:31, Ross Honniball wrote:
 Attention all Sql gurus,

 Is there a way to FORCE mysql resolve specific conditions within a query
 before wasting it's time trying to resolve other conditions?

  www.mysql.com

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
All I can think of is a platter of organic PRUNE CRISPS being trampled
by an army of swarthy, Italian LOUNGE SINGERS ...
*/

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



Re: [PHP-DB] Easy reg expression problem

2004-07-16 Thread Jason Wong
On Friday 16 July 2004 16:01, Tim Van Wassenhove wrote:
 In article [EMAIL PROTECTED], Jason Wong wrote:
  On Friday 16 July 2004 08:05, Justin Patrin wrote:
   If you're simply trying to get '@email.com' then use strstr().
 
  Of courseI'm just so used to pregs...
 
  Well the advantage of using a regex is that you can perform some form of
  validation on the address.

 And in the end compare your regular expression with the one at:
 http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html

That's why I qualified my statement by saying some form of. Anyway, in 
general using a regex as opposed to a straight string function will allow 
some form of data validation.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
What we Are is God's gift to us.
What we Become is our gift to God.
*/

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



Re: [PHP-DB] Easy reg expression problem

2004-07-15 Thread Jason Wong
On Friday 16 July 2004 08:05, Justin Patrin wrote:

  If you're simply trying to get '@email.com' then use strstr().

 Of courseI'm just so used to pregs...

Well the advantage of using a regex is that you can perform some form of 
validation on the address.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Never mind the bullet with your name on it, try to avoid the shrapnel 
addressed to occupant
-- Murphy's New Military Laws n4
*/

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



Re: [PHP-DB] session_start

2004-07-15 Thread Jason Wong
On Friday 16 July 2004 08:15, Steve Butzel wrote:

 It appears that Apache/PHP still thinks the session.save_path is /tmp, even
 though I changed this in php.ini-recommended and php.ini-dist. **What am I
 doing wrong?**

Firstly, to see what your settings really are, use phpinfo(). Secondly, when 
you use phpinfo() you will see that the ini file you need to edit is called 
php.ini. Note the path and edit that file, if it's not there then copy one of 
php.ini-* there.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Okay ... I'm going home to write the I HATE RUBIK's CUBE HANDBOOK FOR
DEAD CAT LOVERS ...
*/

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



Re: [PHP-DB] mysql auto increment

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

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

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

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

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

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

 1001, then 1002, 

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

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



Re: [PHP-DB] Table locking

2004-07-08 Thread Jason Wong
On Friday 09 July 2004 07:09, Rosen wrote:
 Is thath mean, thath, when one user is addind records to table, and lock
 it - when another user is trying to get the max field value for some field,
 the script will waiting the first user to unlock table and then to see the
 max value of some field in a table ?

Depends on what type of LOCK you specify. Refer to your DB docs for details.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
I'm so broke I can't even pay attention.
*/

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



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

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

 What am I doing wrong...?

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

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

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

AFAICS ...

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

would give a mysql error. The correct syntax is:

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


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

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

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



Re: [PHP-DB] [PHP]: session problem

2004-06-24 Thread Jason Wong
On Thursday 24 June 2004 23:43, H. J. Wils wrote:

[snip]

$_SESSION['logged_in'] = true;
$_SESSION['sid'] = $sid;
$_SESSION['user'] = $uid;

$dt = date(Y-m-d H:i:s);

You should always session_write_close() before you redirect.

  header(location: user.php?action=0);

You should be using an absolute URI rather than a relative one.

And just to be safe always have an exit() right after your redirect header(s).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
It is a hard matter, my fellow citizens, to argue with the belly,
since it has no ears.
-- Marcus Porcius Cato
*/

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Fun Facts, #14:
In table tennis, whoever gets 21 points first wins.  That's how
it once was in baseball -- whoever got 21 runs first won.
*/

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



Re: [PHP-DB] value error in PHP form

2004-06-24 Thread Jason Wong
On Thursday 24 June 2004 18:07, Rinku wrote:

 I had written the code :
 if(isset($_POST['Variable1'])isset($_POST['Variable2']))
 {
   Print Rinku;
 }
   Here, even if variables are not set then even I am getting Output as
 Rinku.

Some form elements, eg input type=text ..., are always isset() even when 
you haven't entered anything into them. If you want to check that something 
has been entered into them then use:

 if (!empty($POST['doo'] ...

but depending on what type of inputs your application accepts you may have to 
do further tests.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
QOTD:
Don't let your mind wander -- it's too little to be let out alone.
*/

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



Re: [PHP-DB] adding a mysql query as text into a history table... ?

2004-06-23 Thread Jason Wong
On Wednesday 23 June 2004 17:14, Gawie Marais wrote:

 i would like to add the whole query into a text field in the 'history'
 table, but i get errors when i try to add it... can anyone help ?

 this is the error :-

 Invalid query: You have an error in your SQL syntax near '2004-06-23
 11:09:57', date_modified = '-00-00 00:00:00', date_closed =' at line 6

You'll need to escape the string containing the query before you can insert 
it.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
If you always postpone pleasure you will never have it.  Quit work and play
for once!
*/

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



  1   2   3   4   5   6   7   >