[PHP-DB] Do the included PHP MYSQL calls work with MYSQL 4

2003-07-25 Thread Richard
I have recently built PHP 4.3.2 using the --with-MySQL, but heard a 
rumor that the PHP built in libraries to MySQL are old and not 
completely compatible with MySQL 4. Does anyone out there know if this 
is not a concern...does the built in MySQL interface in PHP 4.3.2 work 
with MySQL or do I need to go another route.

Thanks in advance...

- Richard

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


[PHP-DB] MySQL and PHP?

2003-08-14 Thread Richard
Hello

I hope this is a rumour but I heard that MySQL is now fully GPL which it
wasn't earlier.
I think the part used to communicate with the mysql server was lgpl. Does
this mean that
when using php with mysql your php scripts have to be licensed under the gpl
as well if
released?

If this is the case what other free sql databases are there that can be used
with php?

Thanks for reading.



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



Re: [PHP-DB] Unsubscribe me please

2012-09-20 Thread Richard
Me too

Sent from my iPad

On Sep 19, 2012, at 9:18 PM, "Michel BUYSE"  wrote:

> Unsubscribe me too m...@marvol.be
> 
> -Oorspronkelijk bericht-
> Van: Paul Clark [mailto:p...@leckytech.com] 
> Verzonden: donderdag 20 september 2012 7:13
> Aan: php-db@lists.php.net
> Onderwerp: Re: [PHP-DB] Unsubscribe me please
> 
> Unsubscribe me too leckyt...@gmail.com
> 
> On 19 September 2012 23:43, Graham H.  wrote:
> 
>> Hi,
>> 
>> I tried unsubscribing from the list, but I was unsuccessful, I believe 
>> because when I subscribed I cleverly added +php to the end of my email 
>> address (for Gmail filtering).
>> 
>> Could I be removed please? Thanks.
>> 
>> --
>> Graham Holtslander
>> Computer Systems Technologist
>> www.graham.holtslander.com
>> mene...@gmail.com
>> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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



Re: [PHP-DB] Code Security

2015-02-05 Thread Richard


 Original Message 
> Date: Thursday, February 05, 2015 13:10:51 +
> From: Richard Quadling 
> To: E Rosenberg 
> Cc: PHP Database List 
> Subject: Re: [PHP-DB] Code Security
>
> On 5 February 2015 at 05:52, Ethan Rosenberg <
> erosenb...@hygeiabiomedical.com> wrote:
>> 
>> How do I prevent someone from opening a terminal window, going to
>> /var/www and stealing all my code?
>> 
> 
> 1 - Don't allow terminal access to your box.
> 2 - Use a PHP byte code encoder (IonCube, Zend Guard) - not
> perfect as they can be reversed to access the code in a form.
> 3 - Don't use PHP.

>  -- 
>  Richard Quadling


As Richard [Q...] implies, the only people who are going to be able
to "open[ing] a terminal window" to your site are those you've given
that level of access to. A "user" only has access to the
server-parsed php files (whether they are using a browser or
telnetting directly to port 80). They don't have filesystem access.

Now, if you have open/poorly secured ftp/sftp/scp/telnet/ssh ...
access, someone who can utilize that route will have fairly
unconstrained access to your site and its contents. However, that's
basic access control security and not a php-specific issue.

If it's contractors/co-workers who have filesystem access to the
site, in order to manage content, then you have a trust issue. 

If your concern is with others "on the site" (e.g., a shared hosting
environment) then you have a basic hosting security issue, and
problems well beyond the control/scope of anything php. 



- Richard




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



Re: [PHP-DB] Code Security

2015-02-06 Thread Richard


 Original Message 

>> On Feb 5, 2015, at 8:24 PM, Ethan Rosenberg
>>  wrote:
>> 
>>> On 02/05/2015 11:04 AM, Bastien Koert wrote:
>>> I'm with the two Richard's on this, those users shouldn't have
>>> telnet access to the host server at all. Users should be using
>>> the browser to access your site.
>>> 
>>> Other than that, the most important thing you can do is to
>>> regularly back up your code and database to another location so
>>> that if something happens to the working box (and likely all
>>> tech products, its not IF its WHEN) you can restore the code and
>>> database with minimal data loss
>>> 
>>> Bastien
>>> 
>>>> On Thu Feb 05 2015 at 9:39:43 AM Omar Muhsin
>>>>  wrote:
>>>> 
>>>> You forgot this one "keep the box OFFLINE ... best security" :-D
>>>> 
>>>> 
>>>>> On 05-02-15 14:10, Richard Quadling wrote:
>>>>> 1 - Don't allow terminal access to your box.
>>>>> 2 - Use a PHP byte code encoder (IonCube, Zend Guard) - not
>>>>> perfect as
>>>> they
>>>>> can be reversed to access the code in a form.
>>>>> 3 - Don't use PHP.
>> 
>> 
>> Thanks to all.
>> 
>> I apologize, but I did not properly define the problem I am
>> addressing. I have written code for a POS [Point Of Sale] system
>> to be used in a store.  I don't expect the store owner to play
>> with the code.  His friends [or enemies] might try. There are two
>> logins to the computer, ethan [me] and worker.  Worker has to be
>> able to access the code to use it.  He has to be blocked from
>> reading, writing or copying the code.
>> 
>> How??
>> 
>> TIA
>> 
>> Ethan

> Date: Friday, February 06, 2015 04:49:04 +
> From: Felicia Case 
>
> Hi Ethan,
> 
> If the user is to neither write nor use the code then why do they
> have access in the first place? Just wondering.  
> 
> F 
> 

Your post is, still, rather lacking in useful details...

You are saying that you have written a POS system in interpreted
code, without an interface/wrapper (much less client/server
separation), so for someone to use it they can have direct access to
the (plain text) code files? In my book, this type of setup wouldn't
pass the most basic security audit, and I can only imagine the
potential issues with pci and hippa (assuming the latter given your
previous posts).

You haven't indicated the OS. If it's windows, I think the bets are
mostly off. In a *nix environment, you can control writes with
ownerships and file permissions, but with interpreted code the
(plain text) files need to be readable. Given what you seem to be
trying to do, I don't think that chrooting the worker's login will
work. 

You may want to look into "kiosk mode" options -- for both windows
and *nix -- as that generally disables access options other than the
controlled interface.

In a *nix environment I would probably start with VMs in order to
provide client/server separation, but still on a single box. 

Of course, all this is well beyond the scope of the php-db (or even
php-general) list. You should really take your questions to
os-specific security/hardening lists.


   - Richard




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



Re: [PHP-DB] Re: Code Security

2015-02-18 Thread Richard
But the fault here isn't with PHP. Ethan couldn't do what he wants,
the way he seemingly has things set up, with any programming
language.

Compiled code might let him obscure things a little, and also
potentially help hide the credentials used to access the db, but it
would still be a totally insecure environment. 

In a *nix environment (note -- I don't think it's clear what OS he
is using) you might be able to chroot the "user". This would
mitigate things some, but there are still many holes.

He could set up VMs on his single physical box and get client/server
separation that way. That would improve things markedly. 

In the end, however, the "user" has direct control of the physical
box which leaves a range of options for access to the [user] data
(which is more important to protect than any code) that should cause
this setup to fail even fairly basic security audits.

There are ways to approach this, but it seems to need rather serious
re-engineering -- with data privacy and security as the key element.

   - Richard



 Original Message 
> Date: Wednesday, February 18, 2015 10:14:43 -0500
> From: Mark Murphy 
> To: Taco Mathijs Hillenaar-Meerveld 
> Cc: php-db@lists.php.net, Guru , Karl
DeSaulniers 
> Subject: Re: [PHP-DB] Re: Code Security
>
> @Taco, Read back through the whole thread and you will understand.
> Ethan just can't do what he wants to with PHP.
> On Feb 18, 2015 9:59 AM, "Taco Mathijs Hillenaar-Meerveld" <
> tm.hillen...@gmail.com> wrote:
> 
>> Sorry if i misread and put my reply in a wrong context.
>> but from how i read this question it is all about preventing a
>> user to open a terminal window.
>> 
>> if Mr. Nice is logged in then i assume he has all rights as the
>> topic starter is afraid Mr. ugly can look at his code.
>> 
>> as far as i know it is not common practice to work direct on a
>> server and have all rights and allow other people using that
>> computer when connected to the specific server.
>> Ethan also pointed out that he made a POS (Point of Sale) program
>> to work in that store. there are 2 account types: 1>admin
>> 2>worker.
>> 
>> the worker should not have any rights and the admin account
>> should only be able to change/edit things within that program.
>> 
>> 
>> i don't see why anyone (the admin included) would need to have
>> access on the stand alone server apart for maintainance duties to
>> keep it all up and running.
>> the server needs to be locked in a server room or another place
>> that will fit. but definately locked.
>> 
>> if someone can get on that server through a terminal it will mean
>> something has gone horrible wrong.
>> 
>> i am not sure if Ethan is trolling though. but if i understand
>> his question right and it's a honest question, it sounds kind of
>> weird to me.
>> 
>> when i get an order to install a server, my first question would
>> be like: - who is going to use it?
>> - who has access to it?
>> - who need to have access to it?
>> - where will this server be placed? (server room, datacenter,
>> store).
>> 
>> once the server is installed i have a root account, an admin
>> account with certain rights and i have made a couple of
>> 'administrator groups' . the programs like apache are in this
>> group aswell. but this has nothing to do with the administrator
>> account from the POS.
>> 
>> so are we here talking about securing the code of the POS and its
>> content or are we talking about the basics of securing a Linux
>> server? if it is the latter, the Topic starter better read about
>> how to secure his server. btw, i'm wondering what his question
>> has got to do with PHP and databases :-/
>> 
>> in addition:
>> 
>> *as soon we talk about 'looking at code' and 'user is logged in
>> as an administrator with all rights to delete content' you will
>> make ANY administrator*
>> *nervous :) i know a couple of admins, trust me, they are
>> paranoid and won't trust anyone near their machines. not to speak
>> about getting access to a server!*
>> 
>> 
>> On Fri, Feb 13, 2015 at 6:28 PM, Guru 
>> wrote:
>> 
>> > Put a redirect code in www folder to your index page.
>> > On Feb 13, 2015 10:55 PM, "Karl DeSaulniers"
>> > 
>> wrote:
>> > 
>> > > Set up a password or a salt that Mr. Nice has to call you to
>> > > get and expires on logout.
>> > > 
>> > > Lol
>> > > 
>> &

Re: [PHP-DB] Waiting for localhost

2015-03-18 Thread Richard


 Original Message 
> Date: Wednesday, March 18, 2015 00:23:00 -0400
> From: Ethan Rosenberg 
> To: Karl DeSaulniers , PHP Database List

> Subject: Re: [PHP-DB] Waiting for localhost
>
> Karl -
> 
> Thanks to you and all others that have replied.
> 
> With a little bit of patience [which I should have used
> previously], I reran the the program both with form and with the
> JavaScript.  The program went to the next step [handleweight] BUT
> it took 5 min or more.  So...Apache is slow.  Any ideas??
> 
> TIA
> 
> Ethan

Ethan -- Unless you are seriously mucking with its configuration,
apache simply serves out what your underlying site/programming gives
to it. As such, it is highly unlikely that apache is the source of
your 5min. latency. If you want to see what is coming and going at
the server level, then review the access and error logs,
contemporaneous with the events (a -V at startup provides almost no
useful information about a server that successfully starts up). If
you don't find the default logged information to be sufficient, then
look at the options you can add to the custom log format -- e.g.,
"The time taken to serve the request, in microseconds". 

In general, you need to understand how to do very basic debugging of
your code. You need to put debug statements in your code and/or use
debuggers to help you step through it. You also need to break your
code apart so you can clearly see what is happening (working or not)
stage by stage. Once you have things isolated, then providing all of
the relevant snippet as well as details like OS, web server/version,
programming language specifics (including version) may get someone
to help you.  Simply dumping reams of code or configurations to the
list isn't any more useful than things like "So...Apache is slow.
Any ideas??"  People on this list can be helpful, but we're not here
to do your work for you, and we're not mind readers. Provide
relevant details, showing precisely/explicitly what the issue is,
and you'll likely get an equally relevant response.


- Richard




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



Re: [PHP-DB] Waiting for localhost

2015-03-27 Thread Richard


 Original Message 
> Date: Friday, March 27, 2015 01:29:49 -0400
> From: Ethan Rosenberg 
>
> On 03/18/2015 07:51 AM, Richard wrote:
>> 
>> 
>>  Original Message 
>>> Date: Wednesday, March 18, 2015 00:23:00 -0400
>>> From: Ethan Rosenberg 
>>> 
>>> Karl -
>>> 
>>> Thanks to you and all others that have replied.
>>> 
>>> With a little bit of patience [which I should have used
>>> previously], I reran the the program both with form and with the
>>> JavaScript.  The program went to the next step [handleweight] BUT
>>> it took 5 min or more.  So...Apache is slow.  Any ideas??
>>> 
>>> TIA
>>> 
>>> Ethan
>> 
>> Ethan -- Unless you are seriously mucking with its configuration,
>> apache simply serves out what your underlying site/programming
>> gives to it. As such, it is highly unlikely that apache is the
>> source of your 5min. latency. If you want to see what is coming
>> and going at the server level, then review the access and error
>> logs, contemporaneous with the events (a -V at startup provides
>> almost no useful information about a server that successfully
>> starts up). If you don't find the default logged information to
>> be sufficient, then look at the options you can add to the custom
>> log format -- e.g., "The time taken to serve the request, in
>> microseconds".
>> 
>> In general, you need to understand how to do very basic debugging
>> of your code. You need to put debug statements in your code
>> and/or use debuggers to help you step through it. You also need
>> to break your code apart so you can clearly see what is happening
>> (working or not) stage by stage. Once you have things isolated,
>> then providing all of the relevant snippet as well as details
>> like OS, web server/version, programming language specifics
>> (including version) may get someone to help you.  Simply dumping
>> reams of code or configurations to the list isn't any more useful
>> than things like "So...Apache is slow. Any ideas??"  People on
>> this list can be helpful, but we're not here to do your work for
>> you, and we're not mind readers. Provide relevant details,
>> showing precisely/explicitly what the issue is, and you'll likely
>> get an equally relevant response.
>> 
>> 
>>  - Richard
> 
> Richard -
> 
> Thanks.
> 
> Let me try to dissect the error messages.
> 
> root@meow:/var/www# /usr/sbin/apache2 -V
> Config variable ${APACHE_LOCK_DIR} is not defined
> --> Mutex file:${APACHE_LOCK_DIR} default
> 
> Config variable ${APACHE_PID_FILE} is not defined
> --> # PidFile: The file in which the server should record its
> process
># identification number when it starts.
># This needs to be set in /etc/apache2/envvars
># 
> PidFile ${APACHE_PID_FILE}
> /etc/apache2/envvars
> --> export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
> 
> 
> Config variable ${APACHE_RUN_USER} is not defined
> Config variable ${APACHE_RUN_GROUP} is not defined
> --> # These need to be set in /etc/apache2/envvars
> User ${APACHE_RUN_USER}
> Group ${APACHE_RUN_GROUP}
> /etc/apache2/envvars
> --> export APACHE_RUN_USER=www-data
> export APACHE_RUN_GROUP=www-data
> 
> 
> Config variable ${APACHE_LOG_DIR} is not defined  >> this error
> message appears 5 times??
> --> ErrorLog ${APACHE_LOG_DIR}/error.log
> 
> 
> AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf
> --> I tried to strip out the comments, and came up with less than
> 74 lines.
> 
> 
> Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}
> --> See above.
> 
> I am totally confused.
> 
> I hope that I have not muddied the waters with this.
> 
> TIA
> 
> Ethan


As I said:

  >> Once you have things isolated, then providing all of the 
  >> relevant snippet as well as details like OS, web 
  >> server/version, ...

These errors look odd to me. In many years of working with apache on
a range of *nix OSs, I don't remember a (properly installed) apache
instance that didn't have defaults that worked out of the box. They
may not have been what one wanted, but they worked.

With errors like these I wouldn't expect the web server to start,
but from previous exchanges I thought that it/one was running. Are
you running more than one server? What do ps and netstat show.

As these are web server, not php (and certainly not php-db), issues
you should probably be asking them on the apache list.

[i read the list, please do not include my direct email address in
your messages.]


   - Richard




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



Re: [PHP-DB] Waiting for localhost

2015-04-01 Thread Richard


 Original Message 
> Date: Wednesday, April 01, 2015 00:05:29 -0400
> From: Ethan Rosenberg 
> To: php-db@lists.php.net
> 
> Richard -
> 
> As we saw in the Apache list, the problem lies in PHP/MySQL
> 
> To quote --
> 
> "
> Date: Tuesday, March 31, 2015 02:18:13 -0400
> From: "Ethan Rosenberg, PhD" 
> Subject: Re: [users@httpd] Apache is Slow
> 
> Some more info
> 
> Changed the host in the connect
> 
> $cxn = mysqli_connect($host,$user,$password);
> 
> $host="127.0.1.1";
> 
> Now get an error...
> 
> Warning: mysqli_connect(): (HY000/2003): Can't connect to MySQL
> server on '127.0.1.1' (111) in /var/www/HandleWeight.php on line 56
> Connect Error (2003) Can't connect to MySQL server on '127.0.1.1'
> (111)
> 
> The correct IPnumber for "localhost" is "127.0.0.1". I wouldn't
> generally expect anything to answer on "127.0.1.1".
> 
> Separately, I think that this likely proves that this isn't an
> apache issue. You're getting to the mysql reference in the php
> script that  you're calling (from the js reference) and it's
> failing there because of the incorrect IPnumber.
> 
> -->> So, apache is responding fine and it's seemingly your script
> that has problems.
> "
> 
> All this having been said, I have attached HandleWeight.php
> Hopefully this will assist us in finding the error.
> 
> TIA
> 
> Ethan
> 


I, at least, am not here to do your work for you.

  > Hopefully this will assist us in finding the error.

[if you want private consulting, contact me (or likely many others
on this list), off-list for our rates.]

As has been said previously, you need to do very basic debugging.
You may need to take your script apart and test it piece by piece,
including db, includes, whatever calls/references. Check your
variables going in and out to make certain they hold the values you
expect. Check your typing to make certain that things are properly
named/referenced (e.g., that you're using the correct IPnumber for
"localhost").

If/when you have a specific issue that you are having a problem
with, feel free to post it to the list. Dumping a whole php script,
context-free, and hoping that we will do your work for you is really
not the way to get any assistance.




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



Re: [PHP-DB] Waiting for localhost

2015-04-02 Thread Richard


 Original Message 
> Date: Thursday, April 02, 2015 00:18:45 -0400
> From: Ethan Rosenberg 
> To: php-db@lists.php.net
> Cc: 
> Subject: Re: [PHP-DB] Waiting for localhost
>
> On 04/01/2015 11:41 PM, Karl DeSaulniers wrote:
>> Question to list, since I have not had to venture to the mysqli
>> territory just yet, but is it proper to use mysql_error() with
>> mysqli transactions?
>> 
>> This may be what your missing Ethan.
>> mysql_error() looks for a mysql_ transactions doesn't it?
>> Or are they interchangeable?
>> 
>> Best,
>> 
>> Karl DeSaulniers
>> Design Drumm
>> http://designdrumm.com
>> 
>> 
>> 
>> On Apr 1, 2015, at 10:35 PM, Ethan Rosenberg
>>  wrote:
>>>>> 
>>> 
>>> 
>>> Richard -
>>> 
>>> Thanks.
>>> 
>>> The problem is in the database connection.
>>> 
>>> from MySQL
>>> 
>>> mysql> show tables;
>>> +-+
>>> | Tables_in_Store |
>>> +-+
>>> | Charges |
>>> | Customers   |
>>> | Food|
>>> | Inventory   |
>>> | Orders  |
>>> | Purchases   |
>>> +-+
>>> 
>>> This code works...
>>> 
>>> $hostname="localhost";
>>> $database="Store";
>>> $username="ethan";
>>> $password="x";
>>> 
>>> 
>>> $link = mysqli_connect($hostname, $username, $password);
>>> if (!$link) {
>>> die('Connection failed: ' . mysql_error());
>>> }
>>> else{
>>>  echo "Connection to MySQL server " .$hostname . "
>>>  successful! " . PHP_EOL;
>>> }
>>> 
>>> $db_selected = mysqli_select_db($link, $database);
>>> if (!$db_selected) {
>>> die ('Can\'t select database: ' . mysql_error());
>>> }
>>> else {
>>> echo 'Database ' . $database . ' successfully selected!';
>>> }
>>> 
>>> $sql1 = "show tables";
>>> $result1 = mysqli_query($link, $sql1);
>>> $row1 = mysqli_fetch_array($result1);
>>> echo 'row1';
>>> print_r($row1);
>>> 
>>> BUT
>>> 
>>> The output is 
>>> 
>>> Connection to MySQL server localhost successful! Database Store
>>> successfully selected! row1
>>> Array ( [0] => Charges [Tables_in_Store] => Charges )
>>> 
>>> What am I missing??
>>> 
>>> TIA
>>> 
>>> Ethan
> -
> 
> Dear List -
> 
> Here are some hints
> 
> service apache2 restart
> [] Restarting web server: apache2AH00558: apache2: Could not
> reliably determine the server's fully qualified domain name, using
> 127.0.1.1. Set the 'ServerName' directive globally to suppress
> this message
> . ok
> 
> 
>   using 127.0.1.1 OUCH
> 
> Added this as last line in  /etc/apache2/apache2.conf
> 
> ServerName localhost
> 
> root@meow:/var/www# service apache2 restart
> [ ok ] Restarting web server: apache2
> 
> OK ...good
> 
> But ... I am still getting the same performance - TestConnect [the
> code above] gives the same result, and HandleWeight hangs!!!
> 

As I pointed out on the apache list, 127.0.1.1 != localhost. It's
not clear where all you've stapled that incorrect value in at this
point, but that will account for why apache gave you that error.

In the php code, you are not handling the output from
mysqli_fetch_array correctly. Read the documentation, there are many
examples -- including q/a responses that almost exactly match your
code.

You have shown no debugging effort on "HandleWeight", so we have no
way of providing any insights on it.

You additionally need to provide the version/release level
information for your installed versions of:

  - OS
  - apache
  - mysql
  - php




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



Re: [PHP-DB] Waiting for localhost

2015-04-02 Thread Richard


 Original Message 
> Date: Thursday, April 02, 2015 13:48:06 -0400
> From: Ethan Rosenberg 
> To: php-db@lists.php.net
> Subject: Re: [PHP-DB] Waiting for localhost
>
> On 04/02/2015 06:17 AM, Richard wrote:
>> 
>> 
> 
> 
>>> Here are some hints
>>> 
>>> service apache2 restart
>>> [] Restarting web server: apache2AH00558: apache2: Could not
>>> reliably determine the server's fully qualified domain name,
>>> using 127.0.1.1. Set the 'ServerName' directive globally to
>>> suppress this message
>>> . ok
>>> 
>>> 
>>>using 127.0.1.1 OUCH
>>> 
>>> Added this as last line in  /etc/apache2/apache2.conf
>>> 
>>> ServerName localhost
>>> 
>>> root@meow:/var/www# service apache2 restart
>>> [ ok ] Restarting web server: apache2
>>> 
>>> OK ...good
>>> 
>>> But ... I am still getting the same performance - TestConnect
>>> [the code above] gives the same result, and HandleWeight hangs!!!
>>> 
>> 
>> As I pointed out on the apache list, 127.0.1.1 != localhost. It's
>> not clear where all you've stapled that incorrect value in at this
>> point, but that will account for why apache gave you that error.
>> 
>> In the php code, you are not handling the output from
>> mysqli_fetch_array correctly. Read the documentation, there are
>> many examples -- including q/a responses that almost exactly
>> match your code.
>> 
>> You have shown no debugging effort on "HandleWeight", so we have
>> no way of providing any insights on it.
>> 
>> You additionally need to provide the version/release level
>> information for your installed versions of:
>> 
>>- OS
>>- apache
>>- mysql
>>- php
> 
> Richard -
> 
> Thanks.
> 
> service Apache2 restart
>  >> [] Restarting web server: apache2AH00558: apache2: Could
> not
>  >> reliably determine the server's fully qualified domain name,
> using
>  >> 127.0.1.1. Set the 'ServerName' directive globally to suppress
>  >> this message
> 
> This is what was returned on a restart of Apache.
> 
> Modified the configuration file.
> 
>   Added this as last line in  /etc/apache2/apache2.conf
>  >>
>  >> ServerName localhost
> 
> Now on a restart...
> 
>   root@meow:/var/www# service apache2 restart
>  >> [ ok ] Restarting web server: apache2
> 
> Fixed the mysqli_fetch_array.
> 
> OS Debian Jessie
> Apache/2.4.9 (Debian)
> MySQL  Ver 14.14 Distrib 5.5.37, for debian-linux-gnu (x86_64)
> using readline 6.3
> PHP  5.6.0RC2 (cli)
> 
> Debug
> 
> Here is the connection block w/ debug.
> 
> $hostname="localhost";
> $database="Store";
> $username="ethan";
> $password="x";
> 
> 
> $link = mysqli_connect($hostname, $username, $password);
> if (!$link) {
> die('Connection failed: ' . mysqli_error());
> }
> else{
>   echo "Connection to MySQL server " .$hostname . " successful!
> " . PHP_EOL;
> }
> 
> $db_selected = mysql_select_db( $link,$database);
> if (!$db_selected) {
>  die ('Can\'t select database: ' . mysql_error());
> }
> else {
>  echo 'Database ' . $database . ' successfully selected!';
> }
> 
> Never connects. Hangs
> 

What "Never connects. Hangs" -- your test php page, or HandleWeight?
In either case, that and the "Debug" code that you included above is
basically useless for determining your problem(s). You need to work
through your code from the top, bit by bit, until you know that each
piece to that point works. Put in "if $debug" statements (or
whatever approach you want) so that you can see exactly what's being
returned at each point. This is "programming 101" level debugging,
and something that many of us have suggested over many months of
trying to help you.

[As an aside, you may have fixed this, but you have had 127.0.1.1
listed as "localhost" somewhere (/etc/hosts, apache config, php
code). That won't work. Set the IPnumber for "localhost" to the
correct value.]

I don't have any more time for this. Good luck.




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



Re: [PHP-DB] SQL injection

2015-06-21 Thread Richard


> Date: Sunday, June 21, 2015 12:39:06 PM -0400
> From: Aziz Saleh 
>
> On Sun, Jun 21, 2015 at 9:19 AM, Lester Caine 
> wrote:
> 
>> OK - this had no chance of success since publish_date_desc is
>> processed using the _desc ( or _asc ) and any invalid data
>> stripped
>> 
>> 
>> &sort_mode=publish_date_desc%20or%20(1,2)=(select*from(select%20n
>> ame_const(CHAR(111,108,111,108,111,115,104,101,114),1),name_const
>> (CHAR(111,108,111,108,111,115,104,101,114),1))a)%20--%20and%201%3
>> D1
>> 
>> The question is more of interest in just what it was trying to
>> achieve? I presume hack MySQL? So Firebird would barf anyway, but
>> just trying to something that has generated some several hundred
>> error log entries in the last two days ...
>> 
>> Lester Caine - G8HFL
>> 
>> 
> The sub-query is invalid, if valid it would've been equivalent to:
> or (1,2)=(select*from(select 'b2xvbG9zaGVy' as 1, 'b2xvbG9zaGVy'
> as 1))a) -- and 1=1
> 
> Seems non threatening to me.

Regardless of whether this specific attack could have resulted in
harmful sql injection or not, user input should be sanitized so that
things never get this far.



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



Re: [PHP-DB] Corn job anomaly

2016-09-19 Thread Richard


> Date: Monday, September 19, 2016 03:26:54 -0500
> From: Karl DeSaulniers 
>
> I am hoping someone can enlighten me on this issue I am having.
> I am trying to set up a cron job to run a php file.
> I am getting a strange error though.
> 
> /home/(protected directory)/auto_reminder.php: line 1: ?php: No
> such file or directory /home/(protected
> directory)/auto_reminder.php: line 2: =: command not found
> /home/(protected directory)/auto_reminder.php: line 3: /*WordPress:
> No such file or directory
> 
> This is lines 1, 2 and 3 from my code.
> 
>  $error_log = "";
> /*WordPress Optons Table*/
> 
> Am I correct in thinking that the error is saying that php doesn't
> exist? Has anyone ever experienced this? Is this a server related
> issue? Any clue on how to fix?

What do you have on the "command-line" part of your crontab entry?
Your php script will need to be called as a php cgi or cli. Because
of the way things get set up via cron, it's best to include the full
path to the php binary on the cron command-line.

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



Re: [PHP-DB] Corn job anomaly

2016-09-20 Thread Richard


> Date: Tuesday, September 20, 2016 03:26:39 -0500
> From: Karl DeSaulniers 
>
>> On Sep 20, 2016, at 3:22 AM, Lester Caine 
>> wrote:
>> 
>> On 20/09/16 09:14, Karl DeSaulniers wrote:
>>> Pardon my ignorance, but what do you mean full path?
>> Full path to php application.
>> Cron jobs run as 'root' and so need and user account settings added
>> manually if they do not match the 'root' environment.
>> 
> 
> OH, ok, I did read something about root earlier.
> I think it was something like:
> 
> root /usr/bin/php5 /home/(directory name removed)/auto_reminder.php
> 
> But not positive. I will have to research that more.
> Thank you.
> 
>

Whether cron jobs run as root or a standard user depends on how they
are set up. If set up under a user -- which is the better approach
for general use -- they will run as that user. Really only
system-type cron jobs (that require root access) should be set up to
run as root.

If you use the command: 

   crontab -e

from a user account, then the crontab is set up as that user. The
first 5 fields/values are time/date related, followed by the command
to be invoked. See: man -s5 crontab  for more details.

In that case, the user that mysql sees is the user that is running
the job. So, if your mysql authentication is set to accept
connections/give access to say the user your web server is running as
(which is how php will show by default), then you will either need to
pass those credentials in your cron job php script or, give the user
that's running the cron job access.



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



Re: [PHP-DB] Corn job anomaly

2016-09-20 Thread Richard


 Original Message 
> Date: Tuesday, September 20, 2016 12:54:38 -0500
> From: Karl DeSaulniers 
>
> On Sep 20, 2016, at 7:21 AM, Richard
>  wrote:
>> 
>> 
>> 
>>> Date: Tuesday, September 20, 2016 03:26:39 -0500
>>> From: Karl DeSaulniers 
>>> 
>>>> On Sep 20, 2016, at 3:22 AM, Lester Caine 
>>>> wrote:
>>>> 
>>>>> On 20/09/16 09:14, Karl DeSaulniers wrote:
>>>>> Pardon my ignorance, but what do you mean full path?
>>>> Full path to php application.
>>>> Cron jobs run as 'root' and so need and user account settings
>>>> added manually if they do not match the 'root' environment.
>>>> 
>>> 
>>> OH, ok, I did read something about root earlier.
>>> I think it was something like:
>>> 
>>> root /usr/bin/php5 /home/(directory name
>>> removed)/auto_reminder.php
>>> 
>>> But not positive. I will have to research that more.
>>> Thank you.
>>> 
>>> 
>> 
>> Whether cron jobs run as root or a standard user depends on how
>> they are set up. If set up under a user -- which is the better
>> approach for general use -- they will run as that user. Really only
>> system-type cron jobs (that require root access) should be set up
>> to run as root.
>> 
>> If you use the command: 
>> 
>>   crontab -e
>> 
>> from a user account, then the crontab is set up as that user. The
>> first 5 fields/values are time/date related, followed by the
>> command to be invoked. See: man -s5 crontab  for more details.
>> 
>> In that case, the user that mysql sees is the user that is running
>> the job. So, if your mysql authentication is set to accept
>> connections/give access to say the user your web server is running
>> as (which is how php will show by default), then you will either
>> need to pass those credentials in your cron job php script or,
>> give the user that's running the cron job access.
>> 
> 
> Again, thank you for the response Richard.
> 
> Would you possibly have a link to how to set that up? I mean the
> actual commands. My trouble is I don't know what commands and how
> to write them. Like including a user, forcing the PHP.ini and
> executing the script. All in one line. That is what I am trying to
> accomplish and not sure how. Need to read up on the proper way to
> do this. 
> 

The php.ini that is used will be based on the php rules for the
path(s) (and order) it searches for that file.

The user that is running the script will be the user that the cron
job is set up under. If you set up a cron job as a standard user you
can't assign it to run as a different user. If the issue is mysql
access, you do that just the way you would in a [web]server parsed
php file.

The script is whatever you put on the crontab line.

The script you reference from the crontab entry can be a shell script
that does some setup, and then calls your php script.  Your php
script can have include files (e.g., for mysql connection setup) just
as you might have in a [web]server parsed php file.





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



Re: [PHP-DB] Corn job anomaly

2016-09-23 Thread Richard


> Date: Friday, September 23, 2016 03:28:47 -0500
> From: Karl DeSaulniers 
>
> Ok, so I have run down all the possible things (that I know of)
> that could be keeping this from working. I have checked with my
> hosting service that:
> 
> 1. MySQL is accessible with the original user I started with (for
> this case were using db123456) via ssh. 2. The cron is accessing my
> php script fine.
> 3. The cron is running the script and is attempting to access MySQL
> but not allowing access still.
> 
> I tried running the script via ssh and it is timing out. No error
> of not accessing MySQL, just telling me it is timing out.  This
> tells me (I could be wrong) that it is in fact accessing MySQL and
> that my calls to MySQL are making the script time out? What bothers
> me is that the cron errors out saying access denied but ssh says
> timeout error. Does anyone have any ideas for me to try at this
> point? If I don't get this to work in the next couple of days, I am
> toast!
> 

 -- Try the mysql access and commands directly from the command
line (using the mysql cli).

 -- Put debug/print statements in your code so you can clearly
see where you are getting. 

-- This includes printing out your mysql statements so that
   you know exactly what is being passed to mysql (both when
   you run the script by hand and via cron).




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



Re: [PHP-DB] Corn job anomaly

2016-09-25 Thread Richard


> Date: Sunday, September 25, 2016 08:37:14 -0400
> From: Aziz Saleh 
> Subject: Re: [PHP-DB] Corn job anomaly
>
> On Sun, Sep 25, 2016 at 4:59 AM, Karl DeSaulniers
>  wrote:
> 
>> > On Sep 23, 2016, at 5:38 AM, Richard wrote:
>> > 
>> > -- Try the mysql access and commands directly from the command
>> >line (using the mysql cli).
>> > 
>> > -- Put debug/print statements in your code so you can clearly
>> >see where you are getting.
>> > 
>> >-- This includes printing out your mysql statements so that
>> >   you know exactly what is being passed to mysql (both when
>> >   you run the script by hand and via cron).
>> > 
>> 
>> Thanks Richard,
>> That got me thinking and I figured out my access issue...
>> HALELUYA!
>> 
>> Now I am getting an error with mysql syntax.
>> 
>> "SELECT otn.*, cf.* FROM ".ORDER_TABLE." otn LEFT JOIN
>> ".FIELDS_TABLE." cf ON cf.Order_ID = otn.Order_ID WHERE
>> cf.Earliest_Pickup >= DATE(NOW()) AND cf.Earliest_Pickup <=
>> DATE(NOW() + INTERVAL ".($Num_Days_Away+1)." DAY) AND
>> otn.Order_Status != 'Shipping' AND otn.Order_Status != 'Completed'"
>> 
>> is giving me this error:
>> You have an error in your SQL syntax; check the manual that
>> corresponds to your MySQL server version for the right syntax to
>> use near '\"Shipping\" AND otn.Order_Status != \"Completed\"' at
>> line 1
>> 
>> 
>
> Echo out the query, then manually run it.
>

Based on the quoting, it doesn't appear that the error you are
reporting is actually based on the command syntax you are showing.

If after echoing your mysql query, so that you see all substitutions,
you are still having trouble, then take your query apart and simplify
it. When you get a trimmed down version to work, then add complexity.




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



[PHP-DB]Question on select..for update

2001-02-12 Thread Richard Halford

Hi, just started on the list, and the didn't seem to get through the first
time, so I'll give it another whirl.

I'm trying the following code based on a modded db_oci8.inc (the mod is so
that the call to OCIExecute always passes OCI_DEFAULT rater than
OCI_COMMIT_ON_SUCCESS.

This is a snippet of the relevant code:

The variable $PartNumber contains the part number to query on:

  $db->Query("select part_nbr "
 ." from psns "
 ." where part_nbr = '".$PartNumber."' "
 ." for update ");
  $db->next_record();
?>alert ("Waiting with record lock")Query("lock table psns in exclusive mode");
?>alert ("Waiting with table lock")Query("update psns set user_id = '' where part_nbr =
'".$PartNumber."' ");
  $db->Query("commit");

The problem is that between the firt select query and lock table there
should be a record lock on the requested record. Now opening up a SQLPlus
session I can perform an update on that record. If, from SQLPlus, I try and
lock the table or do a select for update, then this the locking works fine
and there is no problem, so I know it is not an oracle related problem
becuase of this.

I've tried this also with the OCI8 libraries and the same problem occurs.
What I don't understand is why this should occur, after all its just passing
SQL queries through and not doing anything else flash.

Between the table lock and the update the lock should also be placed at
table level, yet there is still no lock applied.


The results in debug mode are :

Obtained the Link_ID: Resource id #3
Debug: commit mode = 0 COMMIT On success = 32 Default = 0 (this is just to
check that the mode is OCI_DEFAULT)
Debug: query = select part_nbr from psns where part_nbr = 'XX' for
update
[PART_NBR]:XX
Debug: commit mode = 0 COMMIT On success = 32 Default = 0
Debug: query = lock table psns in exclusive mode
returned Debug: commit mode = 32 COMMIT On success = 32 Default = 0 (this is
just to check that the mode is OCI_DEFAULT)
Debug: query = update psns set user_id = '' where part_nbr = 'XX'

Regards,
  Richard Halford


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




[PHP-DB] MySQL and XML

2001-02-14 Thread Richard Crawford

Does MySQL 3 have XML support, or do I need to write (or find) a class to
transform MySQL databases into XML documents?



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




RE: [PHP-DB] Parse error on array and SQL query

2003-11-20 Thread Hutchins, Richard
Speaking for myself only, I'm probably going to need to see more code than
this to be able to help. These two lines appear to be OK. The error might be
in what feeds line 187.

> -Original Message-
> From: Dillon, John [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 20, 2003 9:16 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Parse error on array and SQL query
> 
> 
> 
> On line 188 and similar:
>   line 187$this=$altIDs[$i]; 
>   line 188$query .= "ID='$this'"; 
> 
> I get the error: Parse error: parse error in
> /home/jdillon/public_html/provreport.php on line 188
> 
> Could this be because some setting has been changed on my shared host?
> 
> John
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>    http://www.cantor.com
> CONFIDENTIAL: This e-mail, including its contents and 
> attachments, if any, are confidential. If you are not the 
> named recipient please notify the sender and immediately 
> delete it. You may not disseminate, distribute, or forward 
> this e-mail message or disclose its contents to anybody else. 
> Copyright and any other intellectual property rights in its 
> contents are the sole property of Cantor Fitzgerald.
>  E-mail transmission cannot be guaranteed to be secure or 
> error-free. The sender therefore does not accept liability 
> for any errors or omissions in the contents of this message 
> which arise as a result of e-mail transmission.  If 
> verification is required please request a hard-copy version.
>  Although we routinely screen for viruses, addressees 
> should check this e-mail and any attachments for viruses. We 
> make no representation or warranty as to the absence of 
> viruses in this e-mail or any attachments. Please note that 
> to ensure regulatory compliance and for the protection of our 
> customers and business, we may monitor and read e-mails sent 
> to and from our server(s). 
> 
> For further important information, please read the  Important 
> Legal Information and Legal Statement at 
> http://www.cantor.com/legal_information.html
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Parse error on array and SQL query

2003-11-20 Thread Hutchins, Richard
If you're not getting the parse error anymore, I'd suggest you echo $query
to the browser and check to see that the SQL statement is what you expect it
to be. Can't count the number of times doing that has pointed out some stray
apostrophe or comma or something that killed the query.

> -Original Message-
> From: John W. Holmes [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 20, 2003 1:09 PM
> To: Dillon, John
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Parse error on array and SQL query
> 
> 
> Dillon, John wrote:
> 
>  > Tried that, doesn't work with:
>  >
>  > $query="INSERT INTO ReplyTbl VALUES ('" . $monster1 . "', '" .
>  > $monster2 .
>  > "', '" . $monster3 . "', NULL, NULL)";
>  >
>  > Don't suppose they use 'monster' as a reserved word...
> 
> How does it "not work" again??
> 
> -- 
> ---John Holmes...
> 
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
> 
> php|architect: The Magazine for PHP Professionals – www.phparch.com
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP-DB] multiple queries

2003-12-01 Thread Richard Davey
Hello Cameron,

Tuesday, December 2, 2003, 1:08:19 AM, you wrote:

CS> $sql = "SELECT * from dates where store=$store and date=$date";

CS> ultimately I would like to display data for 3 days on either side of
CS> this.   

The following is un-tested, but a quick look over the MySQL manual
should firm this up for you:

SELECT * FROM dates WHERE store='$store' AND date > DATE_SUB(now(),
interval 3 day) AND date < DATE_ADD(now(), interval 3 day)

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



RE: [PHP-DB] user input killing code

2003-12-02 Thread Hutchins, Richard
addslashes($userInput)

Rich

> -Original Message-
> From: redhat [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 02, 2003 10:49 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] user input killing code
> 
> 
> I am still working on this DB entry page.  I have a sort of 
> content mgt
> page that I have built where certain company people input data to be
> displayed on a web page to be viewed by the public.  Everything is
> working great except, when someone enters an ' or " into the 
> form field
> it will not update the database.  I figured out that if you 
> escape the '
> or " with \ it will go through.  I would like to know what I can do to
> my code to keep users from having to remember this.  Any suggestions?
> thanks,
> DF
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP-DB] Redirect.

2003-12-02 Thread Richard Davey
Hello gfmb,

Tuesday, December 2, 2003, 11:18:40 AM, you wrote:

gli> I have a problem.How can I redirect from a PHP script to
gli> another script in asp, php or a HTML page? 
gli> This script redirect to another script in function of the values of a variable.

This isn't really a database related question, is it?
See PHP-General.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



RE: [PHP-DB] Redirect.

2003-12-02 Thread Hutchins, Richard
Don't know if I fully understand your question, but, in general, you can
handle redirects with the header() function, e.g., 

header("Location:
http://www.yoursite.com/yourscript.php?msg=0&storyID=".$newstory."";);

As you can see, you can include variable=value pairs at the end of the URL
as well (msg and storyID in the example above).

Check for the header() function in the documentation on php.net for
additional information. PHP-GENERAL, as suggested by another user, is the
most appropriate and possibly more helpful mailing list for your particular
question.

HTH,
Rich

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 02, 2003 6:19 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Redirect.
> Importance: High
> 
> 
> Hi all,
> I have a problem.How can I redirect from a PHP script to 
> another script in asp, php or a HTML page? 
> This script redirect to another script in function of the 
> values of a variable.
> Thanks in advance
> Francesco
> [EMAIL PROTECTED]
> 

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



[PHP-DB] Annoying Server Responses

2003-12-02 Thread Hutchins, Richard
Sorry to bother all of you with this, but are any of you still getting
either of these responses each time you post to this list?


Il nuovo indirizzo è: [EMAIL PROTECTED]
La mail è stata comunque inoltrata entro 60 minuti al nuovo indirizzo di
posta.
Si consiglia sin da subito l'utilizzo del nuovo indirizzo; a breve il
vecchio indirizzo verrà inattivato.

Questa è una mail di servizio. NON rispondere.



Hi. This is the qmail-send program at pb1.pair.com.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

<[EMAIL PROTECTED]>:
This message is looping: it already has my Delivered-To line. (#5.4.6)
...
blah,blah,blah
...


Not that I'm any MVP (most valuable poster) or anything, but I've actually
cut back on the number of times I respond to this list because each time I
post, I have to delete three of these annoying responses (one of 
and two of ). If I'm avoiding posting here, then maybe others are
as well. And that all contributes to a less-usable list.

Yeah, I could set up an Outlook "Rule" to delete these things automatically,
but I shouldn't have to. The administrators of this list should be able to
clear these little things up. Nothing against Fabio Farinelli, I'm sure he's
a great guy. But, c'mon, I've been getting that automated response for about
three or four months now.

If I'm not the only one receiving these responses and if there's an admin
address to send this stuff to, let me know and I'll drop them a line.

Thanks for your time.
Rich

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



Re: [PHP-DB] Annoying Server Responses

2003-12-02 Thread Richard Davey
Hello Richard,

Tuesday, December 2, 2003, 6:51:40 PM, you wrote:

HR> Sorry to bother all of you with this, but are any of you still getting
HR> either of these responses each time you post to this list?

Yes (he says waiting for another to arrive).

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



[PHP-DB] Selecting every 50th row

2003-12-02 Thread Richard Davey
Hi php-db,

I have a table with approx. 250,000 rows in it. The primary key is an
ID field. All I am wondering is - is there any way at all from MySQL
to directly select every 50th row in this table?

I.e. row 1, 50, 100, 150, etc and return the ID of each row, ideally
with some kind of limit. Even if it was only possible to select the
IDs of two rows, i.e. row 1 and row 50, that would be good too.

It's almost like I need a "step" function, like in a FOR NEXT
statement, only SQL-side.

-- 
Best regards,
 Richard  mailto:[EMAIL PROTECTED]

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



Re: [PHP-DB] Remote DB Connection

2003-12-03 Thread Richard Davey
Hello Omelin,

Wednesday, December 3, 2003, 6:05:52 PM, you wrote:

OM> @mysql_connect ('ipaddres-server2', 'DBName', 'DBPwd') ;
OM> Is their anything else I need to consider to connect ? ,

The server must allow it :) other than that, not really.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



Re: [PHP-DB] Dumping database/restoring

2003-12-04 Thread Richard Davey
Hello John,

Thursday, December 4, 2003, 11:01:20 AM, you wrote:

DJ> The question is how do people out there
DJ> back up their database residing on a server to a local file? Ideally I would
DJ> download the database and save on a CD, and be able to restore from this if
DJ> the worst happened.

Personally, I use mysqldump! Free and works :)
Creates a .sql file which mysqlimport can re-create your DB from.

.sql file is plain text so can be viewed in a text editor, burnt to
CD, zipped, etc.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



Re: [PHP-DB] cookies

2003-12-04 Thread Richard Davey
Hello Maris,

Thursday, December 4, 2003, 10:40:33 AM, you wrote:

MK> Could you share with your experience and point out where
MK> is the problem here. I tried different variations for
MK> domain parameter in setcookie command but it didnt help

It's a security mechanism built into cookies. They cannot be
cross-domain. They can cross sub-domains (i.e. *.launchcode.co.uk) but
a cookie set for one domain cannot be read by another. Think of the
anarchy that would happen if they could (being able to read and mess
with say Hotmail cookies from your own site for example).

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



Re[2]: [PHP-DB] cookies

2003-12-04 Thread Richard Davey
Hello Maris,

Thursday, December 4, 2003, 12:24:10 PM, you wrote:

MK>  src=http://www.cookiedomain.com/cookies/cookies.php>

MK> isnt it refering and setting cookie for  www.cookiedomain.com
MK> even if this HTML file is on another domain?

No, because by that point the Header has already been sent. You can't
issue a cookie after a header has gone and use it in the same page
session. As the PHP manual so elegantly puts it - this is a protocol
restriction.

Your browser will look for cookies at the start of the page request,
not in the middle of it (where your image is). At that point, the
header is already sent.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]


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



Re: Fw: [PHP-DB] PhpmyAdmin from external computers

2003-12-04 Thread Richard Davey
Hello Andy,

Thursday, December 4, 2003, 3:27:11 PM, you wrote:

AL> Im afraid ive already tried that.

Are you sure your MySQL server is actually configured to ALLOW someone
to login remotely? I know most of the ones I work with aren't. This
isn't a setting you'll find in phpMyAdmin btw. Most MySQL servers are
locked down in this way for (very good) security reasons, to the point
that it wouldn't surprise me if this wasn't the default after
installation (I don't know for sure it is though).

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



Re[2]: [PHP-DB] Planetside

2003-12-19 Thread Richard Davey
Hello Cal,

Friday, December 19, 2003, 10:28:19 PM, you wrote:

CE> What is the Planetside database?

It's a pay-to-play on-line multi-player FPS game run by Sony. I don't
think you could interface with it directly, at least I'd be pretty
surprised if you can.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



Re: [PHP-DB] PHP/DB speed

2003-12-21 Thread Richard Davey
Hello Robin,

Sunday, December 21, 2003, 10:15:35 PM, you wrote:

RK> The code I am using is thus and is retrieving around 2,500 records:

RK> $result = mysql_query($sql)
RK> while ($row = mysql_fetch_array($result))
RK> {
RK> build  stmt
RK> }

You're building a select list of 2500 elements? No wonder it's slow.
That must be generating a few hundred KB's worth of HTML on its own,
let alone anything else on the page.

If you're not using all 2500 rows, you need to optimise your query to
reflect this.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



[PHP-DB] Undefined function mysql_connect

2004-01-04 Thread Richard Bewley
Hi,

I compiled mySQL 4.0.16 from source, and installed PHP 4 off the RH9 cd. 
I also have the php-mysql-4.2.2-17 rpm installed.  But for some reason, I
keep getting call to undefined function mysql_connect, and it won't
connect to the mysql database.  Any ideas?

Thanks,
Richard

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



Re: [PHP-DB] Re: SQL WHERE datetime > NOW

2004-01-06 Thread Richard Davey
Hello John,

Tuesday, January 6, 2004, 5:20:22 PM, you wrote:

J> On further reading, it appears LIMIT stops the query running once x number
J> of records are retrieved without sorting the whole table first.

Where did you read this?

If you profile your query you'll notice that in say a 10,000 record
table, if you LIMIT 0,50 but order by something generic (say an ID or
date stamp) it'll still order all 10,000 records before returning the
50 you asked for.

(One of the main reasons I rarely use LIMIT)

J> Is there a function to get the top x number of results, as there is in MS
J> Access? Eg search on an auto-increment and get the last 10 records added?

LIMIT 50,-1

Retrieve from row 50 to last.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



Re[2]: [PHP-DB] Re: SQL WHERE datetime > NOW

2004-01-06 Thread Richard Davey
Hello John,

Tuesday, January 6, 2004, 6:00:09 PM, you wrote:

J> http://www.mysql.com/doc/en/LIMIT_optimisation.html
J> If you use LIMIT row_count with ORDER BY, MySQL will end the sorting as soon
J> as it has found the first row_count lines instead of sorting the whole
J> table.

I wish it did. Rarely in practise do I ever see this happen. I wonder
if it's version specific?

Real world example from a 191,404 row table:

explain select messageid from message order by messageid limit 0,50

From the profile:

table,type,possible_keys,key,key_len,ref,rows,Extra
message,index,NULL,PRIMARY,4,NULL,191404,Using index

So it's definitely doing something with 191,404 rows. It's sorting the
entire table based on the index and bringing back the 50 rows I asked
for. Which does make sense I guess (even if it does seem to contradict
the MySQL manual)

J> I meant to largest 10 values in a column.  For example, I have a record with
J> ID number 1800 in an auto increment field, table has 1805 records.  When I
J> view the table 'raw' record 1800 appears after record 12.  I wanted records
J> 1755-1805.  Instead now I've retrieved the whole table with ORDER BY without
J> LIMIT and put my start and end values in the for () loop.  Now, my eyes may
J> have deceived me...

Use ORDER BY and LIMIT together? Unless you are doing this already,
not sure.

Assuming your auto increment field is called "id":

SELECT * FROM table ORDER BY id DESC LIMIT 0,50

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]


RE: [PHP-DB] Need help replacing one record

2004-01-09 Thread Hutchins, Richard
If I understand your question correctly, an UPDATE query should be all you
need.

UPDATE tablename SET columname='value' WHERE someid='somenum';

I'm assuming you don't have the MySQL doc. Check mysql.com for the docs for
your version of the server.

Rich Hutchins, CIW Professional
Sr. Technical Writing Administrator
Getinge USA
1777 E. Henrietta Rd.
Rochester NY 14623
585-272-5072
www.getingeusa.com



> -Original Message-
> From: Jeroen Wasteels [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 09, 2004 1:24 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Need help replacing one record
> 
> 
> Is there a way to change the information in one record of a 
> database, for
> example the password, without having to open the entire row, 
> delete it, and
> then add it with $row_data[name] and all and the $newpass as changed
> password?
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP-DB] (PHP-DB) Re: Using PHP with Vb6 to display Spatial Data.

2004-01-12 Thread Richard Davey
Hello jonah,

Monday, January 12, 2004, 9:48:35 AM, you wrote:

jm> data and process information from the data. The issue is how to
jm> access the data through the worldwide web. I want to know whether
jm> PHP can be used to interface with VB and the data accessed using a
jm> browser.

Depends entirely on how the data is stored.

SQL Server, SQLLite, Access Databse (ick), another ODBC compliant
source, text file, etc etc etc.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



RE: [PHP-DB] multi-language site

2004-01-15 Thread Hutchins, Richard
$.02 from a technical writer:

If you're going to translate your content from English directly to a foreign
language using machine translation (which is what gettext would amount to)
be very careful. There is a difference between translation and localization.
The free Babelfish service is a good example of translation. You'll get a
word-for-word translation of whatever you want to type in the English box.
However, what shows up in the translation box is not always what you meant
in English. Have you ever bought a Japanese product whose instructions read:
"Use caution when opening my box. I wormhole swimming pool orange piranha
yesterday, sir."

Your best bet may be to write all of the English text, have it translated
and put into XML files as Ignatius suggested, then use PHP to set/retrieve
cookie settings to display the proper language.

I can personally vouch for the difference between text that has been
machine-translated only and text that has been machine translated and
reviewed/corrected by a human. Machine translation cannot match a human's
ability to compensate and account for context and usage. There are quite a
few localzation companies (SH3, VistaTec, SDL International) who specialize
in translating content for web sites even in XML format. Send them an
English XML document, they'll send you a Spanish one back without messing
with your tags - only the content gets translated.

Of course, it DOES all come down to dollars and cents and how important the
translation really is; only you can decide that.

HTH

Rich

> -Original Message-
> From: Ignatius Reilly [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 15, 2004 1:03 PM
> To: Dan Hewins; [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] multi-language site
> 
> 
> I would not consider a DB-based design.
> 
> I use two approaches (sometimes mixed):
> 
> 1. Write content in XML files (one per language) and 
> transform them with
> XSLT. This is nice for mostly content-based sites.
> 
> 2. Write the complete application in English and translate it with the
> excellent PHP gettext() extension. Makes it fast, efficient 
> and very cheap
> to maintain. A better option for web applications.
> 
> In any case the user's language must be stored in a session variable.
> 
> HTH
> Ignatius
> 
> _
> - Original Message -
> From: "Dan Hewins" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, January 15, 2004 18:50
> Subject: [PHP-DB] multi-language site
> 
> 
> > Forgive me if this is pedestrian or has been covered 
> before.  I'm new
> > to the list and I haven't used PHP too much (yet).
> >
> > Here's my question:
> >
> > I'm looking to use PHP for an upcoming site project where the site
> > needs to be in either English or Spanish. Would PHP be a 
> good approach?
> > I was envisioning having a database with every text bit and 
> image with
> > text in it in two columns, one for English, and one for 
> Spanish. Then
> > each web page would reference some kind of global variable 
> (a cookie?)
> > to determine whether to pull the images and text from the English
> > column or the Spanish column. Does this sound like a good 
> approach? Is
> > PHP capable of something like this?
> >
> > Thanks for any help or suggestions you can give.
> >
> > Dan Hewins
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re[2]: [PHP-DB] multi-language site

2004-01-15 Thread Richard Davey
Hello Ignatius,

Thursday, January 15, 2004, 6:41:44 PM, you wrote:

IR> Gettext is NOT an automated translation service. What you do is mark strings
IR> to translate in the original application, then have them translated by a
IR> human. When confronted with a marked string to echo, the application will
IR> look up in the translated file for the corresponding translation.

I use something very similar to this on a few of my sites. I had to
get the whole sentences translated though - you cannot just get
individual words translated and string them together because as you
know, the order of the words varies dramatically from language to
language.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



Re: [PHP-DB] db php question

2004-01-15 Thread Richard Davey
Hello,

Thursday, January 15, 2004, 7:09:25 PM, you wrote:

r> I have a very crude script set up that I am using to keep track of IP
r> addresses, MAC addresses, etc and it dumps into mysql.  I am using a
r> column called "id" which is my primary key and auto-increments.  My
r> question is that I want to make sure that I don't get duplicate IP
r> addresses added into the database and right now it is a varchar field
r> and anything can be put in there.  If I change the column and make it my
r> primary key will that prohibit duplicate entries?  Is there a better way
r> to do this?  I am not a programmer either so I am having to hack my way

Set the IP column type to be Unique. It doesn't have to be a Primary
Key just to be unique.

r> through this.  The second thing that I wanted to do was to be able to
r> run a simple web form search for either ip addresses or computer name
r> and return results.  From what I have seen this seems pretty complex -

Actually, it's pretty simple. If you can post your SQL table structure
here someone could show you how to write a PHP script to display that
information pretty quickly I would have thought.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



[PHP-DB] Unsubscribe User Fabio Farinelli - Headers Needed

2004-01-16 Thread Hutchins, Richard
PHP-List-Admin,

Every time a user posts to the php-db list, the message below is
automatically sent to the sender. This has been a problem for many months
now and frequently sparks multiple requests from frustrated users to have
[EMAIL PROTECTED] removed from the list. Can you please
remove the user from the list? I do not have the headers for this particular
e-mail, but am copying the list in hopes that someone WILL have the original
headers and can attach them to this mail and forward it along. (message
appears below)


Subject: L'utente Fabio Farinelli ha cambiato indirizzo di posta
elettronica.


Il nuovo indirizzo è: [EMAIL PROTECTED]
La mail è stata comunque inoltrata entro 60 minuti al nuovo indirizzo di
posta.
Si consiglia sin da subito l'utilizzo del nuovo indirizzo; a breve il
vecchio indirizzo verrà inattivato.

Questa è una mail di servizio. NON rispondere.

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



RE: [PHP-DB] i want to unsubscribe

2004-01-19 Thread Hutchins, Richard
Other alternatives here:
http://www.php.net/unsub.php



> -Original Message-
> From: V i s h a l Kashyap @ [Sai Hertz And Control Systems]
> [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 19, 2004 1:53 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] i want to unsubscribe
> 
> 
> Dear Thomas J. Rudd ,
> 
> >See
> >To unsubscribe, visit:  http://www.php.net/unsub.php
> >  
> >
> This sucks,  I have tried to unsubscribed 10 times with out 
> any success
> 
> 
> -- 
> Regards,
> Vishal Kashyap
> 
> ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
> I Know you believe my words so logon to Jabber.org
> and add [EMAIL PROTECTED] to your roster.
> ~*~*~*~*~*~*~*~*
> I am usually called by the name Vishal Kashyap
> but my Girl friend believes my name should be
> Vishal CASH UP.This is because others love my
> nature and my Girl friend loves my CASH.
> ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Unsubscribe (mailign lsits in general) question...

2004-01-20 Thread Hutchins, Richard
Tris,

Here's what I found on infoworld.com in a very limited search (dated
1/12/04). There is info in there that should provide you with other avenues
of research to clarify your company's responsibility. Here is a relevant
excerpt:

"CAN-SPAM [went into effect Jan 1., 2004] requires that spam e-mail include
a working return e-mail address, a valid postal address for the sending
company, a working opt-out mechanism and a relevant subject line. The law
also directs the U.S. Federal Trade Commission (FTC) to study setting up a
national do-not-spam list, similar to the national do-not-call telemarketing
list now in effect."

And the relevant link:
http://infoworld.com/article/04/01/12/HNspamcomply_1.html

So, in a not-so-thorough examination, it does not look like an "opt-in" link
is required. Although, it would seem that the Federal Trade Commission's
website (www.ftc.com) should provide additional info for the US.

HTH,
Rich

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 20, 2004 9:12 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Unsubscribe (mailign lsits in general) question...
> 
> 
> I've been told by my boss, that the law has changed in 
> relation to 'Opt 
> out' options on mailing lists etc...
> she tells me that I have to now change all my forms to conform.
> 
> She claims that now, each time the user must click the 
> 'remain subscribed' 
> link, or we have to remove them from our mailing lists.
> Thus changing opt out, to opt in, EACH TIME?
> Is this true?
> 
> She seems quite sure.
> 
> We deal with both European and US clients (world wide to be 
> honest, but 
> most other countries don'e care about this.. do they?)
> 
> Anyone heard of this before?
> Tris...
> 
> *
> The information contained in this e-mail message is intended only for 
> the personal and confidential use of the recipient(s) named above.  
> If the reader of this message is not the intended recipient 
> or an agent
> responsible for delivering it to the intended recipient, you 
> are hereby 
> notified that you have received this document in error and that any
> review, dissemination, distribution, or copying of this message is 
> strictly prohibited. If you have received this communication 
> in error, 
> please notify us immediately by e-mail, and delete the 
> original message.
> **
> *
> 
> 

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



RE: [PHP-DB] Paging large recordsets

2004-02-13 Thread Hutchins, Richard
I know phpclasses.org has a few recordset paging classes out there for your
convenience. Might want to try on a couple of those too just to see if they
fit.

Rich

> -Original Message-
> From: Robert Twitty [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 13, 2004 1:34 PM
> To: Karen Resplendo
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Paging large recordsets
> 
> 
> Most of the PHP solutions I have seeen require the use of session
> variables.  You could create an array containing only the unique
> identifiers of all the records, and then store it into a 
> session variable.
> You would then use another session variable to retain the 
> page size, and
> then include the page numbers in the "Next", "Prev", "First", 
> "Last" and
> "Absolutr" page links.  Printing is probably best done with 
> dynamically
> generated PDF instead of HTML.
> 
> -- bob
> 
> On Fri, 13 Feb 2004, Karen Resplendo wrote:
> 
> > I guess the time has come that my boss wants "Next", 
> "Previous", "First", "Last" paging for our data displays of 
> large recordsets or datasets.
> >
> > Any good solutons out there already? I have pieces of a few 
> examples.
> >
> > Also, how to deal with printing? I would assume that the 
> ideal page size is not the ideal printed page size. oi vay!
> >
> > TIA
> >
> >
> > -
> > Do you Yahoo!?
> > Yahoo! Finance: Get your refund fast by filing online
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Problem with cookies

2004-02-16 Thread Hutchins, Richard
Normally, you get that warning when you've already sent display information
to the browser before you attempt to use the header() function. You need to
make sure you haven't sent ANY HTML to the browser prior to the header()
line in your code. You can check the PHP documentation regarding the
header() function.

Hard to tell without seeing your code though.

HTH,
Rich

> -Original Message-
> From: Ruprecht Helms [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 16, 2004 1:00 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Problem with cookies
> 
> 
> Hi,
> 
> I've some trouble with the handling of cookies. At the 
> command setcookie I get a 
> warning that the header is already set. How can I fix the problem.
> 
> Regards,
> Ruprecht--
> --
> Ruprecht Helms IT-Service & Softwareentwicklung
> 
> Tel./Fax +49[0]7621 16 99 16
> 
> Web:  http://www.rheyn.de
> email:[EMAIL PROTECTED]
> 
> 
> 

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



RE: [PHP-DB] Interbase: How to get table structure via SQL ?

2004-02-18 Thread Hutchins, Richard
If you're using MySQL, you can use the DESCRIBE tablename command. There's a
pretty straightforward (and easy to find) section on the DESCRIBE command in
the MySQL documentation.


> -Original Message-
> From: DiZEM PGC [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 18, 2004 8:11 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Interbase: How to get table structure via SQL ?
> 
> 
> Hi,
> 
> does anyone know how to get the Structure of a table using SQL.
> (ex.: SELECT ?RELATION_SOURCE?, RDB$RELATION_NAME FROM RDB$RELATIONS)
> 
> Isn't there any table containing the CREATE STATEMENT for a table?
> Maybe I have to use another command?
> Please help !
> 
> Thx,
> DiZEM
> 
> -- 
> GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 
> EUR/Monat...)
> jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ 
http://www.gmx.net/derspiegel +++

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

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



RE: [PHP-DB] Interbase: How to get table structure via SQL ?

2004-02-18 Thread Hutchins, Richard
Sorry...just re-read the subject and realized you're using Interbase. Need
coffee. ;)


> -Original Message-
> From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 18, 2004 8:24 AM
> To: 'DiZEM PGC'; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Interbase: How to get table structure via SQL ?
> 
> 
> If you're using MySQL, you can use the DESCRIBE tablename 
> command. There's a
> pretty straightforward (and easy to find) section on the 
> DESCRIBE command in
> the MySQL documentation.
> 
> 
> > -Original Message-
> > From: DiZEM PGC [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, February 18, 2004 8:11 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] Interbase: How to get table structure via SQL ?
> > 
> > 
> > Hi,
> > 
> > does anyone know how to get the Structure of a table using SQL.
> > (ex.: SELECT ?RELATION_SOURCE?, RDB$RELATION_NAME FROM 
> RDB$RELATIONS)
> > 
> > Isn't there any table containing the CREATE STATEMENT for a table?
> > Maybe I have to use another command?
> > Please help !
> > 
> > Thx,
> > DiZEM
> > 
> > -- 
> > GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 
> > EUR/Monat...)
> > jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ 
> http://www.gmx.net/derspiegel +++
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



[PHP-DB] Re: [PHP] Re: [PEAR] Re: PEAR DB 1.6.0 has been released

2004-02-23 Thread Richard Davey
Hello Justin,

Monday, February 23, 2004, 4:11:40 PM, you wrote:

JP>3) A unified architecture for mysql and Oracle. You don't have to
JP> remember different functions for use with different databases.

That abstraction only abstracts the functions to connect to, select and
query the database, surely? Oracle/SQL Server/MySQL all use slightly
different SQL syntax - so if the query you pass in has to be unique
depending on the database in hand - you're already having to remember
a stack of system specific SQL and will have to code your application
to take into consideration all of those different syntax.

What I'm trying to say is that abstracting the connection to the
database is the easy part, writing an application that will support
them all is another matter.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



[PHP-DB] Re[2]: [PHP] Re: [PEAR] Re: PEAR DB 1.6.0 has been released

2004-02-23 Thread Richard Davey
Hello Justin,

Monday, February 23, 2004, 5:30:16 PM, you wrote:

JP> The real hairy part is dealing with joins as the syntax is very 
JP> different across the DBs. This can be solved by simply not doing them or

I wish :)

JP> using a syntax that most use. Or you can try to use DB_DataObject, but
JP> I'm not sure it works for all DBs yet.

Yeah, I thought as much. I think if I was creating an application to
be distributed open-source on the Internet it'd make life easier
for other developers if it used something like the PEAR-DB class, but
when you're building your own/companies site and know the environment
it lessens the value somewhat.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
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-02-26 Thread Hutchins, Richard
Been kind of following this thread off and on...

If the syntax is acceptable by MySQL, which it appears to be, is it possible
that the variables you are using within the query string are not set to
anything? Or is it possible that there is something broken immediately
before the query string is fired?

Most times, when I run into query problems, immediately before I send the
query to the database, I'll echo the statement out to the browser so I can
see the exact string that's being sent to the db.

So can you do this:

$sql = "INSERT INTO log SET term='$search', returns='$arrayword',
time=CURTIME(), date=CURDATE(), ip='$ip'";

echo $sql;

$logit = mysql_query($sql) or
die(mysql_error());


And check out what gets spit out to the browser when $sql is echoed? Maybe
that'll point out something that's going wrong. If nothing is apparent, post
the results of echo $sql back to the list and maybe one of us will find
something.

HTH.

Rich

> -Original Message-
> From: Axel IS Main [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 26, 2004 2:37 PM
> To: PHP DB
> Subject: Re: [PHP-DB] What's wrong with this query?
> 
> 
> Ok, ok. I get the message about the syntax. Since I've used 
> this syntax 
> for a long time and so far there hasn't been a problem I'll assume 
> that's not the problem. I will, however, review this and 
> probably make 
> some changes for the sake of compliance if nothing else. In 
> any event, 
> the syntax is NOT why it is failing, smart ass comments by people who 
> think two years is a long time not withstanding.
> 
> As to the useful questions that where asked. There is no 
> error reported. 
> Error reporting is set to E_ALL & ~E_NOTICE. I removed the 
> notice part 
> so I would get everything and still nothing showed up. I'm 
> also logging 
> errors and nothing is showing up in the log either. Not all PHP/MySQL 
> errors are reported. Sometimes what happens is not considered 
> an error, 
> even though it does not do what you would expect it to do. If 
> the query 
> syntax was wrong, I would get a syntax error. There is no 
> error, it just 
> doesn't write to the table. I can go into phpMyAdmin and with 
> the same 
> syntax insert into the table all day long.
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] passing parameter to function

2004-02-26 Thread Hutchins, Richard
Script 1:


...other form stuff as necessary...


Submit the form.

Script 2:
Access the data passed in the hidden field as $_POST["codename"].

For example, echo $_POST["codename"];

Rich



> -Original Message-
> From: Robbie Staufer [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 26, 2004 3:21 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] passing parameter to function
> 
> 
> Hi,
> 
> Say I have a script that knows the value of a variable $codename.
> The script contains a function that needs to know the value 
> of $codename.
> What is the syntax for passing the parameter to the function?
> 
> Example:  the script knows that $codename = blah.  The 
> function has to 
> pass 'blah' on to another script as a hidden value in a form 
> using the 
> POST method.  The other script is not receiving the value of 
> $codename.
> 
> Thanks for any help.
> Robbie
> 
> -- 
> -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
> Robbie Staufer
> NCAR/SCD
> 1850 Table Mesa Dr. Rm. 42
> Boulder, CO. 80305
> (303) 497-1836
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP-DB] "global" variables

2004-03-01 Thread Richard Davey
Hello Torsten,

Monday, March 1, 2004, 4:48:39 PM, you wrote:

TL> I build a small web interface to a database.

This should be on the PHP General list, not DB - but even so, I'll
answer your question:

TL> if(!isset($page_no))
TL> {
TL> $page_no = "login";
TL> }

TL> I declared the $page_no in my
TL> #variables.php as
TL> $v_dec["page_no"] = $page_no.

You don't check $v_dec in your manage.php script though, you check to
see if $page_no is set which it never will be, because no-where do you
give it a value.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html


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



RE: [PHP-DB] Is there a limit to columns in a mysql table

2004-03-01 Thread Hutchins, Richard
1. What type of error is being returned by the database when your INSERT
fails?
2. Does the INSERT work from the command line interface for your database?
3. What does the table structure look like (DESCRIBE tablename)?

> -Original Message-
> From: Piet from South Africa [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 01, 2004 11:29 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Is there a limit to columns in a mysql table
> 
> 
> Hi
> 
> I want to know if there is a limit to the amount of columns 
> that can be
> created in a table, i have 30 columns, and i cannot insert 
> data, i have
> checked everything over and over again, even written a shorter insert
> function that worked on the database.
> 
> Can anyone help me here!
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] my code

2004-03-01 Thread Hutchins, Richard
For one thing, your column name Long is invalid. It's a reserved keyword in
MySQL. Either enclose it in backticks or change the name of the column.

If you want to see what the db is reporting, do this:

$result = mysql_query($query)
or die(mysql_error())

And see what the database tells you.



> -Original Message-
> From: Piet from South Africa [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 01, 2004 11:48 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] my code
> 
> 
> This is my code
> 
> My function call:
> 
> insert_property($name, $upfile1, $upfile2, $upfile3, 
> $upfile4, $bed, $bath,
> 
> $living, $dining, $reception, $garages, $flats, $servant, 
> $pool, $jacuzzi,
> $lapa,
> 
> $entertain, $security, $securest, $short, $long, $contact, 
> $number, $mail,
> $fax,
> 
> $period, $prov, $city, $area);
> 
> My function:
> 
> function insert_property($name, $upfile1, $upfile2, $upfile3, 
> $upfile4,
> $bed, $bath,
> 
> $living, $dining, $reception, $garages, $flats, $servant, 
> $pool, $jacuzzi,
> $lapa,
> 
> $entertain, $security, $securest, $short, $long, $contact, 
> $number, $mail,
> $fax,
> 
> $period, $prov, $city, $area)
> 
> {
> 
> global $link;
> 
> 
> $query = "insert into property (name, photo1, photo2, photo3, 
> logo, bed,
> bath,
> 
> living, dining, reception, garages, flats, servant, pool, 
> jacuzzi, lapa,
> 
> entertain, security, securest, short, long, contact, number, 
> mail, fax,
> 
> period, prov, city, area)
> 
> values ('" . $name . "', '" . $upfile1 . "', '" . $upfile2 . "', '" .
> $upfile3 . "'
> 
> ,'" . $upfile4 . "', '" . $bed . "', '" . $bath . "', '" . 
> $living . "'
> 
> ,'" . $dining . "', '" . $reception . "', '" . $garages . "', 
> '" . $flats .
> "'
> 
> , '" . $servant . "', '" . $pool . "', '" . $jacuzzi . "', '" 
> . $lapa . "'
> 
> , '" . $entertain . "', '" . $security . "', '" . $securest . "', '" .
> $short . "'
> 
> , '" . $long . "', '" . $contact . "', '" . $number . "', '" 
> . $mail . "'
> 
> , '" . $fax . "', '" . $period . "', '" . $prov . "', '" . $city . "'
> 
> , '" . $area . "')";
> 
> 
> $result = mysql_query($query);
> 
> if (!$result)
> 
> {
> 
> echo "no result";
> 
> }
> 
> else
> 
> {
> 
> echo "";
> 
> 
> }
> 
> }
> 
> 
> "Piet From South Africa" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi
> >
> > I want to know if there is a limit to the amount of columns 
> that can be
> > created in a table, i have 30 columns, and i cannot insert 
> data, i have
> > checked everything over and over again, even written a 
> shorter insert
> > function that worked on the database.
> >
> > Can anyone help me here!
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



[PHP-DB] Optimising LIMITs

2004-03-01 Thread Richard Davey
Hi all,

I have what is probably a quite standard question and would love to
know how you would all approach this scenario:

I have a table in a database that has approx. 190,000 records in it.
The table is currently 128MB in size and I'm happy that it is well
constructed with no data duplication and sensible indexes.

I'm using MySQL 3.28.58. and my question is about querying this volume
of data efficiently.

The table holds forum threads (several years worth) so a common query
running on the table is to bring back the top 50 or 100 threads from a
board within the forum.

To do this I'm using a LIMIT on my query and for the paging through
the data (i.e. the first 100 threads, the next 100, etc) I use the
LIMIT n,x syntax. Threads are sorted by date (most recent to the top).

This is fine and it works well but I'm concerned it's not the most
efficient way to do this because the use of LIMIT is causing the
whole table to be scanned each time.

Here is a typical (simplified) query:

SELECT *
FROM thread
WHERE
thread.status='L' AND
thread.boardid=1
ORDER BY created DESC
LIMIT 100,50

This takes over 1.02 seconds to process.

Running an EXPLAIN on my query shows that it's using one key
(boardid), but in the Extra field it shows it is having to use a
filesort on the data. 5701 rows were used in order to bring back the
final 50 - that's every single thread for this board.

What I'm trying to figure out is a more efficient way of selecting a
block of 50 or 100 records from any point in my table without MySQL
needing to sort/check them all first.

One thought I did have was that the Primary Key on my table is called
threadid - and I thought that instead of bring back the data in my
original query, I could collect nothing but the thread IDs and then
use a separate query that does something like: "SELECT * FROM thread
WHERE threadid IN (...)" (where ... = all of the IDs previously
selected). Would the fact that threadid is my primary key make the
original LIMIT/sort faster?

Any thoughts appreciated.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re[2]: [PHP-DB] "global" variables

2004-03-01 Thread Richard Davey
Hello Torsten,

Monday, March 1, 2004, 6:30:11 PM, you wrote:

TL> You mean this will unset $v_dec["page_no"]?

Well $page_no at that point in your script equals nothing, so yes - it
will always make $v_dec equal nothing.

TL> This explains why at reload of index.php happens what happend.
TL> But how to solve it? I _have_ to store some variables anywhere.

Yes agreed - but you cannot store them in a variable because they will
be lost each time the page reloads. Why not store them in a cookie?

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re[2]: [PHP-DB] Optimising LIMITs

2004-03-01 Thread Richard Davey
Hello Jeffrey,

Monday, March 1, 2004, 5:27:41 PM, you wrote:

JM> Primary keys aren't any faster than normal keys. They're simply for
JM> identification. (correct me if I'm wrong, that is my understanding)
JM> If you don't already have an index on created, I'd do that.

I do - here's a question though, what is the best way to have an
index? To combine multiple fields into one index - or to have one
field per index? I ask because MySQL will appear to select the best
possible index for the query and sometimes it's wrong - I read
somewhere you can control which index it uses, but if you had a
"combined" index would this make things any more/less effective?

JM> If you want to optimize things further, I would run the query at midnight
JM> each morning, and instead of paging through the entire table, just page
JM> through that temporary table.

Figured someone might suggest that - I will have to look into it.
Thanks.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



[PHP-DB] Optimising LIMITs - alter table order by...

2004-03-02 Thread Richard Davey
Hello Pavel,

Tuesday, March 2, 2004, 7:20:03 AM, you wrote:

PL> 2. ALTER TABLE `board` ORDER BY `threadid` DESC;

I never knew you could do this - it's quite fascinating this list
sometimes :)

I do have a question though - if I use this "order by" table
alteration, does MySQL remember it, or will I need to keep doing it
every now and again?

For example if I view the data in my table I can see the IDs like
this:

1
2
3
250
5
6
323

(etc)

This is simply where MySQL has gone back and re-used an old slot for a
new record.

However if I use your query technique for bringing back a block of
records knowing they're in the exact right sequence - will MySQL just
fragment this again over time?

PL> Split your table in two tables, like:

I can't see a real benefit of doing this. In my mind 675 bytes per
thread isn't really that much. The only thing I could split away would
be the subject of the thread (associated messages are held elsewhere)
but in making a smaller table I'd just have to join the data back in
again, surely?

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re[2]: [PHP-DB] Optimising LIMITs - alter table order by...

2004-03-02 Thread Richard Davey
Hello Pavel,

Tuesday, March 2, 2004, 12:33:17 PM, you wrote:

PL> 
http://www.mysql.com/documentation/mysql/bychapter/manual_SQL_Syntax.html#ALTER_TABLE
PL> ORDER BY allows you to create the new table with the rows in a specific
PL> order. Note that the table will not remain in this order after inserts
PL> and deletes. In some cases, it might make sorting easier for MySQL if

Figured as much, thanks for the reference. I hope one day MySQL will
produce a manual that isn't one horrendous long document per section.

PL> You need to split the table and move "post messages" to another table if
PL> you want to get higher perfomance for (2).

With regard to disk seeking, here is my table structure:

CREATE TABLE `thread` (
  `threadid` int(10) unsigned NOT NULL auto_increment,
  `site_user_id` varchar(32) NOT NULL default '',
  `boardid` tinyint(3) unsigned NOT NULL default '0',
  `subject` varchar(200) NOT NULL default '',
  `modified` timestamp(14) NOT NULL,
  `created` timestamp(14) NOT NULL,
  `status` enum('L','P','H','D') NOT NULL default 'L',

  PRIMARY KEY  (`threadid`),
  FULLTEXT KEY `subject` (`subject`),
  KEY `boardid` (`boardid`),
  KEY `site_user_id` (`site_user_id`),
  KEY `created` (`created`),
  KEY `status` (`status`)
) TYPE=MyISAM;

As well as moving the subject field to another table (because it's the
only non-defined length field), would another way of speeding up the
disk seek be to turn it from a varchar(200) into a char(200)? I know
it means a larger table size, but MySQL should then be able to
calculate exactly where to jump to in the file?

PL> All MySQL functions should be very optimized, but there may be some
PL> exceptions. BENCHMARK(loop_count,expression) is a great tool to find out
PL> if this is a problem with your query.

I will look at this now.

I had been toying with the idea of creating a cache table that held
the 200 most recent threads, pre-sequenced so I just bring back that
instead of having to query the database unless they go beyond that 200
limit.

Your comments (and MySQL manual posts) have been very useful, thank
you.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP-DB] Re: Alterations

2004-03-02 Thread Richard Davey
Hello Pavel,

Tuesday, March 2, 2004, 2:05:44 PM, you wrote:

PL> Note! IMHO

[snip]

Wow. I'm speechless - thank you, that was probably the single most
useful post I've ever read on this list. You sir are a genius.

PL> Change `site_user_id` FROM VARCHAR(32) TO CHAR(32)

It was a char(32) - it holds an MD5 key, for some reason MySQL-Front
exported the description as a varchar, sorry for the confusion!

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP-DB] Re: Alterations + all numeric tables

2004-03-03 Thread Richard Davey
Hello Pavel,

Tuesday, March 2, 2004, 2:05:44 PM, you wrote:

PL> 398(rows) * 37(average) = 14KB, sorting is more faster
PL> etc...

I have been reading over the MySQL Manual today (specifically the
Optimisation sections) and one thing caught my eye:

"In some cases, MySQL can read rows from the index without even
consulting the datafile. If all columns used from the index are
numeric, only the index tree is used to resolve the query."

I have followed your advice and moved the variable length and char
fields out of my core table so all I am left with are the following:

threadid int(4) unsigned primary
boardid tinyint(3) unsigned
modified timestamp
created timestamp
status enum('l','p','h','d')

My question is - if I change the status field from an enum to a tiny
int (so L=1, P=2, etc) will MySQL consider the table to be purely
numeric? Or would the timestamps stop this from happening? If it does
then maybe I would see some more performance increases.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



RE: [PHP-DB] mysql_num_rows

2004-03-03 Thread Hutchins, Richard
Craig,

First off, where is the $db variable being set? You include it in:

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

which is line 65, but, according to your function, it's not passed into the
function as an argument and I don't see you setting $db equal to anything
inside the function.

Second, why are you checking

if(!$query)?

You set $query to the string

$query ="SELECT username FROM users WHERE username=('$username')";

so why would it never NOT be set? Maybe you mean to check to see if the
query produced any results? In which case you should probably be checking

if(!$results).

Additionally, you should probably add an or die(mysql_error()) after your
mysql_query... line to display errors from the database.

And if your query process fails at line 65 because $db isn't defined, then
line 70 won't work because you haven't performed a query to return any rows.

Hope this helps.

Rich

> -Original Message-
> From: Craig Hoffman [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 03, 2004 3:34 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] mysql_num_rows
> 
> 
> ok, I uncommented the line and changed a few things around.  
> However I  
> am still getting errors.   I really do appreciate everyone's  help.   
> Thanks CH
> Here is the 'new' code:
> 
> function notify_password($username, $password)
> // notify the user that their password has been changed
> {
> 
> $query ="SELECT username FROM users WHERE username=('$username')";
> => line 65$result = mysql_query($query, $db);
>  if (!$query)
>  {
>return false;  // not changed
>  }
> => line 70else if (mysql_num_rows($result)==1)
> 
>$user_id = mysql_result($result, 0, 'user_id');
>$from = "From: [EMAIL PROTECTED] \r\n";
>$mesg = "Your password has been changed to $password \r\n"
>."You might want to change it next time you 
> log in. \r\n";
> 
>if (mail($username, 'Cyclists Edge login information', $mesg,  
> $from))
>  return true;
>else
>  return false;
>  }
> 
> 
> Warning: mysql_query(): supplied argument is not a valid MySQL-Link  
> resource in  
> /Users/choffman/Sites/www/cyclistsedge/include/ 
> forgot_password_functions.php on line 65
> 
> Warning: mysql_num_rows(): supplied argument is not a valid MySQL  
> result resource in  
> /Users/choffman/Sites/www/cyclistsedge/include/ 
> forgot_password_functions.php on line 70
>   Your new password has been sent to your email address.
> 
> __
> Craig Hoffman - eClimb Media
> 
> v: (847) 644 - 8914
> f: (847) 866 - 1946
> e: [EMAIL PROTECTED]
> w: www.eclimb.net
> _
> On Mar 3, 2004, at 2:17 PM, Daniel Clark wrote:
> 
> >>  $query ="SELECT username FROM users WHERE  
> >> username=('$username')";
> >> // $result = mysql_query($query, $db);
> >
> >
> > Above line should be uncommented.
> >
> >
> >>  if (!$query)
> >
> > And the "if" checking the number of rows returned from the 
> $result set.
> >
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP-DB] only showing partial info of a field in mysql...

2004-03-04 Thread Richard Davey
Hello Tristan,

Thursday, March 4, 2004, 10:27:34 AM, you wrote:

TPrsc> You know in PHPmyADMIN...
TPrsc> if you hav a large field, and hit browse, you only see some fo the text...
TPrsc> is this a PHP thing, or a MySQL thing... more improtantly, how can I do
TPrsc> that??

I don't know how PHPmyAdmin does it, but you can do this in SQL
directly without having to do it in PHP. Look at the SQL functions:

LEFT(), MID(), RIGHT() and SUBSTRING().

I.e.

SELECT LEFT(longfield, 100) FROM table

This will bring back the first 100 characters from the longfield
column (assuming it has 100 characters in it).

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP-DB] SELECT

2004-03-04 Thread Richard Davey
Hello peppe,

Thursday, March 4, 2004, 11:28:30 AM, you wrote:

p> Hi I have a  table users with columns name email and access
p> In email I have values [EMAIL PROTECTED] etc in access I have values 1,2,3,4,7,8
p> How can I filter value 2 ?
p> Beacause I need only users with value 2 to send email

SELECT * FROM users WHERE access=2

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re[2]: [PHP-DB] SELECT

2004-03-04 Thread Richard Davey
Hello peppe,

Thursday, March 4, 2004, 12:02:40 PM, you wrote:

p> The problem is in access values are like string 1,2,3,4,5

Sorry, I didn't realise that. In this case FIND_IN_SET (which I think
Ignatius suggested too).

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



RE: [PHP-DB] No data being put into the DB

2004-03-04 Thread Hutchins, Richard
Yeah, I prefer the ... '".$_POST["varname"]."' ... syntax primarily because
of the way my editor (EditPlus) highlights the code. I tried the braces
syntax in EditPlus and it doesn't highlight the same way. I'll check out the
editors you guys (Jason and Jeffrey) use to see if I like them and maybe
I'll switch (especially if they're free :) ).

I'll admit, the whole quote-dot syntax thing is a bigger pain than the
braces syntax. But I'm not aware of any performance or security issues
related to the use of quote-dot notation. If there are any, I'd certainly
like to be made aware of them. However, I think it comes down to issues of
personal preference and the coding standards of your individual corporate
environment or client.

> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 03, 2004 10:09 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] No data being put into the DB
> 
> 
> On Thursday 04 March 2004 10:36, [EMAIL PROTECTED] wrote:
> 
> > >>IMO it is better to use the braces syntax:
> > >>"insert into show
> > >>values('','{$_POST['Accnt_name']}','{$_POST['acc_num']}', ...)"
> >
> > I'm not second guessing at all, just curious as to why?  Is 
> it less work on
> > the parser?
> > Do you find it cleaner? 
> 
> Consistent - items in arrays are always referenced by $array['item'].
> Clean - no jumping in and out of double-quotes
> 
> > I've often used Richard's method myself, for the
> > color coding that shows
> > in my editors(Ultraedit and VIM) when concatenating with . 
> , mainly for
> > readability...but have found myself, of late, using the 
> braces more...
> 
> The braces syntax highlights fine on Quanta.
> 
> -- 
> 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 go to bed mad.  Stay up and fight.
>   -- Phyllis Diller, "Phyllis Diller's Housekeeping Hints"
> */
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Php datetime

2004-03-04 Thread Hutchins, Richard
You also have the option of changing the column type to TIMESTAMP. With a
TIMESTAMP column you don't have to do anything to get it to update
automatically. Just do an INSERT into the table and the column will be
updated automatically.

Here's a snippet, but check the full MySQL documentation for more
information.:

"Automatic updating of the TIMESTAMP column occurs under any of the
following conditions:
The column is not specied explicitly in an INSERT or LOAD DATA
INFILE statement.
The column is not specied explicitly in an UPDATE statement and some
other column changes value. (Note that an UPDATE that sets a column to the
value it already has will not cause the TIMESTAMP column to be updated,
because if you set a column to its current value, MySQL ignores the update
for efficiency.)
You explicitly set the TIMESTAMP column to NULL."


> -Original Message-
> From: ..: GamCo :.. Gawie Marais [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 04, 2004 8:35 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Php datetime
> 
> 
> hi,
> 
> i have created a mysql table where i would like to store the 
> date and time
> whenever a user logs into a web site. the login is done 
> through php/mysql as
> well but i'm not sure what the php code is to add the current 
> date/time into
> a mysql database. the field in the db is created as a 
> 'datetime' field.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Regards,
> 
> 
> Gawie Marais
> ..: GamCo :..
> 
> --
> Tel: +27 11 312 0481
> Fax: +27 11 312 0483 / +27 82 239 2986
> http://www.gam.co.za
> --
> if(empty($beer)) 
> { getbeer() } 
> else 
> { consume($beer) }
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Multiple deletes and updates...

2004-03-04 Thread Hutchins, Richard
Are you thinking about something like (off the top of my head, untested):




for each of the people listed on your page?

Then, in the script that handles the updating stuff, you simply do a 

foreach($_POST["update"] as $value){
$sql = "some UPDATE query using $value";
}

foreach($_POST["delete"] as $value){
$sql = "some DELETE query using $value";
}

to send information to the database? Depending on your requirements, you
might need to determine whether the data should be DELETEd or UPDATEd, but
that's not too tough either.

One suggestion would be to consider using radio buttons instead of
checkboxes to prevent somebody from accidentally checking both DELETE and
UPDATE then causing some sort of problem.


Hope this helps.

P.S. What the heck does chocka mean?

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 04, 2004 8:36 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Multiple deletes and updates...
> 
> 
> I simply can't get my head round this today
> Probably easy, but I've been chocka, and brain is melting...
> Anyhoo...
> 
> If I have a table, with say, id(unique, auto inc), name, email, 
> membership_type
> 
> I've listed them on a PHP page...
> I want to add a checkbox to each row, so that I can select 1 
> or all, and 
> then perform an action on ALL selected (Either Delete, or change 
> membership_type)
> I can do this with ease one by one, but I cant get my head 
> round to more 
> than one with one submit button...?
> 
> Can anyone nudge me in the right direction?
> I've seen this on the list before, but couldn't find it in 
> the archive (I 
> may have imagined it?)
> 
> cheers,
> Tris...
> 
> 
> *
> The information contained in this e-mail message is intended only for 
> the personal and confidential use of the recipient(s) named above.  
> If the reader of this message is not the intended recipient 
> or an agent
> responsible for delivering it to the intended recipient, you 
> are hereby 
> notified that you have received this document in error and that any
> review, dissemination, distribution, or copying of this message is 
> strictly prohibited. If you have received this communication 
> in error, 
> please notify us immediately by e-mail, and delete the 
> original message.
> **
> *
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



[PHP-DB] How do you make an IN span multiple tables?

2004-03-04 Thread Richard Davey
Hi,

I'm a bit stuck with the following: I need to select data from 3
different tables and want to do it via a SELECT ... IN query. Each
table has a primary key called thread_ref. I would like to do
something like this:

SELECT
  *
FROM
   table1,
   table2,
   table3
WHERE
 thread_ref IN (1,2,3,4,5,6,7,8,9,10)

Now the problem is that MySQL complains about the thread_ref being
ambiguous - which I know that it is. But putting a table name in-front
of it will limit the IN query to that specific table and cause no
results to be returned.

It is possible that not all of the tables will contain all of the
thread_ref's in question.

Does anyone have any ideas or is it just not possible using this
method? I'm not using MySQL 4 otherwise I would have looked at using a
UNION.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP-DB] working with ' in SQL

2004-03-04 Thread Richard Davey
Hello Adam,

Thursday, March 4, 2004, 3:30:32 PM, you wrote:

AW> Hi, I have an SQL statement that is ran when data is submitted through a
AW> form.  When someone types in a word with an ' such as farmer's the SQL
AW> statement fails.  I tried $_POST[data] =
AW> addslashes($_POST[data]); before 
AW> executing the SQL statement, but the statement still fails.  any 
AW> suggestions?  using words without a ' works fine.

$_POST['data'] = addslashes($_POST['data']);

will work - you need the quotes or the array element won't be found.

Here is a function that will addslashes to an entire array (in this
instance $_POST) if you want:



-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



[PHP-DB] How to calculate size of INT(x) field

2004-03-05 Thread Richard Davey
Hi all,

Sorry for such a newbie question! But I have been digging through the
O'Reilly MySQL book + MySQL Cookbook and cannot find an answer to what
I think is a very simple question:

When creating an unsigned INT field, how does the value in brackets
(if given) limit the size of the field? I.e. what is the difference in
possible maximum values held between an INT(10) and an INT(4)? I know
MySQL will create an INT(10) as standard but I'm not sure I need it to
be able to hold a number that high.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP-DB] Forum Script

2004-03-07 Thread Richard Davey
Hello Marcjon,

Sunday, March 7, 2004, 6:12:49 PM, you wrote:

ML> If I'm not being clear or I'm not using proper netiquette, I appologize,
ML> I'm new to this (mailing lists). Any help would be appreciated!

Nothing wrong at all, but it'd much easier for us if you could post
your MySQL tables so we can see the relationship between them and see
what fields you have, etc.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



RE: [PHP-DB] Pulldown value not passed to next page

2004-03-11 Thread Hutchins, Richard
Karen,

I'm assuming that when you say:
> For some reason, 
> when Previous/Next are clicked, the value passed is still 15 
> even though the pulldown says something else (5 or 15 or 
> whatever)

you're drawing that conclusion because 15 images (or whatever) are displayed
on the resulting page regardless of what you select in the pulldown. Does
the actual URL say 15 or does it say something else (e.g. 20)?

If the URL shows that pagesize=15, but the resulting page displays 20
images, it's possible the problem is that you're not checking the actual
value passed in the URL.

Your current code:
 If(!$pagesize)
  {
   $pagesize=15;
  }

Should read:
If(!$_GET["pagesize"]){
$pagesize=15;
}
Else{
$pagesize = $_GET["pagesize"];
}

This is assuming that you have register globals turned off (I think that's
right). Because, otherwise, each time the page loads with your current code,
$pagesize would never be set and would always default to 15.

Hope this helps. 

Rich

> -Original Message-
> From: Karen Resplendo [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 11, 2004 2:11 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Pulldown value not passed to next page
> 
> 
> What is wrong with this picture? I build a pulldown for 
> selecting page size(number of rows in one page). If page is 
> new, it gives the default (selected) of 15. For some reason, 
> when Previous/Next are clicked, the value passed is still 15 
> even though the pulldown says something else (5 or 15 or 
> whatever). Down below my pulldown code is the code to call 
> the Next/Previous pages (just the important part)>
>  
> **
> Pulldown built here
> **
>//use rcan select page size from a pulldown
>  $myArray = array('5','10','15','20','25','30','35', '40');
> $numElements = count($myArray);
>  If(!$pagesize)
>   {
>$pagesize=15;
>   }
> echo "";
> /*loop through filling  pulldown*/
>   for($i=0;$i<=$numElements;$i++){ 
>   echo "".$myArray[$i]."\n";
> }
> Else
> {
>  echo ">".$myArray[$i]."\n";
> }
>   }  
> echo "";
>  
> 
> link when Next/Previous clicked
> ***
>  
> else// not the last page, link to the next page 
> echo " href=\"chemlatestPAGETEST.php3?pwsno=".$pwsno."&pagenum=" . 
> ($pagenum + 1)."&pagesize=".$pagesize.  "\">Next"; 
> 
> 
> -
> Do you Yahoo!?
> Yahoo! Search - Find what you're looking for faster.
> 

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



RE: [PHP-DB] How to redirect after a valid login

2004-03-12 Thread Hutchins, Richard
Not to mention, the header() statement is being used incorrectly in the
example code.

You don't echo out the header() statement. You simply use it.

For example...



In your sample code, you include("mainmenu.php") which looks like it would
output to the browser. You can't to that on the same page you use header().

HTH,
Rich


> -Original Message-
> From: Brent Baisley [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 12, 2004 4:12 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] How to redirect after a valid login 
> 
> 
> You can do a redirect at any point in your code as long as 
> you haven't  
> sent anything to the browser yet. You can run 10,000 lines of 
> PHP code  
> and do 1,000 queries and still send a redirect to the 
> browser. In a nut  
> shell, have no echo statement before your redirect.
> 
> 
> On Mar 12, 2004, at 3:02 PM, Larry Sandwick wrote:
> 
> > Is there a way that after a execution of a Login script and 
> validation
> > of login from a MySql database to automatically redirected to run
> > another script ?
> >
> >
> > example
> >
> > someone logs in through the login.php script, in the login 
> script you
> > are validated and then you run another script called mainmenu.php ?
> >
> >
> >
> >
> >
> > I have tried the following:
> >
> >
> >
> > include "mainmenu.php"; // Which gives me an error !
> >
> >
> >
> > This one just put the link on the page and does not 
> redirect to another
> > script.
> >
> > echo "header(Location:  > href=http://www.example.com/InVocie/MainMenu.php);
> > '
> > 
> target='_blank'>http://www.example.com/InVoice/MainMenu.php?r=$a); > a>";
> > /* Redirect browser */
> >
> >
> >
> >
> >
> >
> > Larry Sandwick
> >
> > Sarreid, Ltd.
> >
> > Network/System Administrator
> >
> > phone: (252) 291-1414 x223
> >
> > fax  : (252) 237-1592
> >
> >
> >
> >
> -- 
> Brent Baisley
> Systems Architect
> Landover Associates, Inc.
> Search & Advisory Services for Advanced Technology Environments
> p: 212.759.6400/800.759.0577
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] MySQL Logging

2004-03-13 Thread Richard Bewley
Hi,

You could do something like tail -n25 /var/log/mysqld.log | mail -s
"Database Logs" [EMAIL PROTECTED], and run it in cron.  For logging, if you
want to log queries, you would use mysqld --log=/var/log/queries.log, but
I'm not sure this is the type of logging you're looking for.

What might be a better idea, is do the mysqldump, dump everything to a text
file, then, at the end of the text file, append the date so that it looks
like:

INSERT INTO
03/13/2004

Then, just tail the last 10 lines of the text file, and you can verify a
couple lines of data as well as the current date.  Worse case, you have to
restore that data, you just have to remove the date.

Hope this helps,
Richard

-Original Message-
From: Jai Jones [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 13, 2004 8:13 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL Logging

Hi,

Sorry if this the wrong list, I am a little confused on how to get MySQL 
logging working, I am hoping some PHP users are doing something like this.

I am backing up my MySQL data using a shell script and mysqldump. I would 
like to be able to send an email notification to myself to know that the 
dump worked.

My idea is tac'ing or tail'ing the last few entries of a mysql (or 
mysqldump?) log and pipping it to email. Does this sound like a good idea?

It appears my server is not logging by default, how do I enable a log that 
would store this info, or am I looking at this the wrong way.

All help is kindly appreciated.

Thankyou :)
JJ

_
MSN Messenger: instale grátis e converse com seus amigos. 
http://messenger.msn.com.br

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

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



RE: [PHP-DB] Multiple Sorts

2004-03-16 Thread Hutchins, Richard
Robert,

You should be able to just do:
SELECT * FROM access_tracking WHERE user = '$user_id' ORDER BY time
DESC,date_accessed ASC;

Just experiment with the ORDER BY columns and the ASC and DESC orders to get
the results you're looking for.

Hope this helps,
Rich

> -Original Message-
> From: Robert Sossomon [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 16, 2004 7:57 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Multiple Sorts
> 
> 
> How can I write a sort to sort on 2 columns, one ascending, one
> descending?
> 
> $get_list = "select * from access_tracking where user = 
> '$user_id' order
> by time,date_accessed desc"
> 
> But the ordering seems backwards sorted by date first, and then time.
> 
> TIA!!
> Robert
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] MySQL category tree db sorting

2004-03-19 Thread Hutchins, Richard
I'd recommend you search the PHP archives for an answer. This question comes
up a few times a year and the last time I remember seeing it, somebody (John
Holmes, I think) provided an excellent discourse on the different ways to
approach this solution.

You'll probably get other new responses with recommendations as to how to
proceed as well, but the archives should yield a wealth of information on
this issue in a relatively short period of time.

HTH,
Rich


> -Original Message-
> From: Age Bosma [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 19, 2004 9:48 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] MySQL category tree db sorting
> 
> 
> I'm trying to work out what the most efficient way will be to get the 
> complete tree structure from top to bottom of a category tree db. 
> Starting with the first main branch listing it's first child branch 
> followed by it's children, after that the second child 
> branch, ect. When 
> the first main branch is done it should start with the second main 
> branch, etc.
> 
> I've got a category tree db with the following columns:
> 
> cat_id - Unique id for each row
> parent_id - cat_id of its parent, 0 if it has none
> prev_sibling_id - cat_id of it's previous sibling, 0 if it has none
> next_sibling_id - cat_id of it's next sibling, 0 if it has none.
> 
> To get the complete tree stucture from the db, is it possible 
> to get the 
> sequence from top to bottom by one sql query, should the 
> whole table be 
> gotten and sorted using php or does it require multiple (nested) 
> query's? (or a combination of both)
> If all the rows are correctly sorted I can use php to determine which 
> position it has in the tree if I run by each row one by one.
> 
> I could at least group by parent_id but sorting in the quiry 
> can hardly 
> be done because the id itself tells nothing about the position or 
> sequence in the tree.
> If the prev_sibling=0 it could be placed first and if 
> next_silbing=0 it 
> could be placed last (per parent group) but again you have no 
> controle 
> over the rows in between, am I right about this so far?
> 
> What would be the best solution?
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Testing - no emails since 11:45 AM 3/23/04

2004-03-23 Thread Hutchins, Richard
List has been quiet, but I (obviously) saw your post, Gary.

Rich



> -Original Message-
> From: Gary Every [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 23, 2004 4:44 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Testing - no emails since 11:45 AM 3/23/04
> 
> 
> Testing, have received no emails since 11:45
> 
> Gary Every
> Sr. UNIX Administrator
> Ingram Entertainment Inc.
> 2 Ingram Blvd, La Vergne, TN 37089
> "Pay It Forward!"
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Newbie question

2004-03-24 Thread Hutchins, Richard
Try:





> -Original Message-
> From: Gajo Csaba [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 24, 2004 4:10 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Newbie question
> 
> 
> Hi!
> I'm new to PHP, so this may be an easy question. I tried to make a 
> simple form-page, where the user enters his name, and on the 
> following 
> page it says "Hello $name". What happens is that on the 
> second page it 
> says soemthing like "unknown identifier $name".
> 
> I'm using Apache 2 so that may be causing the problem, cause 
> this is a 
> clear textbook example:
> 
> -- first.php --
> 
> 
> First
> 
>  vlink="#808040"
> alink="#808040">
> 
> Whats your name?
>  value="">
> 
> 
> 
> 
> --- second.php 
> 
> 
> Second
> 
>  vlink="#808040"
> alink="#808040">
>print "Hello $name!";
> ?>
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] password input type

2004-04-05 Thread Hutchins, Richard
It's presentation layer only - the data is not encrypted during transfer.

Rich


> -Original Message-
> From: matthew perry [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 05, 2004 2:14 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] password input type
> 
> 
> Does using a pasword input type  type="password"> 
> make the transfer more secure from someone "sniffing" my 
> connection or 
> does it only shield an onlooker from seeing what the user enters?
> - Matt
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Where's the error?

2004-04-08 Thread Hutchins, Richard
If you "view source" on the page that's displaying nothing, is there any
HTML code there? If so, search through it and let us know if there's a PHP
error buried in the HTML code somewhere.



> -Original Message-
> From: Robert Sossomon [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 08, 2004 3:56 PM
> To: 'Edward Peloke'; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Where's the error?
> 
> 
> It is not displaying anything at all.  
> 
> -Original Message-
> From: Edward Peloke [mailto:[EMAIL PROTECTED] 
> Sent: Friday, April 09, 2004 3:52 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Where's the error?
> 
> 
> does the page actually error or does it not do anything?
> 
> -Original Message-
> From: Robert Sossomon [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 08, 2004 3:41 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Where's the error?
> 
> 
> I have this script which SHOULD produce a linked webpage for 
> soon-to-be
> created static web pages, however I can't seem to find the error in my
> code:
> 
>  //connect to database
> include 'db.php';
> 
> $display_block = "PFS Sales Categories Select a 
> category to
> see its items.";
> 
> //Show categories first
> $get_cats = "select id_num, id_name, description, cat_code from
> PFS_categories order by id_name"; $get_cats_res = 
> mysql_query($get_cats)
> or die(mysql_error());
> 
> if (mysql_num_rows($get_cats_res) < 1)
> {
>  $display_block = "Sorry, no categories to browse."; }
> else {  while ($cats = mysql_fetch_array($get_cats_res))  {
>   $cat_id = $cats[id_num];
>   if ($cat_id != "53" || $cat_id != "54" || $cat_id != "55" || $cat_id
> != "117" || $cat_id != "118")
>   {
>   $cat_title = strtoupper(stripslashes($cats[id_name]));
>   $cat_desc = stripslashes($cats[description]);
>   $display_block .= " href=$_SERVER[PHP_SELF]?cat_id=$cat_id>$cat_title
> $cat_desc\n";
>   
>   if ($_GET[cat_id] == $cat_id) //get items
>   {
>$get_items = "select id, item_num, description from PFS_items where
> cat_code = $cat_id";
>$get_items_res = mysql_query($get_items) or die(mysql_error());
>
>if (mysql_num_rows($get_items_res) < 1)
>{
> $display_block = "Sorry, no Items to browse.\n";
>}
>   else
>   {
> #   $display_block .= "\n";
>while ($items = mysql_fetch_array($get_items_res))
>{
> $item_id = $items[id];
> $item_num = $items[item_num];
> $item_desc = stripslashes($items[description]);
> if ($item_num != "ABC-R37" || $item_num !=  "ABC-R42" || $item_num
> != "HB-99100" || $item_num != "RO-PUMPS" || $item_num != "ML-HDGALJUG"
> || $item_num != "PFS-CAC21" || $item_num != "PFS-CO2")
> {
> $display_block .= " href=\"catalog/$item_id.html\">$item_num -
> $item_desc\n";
> } 
>}
> #   $display_block .= "\n";
> #   $display_block .= "\n";
>   }}
>  }
> }
> ?>
> 
> 
> Categories of Items
> 
>   include("nav/top_nav.html");
> ?>
>   include("nav/side_nav.html");
> ?>
>   
> 
> 
> 
>   
> 
>   include("nav/bottom_nav.html");
> ?>
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Where's the error?

2004-04-08 Thread Hutchins, Richard
I think you're right, Robert. Hopefully, your editor has a Match Brace
feature or something similar so you don't have to search manually. You also
might want to raise your level of error reporting in your PHP.ini file so,
in your testing environment, those errors get spit out to the browser. It'll
save you some time searching around. Up to you though (obviously).

Happy hunting! ;)

> -Original Message-
> From: Robert Sossomon [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 08, 2004 4:05 PM
> To: 'Hutchins, Richard'; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Where's the error?
> 
> 
> Nothing, 
> 
> I just found this in the error log:
> PHP Parse Error: parse error, unexpected $ in catalog.html on line 74
> 
> This is the last line of the whole file...  Guessing I have a curly
> brace not closed somewhere???
> 
> -Original Message-
> From: Hutchins, Richard [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, April 08, 2004 4:01 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Where's the error?
> 
> 
> If you "view source" on the page that's displaying nothing, 
> is there any
> HTML code there? If so, search through it and let us know if there's a
> PHP error buried in the HTML code somewhere.
> 
> 
> 
> > -Original Message-
> > From: Robert Sossomon [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, April 08, 2004 3:56 PM
> > To: 'Edward Peloke'; [EMAIL PROTECTED]
> > Subject: RE: [PHP-DB] Where's the error?
> > 
> > 
> > It is not displaying anything at all.
> > 
> > -Original Message-
> > From: Edward Peloke [mailto:[EMAIL PROTECTED]
> > Sent: Friday, April 09, 2004 3:52 AM
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: RE: [PHP-DB] Where's the error?
> > 
> > 
> > does the page actually error or does it not do anything?
> > 
> > -Original Message-
> > From: Robert Sossomon [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, April 08, 2004 3:41 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] Where's the error?
> > 
> > 
> > I have this script which SHOULD produce a linked webpage for
> > soon-to-be
> > created static web pages, however I can't seem to find the 
> error in my
> > code:
> > 
> >  > //connect to database
> > include 'db.php';
> > 
> > $display_block = "PFS Sales Categories Select a
> > category to
> > see its items.";
> > 
> > //Show categories first
> > $get_cats = "select id_num, id_name, description, cat_code from 
> > PFS_categories order by id_name"; $get_cats_res =
> > mysql_query($get_cats)
> > or die(mysql_error());
> > 
> > if (mysql_num_rows($get_cats_res) < 1)
> > {
> >  $display_block = "Sorry, no categories to 
> browse."; }
> 
> > else {  while ($cats = mysql_fetch_array($get_cats_res))  {
> >   $cat_id = $cats[id_num];
> >   if ($cat_id != "53" || $cat_id != "54" || $cat_id != "55" 
> || $cat_id
> 
> > != "117" || $cat_id != "118")
> >   {
> >   $cat_title = strtoupper(stripslashes($cats[id_name]));
> >   $cat_desc = stripslashes($cats[description]);
> >   $display_block .= " > href=$_SERVER[PHP_SELF]?cat_id=$cat_id>$cat_title
> > $cat_desc\n";
> >   
> >   if ($_GET[cat_id] == $cat_id) //get items
> >   {
> >$get_items = "select id, item_num, description from 
> PFS_items where
> 
> > cat_code = $cat_id";
> >$get_items_res = mysql_query($get_items) or die(mysql_error());
> >
> >if (mysql_num_rows($get_items_res) < 1)
> >{
> > $display_block = "Sorry, no Items to browse.\n";
> >}
> >   else
> >   {
> > #   $display_block .= "\n";
> >while ($items = mysql_fetch_array($get_items_res))
> >{
> > $item_id = $items[id];
> > $item_num = $items[item_num];
> > $item_desc = stripslashes($items[description]);
> > if ($item_num != "ABC-R37" || $item_num !=  "ABC-R42" 
> || $item_num
> 
> > != "HB-99100" || $item_num != "RO-PUMPS" || $item_num != 
> "ML-HDGALJUG"
> > || $item_num != "PFS-CAC21" || $item_num != "PFS-CO2")
> > {
> > $display_block .= " > href=\"catalog/$item_id.html\">$item_num - 
> > $item_desc\n";
> > } 
> >}
> > #   $display_block .= "\n";
> > #   $display_block .= "\n";
> >   }}
> >  }
> > }
> > ?>
> > 
> > 
> > Categories of Items
> > 
> >  >  include("nav/top_nav.html");
> > ?>
> >  >  include("nav/side_nav.html");
> > ?>
> >   
> > 
> > 
> > 
> >   
> > 
> >  >  include("nav/bottom_nav.html");
> > ?>
> > 
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Session_Start won't work Help?

2004-04-09 Thread Hutchins, Richard
You can also use ini_set() in a script to change the directory for that
specific script. However, as others have stated, the directory must exist
and the Apache user must have permission to write to it. I don't know if
ini_set() is any more/less secure than changing the php.ini file. I only
know it works.

Rich


> -Original Message-
> From: Daniel Clark [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 09, 2004 11:40 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Session_Start won't work Help?
> 
> 
> In PHP.INI there is a variable session.save_path.
> Make sure it's uncommented and has a directory to store the 
> temp session
> files on the web server.
> 
> 
> > I'm running Apache/2.0.49 and PHP/4.3.5 on windows XP. I 
> get warnings:
> >
> > WARNING: session_start(): 
> open/tmp\sess_242f6f668d85d512f9f4379ffa1e1,
> > O_DWR failed: No such file or directory (2) in c:\program 
> files\apache
> > group\apache2\htdocs\register_new.php on line 10
> >
> > I also get another similar warning for seesion start that 
> says cannot send
> > seesion cookie and another that says cannot send session cache.
> >
> > Is this some sort of configuratrion problem in my  
> httpd.cong file or my
> > php.ini file? HELP?
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: Re[2]: [PHP-DB] Curious if include_once will work better than include

2004-04-13 Thread Hutchins, Richard
After a 2-second search of the PHP manual...

"require() and include() are identical in every way except how they handle
failure. include() produces a Warning while require() results in a Fatal
Error. In other words, don't hesitate to use require() if you want a missing
file to halt processing of the page. include() does not behave this way, the
script will continue regardless. Be sure to have an appropriate include_path
setting as well."

And..

"The include_once() statement includes and evaluates the specified file
during the execution of the script. This is a behavior similar to the
include() statement, with the only difference being that if the code from a
file has already been included, it will not be included again. As the name
suggests, it will be included just once."



> -Original Message-
> From: Mikhail U. Petrov [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 13, 2004 2:07 PM
> To: Eric Girard
> Cc: Karen Resplendo; [EMAIL PROTECTED]
> Subject: Re[2]: [PHP-DB] Curious if include_once will work better than
> include
> 
> 
> Hi!
> Sorry for my offtopic, but by the way,
> what's the difference between include/include_once and
> require/require_once?
> 
> 
> Tuesday, April 13, 2004, 10:29:14 PM, Eric wrote:
> 
> >> Curious about "include_once" versus "include".
> >>
> >> All my connection stuff is in "conn.php3".
> >>
> >> I am planning on including it at the top of the page like this:
> >> include_once "conn.php3";
> >>
> >> Now will that speed things up compared to just using a 
> plain "include". I
> >> call $connectionSDWIS(which is in the include) 5 different times?
> 
> EG> IMHO the 'speed' difference between include and 
> include_once will be
> EG> slight, probably with include_once being slower because 
> of the overhead
> EG> needed to keep track of which files have been included 
> already.  But this
> EG> isn't really what the question is about.  include and 
> include_once will
> EG> not magically optimize the code for you, but if you 
> include the same file
> EG> 20 times that will be more that has to be parsed 
> needlessly, so if you
> EG> can't keep track of your includes or if including a 
> particular file more
> EG> than once will alter the result, than use include_once. Another
> EG> alternative is to use require() or require_once() to make 
> sure that the
> EG> file is included.   Just my $.02,
> 
> EG> Eric
> 
> 
> 
> -- 
> Best regards,
> Mikhail U. Petrov
> mailto:[EMAIL PROTECTED]
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Macs and sessions

2004-04-20 Thread Hutchins, Richard
Are you certain that, for those users experiencing problems, cookies are
enabled/accepted by their browsers?

Just a guess.

> -Original Message-
> From: matthew perry [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 20, 2004 1:32 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Macs and sessions
> 
> 
> Macintosh users can't log in on my web site.
> I don't require anything unusual for log ins - simply a form 
> with a user 
> id and password that queries a MySQL database.
> The form is not encripted and I don't even use any security 
> precautions 
> for the data transfer (users can't do much anyway).
> After the log in I store all information in session data.
> The rest of my site's pages work fine including my PHP pages.
> Anyone know why macs might have problems with PHP/MySQL data 
> transfers?
> 
> Matt
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Remove white space?

2004-04-22 Thread Hutchins, Richard
Robert,

ltrim() or rtrim() to get rid of the whitespace if it's at the beginning or
end of the data.

strtolower() to turn the string into all lowercase characters.

Rich


> -Original Message-
> From: Robert Sossomon [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 22, 2004 10:51 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: [PHP-DB] Remove white space?
> 
> 
> I am pulling data from a MySQL DB and I need to remove the 
> whitespace on
> the variable and turn it to lowercase.
> 
> 
> 
> $get_items = "select * from PFS_items";
> $get_items_res = mysql_query($get_items) or die(mysql_error());
> while ($items = mysql_fetch_array($get_items_res))
> {
>  $item_id = $items[id];
>  $item_num = $items[item_num];
> 
> 
> 
> Overtime I need to rewrite my DB loading script to handle this for me,
> but right now I need to band-aid it so that I can auto-generate pages
> and get them loaded into a catalog.
> 
> Thanks!
> 
> Robert
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] question on

2004-05-12 Thread Hutchins, Richard
You'd have to take the value of the first select box in your form and pass
it to another script. You can do that by setting the form's ACTION property
to either GET or POST. Personally, I prefer POST.

In the script to which you submit your form, you can access the value of the
select object thusly: $_POST["varname"] and insert it into your query
however you want (using the appropriate input sanitization methods).

The important concept to understand here is that you cannot use PHP to drive
the contents of your second select object without a round-trip to the
server. Since PHP is a server-side technology, it HAS to work that way.

To make a client-side solution possible, you'd have to send ALL POSSIBLE
data to the page all at the same time then manipulate it with JavaScript.

You can make it LOOK like a dynamic solution by repeatedly resubmitting the
page to itself and using a combo platter of JS and PHP functions on the page
to handle data as it is progressively requested/sent, but you're still doing
a round-trip each time. It only looks like a client-side solution because
you submit to the same page all the time until certain conditions are
satisfied or your user clicks on a specific link or button.

If you're truly in search of a completely client-side solution using
JavaScript, I suggest checking the Javascript Boutique or Javascript Source
or any one of the hundreds of JS repositories you'll find in a google
search. There are many great examples of this problem such as selecting a
State in one select box then having the major cities in that State show up
in a second select object.

Hope this helped.

Rich



> -Original Message-
> From: hengameh [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 12, 2004 11:34 AM
> To: 'Tony S. Wu'
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] question on 
> 
> 
> Well I am suing Java script to capture the selected item and 
> make it the
> value of my input box. But my problem is how to access this 
> information from
> this point on. Can someone please tell me how I can use the 
> selected item in
> my next SQL query?
> 
> -Original Message-
> From: Tony S. Wu [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, May 12, 2004 11:07 AM
> To: hengameh
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] question on 
> 
> sounds like a job for JavaScript.
> 
> Tony S. Wu
> [EMAIL PROTECTED]
> 
> "Look into the right places, you can find some good offerings."
> http://homepage.mac.com/tonyswu/stw- The perfect business.
> http://homepage.mac.com/tonyswu/tonyswu- My web page.
> --
> -- 
> ---
> 
> 
> 
> On May 12, 2004, at 7:02 AM, hengameh wrote:
> 
> >
> >
> > Hello,
> >
> > I am very new to php and mysql so please be patient with 
> me. I don't  
> > even
> > know if I am using the right listing, but I hope someone 
> can help me!
> >
> >
> >
> > I need to create a  and the possible options are 
> from my mysql
> > database ( so far so good, I was able to find code to do that).
> >
> > Now I need to use the user selected option to drive the 
> options of me  
> > next
> > .  I need to know how to capture what user selected 
> and how to  
> > pass
> > that around? I have used "onchange" attribute of the  to  
> > capture the
> > selected line but now how can I pass that to other php 
> scripts?  ( I  
> > need to
> > get the name of the country so that I can show a list of possible
> > state/province. I setting the value of the "newcountry" input to the
> > selected "country" but when I do echo $newcountry in 
> quicksearch.php,  
> > its
> > blank!!)
> >
> > Please help!!
> >
> >
> >
> > Thanks so much
> >
> >
> >
> > Here is what I have so far:
> >
> >
> >
> > Quicksearch.php file has the following code
> >
> > 
> >
> > 
> >
> >   
> >
> > Steps 1-4
> >
> >   
> >
> >
> >
> >   
> >
> > 
> >
> >   
> >
> >   
> >
> >
> >
> >   
> >
> >
> >
> > 
> >
> > 
> >
> > 
> >
> >
> >
> > 
> >
> > 
> >
> > 
> >
> >
> >
> > Countrty_buil.php has the following
> >
> >
> >
> >  >
> > require_once("util.php");
> >
> >
> >
> > echo " > onchange=\"changeMenu()\">";
> >
> > //
> >
> > // initialize or capture the country variable
> >
> > $country = !isset($_REQUEST['country'])? "Select a country":
> > $_REQUEST['country'];
> >
> > $countrySQL = !isset($_REQUEST['country'])? "*": 
> $_REQUEST['country'];
> >
> > echo "$country";
> >
> > $query = "SELECT country FROM ". TABLECOUNTRY . " ORDER BY country  
> > ASC";
> >
> > // pconnect, select and query
> >
> > if ($link_identifier = mysql_pconnect(DBSERVERHOST, DBUSERNAME,  
> > DBPASSWORD))
> > {
> >
> >   if ( mysql_select_db(DBNAME, $link_identifier)) {
> >
>

RE: [PHP-DB] Re: inserting data into database!

2004-05-14 Thread Hutchins, Richard
Have you declared a new instance of the db class anywhere on your page?



> -Original Message-
> From: Ronald Allen [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 14, 2004 4:13 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Re: inserting data into database!
> 
> 
> Now that I closed the bracket
>  it tells me that $row is not defined.
> I have plagiarized from a couple of different places to come 
> up with my code
> so that is the reason that it may not work that well.  Here 
> is my code right
> now
> 
> $conn = mysql_connect($db_host,$db_user,$db_pass);
> if ($conn == true) {
>  $insert = "INSERT INTO $db_table SET ";
> $insert .= "Base = '" . $row->Base . "', ";
> $insert .= "Date_and_Time = '" . $row->Date_and_Time . "', ";
> $insert .= "Event_Type = '" . $row->Event_Type . "', ";
> $insert .= "Description = '" . $row->Description . "', ";
> $insert .= "Initials = '" . $row->Initials . "'";
> 
> mysql_query($insert, $conn);
> 
> }
> ?>
> "Ronald Allen" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Here is my code now, but I am getting a parsing error
> >
> > Parse error: parse error, unexpected $end
> >
> > $db_table = 'log';
> >
> > $conn = mysql_connect($db_host,$db_user,$db_pass);
> >
> > if ($conn == true) {
> >
> > $insert = "INSERT INTO $db_table SET ";
> >
> > $insert .= "Base = '" . $row->Base . "', ";
> >
> > $insert .= "Date_and_Time = '" . $row->Date_and_Time . "', ";
> >
> > $insert .= "Event_Type = '" . $row->Event_Type . "', ";
> >
> > $insert .= "Description = '" . $row->Description . "', ";
> >
> > $insert .= "Initials = '" . $row->Initials . "'";
> >
> > mysql_query($insert, $conn);
> >
> > ?>
> >
> > "Torsten Roehr" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > "Ronald Allen" <[EMAIL PROTECTED]> wrote in message
> > > news:[EMAIL PROTECTED]
> > > > Two questions?
> > > > First why am I getting  undefined variable tmp , yet it works
> > > > Second how would I insert data into this table?
> > > >  > > > $db_table = 'log';
> > > > $conn = mysql_connect($db_host,$db_user,$db_pass);
> > > >
> > > > if ($conn == true) {
> > > >   mysql_select_db($db_name,$conn);
> > > >   $result = mysql_query("SELECT * from $db_table",$conn);
> > > > while($row = mysql_fetch_object($result)) {
> > > > $tmp .= "ID   : $row->ID   \n";
> > > > $tmp .= "Base : $row->Base \n";
> > > > $tmp .= "Date_and_Time  : $row->Date_and_Time   \n";
> > > > $tmp .= "Event_Type : $row->Event_Type \n";
> > > > $tmp .= "Description : $row->Description \n";
> > > > $tmp .= "Initials : $row->Initials \n";
> > > > }
> > > > } else {
> > > > echo 'could not connect to database : '. mysql_error();
> > > > }
> > > > print $tmp;
> > > > ?>
> > >
> > > You have to initialize $temp before using it with '.='
> > > $temp = '';
> > > $temp .= 'my string';
> > >
> > > Or just set the first line with =
> > > $tmp = "ID   : $row->ID   \n";
> > > $tmp .= "Base : $row->Base \n";
> > > $tmp .= "Date_and_Time  : $row->Date_and
> > >
> > > Your insert should look like this (if ID is an 
> auto-increment field):
> > > $insert = "INSERT INTO $db_table SET ";
> > > $insert .= "Base = '" . $row->Base . "', ";
> > > $insert .= "Date_and_Time = '" . $row->Date_and_Time . "', ";
> > > $insert .= "Event_Type = '" . $row->Event_Type . "', ";
> > > $insert .= "Description = '" . $row->Description . "', ";
> > > $insert .= "Initials = '" . $row->Initials . "'";
> > >
> > > mysql_query($insert, $conn);
> > >
> > > Hope this helps,
> > >
> > > Regards, Torsten
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Re: inserting data into database!

2004-05-14 Thread Hutchins, Richard
...or whatever class contains $row-> functionality?




> -Original Message-
> From: Ronald Allen [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 14, 2004 4:13 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Re: inserting data into database!
> 
> 
> Now that I closed the bracket
>  it tells me that $row is not defined.
> I have plagiarized from a couple of different places to come 
> up with my code
> so that is the reason that it may not work that well.  Here 
> is my code right
> now
> 
> $conn = mysql_connect($db_host,$db_user,$db_pass);
> if ($conn == true) {
>  $insert = "INSERT INTO $db_table SET ";
> $insert .= "Base = '" . $row->Base . "', ";
> $insert .= "Date_and_Time = '" . $row->Date_and_Time . "', ";
> $insert .= "Event_Type = '" . $row->Event_Type . "', ";
> $insert .= "Description = '" . $row->Description . "', ";
> $insert .= "Initials = '" . $row->Initials . "'";
> 
> mysql_query($insert, $conn);
> 
> }
> ?>
> "Ronald Allen" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Here is my code now, but I am getting a parsing error
> >
> > Parse error: parse error, unexpected $end
> >
> > $db_table = 'log';
> >
> > $conn = mysql_connect($db_host,$db_user,$db_pass);
> >
> > if ($conn == true) {
> >
> > $insert = "INSERT INTO $db_table SET ";
> >
> > $insert .= "Base = '" . $row->Base . "', ";
> >
> > $insert .= "Date_and_Time = '" . $row->Date_and_Time . "', ";
> >
> > $insert .= "Event_Type = '" . $row->Event_Type . "', ";
> >
> > $insert .= "Description = '" . $row->Description . "', ";
> >
> > $insert .= "Initials = '" . $row->Initials . "'";
> >
> > mysql_query($insert, $conn);
> >
> > ?>
> >
> > "Torsten Roehr" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > "Ronald Allen" <[EMAIL PROTECTED]> wrote in message
> > > news:[EMAIL PROTECTED]
> > > > Two questions?
> > > > First why am I getting  undefined variable tmp , yet it works
> > > > Second how would I insert data into this table?
> > > >  > > > $db_table = 'log';
> > > > $conn = mysql_connect($db_host,$db_user,$db_pass);
> > > >
> > > > if ($conn == true) {
> > > >   mysql_select_db($db_name,$conn);
> > > >   $result = mysql_query("SELECT * from $db_table",$conn);
> > > > while($row = mysql_fetch_object($result)) {
> > > > $tmp .= "ID   : $row->ID   \n";
> > > > $tmp .= "Base : $row->Base \n";
> > > > $tmp .= "Date_and_Time  : $row->Date_and_Time   \n";
> > > > $tmp .= "Event_Type : $row->Event_Type \n";
> > > > $tmp .= "Description : $row->Description \n";
> > > > $tmp .= "Initials : $row->Initials \n";
> > > > }
> > > > } else {
> > > > echo 'could not connect to database : '. mysql_error();
> > > > }
> > > > print $tmp;
> > > > ?>
> > >
> > > You have to initialize $temp before using it with '.='
> > > $temp = '';
> > > $temp .= 'my string';
> > >
> > > Or just set the first line with =
> > > $tmp = "ID   : $row->ID   \n";
> > > $tmp .= "Base : $row->Base \n";
> > > $tmp .= "Date_and_Time  : $row->Date_and
> > >
> > > Your insert should look like this (if ID is an 
> auto-increment field):
> > > $insert = "INSERT INTO $db_table SET ";
> > > $insert .= "Base = '" . $row->Base . "', ";
> > > $insert .= "Date_and_Time = '" . $row->Date_and_Time . "', ";
> > > $insert .= "Event_Type = '" . $row->Event_Type . "', ";
> > > $insert .= "Description = '" . $row->Description . "', ";
> > > $insert .= "Initials = '" . $row->Initials . "'";
> > >
> > > mysql_query($insert, $conn);
> > >
> > > Hope this helps,
> > >
> > > Regards, Torsten
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Image / file uploader

2004-04-30 Thread Hutchins, Richard
Craig,

Where is the code that actually handles the image upload? Is it in
/~choffman/www/mtrain/client_profile.php? If so, can you post that too?

Rich

> -Original Message-
> From: Craig Hoffman [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 30, 2004 10:08 AM
> To: Hans Lellelid
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Image / file uploader
> 
> 
> No problem -  Here you go.  Thanks - CH
> 
>   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
> 
>   eClimb Media and RaceLogix Traininglog
>   
>   
>   
>   
>   
> 
>  media="all" />
> 
> 
>  align="center" id="main_content_table">
>   
>   Welcome 
> to Training 
> log
>   
>   
>id="left_nav_table" 
> cellpadding="0" cellspacing="0">
>   
>href="index.php">Home
>   
> 
> 
> 
> 
>
>   
>href="login.php">Login
>   
>   
>href="mailinglist.php">Mailing List
>  
>   
>href="contact.php">Contact
>   
>   
> 
> 
> 
> 
> 
> 
>   
>href="coaching.php">Coaching
>   
>   
>href="grouprun.php">Group Runs
>  
>   
>href="featuredathlete.php">Featured Athlete
>   
> 
> 
> 
> 
> 
>   
>href="util.php">Utilities
>   
>   
>href="logout.php">Logout
>  
>   
>   
> 
>   Edit Your Bio
>   Tell us a little about yourself.
>   
>   No new image supplied.
> 
> UPDATE users SET bio = 'Hello World - Bio', goals = 'Hello World - 
> Goal', fav_race = 'Hello World - Race', fav_train = 'Hello World - 
> Trainingf', photo_name = ''  WHERE user_id = '12'
> 
>  encType='multipart/form-data'> width='500' cellspacing='0' id='result_table'>
>   
>   
> Name:
>   
> Craig Hoffman
>   
> Bio:
>   
> Hello 
> World - Bioing
>  
>   
>bgcolor='#DBE6D1'>
>   
> Goals:
>   
> Hello 
> World - Goaling
>  
>   
>bgcolor='#ECF8DF'>
>   
> Favorite Race:
>   
>  cols='45'>Hello World - Raceing
>   
>   
>bgcolor='#DBE6D1'>
>   
> Favorite Place to Train:
>   
>  cols='45'>Hello World - Trainingfsdf
>   
>   
>bgcolor='#ECF8DF'>
>   
> Upload Photo:
>   
> 
>   
>   
>bgcolor='#DBE6D1'>
>   
> 
>   
> 
>   
> 
>   
> 
>   
> 
>   
>   
>   
>   
>
>   
>   
>   
>   
> 
> 
> 
> 
> __
> Craig Hoffman - eClimb Media
> 
> v: (847) 644 - 8914
> f: (847) 866 - 1946
> e: [EMAIL PROTECTED]
> w: www.eclimbmedia.com
> _
> On Apr 30, 2004, at 8:56 AM, Hans Lellelid wrote:
> 
> > > Here you go:  I mostly echo out the HTML.   I have included the 
> > entire
> > > form here.
> > > Thanks - CH
> > >
> > >

RE: [PHP-DB] Image / file uploader

2004-04-30 Thread Hutchins, Richard
Jinkeys! I had a hunch the problem was with that upload script. Nice catch,
Hans!

Rich


> -Original Message-
> From: Craig Hoffman [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 30, 2004 10:41 AM
> To: Hans Lellelid
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Image / file uploader
> 
> 
> That worked!  Han's and everyone else thank you very much.  I owe 
> everyone who helped out a beer.  ;)
> 
> Thanks CH
> __
> Craig Hoffman - eClimb Media
> 
> v: (847) 644 - 8914
> f: (847) 866 - 1946
> e: [EMAIL PROTECTED]
> w: www.eclimbmedia.com
> _
> On Apr 30, 2004, at 9:22 AM, Hans Lellelid wrote:
> 
> > Errr  $HTTP_POST_FILES is not superglobal  (am I wrong?)
> >
> > $_FILES or specify global $HTTP_POST_FILES
> >
> > Hans
> >
> > Craig Hoffman wrote:
> >>  >> function display_edit_bio($user_id)
> >> {
> >> if($_POST['postback_bio'])
> >> {
> >>include "include/dbadmin.php";
> >>//image uploader
> >> $uploadpath = 'images/clients/';
> >> $source = $HTTP_POST_FILES['photo']['tmp_name'];
> >> $photo_name = $HTTP_POST_FILES['photo']['name'];
> >> $dest = '';
> >> if (($source != '') && ($source != '')) {
> >> $dest = $uploadpath.$photo_name;
> >> if ($dest != '') {
> >> if (move_uploaded_file($source, $dest)) {
> >> echo ("Image and Bio has been 
> >> successfully stored. ");
> >> } else {
> >> echo ("Image could not be 
> >> stored.");
> >> }
> >> }
> >> } else {
> >> echo ("No new image supplied.");
> >> $photo_name = $oldimage;
> >> }
> >>//declare varibles
> >> $user_id = $_POST["user_id"];
> >> $name = $_POST["name"];
> >> $bio = $_POST["bio"];
> >> $goals = $_POST["goals"];
> >> $fav_race = $_POST["fav_race"];
> >> $fav_train = $_POST["fav_train"];
> >> $photo = $_POST["photo_name"];
> >>$query = "UPDATE users SET bio = '$bio', goals 
> = '$goals', 
> >> fav_race = '$fav_race', fav_train = '$fav_train', photo_name = 
> >> '$photo_name'  WHERE user_id = '$user_id'";
> >> echo $query;
> >> $msg = "Could not update 
> >> record";
> >> $result = mysql_query($query, $db) or ($msg);
> >> }
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP-DB] diference between == and ===

2004-05-03 Thread Richard Davey
Hello Bruno,

Monday, May 3, 2004, 2:16:29 PM, you wrote:

BB> Wich is the diference between if ($var == '1')  or if ($var === '1')

BB> == means equality and what does the === means ?!

Forced-type equality. I.e. it checks that $var is not only equal to 1,
but is an integer also (as opposed to a string that evaluates to 1
when converted).

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



RE: [PHP-DB] how to reuse DB results

2004-05-20 Thread Hutchins, Richard
Off the top of my head, you could do the db call once, assign the full
result set to an array, pull off the parts you want at the top of the page,
then use reset($arrayname) to put the pointer back to the beginning of the
array then use a loop to print out the whole thing at the bottom of the
page.

That's just one way though. There are probably others available with and
without the use of a db abstraction class.

HTH,
Rich

> -Original Message-
> From: Aaron Wolski [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 20, 2004 4:14 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] how to reuse DB results
> 
> 
> Hi All,
> 
> Got this logic problem I don't know how to solve.
> 
> Is there any way I can make a call to the DB for some records.
> 
> Display some info from a column or two say at the top of the page and
> then display the full result set in a while() loop?
> 
> Right now, I am making two calls to the Db to get the data I need to
> display at the top of the page and then a second query to retrieve the
> full result set.
> 
> I'm confused!
> 
> Thanks for any help!
> 
> Aaron
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] how to reuse DB results

2004-05-20 Thread Hutchins, Richard
Yeah, that's kind of what I was thinking. The logic in your pseudocode seems
correct. However, I'm not sure about the bit where you do:

$resultset[] = $results

Not because it's wrong, just because I always have to refer back to some
form of documentation when putting result sets into an array to make sure
I'm doing it right because PHP has that whole Resource thingy (I can see you
all cringing now) that represents result sets. Seems to me there's a little
more to it than what's written out above. But I'm certain it's possible to
put a result set right into an array. And once you have that, you can echo()
out whatever members of the array you want and the reset() function will
reset the array pointer to the beginning allowing you to loop through the
array and echo out the results.

Give it a go though, this can't be too far off.

Rich
> -Original Message-
> From: Aaron Wolski [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 20, 2004 4:26 PM
> To: 'Hutchins, Richard'; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] how to reuse DB results
> 
> 
> Hi Richard!
> 
> Thanks.
> 
> Ok.. let me see if I got this straight
> 
> Db_query...
> While($results)
> {
> 
>   $resultset[] = $results;
> 
> }
> 
> //display initial data needed
> echo "{$resultset[0]} {"{$resultset[3]}";
> 
> //display full results further down page
> reset($resultset);
> 
> while($resultset)
> {
> 
>   //display full result set here
> 
> }
> 
> 
> Is my logic right or completely off base?
> 
> Thanks!
> 
> A
> 
> 
> 
> > -Original Message-
> > From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
> > Sent: May 20, 2004 4:19 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [PHP-DB] how to reuse DB results
> > 
> > Off the top of my head, you could do the db call once, 
> assign the full
> > result set to an array, pull off the parts you want at the 
> top of the
> > page,
> > then use reset($arrayname) to put the pointer back to the 
> beginning of
> the
> > array then use a loop to print out the whole thing at the bottom of
> the
> > page.
> > 
> > That's just one way though. There are probably others available with
> and
> > without the use of a db abstraction class.
> > 
> > HTH,
> > Rich
> > 
> > > -Original Message-
> > > From: Aaron Wolski [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, May 20, 2004 4:14 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP-DB] how to reuse DB results
> > >
> > >
> > > Hi All,
> > >
> > > Got this logic problem I don't know how to solve.
> > >
> > > Is there any way I can make a call to the DB for some records.
> > >
> > > Display some info from a column or two say at the top of the page
> and
> > > then display the full result set in a while() loop?
> > >
> > > Right now, I am making two calls to the Db to get the 
> data I need to
> > > display at the top of the page and then a second query to retrieve
> the
> > > full result set.
> > >
> > > I'm confused!
> > >
> > > Thanks for any help!
> > >
> > > Aaron
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > 
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Version Upgrade

2004-05-21 Thread Hutchins, Richard
The folks at PHP.NET have an excellent resource to help answer questions
like these. Check out this link:

http://www.php.net/releases.php#4.3.0

You're going to have to read the material and compare it against what you're
doing in your scripts to see if the 4.3.0 release is going to do anything to
your code.

Rich


> -Original Message-
> From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 20, 2004 9:07 PM
> To: DBList
> Subject: Re: [PHP-DB] Version Upgrade
> 
> 
> hi all,
> 
> Sorry, I meant to say PHP 4.3. Will it be very different from 
> PHP4.2.2 that
> my programs may perform strangely if I upgrade to PHP4.3?
> 
> many thanks,
> Hwee
> 
> - Original Message - 
> From: "Gary Every" <[EMAIL PROTECTED]>
> To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> Sent: Thursday, May 20, 2004 9:23 PM
> Subject: RE: [PHP-DB] Version Upgrade
> 
> 
> > MySQL 4.0.19 is the latest stable release, and PHP 4.2.3 
> will work well
> > for you. MySQL 4.1 is still in beta.
> >
> >
> > Gary Every
> > Sr. UNIX Administrator
> > Ingram Entertainment Inc.
> > 2 Ingram Blvd, La Vergne, TN 37089
> > "Pay It Forward!"
> >
> > -Original Message-
> > From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, May 20, 2004 5:15 AM
> > To: DBList
> > Subject: [PHP-DB] Version Upgrade
> >
> > Hi all,
> >
> > I'm running on PHP 4.2.2 and MySQL 3.23.54
> >
> > I would like to do an upgrade... What would be the highest version
> > number that I can upgrade to without causing any possible conflict?
> >
> > I'm thinking of upgrading to PHP 4.2.3 and MySQL 4.0.4 
> because they have
> > some features that I need.
> >
> > But I will like to be more adventurous so will PHP 4.2.3 
> and MySQL 4.1
> > be advisable?
> >
> > Many thanks,
> > Hwee Hwee
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] Inventory Management for ecommerce store

2004-05-21 Thread Hutchins, Richard
I have an e-commerce project coming up in the next quarter and I want to
just piggyback (not hijack the thread) one question onto this thread. And
that is, don't e-commerce packages come with the functionality to track
inventory? I mean, most times when I shop online, I see whether an item is
in stock or how many pieces a retailer has in stock.

I am concerned that there is more work than meets the eye with an e-commerce
implementation in regards to constructing a DBMS to handle the inventory
issues in addition to implementing the shopping cart and the catalog.

Sorry if this is off topic, but this issue just raised a red flag for me and
I need to understand it a bit better before I put together an estimate. I
have a catalog component and a credit card processing component at my
disposal, but need to know if it is common practice to hand-build the
inventory management end of it.

Consequently, this could help with Aaron's original question if there are
inventory management components out there already by allowing him (and I) to
simply use an existing one rather than reinventing the wheel, so to speak.

Thanks,
Rich


> -Original Message-
> From: Matt [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 21, 2004 11:42 AM
> To: Aaron Wolski; [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Inventory Management for ecommerce store
> 
> 
> > From: "Aaron Wolski" <[EMAIL PROTECTED]>  Friday, May 
> 21, 2004 10:52
> AM
> > Subject: [PHP-DB] Inventory Management for ecommerce store
> 
> 
> > I'm looking for some advise/login on developing an 
> Inventory Management
> > system for an ecommerce store and what pitfalls one needs 
> to be on the
> > lookout for.
> 
> You should have at least two ways to indentify each stock 
> item, a unique
> item number (auto increment) and a displayed value (catalog 
> number).  All of
> the inventory records are always keyed by the unique item 
> number.  This
> allows one to change catalog numbers easily without effecting 
> keys.  You may
> want more fields such as manufacturers item number, and UPC code.
> 
> As for inventory counts, here's what I do. I have 3 fields:
> quantity-on-hand, quantity-committed-to-orders, quantity-sold
> quantity available is calculated: quantity-available = 
> quantity-on-hand -
> quantity-committed-to-orders
> 
> When an order is created, the quantity-committed-to-orders is 
> incremented by
> the order-quantity.
> 
> When an order shipped, the quantity-committed-to-orders, and the
> quantity-on-hand are decremented by the order quantity.  The 
> quantity sold
> is incremented.
> 
> If an order is canceled, decrement the quanity-committed-to-orders.
> 
> In this way, you always know what the quantity in stock is, 
> and you know how
> much of that stock is allocated to orders.
> 
> I also recommend an item ledger table that includes item 
> number (unique),
> catalog number, trans type, quantity,  order number, selling 
> $, cost, who,
> when, why.  Each transaction (order detail at ship, receipt 
> of stock) is
> logged to the item ledger.  The item ledger provides an audit 
> trail for
> accounting and for you to answer question on what happened to 
> inventory.
> Inventory adjustments (losses/gains) from physical inventory 
> go there too.
> 
> Order Lines should have the unique id, catalog number, qty, 
> sale price,
> cost, actual tax (if taxed at this level).
> 
> ---
> The future will be better tomorrow
> ---
> http://www.spiceplace.com/
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



RE: [PHP-DB] escape character

2004-06-09 Thread Hutchins, Richard
stripslashes()?
 

-Original Message-
From: Marie Osypian [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 09, 2004 9:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] escape character



\"Fees and Expenses.\"

Quick question: I am sending email via a simple script: \"QUOTED TEXT.\" is
in the body of the message with escape characters. When the mail is sent and
arrives the \ (escape characters) are still in the email text, any way to
remove them an not break the script?

$headers  = "From: $name <$email>\n";
$headers .= "Cc: $Name <$email>\n";
$headers .= "X-Sender: <$email>\n";
$headers .= "X-Mailer: $Name\n";
$headers .= "X-Priority: 1\n";
$headers .= "Return-Path: <$email>";

$recipient = "$user_first $user_last <$user_email>";
$subject = "$Subject";

$message  = "Dear $First $Last,\n";
$message .= "\n";
$message .= "Example text here \"QUOTED TEXT.\" \n";
$message .= "\n";
$message .= "Example text here \"QUOTED TEXT.\"\n";
$message .= "\n";
$message .= "Example text here \"QUOTED TEXT.\"\n";
$message .= "\n";
$message .= "$Name\n";
$message .= "$Company\n";
$message .= "$Phone \n";

mail($recipient, $subject, $message, $headers);

Thanks,
 
MAO



  1   2   3   4   5   6   >