Re: [PHP-DB] Question about database design

2007-10-24 Thread Tony Grimes
A second address table is definitely the way to go (the '*' signifies the
primary key):

People Table

*user_id
first_name
last_name
etc

Address Table (compound primary key)
=
*user_id (fk to People Table)
*address_id
*obs_no (you can skip this if you don't want to keep an address history)
active_ind (is the row currently active or deleted?)
effective_date
expiry_date
address_line_1
address_line_2
city
etc

So say a user lives in the north from Mar to Sept and in the South from Oct
to Feb, your two rows would look like this:

Row 1
=
*john_doe (I prefer natural keys to surrogate)
*north
*1
Y
2007-03-01
2007-10-01
blah
blah

Row 2
=
*john_doe
*south
*1
Y
2007-10-01
2007-03-01
blah
blah

If you want to keep a history of past addresses, just add a new row with an
obs_no of 2 and set the active_ind to 'N' for the old row. All your queries
will have to contain a where clause (active_ind = 'Y') to keep the old rows
from showing up.

I hope this helps.

Tony


On 10/24/07 7:30 AM, Bastien Koert [EMAIL PROTECTED] wrote:

 
 I would approach this by having a main people table (with a unique id of
 course) and then create a second addresses table which uses the people Id key
 as the foreign key to this table...then you can have multiple (more than two)
 addresses for those users, you could add a season in the addresses to be able
 to pull the correct one based on date

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



[PHP-DB] PG: Table last updated?

2007-10-23 Thread Tony Grimes
We've got a huge table in one of our Postgres databases and nobody seems to
know what it's for. Do any of the system tables keep track of the last time
the table was altered (i.e. Row INSERTs, UPDATEs, etc)?

Tony

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



Re: [PHP-DB] PG: Table last updated?

2007-10-23 Thread Tony Grimes
I'm not sure. How can I tell? This database is running on a different server
than the one that created the data. I'm trying to restore a fried server
from a backup. Not sure if that matters.

Tony


On 10/23/07 6:20 PM, Bastien Koert [EMAIL PROTECTED] wrote:

 
 Is logging turned on?
 
 bastien
 
 
  Date: Tue, 23 Oct 2007 16:12:14
 -0600 From: [EMAIL PROTECTED] To: php-db@lists.php.net Subject:
 [PHP-DB] PG: Table last updated? We've got a huge table in one of our
 Postgres databases and nobody seems to know what it's for. Do any of the
 system tables keep track of the last time the table was altered (i.e. Row
 INSERTs, UPDATEs, etc)? Tony -- PHP Database Mailing List
 (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
 
 _
 R U Ready for Windows Live Messenger Beta 8.5? Try it today!
 http://entertainment.sympatico.msn.ca/WindowsLiveMessenger
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP-DB] Remote DB Connection: Pros and Cons?

2007-10-12 Thread Tony Grimes
Thank you all for the responses. I think we're going to try replicating the
databases with Slony. Wish me luck!

Tony


On 10/11/07 6:23 PM, Chris [EMAIL PROTECTED] wrote:

 Tony Grimes wrote:
 Splitting the tables probably wouldn't work. Most of the tables are used by
 both sites and the ones that aren't are tied to the rest by foreign keys.
 
 Most of the updates are done from the admin site, so we're toying with the
 idea of creating a read-only data warehouse for the website. The sync would
 be one way from main office db to the warehouse (say, every 10 minutes).
 
 No need to create something that has already been done.
 
 Use slony or something to replicate the database.
 
 Any updates the website does (like an event registration or profile update)
 would be done remotely to the office db. In this scheme the website db would
 be 10 minutes behind. We can live with that.
 
 When you do a registration, get it to use a remote database connection
 instead of the 'local' one.
 
 $local_connection = pg_connect('localhost');
 
 $remote_connection = pg_connect('remote_server_ip');
 
 $remote_result = pg_query($remote_connection, $query);
 
 Doing everything by remote connection would be easier, but we're worried
 about the performance.
 
 The only way to find out would be to test it really. As long as you have
 a decent connection in to the office and a decent connection on the
 remote end and aren't pulling through a ridiculous amount of data in
 queries (eg pulling through 50,000 records when you only really need
 10), you should be fine.

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



[PHP-DB] Remote DB Connection: Pros and Cons?

2007-10-11 Thread Tony Grimes
Have any of you tried running a PHP website using a remote database
connection?

We currently have an in-house PHP website driven by a PostgreSQL database
that is HEAVILY administered within the office with an administration sister
site (also PHP). 

Problem: the office connection is having trouble keeping up with the website
traffic. Our IT guys want to outsource the whole server to a co-location
facility, but the administrators don't want the extra lag on the admin site.

Is it feasible to host the database and admin site in the office, but
outsource the website and connect to the office database remotely? Is there
any other way to do this?

Tony

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



Re: [PHP-DB] Remote DB Connection: Pros and Cons?

2007-10-11 Thread Tony Grimes
Splitting the tables probably wouldn't work. Most of the tables are used by
both sites and the ones that aren't are tied to the rest by foreign keys.

Most of the updates are done from the admin site, so we're toying with the
idea of creating a read-only data warehouse for the website. The sync would
be one way from main office db to the warehouse (say, every 10 minutes).

Any updates the website does (like an event registration or profile update)
would be done remotely to the office db. In this scheme the website db would
be 10 minutes behind. We can live with that.

Doing everything by remote connection would be easier, but we're worried
about the performance.

Tony


On 10/11/07 6:01 PM, Chris [EMAIL PROTECTED] wrote:

 Tony Grimes wrote:
 Have any of you tried running a PHP website using a remote database
 connection?
 
 We currently have an in-house PHP website driven by a PostgreSQL database
 that is HEAVILY administered within the office with an administration sister
 site (also PHP).
 
 Problem: the office connection is having trouble keeping up with the website
 traffic. Our IT guys want to outsource the whole server to a co-location
 facility, but the administrators don't want the extra lag on the admin site.
 
 Is it feasible to host the database and admin site in the office, but
 outsource the website and connect to the office database remotely? Is there
 any other way to do this?
 
 Do the website and admin area reference the same database tables?
 
 If they don't, split the database up and keep the website db on the
 website server and the other internally.
 
 If they do, which one is the 'primary' set? ie which one gets updated?
 
 You could use replication to keep them in sync (http://www.slony.info/
 for example).

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



[PHP-DB] MySQL BETWEEN Problems

2007-05-18 Thread Tony Grimes
I'm using BETWEEN to return a list all people who's last names fall between
A and F:

 WHERE last_name BETWEEN 'A' AND 'F' ...

but it's only returning names between A and E. The same thing happens when I
use:

 WHERE last_name = 'A' AND last_name = 'F' ...

Shouldn't this work the way I expect it? What am I doing wrong?

Tony

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



Re: [PHP-DB] MySQL BETWEEN Problems

2007-05-18 Thread Tony Grimes
Yeah, but what do I do for Q-Z? I guess I¹ll have to write a condition to
use last_name = ŒQ¹ if it finds a Z. I¹ll have to write conditions to look
for other exceptions too. Aaarrgh!

*looks up at the Gods*

Damn you BETWEEN! Why must you torture me so!?!



Have a good weekend.


On 5/18/07 2:51 PM, Dan Shirah [EMAIL PROTECTED] wrote:

 So just change it to WHERE last_name BETWEEN 'A' AND 'G' .  That'll get you
 Aa-Fz :)
 
  
 On 5/18/07, Tony Grimes [EMAIL PROTECTED] wrote:
 We tried that and it didn't work. We've also tried every combination of
 upper and lower case too.
 
 Tony
 
 
 On 5/18/07 2:18 PM, Brad Bonkoski [EMAIL PROTECTED] wrote:
 
  I think you need between 'A' and 'F%'
 
  Aa is between A and F
  but 'Fa' is not between 'A' and 'F'
  (but 'Ez' would be between 'A' and 'F')
  -B
 
 
  Tony Grimes wrote:
  I'm using BETWEEN to return a list all people who's last names fall
 between
  A and F:
 
   WHERE last_name BETWEEN 'A' AND 'F' ...
 
  but it's only returning names between A and E. The same thing happens
 when I 
  use:
 
   WHERE last_name = 'A' AND last_name = 'F' ...
 
  Shouldn't this work the way I expect it? What am I doing wrong?
 
  Tony
 
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 http://www.php.net/unsub.php
 
 
 




Re: [PHP-DB] MySQL BETWEEN Problems

2007-05-18 Thread Tony Grimes
Nice! That did the trick. Thanks Brad. I live to fight another day.

Tony


On 5/18/07 3:00 PM, Brad Bonkoski [EMAIL PROTECTED] wrote:

 Try using the substr, since you are only comparing the first letters...
 (sorry I did not reply all on the other email, Dan)
 
 i.e.
 
 select name from users where substr(name, 1, 1) = 'A' and substr(name,
 1, 1) = 'B';
 
 -B
 Dan Shirah wrote:
 So just change it to WHERE last_name BETWEEN 'A' AND 'G' .  That'll
 get you
 Aa-Fz :)
 
 
 On 5/18/07, Tony Grimes [EMAIL PROTECTED] wrote:
 
 We tried that and it didn't work. We've also tried every combination of
 upper and lower case too.
 
 Tony
 
 
 On 5/18/07 2:18 PM, Brad Bonkoski [EMAIL PROTECTED] wrote:
 
 I think you need between 'A' and 'F%'
 
 Aa is between A and F
 but 'Fa' is not between 'A' and 'F'
 (but 'Ez' would be between 'A' and 'F')
 -B
 
 
 Tony Grimes wrote:
 I'm using BETWEEN to return a list all people who's last names fall
 between
 A and F:
 
  WHERE last_name BETWEEN 'A' AND 'F' ...
 
 but it's only returning names between A and E. The same thing happens
 when I
 use:
 
  WHERE last_name = 'A' AND last_name = 'F' ...
 
 Shouldn't this work the way I expect it? What am I doing wrong?
 
 Tony
 
 
 
 
 -- 
 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] Include function across servers

2007-04-02 Thread Tony Miceli
wouldn't that be very dangerous if someone could grab my code and run it on 
their server?


i'm an intermediate php guy at best. for many reasons i would not want 
someone including my files and running them on another server!!! i hope 
there's no easy way to do that!


btw if files are outside of the route directory then that means only the 
local files can all them and execute them, right??


thanks
tony


 
My email address has changed. It is now [EMAIL PROTECTED] Visit my website
- Original Message - 
From: Micah Stevens [EMAIL PROTECTED]

To: [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Sent: Monday, April 02, 2007 4:20 PM
Subject: Re: [PHP-DB] Include function across servers



I'm not totally clear on what you're asking, so here's two options:

If you use the include() function, you're pulling the code from the 
external server and running on the local server. If you're running an HTTP 
call, say via an Ajax routine for example, the code runs on the external 
server.


The difference is if you're grabbing the source from the external server 
and running it on the local php interpreter, or if you're using the 
external php setup.


This seems to be what you're asking, the answer in this case is, either 
one could happen, it depends on your implementation. If you provide 
details on the exact implementation then I can give a more exact answer.


HTH,
-Micah

On 04/02/2007 06:53 AM, ioannes wrote:
I ask this as I do not have two web sites on different servers to test at 
the moment.
Does it work to use an include function in the php code on one site that 
calls a function on the other site?  If you include a file on a remote 
server that runs a function, where does the function run - on the server 
where the function is originally written or on the calling server?  I am 
thinking that if I write code, it is one way to make the functionality 
available without actually disposing of the source code itself.


So the included functions might be variable values.  Eg you could pass 
back a whole calendar to the calling server, which then just prints on 
the calling web site just by printing the returned variable.  (I know 
that in terms of getting data to mark up the calendar the database would 
need to be fully referenced: user, password, server, and the calling 
(shared) host for instance will ask for the remote IP address to add to a 
white list.)


John



--
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] Include function across servers

2007-04-02 Thread Tony Miceli
thanks for your reply. that's what i figured using common sense, but that's 
not always the case with software.


cu
tony
 
My email address has changed. It is now [EMAIL PROTECTED] Visit my website
- Original Message - 
From: Chris [EMAIL PROTECTED]

To: Tony Miceli [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Sent: Monday, April 02, 2007 6:24 PM
Subject: Re: [PHP-DB] Include function across servers



Tony Miceli wrote:
wouldn't that be very dangerous if someone could grab my code and run it 
on their server?


Yeh, pretty dangerous. That's how c99shell and a bunch of other scripts 
work.


i'm an intermediate php guy at best. for many reasons i would not want 
someone including my files and running them on another server!!! i hope 
there's no easy way to do that!


If they are named with an extension that isn't parsed by php (eg .txt), 
then they will be executed on another server.


If they are parsed by php (ie .php) then including them remotely won't 
work - it will include whatever your php script spits out (eg html).


btw if files are outside of the route directory then that means only the 
local files can all them and execute them, right??


Right.

--
Postgresql  php tutorials
http://www.designmagick.com/ 


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



[PHP-DB] MySQL sort stopped working

2007-03-13 Thread Tony Grimes
I have this page that lists artists alphabetically:

http://www.wallacegalleries.com/artists.php

At least it did until today. Nobody made any changes to the files, but the
database stopped sorting by artist_id. The list shown is just the default
order that mysql spits out if the SORT BY clause is omitted (as if I clicked
'browse' in phpMyAdmin).

The SQL works in phpMyAdmin, and the site uses PEAR::DB. We patched the
server last week, but the problem showed up this morning.

Anyone have any ideas on what could be causing this?

Thanks in advance,
Tony

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



Re: [PHP-DB] array field type

2007-03-06 Thread Tony Marston

Sancar Saran [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Sunday 04 March 2007 23:04, Sancar Saran wrote:
 Hi,

 I want to know is there any db server around there for store php arrays
 natively.

 Regards

 Sancar
 Thanks for responses, it seems I have to give more info about situation.

 In my current project, we had tons of arrays. They are very deep and
 unpredictable nested arrays.

 Currently we are using serialize/unserialize and it seems it comes with 
 own
 cpu cost. Xdebug shows some serializing cost blips. Sure it was not SO BIG
 deal (for now of course).

 My db expertise covers a bit mysql and mysql does not have any array type
 field (enum just so simple).

Wrong! Take a look at the SET datatype 
http://dev.mysql.com/doc/refman/4.1/en/set.html. This allows you to have an 
array of values in a single field, and the user can select any number of 
them.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

 I just want to know is there any way to keep array data type natively in a 
 sql
 field.

 Regards.

 Sancar 

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



[PHP-DB] SQL Performance Help

2006-12-27 Thread Tony Grimes
I'm developing a course calendar for a client and I'm running into
performance problems with the admin site. For example, when I try to include
registration counts in the course list, the page really slows down for large
course lists (50 or so):

COURSEATTENDEES  CAPACITYSEATS LEFT
===  ==
Course 1 5  10   5
Course 2 6  15   9
Course 3 4  10   6

I've been using one query to retrieve the course list and then one for each
attendee count. Is there a more efficient way of doing this all in one
query? I was thinking something like this (I'm not a SQL expert, so I don't
know if this is even possible):

SELECT
course_name,
capacity,
count(query here) as attendee_count
FROM events AS e
LEFT OUTER JOIN event_attendees AS a ON e.event_id = a.event_id
WHERE start_time BETWEEN point_a AND point_b

Or should I just pull everything as a separate row like this and sort it all
out programmatically:

SELECT
e.course_name,
e.capacity,
a.user_id
FROM events AS e
LEFT OUTER JOIN event_attendees AS a ON e.event_id = a.event_id
WHERE start_time BETWEEN point_a AND point_b

Or should I just try caching the data in PHP? Would an index help?

I realize any answers might be complicated, but if you could just point me
in the right direction, I can probably figure the rest out.

Thanks,
Tony

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



Re: [PHP-DB]: small question php/postgreSQL

2006-11-07 Thread Tony Grimes
Is your server configured to display errors? Try adding this at the top of
your script:

ini_set('display_errors',true);

It won't catch syntax errors, but it should help. Also, try adding this to
the top of your script:

echo 'test';

If you still get a blank page, then it's probably not a problem with your
actual script. Maybe your configuration.

Tony


On 11/7/06 8:38 AM, Desmond Coughlan [EMAIL PROTECTED] wrote:

 X-No-Archive: true
  
 That doesn't work, either.  Still the blank page.  Hmm ... the file is in the
 right place../usr/local/www/data ... 'cos all of the other files (*.html one
 an d all) are served from there, and they're available to the outside world.
  
 D.
 
 Bastien Koert [EMAIL PROTECTED] a écrit :
 The code does need to know what the fields are...I think a more likely issue
 is the query for some reason, also change the $query to result in the query
 statement
 
 try
 
 $result=pg_query($query) or die(pg_error()); //to see if there are any
 errors with the query
 
 while($row=pg_fetch_array($result,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }else{
 echo No rows found;
 }
 
 
 bastien
 
 
 From: JeRRy 
 To: php-db@lists.php.net
 Subject: [PHP-DB] re: small question php/postgreSQL (basic question, not
 small)
 Date: Tue, 7 Nov 2006 23:18:58 +1100 (EST)
 
 Date: Tue, 7 Nov 2006 10:38:18 +0100 (CET) From: Desmond
 Coughlan To: php
 
 Subject: small question php/postgreSQL
 Hi,
 
 I've been trying to get a small DB up and working with PhP. It's a
 library, and so far, I can't get past the stage of displaying a page. I
 try the 'hello world' example, and it displays. I then populate a DB
 and can access it via psql ..
 
 cdi= SELECT * FROM stock ;
 -[ RECORD 1 ]-+---
 stock_ids | 1
 isbn_no | 10101010
 code_livre | 23455
 titre | toto goes to Hollywood
 editeur | editions toto
 collection | collection toto
 auteur_nom | smith
 auteur_prenom | john
 matiere | ang
 media_type | li
 -[ RECORD 2 ]-+---
 stock_ids | 2
 isbn_no | 10536278
 code_livre | 24874
 titre | toto comes back from Hollywood
 editeur | editions baba
 collection | collection toto
 auteur_nom | martin
 auteur_prenom | peter
 matiere | fre
 media_type | dvd
 
 OK, I then write the following script 
 
 pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
 Connect: .pg
 _last_error());
 $query=SELECT * FROM stock;
 $query=pg_query($query);
 // start the output
 while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }
 ?
 
 (sorry not to put that in italics or whatever...)
 
 ... and put it in the document root of my webserver, under
 php_experimental.
 
 I get a blank page. The apache weblogs look like ...
 
 192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET
 /php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible;
 MSIE 6.0;
 Windows NT 5.0)
 
 There's something obvious that I'm missing. Any ideas ..?
 
 Thanks.
 
 D.
 
 --
 
 re:
 
 pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
 Connect: .pg
 _last_error());
 $query=SELECT * FROM stock;
 $query=pg_query($query);
 // start the output
 while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }
 ?
 
 Simple, isbn_no and code_livre need to be defined in your code.
 Otherwise PHP don't know what your looking for.
 
 There is PLENTY of docs online to show you how to display items in a DB.
 Hello World is basic, too basic to use as an example and is a poor one to
 use. If your nerw you have to go a bit more into it than Hello World code.
 (which in my opinion gets you know-where) been there done that.
 
 Google how to display items in a DB in PHP and shoot you get some handy
 things.
 
 I just feel this question is not required here when google has all the
 answers like this.
 
 Jerry
 
 _
 Ready for the world's first international mobile film festival celebrating
 the creative potential of today's youth? Check out Mobile Jam Fest for your
 a chance to WIN $10,000! www.mobilejamfest.com

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



Re: [PHP-DB] RE : Re: [PHP-DB]: small question php/postgreSQL

2006-11-07 Thread Tony Grimes
Alright, now try commenting out all the script except for the ini_set and
echo 'test' at the top. There still might be a syntax error in the code.

Essentially, you want to do whatever you can to get the page to display a
simple message. Then, work backwards until you get the error/blank page.

If you can't get a message to display, try copying the script from hello.php
to right into your new script. That should give you enough to troubleshoot.

Tony


On 11/7/06 9:00 AM, Desmond Coughlan [EMAIL PROTECTED] wrote:

 X-No-Archive: true
  
 OK, that gives a blank page, too... which is puzzling, 'cos I tried
 'hello.php' before getting into the db 'thang', and I saw the text on the
 screen.
  
 Well .. back to the drawing board...
  
 D.
 
 Tony Grimes [EMAIL PROTECTED] a écrit :
 Is your server configured to display errors? Try adding this at the top of
 your script:
 
 ini_set('display_errors',true);
 
 It won't catch syntax errors, but it should help. Also, try adding this to
 the top of your script:
 
 echo 'test';
 
 If you still get a blank page, then it's probably not a problem with your
 actual script. Maybe your configuration.
 
 Tony
 

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



Re: [PHP-DB]: small question php/postgreSQL

2006-11-07 Thread Tony Grimes
You should turn on display_errors in your php.ini file. That would make it a
lot easier to track down the error.

Tony


On 11/7/06 9:27 AM, Desmond Coughlan [EMAIL PROTECTED] wrote:

 X-No-Archive:
   
 
 Curious.  I put this in a file...
   
  
   
 ?php
   
 echo 'pHello World/p'
   
 ?
   
 Bingo.  
   
  
   
 I then take the *same* file, I don't rename it, I just open it in vi.  I copy
 a single occurrence of 'pg_connect' etc...
   
  
   
 And the 'hello world' disappears.
   
  
   
 D.
   
 
 
 Tony Grimes [EMAIL PROTECTED] a écrit :
   
 Is your server configured to display errors? Try adding this at the top of
 your script:
 
 ini_set('display_errors',true);
 
 It won't catch syntax errors, but it should help. Also, try adding this to
 the top of your script:
 
 echo 'test';
 
 If you still get a blank page, then it's  probably not a problem with your
 actual script. Maybe your configuration.
 
 Tony
 
 
 On 11/7/06 8:38 AM, Desmond Coughlan wrote:
 
  X-No-Archive: true
  
  That doesn't work, either. Still the blank page. Hmm ... the file is in
 the
  right place../usr/local/www/data ... 'cos all of the other files (*.html
 one
  an d all) are served from there, and they're available to the outside
 world.
  
  D.
  
  Bastien Koert a écrit :
  The code does need to know what the fields are...I think a more likely
 issue
  is the query for some reason, also change the $query to result in the
 query
  statement
  
  try
  
  $result=pg_query($query) or die(pg_error()); //to see if there are any
  errors with the query
  
  while($row=pg_fetch_array($result,NULL,PGSQL_ASSOC)) {
  echo Title:  .$row['isbn_no'].
  ;
  echo blah .$row['code_livre'].
  ;
  }else{
  echo No rows found;
  }
  
  
  bastien
  
  
  From: JeRRy
  To: php-db@lists.php.net
  Subject: [PHP-DB] re: small question php/postgreSQL (basic question, not
  small)
  Date: Tue, 7 Nov 2006 23:18:58 +1100 (EST)
  
  Date: Tue, 7 Nov 2006 10:38:18 +0100 (CET) From: Desmond
  Coughlan To: php
  
  Subject: small question php/postgreSQL
  Hi,
  
  I've been trying to get a small DB up and working with PhP. It's a
  library, and so far, I can't get past the stage of displaying a page. I
  try the 'hello world' example, and it displays. I then populate a DB
  and can access it via psql ..
  
  cdi= SELECT * FROM stock ;
  -[ RECORD 1  ]-+---
  stock_ids | 1
  isbn_no | 10101010
  code_livre | 23455
  titre | toto goes to Hollywood
  editeur | editions toto
  collection | collection toto
  auteur_nom | smith
  auteur_prenom | john
  matiere | ang
  media_type | li
  -[ RECORD 2 ]-+---
  stock_ids | 2
  isbn_no | 10536278
  code_livre | 24874
  titre | toto comes back from Hollywood
  editeur | editions baba
  collection | collection toto
  auteur_nom | martin
  auteur_prenom | peter
  matiere | fre
  media_type | dvd
  
  OK, I then write the following script 
  
  pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
  Connect: .pg
  _last_error());
   $query=SELECT * FROM stock;
  $query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
  echo Title: .$row['isbn_no'].
  ;
  echo blah .$row['code_livre'].
  ;
  }
  ?
  
  (sorry not to put that in italics or whatever...)
  
  ... and put it in the document root of my webserver, under
  php_experimental.
  
  I get a blank page. The apache weblogs look like ...
  
  192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET
  /php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible;
  MSIE 6.0;
  Windows NT 5.0)
  
  There's something obvious that I'm missing. Any ideas ..?
  
  Thanks.
  
  D.
  
  --
   
  re:
  
  pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
  Connect: .pg
  _last_error());
  $query=SELECT * FROM stock;
  $query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
  echo Title: .$row['isbn_no'].
  ;
  echo blah .$row['code_livre'].
  ;
  }
  ?
  
  Simple, isbn_no and code_livre need to be defined in your code.
  Otherwise PHP don't know what your looking for.
  
  There is PLENTY of docs online to show you how to display items in a DB.
  Hello World is basic, too basic to use as an example and is a poor one
to
  use. If your nerw you have to go a bit more into it than Hello World
 code.
  (which in my opinion gets you know-where) been there done  that.
  
  Google how to display items in a DB in PHP and shoot you get some handy
  things.
  
  I just feel this question is not required here when google has all the
  answers like this.
  
  Jerry
  
  _
  Ready for the world's first international mobile film festival celebrating
  the creative potential of today's youth? Check out Mobile Jam Fest for
 your
  a chance to WIN $10,000! www.mobilejamfest.com
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe

Re: [PHP-DB] Database abstract layer

2006-11-07 Thread Tony Grimes
Why not build the options into your data model? Instead of using integers
for gender, use a varchar field that stores 'Male' and 'Female'. You can
ensure data integrity by adding a check constraint to the column.

If the presentation might change depending on context, you can create gender
reference table with columns like short_name, long_name and abbreviation and
use a foreign key to reference it from the main table.

I try to use natural keys (i.e. Male,Female) instead of surrogate keys (1,2)
whenever possible. It makes the database information more readable and
you're not constantly picking through code to figure out what '3' means.

Hope that helps,
Tony


On 11/7/06 2:19 PM, Vignesh M P N [EMAIL PROTECTED] wrote:

 Hi
 
 
 
 I am facing a common problem which any developer querying the database would
 face.
 
 
 
 In our web applications wherever we have more than one standard options for
 a field, we usually denote them as integers. Say, for gender, we store it as
 1 or 2, but we display that as male or female in the user interface. So far
 I had been handling this translation in the presentation layer ie., just
 before displaying the data in the table, I check if the retrieved is 1 and
 then translate it to male and so on. But this becomes clumsy when we have
 lots of such standard options and when we need this translation in multiple
 places in the application.
 
 
 
 So now I am thinking of adding an abstract layer which does all the
 querying, retrieving and translation; and then return to my presentation
 layer, so that if my presentation layer just calls a function in the
 database abstract layer with the required query parameters, it gets back a
 resultset with the translations. I hope this is a very common problem every
 developer faces.
 
 
 
 I would like to have your guidance on this. I understand that a resultset
 object is not easy to replicate. How do I make these translations and store
 them back in an object and return it to the presentation layer?
 
 
 
 Or do we have existing PHP libraries which serve this purpose? Could you
 suggest me a better way of solving this problem?
 
 
 
 Please help me on this.
 
 
 
 Thanks
 
 Vignesh.
 
 
 
 
 
 

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



Re: [PHP-DB] barcode

2006-10-21 Thread Tony Grimes
One of my programmers did something exactly like this. I can't remember
specifics, but the car code is alpha numeric and displayed in a special
'barcode' font on the page. If you don't store any information in the code,
why not just use the PHP session id?

Tony


On 10/21/06 3:54 AM, Mad Unix [EMAIL PROTECTED] wrote:

 I am in the process to create an online form using PHP with DB Oracle or
 MySQL, this form which consist of
 2x parts personal data and finance data, and it will be filled by the users,
 once the form is filled and submitted ,
 it will be saved to the system as reference and printed as hardcopy it could
 be a pdf or not, but the print format
 will be on A4 format hardcopy with printed random generated (internal
 calculation) bar code printed on the paper.
 Then in the central office through bar code readers the date will be
 retrieved.
 
 Any one implemented this kind of application, if yes  how did you generate
 the bar code on the web form
 through php, and which bar code readers did you use in order to access and
 retrieve the data from the form?
 
 Thanks

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



[PHP-DB] EXISTS syntax for SELECT INTO?

2006-10-11 Thread Tony Grimes
I have a script that creates a table copy using SELECT INTO, but I want it
to check if the new table already exists first. Does SQL support the EXISTS
keyword for SELECT INTO statements (I'm running PG7)?

If not, is there another way to do it in SQL? I'd rather not do it
programmatically.

Thanks in advance,
Tony

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



[PHP-DB] Unicode error with PostgreSQL

2006-09-26 Thread Tony Grimes
I'm getting the following error when PHP tries to insert a Unicode character
(the problem word is resume with the accents) into a PostgreSQL database:

pg_exec(): Query failed: ERROR:  Invalid UNICODE character sequence found
(0xe97375)

I can't figure out why I'm getting the error. The HTML form is utf-8 and the
database is UNICODE, but I'm still getting the error. Is there some problem
with the PHP library? Is there a PHP setting that controls character
encoding within scripts? Any help would be appreciated.

Thanks in advance,
Tony


Re: [PHP-DB] Error when trying to connecting to an Oracle database

2006-09-26 Thread Tony Grimes
Hi Janet,

This is a PHP 5 only function. Are you running PHP 5? If not, try using
ocilogon() instead. If you are running 5, then maybe the Oracle library
wasn't included when PHP was compiled.

HTH,
Tony


On 9/26/06 2:13 PM, Janet Smith [EMAIL PROTECTED] wrote:

 I am trying to use a program written in PHP but connect to an Oracle
 database. 
 
 We have a function as follows:
 
 function dbconnect($db, $username, $password)
 {
global $siteadmin;
global $db;
 
// $bob = @mysql_connect($db, $username, $password);
//$bob= oci_connect($username, $password, $db);
// mysql_select_db($db, $bob);
$bob = oci_connect(, , devl);
   echo $bob;
 return $bob;
 }
 
 where  is replaced with a username and  is replaced with a
 password. We get the following error:
 
 Fatal error: Call to undefined function: oci_connect() in
 /www/WEBUSERS/ics2004/public_html/PHP/Project Manager/dba_copy(1).php on
 line 52
 
 Line 52 is $bob = oci_connect(, , devl);
 
 Can anyone tell me why I am getting this error?
 

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



Re: [PHP-DB] Unicode error with PostgreSQL

2006-09-26 Thread Tony Grimes
So does that mean I will always get that error? There's got to be a way
around that. Is there at least a way to detect invalid characters before I
try to insert?

Tony


On 9/26/06 1:17 PM, Niel Archer [EMAIL PROTECTED] wrote:

 PHP isn't multibyte aware by default.
 
 Niel
 

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



Re: [PHP-DB] Error when trying to connecting to an Oracle database

2006-09-26 Thread Tony Grimes
Hi Janet,

This is a PHP 5 only function. Are you running PHP 5? If not, try using
ocilogon() instead. If you are running 5, then maybe the Oracle library
wasn't included when PHP was compiled.

HTH,
Tony


On 9/26/06 2:13 PM, Janet Smith [EMAIL PROTECTED] wrote:

 I am trying to use a program written in PHP but connect to an Oracle
 database. 
 
 We have a function as follows:
 
 function dbconnect($db, $username, $password)
 {
global $siteadmin;
global $db;
 
// $bob = @mysql_connect($db, $username, $password);
//$bob= oci_connect($username, $password, $db);
// mysql_select_db($db, $bob);
$bob = oci_connect(, , devl);
   echo $bob;
 return $bob;
 }
 
 where  is replaced with a username and  is replaced with a
 password. We get the following error:
 
 Fatal error: Call to undefined function: oci_connect() in
 /www/WEBUSERS/ics2004/public_html/PHP/Project Manager/dba_copy(1).php on
 line 52
 
 Line 52 is $bob = oci_connect(, , devl);
 
 Can anyone tell me why I am getting this error?
 
 Thanks
 
 
 Jan Smith
 Programmer Analyst
 Indiana State University
 Terre Haute, Indiana
 Phone: (812) 237-8593
 Email: [EMAIL PROTECTED]
 
 **
 *
 This email, and any attachments, thereto, is intended only for use by
 the addressee(s) named herein and may contain privileged and/or
 confidential information.  If you are not the intended recipient of this
 email, you are hereby notified that any dissemination, distribution or
 copying of this email, and any attachments thereto, is strictly
 prohibited.
 **
 *

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



Re: [PHP-DB] Unicode error with PostgreSQL

2006-09-26 Thread Tony Grimes
So does that mean I will always get that error? There's got to be a way
around that. Is there at least a way to detect invalid characters before I
try to insert?

Tony


On 9/26/06 1:17 PM, Niel Archer [EMAIL PROTECTED] wrote:

 PHP isn't multibyte aware by default.
 
 Niel
 

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



Re: [PHP-DB] PostgreSQL functions missing

2006-04-27 Thread Tony Grimes
Hi Chris,

I'm not sure if PG was updated at the same time. I do know that a separate
server has no problem connecting to the database and it's running PHP 4.3.
In any case, I think I've given the support guys enough info to go on.

I figure if they broke it, they can fix it :)

Thanks,
Tony


On 4/26/06 8:55 PM, chris smith [EMAIL PROTECTED] wrote:

 On 4/27/06, Tony Grimes [EMAIL PROTECTED] wrote:
 Hi,
 
 My sys admin installed an update to H-Sphere (control panel software) that
 broke PEAR::DB and phpBB last week. After much trial and error, I finally
 tracked it down to missing pg_affected_rows() and pg_cmdtuples() functions
 (for PEAR and phpBB respectively) in PHP. I'm assuming that the H-Sphere
 update also included an upgrade for PHP and they didn't compile it right.
 
 Does anyone know how we can fix this? Does Psoft (the company that makes
 H-Sphere) have to recompile libpq? The server is currently running PHP 4.4.2
 and PosgreSQL 7.4.11. Any insight would be much appreciated.
 
 Was postgres updated at the same time or possibly compiled against a
 different version to yours?
 
 http://www.php.net/manual/en/ref.pgsql.php
 
 Note:  Not all functions are supported by all builds. It depends on
 your libpq (The PostgreSQL C client library) version and how libpq is
 compiled. If PHP PostgreSQL extensions are missing, then it is because
 your libpq version does not support them.
 
 I guess psoft needs to help you sort this one out..
 
 --
 Postgresql  php tutorials
 http://www.designmagick.com/

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



[PHP-DB] PostgreSQL functions missing

2006-04-26 Thread Tony Grimes
Hi,

My sys admin installed an update to H-Sphere (control panel software) that
broke PEAR::DB and phpBB last week. After much trial and error, I finally
tracked it down to missing pg_affected_rows() and pg_cmdtuples() functions
(for PEAR and phpBB respectively) in PHP. I'm assuming that the H-Sphere
update also included an upgrade for PHP and they didn't compile it right.

Does anyone know how we can fix this? Does Psoft (the company that makes
H-Sphere) have to recompile libpq? The server is currently running PHP 4.4.2
and PosgreSQL 7.4.11. Any insight would be much appreciated.

Thanks in advance,
Tony

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



Re: [PHP-DB] novice on table design

2005-05-14 Thread Tony S. Wu
actually, no, Shop, Employee, and Customer are not distinct.
in your instance they are the same type of entry.
don't distinguish them by tables, rather use a column to hold some sort 
of an ID for each type.
of course you'll end up with a table with many columns, and many of 
them will be null depending on which type an entry is.
but with this approach, you can easily associate with an address table.

Tony S. Wu
[EMAIL PROTECTED]

On May 14, 2005, at 4:49 AM, tony yau wrote:
Hi Miguel,
Thanks for the reply.
the non-customer is actually a Shop, so Employee, Customer and 
Shop are
distinct enough to have their own tables. Now they all have an 
Address, and
the problem is how do I allow multiple addresses for each these 
'people'
(without using
a lookup table)

tony.
Miguel Guirao [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
The schema of your table is wrong, is you do bnormalize it you will 
find
out
that you need two tables for this approach.
One table for your people and another one for the n addresses of your
people.
If you keep your current schema, you will have as many rows for one 
person
as many addresses for that person you have, and you will be 
duplicating
many
fields. So you must split your tables, one for your people and 
another for
your people's addresses.

-Original Message-
From: tony yau [mailto:[EMAIL PROTECTED]
Sent: Viernes, 13 de Mayo de 2005 09:27 a.m.
To: php-db@lists.php.net
Subject: [PHP-DB] novice on table design

Hi all,
I have the following tables
EmployeeCustomernon-Customer
Address
=======
pkey pkeypkey
pkey
number type type
...
payrate grantcapital
I need to allow the three types of people to have n addresses, so I've
added
a type to distinguish the 3 types of people and their respective pkey 
onto
address table.

Address
=
pkey
...
type(either Employee, Customer or non-Customer etc)
fkey(the pkey of Employee, Customer or non-Customer etc)
I know this design looks awkward but it does have the advantage of 
having
less tables otherwise.
BUT somehow it doesn't feel right. Can someone points me its pros and
cons.
thanks all.
Tony Yau
--
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] novice on table design

2005-05-13 Thread tony yau

Hi all,

I have the following tables

EmployeeCustomernon-CustomerAddress
=======
pkey pkeypkey
pkey
number type type
...
payrate grantcapital

I need to allow the three types of people to have n addresses, so I've added
a type to distinguish the 3 types of people and their respective pkey onto
address table.

Address
=
pkey
...
type(either Employee, Customer or non-Customer etc)
fkey(the pkey of Employee, Customer or non-Customer etc)

I know this design looks awkward but it does have the advantage of having
less tables otherwise.
BUT somehow it doesn't feel right. Can someone points me its pros and cons.

thanks all.
Tony Yau

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



Re: [PHP-DB] novice on table design

2005-05-13 Thread tony yau
Hi Miguel,
Thanks for the reply.

the non-customer is actually a Shop, so Employee, Customer and Shop are
distinct enough to have their own tables. Now they all have an Address, and
the problem is how do I allow multiple addresses for each these 'people'
(without using
a lookup table)

tony.

Miguel Guirao [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 The schema of your table is wrong, is you do bnormalize it you will find
out
 that you need two tables for this approach.

 One table for your people and another one for the n addresses of your
 people.

 If you keep your current schema, you will have as many rows for one person
 as many addresses for that person you have, and you will be duplicating
many
 fields. So you must split your tables, one for your people and another for
 your people's addresses.

 -Original Message-
 From: tony yau [mailto:[EMAIL PROTECTED]
 Sent: Viernes, 13 de Mayo de 2005 09:27 a.m.
 To: php-db@lists.php.net
 Subject: [PHP-DB] novice on table design



 Hi all,

 I have the following tables

 EmployeeCustomernon-Customer
Address
 =======
 pkey pkeypkey
 pkey
 number type type
 ...
 payrate grantcapital

 I need to allow the three types of people to have n addresses, so I've
added
 a type to distinguish the 3 types of people and their respective pkey onto
 address table.

 Address
 =
 pkey
 ...
 type(either Employee, Customer or non-Customer etc)
 fkey(the pkey of Employee, Customer or non-Customer etc)

 I know this design looks awkward but it does have the advantage of having
 less tables otherwise.
 BUT somehow it doesn't feel right. Can someone points me its pros and
cons.

 thanks all.
 Tony Yau

 --
 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] ways of making access and visib compat with 4 and 5

2005-03-14 Thread tony yau
hi all,

I'm trying to make my classes compat with php4 and php5 is there a way of
doing something like this:

if( version== 4)
define( VISIBILITY,  );
else if (version==5)
define( VISIBILITY, protected );

class Flex
{
 VISIBILITY function CompatFunc();
}
-- 

Tony Yau

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



[PHP-DB] Define constants: awkward usage?

2005-01-26 Thread tony

Hi all,

I got this sets(20) of defined constants which using them as keys to an
array
eg
define(FNAME, fname);
farray = array( FNAME = hello ,...);

my question is how do I insert that directly into a javascript(to do
some client validation)
I need this:
var fname = document.addrform.fname.value

var fname = document.addrform.{FName}.value//don't work
var fname = document.addrform.{'FName'}.value//don't work
var fname = document.addrform.[FName].value//don't work

I know this work, but messey
$tmp = FNAME;
var fname = document.addrform.{$tmp}.value

I'am finding the use of define constants rather awkward. does anyone
make much use of them?

Thanks
Tony

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



[PHP-DB] Re: neebee: on table designs.

2004-11-17 Thread tony
Thanks you all,

Nate Nielsen

I would say just from a basic normalization standpoint that you should
definitely not do the 5000+ tables option.  That would be an absolute mess
to maintain.  Surely you wouldn't want to join 5000 tables to search all of
your clients either.

yes that was a very good point.
Thanks


Sebastian Mendel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Phpnews wrote:
  Hi All,
 
  I have 5000+ individual clients, each clients may have 100+ records.
  Each client can modify to their own records.
 
  In the order of maintenance, robustness, scalability then
performance,
  which of the following do you think is best.
 
  i)1 big table with 50+ records
  ii)5000+ small tables with 100+ records (1 table for each
client)?
 
  At first I thought (i) but then for robustness a colleague pointed
out
  that on (ii) if clients screw up their own table it will not affect
anyone
  else!
 
  any comments/suggestions are very much appreciated
  tony


 1 table with clients
 1 table with records


 -- 
 Sebastian Mendel

 www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com
 www.sf.net/projects/phpdatetimewww.sf.net/projects/phptimesheet

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



Re: [PHP-DB] question on select

2004-05-12 Thread Tony S . Wu
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 select 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
select.  I need to know how to capture what user selected and how to  
pass
that around? I have used onchange attribute of the select 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

br

table class='form'

  tr

thSteps 1-4/th

  /tr



  trtd

form name=fcountry method=post

  ?php  require(country_build.php);?

  input type=text name=newcountry value=



  /form



/td/tr

/table

!-- quicksearch.php   end --



script language=JavaScript

!--

function changeMenu()

  {

  document.fcountry.newcountry.value =
document.fcountry.country.options[document.fcountry.country.selectedInd 
ex].v
alue;

 }

--

/script



Countrty_buil.php has the following



?php

require_once(util.php);



echo SELECT name=\country\ class=\input\   
onchange=\changeMenu()\;

//

// initialize or capture the country variable

$country = !isset($_REQUEST['country'])? Select a country:
$_REQUEST['country'];
$countrySQL = !isset($_REQUEST['country'])? *: $_REQUEST['country'];

echo option value='$countrySQL' SELECTED$country/option;

$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)) {

// run the query

 $queryResultHandle = mysql_query($query, $link_identifier) or  
die(
mysql_error() );

 $ctrRows = mysql_num_rows($queryResultHandle); // row counter

// if data exists then $rows will be 1 or greater

if( $ctrRows == 0 ) {

  echooption value='*'No data  
found/option/select;

}else{

  // build the select list

  while($row = mysql_fetch_object($queryResultHandle))  
{ //
grab a row

echo option
value=\$row-country\$row-country/option;
  }

  echo /SELECTbrbr;



}

  }else{ // select

echo mysql_error();

  }

}else{ //pconnect

  echo mysql_error();

}

?











[PHP-DB] Using fopen() for internet URL

2003-06-08 Thread Tony S . Wu
I have an auto-update script to gather some information from other web 
pages to update information in my database.
And i use fopen() to open the URL.
as far as i know, the return result contains image, which i don't need.
so is there anyway to disable loading image when using fopen() with URL?
just want to speed things up a bit :P
thanks.

Tony S. Wu
[EMAIL PROTECTED]
The world doesn't give us hope - it gives us chance.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Using fopen() for internet URL

2003-06-08 Thread Tony S . Wu
Thanks, i think i got the description mixed up :D

Tony S. Wu
[EMAIL PROTECTED]
The world doesn't give us hope - it gives us chance.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
On Sunday, June 8, 2003, at 04:29 PM, Tony S. Wu wrote:

I have an auto-update script to gather some information from other web 
pages to update information in my database.
And i use fopen() to open the URL.
as far as i know, the return result contains image, which i don't need.
so is there anyway to disable loading image when using fopen() with 
URL?
just want to speed things up a bit :P
thanks.

Tony S. Wu
[EMAIL PROTECTED]
The world doesn't give us hope - it gives us chance.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
--
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] fopen() question and auto update question

2003-06-08 Thread Tony S . Wu
has any of you have any problem with fopen() that it can't open some 
web page?
i am trying to use it to gather information from other web pages, but i 
am having problem with one particular website, macmall.com.
might anyone know what the problem is?
also, if there is no solution to this, i am going to have to abandon 
the idea by using fopen() to gather information.
can anyone suggest an alternative way, which won't cost me too much 
time to get to it?
there will be around 200 data to be updated each time.
thanks a lot.

Tony S. Wu
[EMAIL PROTECTED]
The world doesn't give us hope - it gives us chance.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Mail() on OS X

2003-06-02 Thread Tony S. Wu
hi all, i am trying to use mail() on Mac OS X 10.2 WITHOUT sendmail.
I have php.ini file in my usr/local/lib directory, with SMTP set to my 
desire smtp server.
But it just doesn't work.
Does anyone here know how to use mail() on OS X?
Thanks a lot.

Tony S. Wu
[EMAIL PROTECTED]
The world doesn't give us hope - it gives us chance.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
Tony S. Wu
[EMAIL PROTECTED]
The world doesn't give us hope - it gives us chance.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: Mail() on OS X

2003-06-02 Thread Tony Wu
thanks for the link, unfortunately, i have trouble getting it to work.
and i can't find anything document for it.
some instructions, please?
also, someone told me before that it's impossible to use mail() on OS X without 
sendmail.
is it true?


 
On Sunday, June 01, 2003, at 07:05PM, Manuel Lemos [EMAIL PROTECTED] wrote:

Hello,

On 06/01/2003 10:37 PM, Tony S. Wu wrote:
 hi all, i am trying to use mail() on Mac OS X 10.2 WITHOUT sendmail.
 I have php.ini file in my usr/local/lib directory, with SMTP set to my 
 desire smtp server.
 But it just doesn't work.
 Does anyone here know how to use mail() on OS X?

No, the mail() function only uses a SMTP server under Unix.

To solve your problem you may want to try this class for composing and 
sending messages that comes with a subclass for delivering via a SMTP 
server.

If you do not want to change much your scripts, it comes with a function 
named smtp_mail() that emulates the mail() function except that it send 
the messages to  SMTP server of your choice:

http://www.phpclasses.org/mimemessage

To send via SMTP you also need this other class:

http://www.phpclasses.org/smtpclass



-- 

Regards,
Manuel Lemos

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




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



Re: [PHP-DB] Re: Mail() on OS X [follow up]

2003-06-02 Thread Tony Wu
ok, i've installed a mail server on my machine (CommuniGate).
But it still doesn't work.
I've specified SMTP server in php.ini.
a frind of mine got it to work with the same configure (CommuniGate) and he said he 
just put his SMTP in php.ini.
and now we both have tried to get it to work on two local machines with no luck.
what gives?

 
On Sunday, June 01, 2003, at 07:05PM, Manuel Lemos [EMAIL PROTECTED] wrote:

Hello,

On 06/01/2003 10:37 PM, Tony S. Wu wrote:
 hi all, i am trying to use mail() on Mac OS X 10.2 WITHOUT sendmail.
 I have php.ini file in my usr/local/lib directory, with SMTP set to my 
 desire smtp server.
 But it just doesn't work.
 Does anyone here know how to use mail() on OS X?

No, the mail() function only uses a SMTP server under Unix.

To solve your problem you may want to try this class for composing and 
sending messages that comes with a subclass for delivering via a SMTP 
server.

If you do not want to change much your scripts, it comes with a function 
named smtp_mail() that emulates the mail() function except that it send 
the messages to  SMTP server of your choice:

http://www.phpclasses.org/mimemessage

To send via SMTP you also need this other class:

http://www.phpclasses.org/smtpclass



-- 

Regards,
Manuel Lemos

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


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




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



[PHP-DB] [NB] Mail() question

2003-01-18 Thread Tony S . Wu
I need to send myself an email in one of my PHP page.
So i wrote the following code:

$result = ini_set(SMTP, smtp.earthlink.net);
	
if ($result)
{
	echo ini_get(SMTP);
	$result = mail([EMAIL PROTECTED], test, test123);
	
	if ($result)
		echo mail sent;
}

It always print mail sent, but I never got the email.
So I was wondering if Mail() request any send mail program to work.
Can anyone tell me?
Thanks.

Tony S. Wu
[EMAIL PROTECTED]


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




Re: [PHP-DB] [NB] Mail() question

2003-01-18 Thread Tony S . Wu
EarthLink is my DSL ISP, so its smtp server is not likely to block my 
mail.
Besides, I can send email with my mail program just fine.
I tried the similar thing on a friend's smtp server where I have access 
to the log, weird thing is I didn't even see PHP trying to access the 
smtp server.
I need to figure out why it's not working fast...
Thanks to your help.

Tony S. Wu
[EMAIL PROTECTED]

It takes a smart man to be stupid. ~Tony


On Saturday, January 18, 2003, at 01:47 PM, Micah Stevens wrote:

The mail() function returns true if it functions, i.e. if you have all
the parameters correct, and that sort of thing. If the SMTP server
rejects the email, you'll still get true returned. I ran into this a
while back. Try and do a manual connection to the SMTP server from your
PHP machine and see if it works that way. It may be failing and you
don't know. If you have access to the mail logs, check those out too.

-Micah


On Sat, 2003-01-18 at 12:48, Tony S.Wu wrote:


I need to send myself an email in one of my PHP page.
So i wrote the following code:

$result = ini_set(SMTP, smtp.earthlink.net);
	
if ($result)
{
	echo ini_get(SMTP);
	$result = mail([EMAIL PROTECTED], test, test123);
	
	if ($result)
		echo mail sent;
}

It always print mail sent, but I never got the email.
So I was wondering if Mail() request any send mail program to work.
Can anyone tell me?
Thanks.

Tony S. Wu


[EMAIL PROTECTED]

--
Raincross Technologies
Development and Consulting Services
http://www.raincross-tech.com





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




Re: [PHP-DB] [NB] Mail() question

2003-01-18 Thread Tony S . Wu
EarthLink is my DSL ISP, so its smtp server is not likely to block my 
mail.
Besides, I can send email with my mail program just fine.
I tried the similar thing on a friend's smtp server where I have access 
to the log, weird thing is I didn't even see PHP trying to access the 
smtp server.
I need to figure out why it's not working fast...
Thanks to your help.

Tony S. Wu
[EMAIL PROTECTED]


On Saturday, January 18, 2003, at 01:47 PM, Micah Stevens wrote:

The mail() function returns true if it functions, i.e. if you have all
the parameters correct, and that sort of thing. If the SMTP server
rejects the email, you'll still get true returned. I ran into this a
while back. Try and do a manual connection to the SMTP server from your
PHP machine and see if it works that way. It may be failing and you
don't know. If you have access to the mail logs, check those out too.

-Micah


On Sat, 2003-01-18 at 12:48, Tony S.Wu wrote:


I need to send myself an email in one of my PHP page.
So i wrote the following code:

$result = ini_set(SMTP, smtp.earthlink.net);
	
if ($result)
{
	echo ini_get(SMTP);
	$result = mail([EMAIL PROTECTED], test, test123);
	
	if ($result)
		echo mail sent;
}

It always print mail sent, but I never got the email.
So I was wondering if Mail() request any send mail program to work.
Can anyone tell me?
Thanks.

Tony S. Wu


[EMAIL PROTECTED]

--
Raincross Technologies
Development and Consulting Services
http://www.raincross-tech.com





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




Re: [PHP-DB] [NB] Mail() question

2003-01-18 Thread Tony S . Wu
Ah, that must be it.
I am running a Mac OS X server, which is Darwin based.
Guess I should go with sendmail.
Thanks a lot.

Tony S. Wu
[EMAIL PROTECTED]


On Saturday, January 18, 2003, at 02:27 PM, Jason Wong wrote:


On Sunday 19 January 2003 04:48, Tony S. Wu wrote:

I need to send myself an email in one of my PHP page.
So i wrote the following code:

$result = ini_set(SMTP, smtp.earthlink.net);

if ($result)
{
	echo ini_get(SMTP);
	$result = mail([EMAIL PROTECTED], test, test123);

	if ($result)
		echo mail sent;
}

It always print mail sent, but I never got the email.
So I was wondering if Mail() request any send mail program to work.


Is it a windows server that you're using? SMTP only works for windows.
Anything else uses sendmail or equivalent.

--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
transient bus protocol violation
*/


--
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] Storing Radio Buttons Checkboxes in MySQL

2003-01-05 Thread Tony Bollino
Greetings all.
Thank you to all those on the list who have been helpful in the past. 
I'm hoping you will be able to come through for me again.  Here is my 
conundrum.

I am using an app (GBSurvey) I downloaded from the web to create a 
survey for teachers at a school.  The application only allows for radio 
buttons in the surveys. The school wants some questions to have 
checkboxes so responders can select multiple answers for the question. 
I rewrote the code to allow the admin to select if the answers to a 
survey question will be radio buttons or checkboxes.  That displays 
properly.  When I test it with multiple check boxes selected in one of 
the questions only the value of the last checkbox selected is entered 
into the database.

Here is the code:

Explaination of VARS for this example
--
$survey_id = The id of the survey

DB Field Definitions
--
surveya_type = Radio or Checkbox
surveyq_id = The question id in the database
surveya_id = The answer id in the database
surveya_name = The answer itself
--

This is the code to create the questions:
--
function list_surveyq($survey_id) {
   echo bia 
href=\.$GLOBALS[PHP_SELF].?survey_id=.$survey_id.view_results=true\View 
results without taking the survey/a/i/bP\n;

   $strSQL = SELECT * From bug_public_survey WHERE 
survey_id=.$survey_id;
   $query1 = mysql_query($strSQL,$GLOBALS[dbconn]);
   $survey = mysql_fetch_array($query1);
   echo form method=\post\ action=\.$GLOBALS[PHP_SELF].\\n;
   echo input type=\hidden\ name=\votes\ value=\1\\n;
   echo input type=\hidden\ name=\survey_id\ 
value=\.$survey_id.\\n;
//Get all the questions
   $strSQL = SELECT * From bug_public_surveyq WHERE 
surveyq_surveyid=.$survey[survey_id]. ORDER By surveyq_id;
   $query2 = mysql_query($strSQL,$GLOBALS[dbconn]);
   while($surveyq = mysql_fetch_array($query2)) {
//Get all the answers
   echo b.$surveyq[surveyq_name]./bbr\n;
   $strSQL = SELECT * From bug_public_surveya WHERE 
surveya_surveyqid=.$surveyq[surveyq_id];
   $query3 = mysql_query($strSQL,$GLOBALS[dbconn]);
   echo ul\n;
   while($surveya = mysql_fetch_array($query3)) {

   //
   //THIS IS WHERE THE ANSWERS ARE PRINTED
   //print radio button or checkbox and answer 
title for each question
   //
echo input type=\.$surveya[surveya_type].\ 
name=\answer[.$surveyq[surveyq_id].]\ 
value=\.$surveya[surveya_id].\ .$surveya[surveya_name].br\n;
//original code - echo input type=\radio\ 
name=\answer[.$surveyq[surveyq_id].]\ 
value=\.$surveya[surveya_id].\ .$surveya[surveya_name].br\n;
   }
   echo hr/ul\n;
   }
   echo input type=\submit\ value=\Submit\\n;
   echo /form\n;

--

When the form is submitted, this is the SQL that is executed.   The 
value of $votes is set to 1.  The page will reload and check to see if 
$votes is set.

---

if (isset($votes)) {
   $strSQL = SELECT * From bug_public_surveyq WHERE 
surveyq_surveyid=.$survey_id;
   $query = mysql_query($strSQL,$GLOBALS[dbconn]);
   while($surveyq = mysql_fetch_array($query)) {
   $strSQL = INSERT INTO bug_public_surveyr 
(surveyr_surveyid, surveyr_surveyaid, surveyr_surveyqid) VALUES 
(.$survey_id., .$answer[$surveyq[surveyq_id]]., 
.$surveyq[surveyq_id].);
 echo $strSQL;
   mysql_query($strSQL,$dbconn);
   }
   mysql_free_result($query);
}
---

The name of each checkbox is the same but the values are different.  Do 
both the name and values have to be different?  When it is inserted into 
the DB it shouldn't matter since the record would not be a duplicate.

--
Tony Bollino
AdytumSolutions
Sales and Field Operations
301-788-6886
http://www.adytumsolutions.com
[EMAIL PROTECTED]


* Not just a solution ... an AdytumSolution. *



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



[PHP-DB] mail() question

2003-01-05 Thread tony
I am trying to get the mail() function to work.
Here is my test code:

ini_set(SMTP, mail.mydomain.com);
ini_set(sendmail_from, [EMAIL PROTECTED]);
echo ini_get(SMTP);
echo brbr, ini_get(sendmail_from);
echo brbr, ini_get(sendmail_path);

echo $success = mail([EMAIL PROTECTED], A subject, Some contents);

I print the settings out to make sure they are right.
And they look like right.
But even if the mail() function retuns 1, the mail still doesn't go through.
Don't even see a log on the mail server.
Can somebody tell me what I am missing?
Thanks a lot for your help.


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




Re: [PHP-DB] Infinite Loop?

2002-11-02 Thread Tony S. Wu
I've seen no way to get out of the while loop.

Tony S. Wu
[EMAIL PROTECTED]

Nope, this world ain't perfect. But at least I know it's not because of
me.


Graeme McLaren at [EMAIL PROTECTED] wrote:

 Greetings list members.  I've written the code below as part of an
 automatic email script.  The problem with this is it seems to run in to
 an infinite loop.  The for loop seems to get completely ignored by
 emails get sent constantly.  I deleted the script after receiving 2500
 emails ! :'( 
 
 Can anyone point out what the problem with this is?
 
 while($tmp = $NowUnix)
 {
 
 for($i=0; $i=2; $i++)
 {
 $sendto = [EMAIL PROTECTED];
 $subject = Test Automatic Email;
 $message = If you get this then age3.php works
 $message = If you get this then age3.php works
 $message = If you get this then age3.php works;
 
 mail($sendto, $subject, $message);
 }
 }
 
 Cheers,
 
 Graeme :)




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




[PHP-DB] Free shopping cart

2002-10-20 Thread Tony S. Wu
I need to write a shopping cart for my friend's website.
I thought modifying a free one for my need would be easier.
Sorry for asking question like this.
But I've done the search on google and all I could find weren't free.
Can anyone provide me some links?
Thanks a lot.

Tony S. Wu
[EMAIL PROTECTED]

Nope, this world ain't perfect. But at least I know it's not because of
me.


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




Re: [PHP-DB] Free shopping cart

2002-10-20 Thread Tony S. Wu
Thanks a lot :D

Tony S. Wu
[EMAIL PROTECTED]

Nope, this world ain't perfect. But at least I know it's not because of
me.


Jason Wong at [EMAIL PROTECTED] wrote:

 On Sunday 20 October 2002 23:17, Tony S. Wu wrote:
 I need to write a shopping cart for my friend's website.
 I thought modifying a free one for my need would be easier.
 Sorry for asking question like this.
 But I've done the search on google and all I could find weren't free.
 Can anyone provide me some links?
 
 Try:
 
 www.zend.com
 freshmeat.net
 sourceforge.net
 
 and even:
 
 www.hotscripts.com




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




[PHP-DB] LDAP?

2002-09-12 Thread Tony Earnshaw

Hi list!

Seen a lot of SQL stuff floating by, but my present, consuming interest
is Openldap.

Is this the right list, or should I subscribe to any other list?

Best,

Tony

-- 

Tony Earnshaw

Tha can allway tell a Yorkshireman, but tha canna tell 'im much.

e-post: [EMAIL PROTECTED]
www:http://www.billy.demon.nl
gpg public key: http://www.billy.demon.nl/tonni.armor

Telefoon:   (+31) (0)172 530428
Mobiel: (+31) (0)6 51153356

GPG Fingerprint = 3924 6BF8 A755 DE1A 4AD6 FA2B F7D7 6051 3BE7 B981
3BE7B981





signature.asc
Description: Dette er en digitalt signert meldingsdel


[PHP-DB] oscommerce

2002-09-11 Thread Tony Kuntz

Has anyone on this list had any experience working with oscommerce?



Re: [PHP-DB] search syntax

2002-07-21 Thread Tony

Try break up the query, like:

WHERE (column1 LIKE '%$search%' OR column2 LIKE '%$search%' OR column3 LIKE
'%$search%') AND ...

Tony S. Wu


Matthew K. Gold at [EMAIL PROTECTED] wrote:

 hi everyone,
 
 I'm writing the code to make my mysql database searchable.  I can search two
 columns, but I seem to have problems when I try to search three.
 
 In the SELECT statement, this WHERE statement works:  WHERE column1 OR
 column2 LIKE '%$search%' AND...
 
 This WHERE statement doesn't work:  WHERE column1 OR column2 OR column3 LIKE
 '%$search%' AND ...
 
 I'm obviously having a syntax problem...Thanks in advance for your help.
 And in case any of this is confusing, I'll include the real code below.
 
 Thanks,
 
 Matt
 
 
 $get_data = select course.CourseNumber, course.CourseTitle,
 concat(prof.ProfFName, \ \, prof.ProfLName), instit.InstitName,
 disc.DiscName, course.Format from course, disc, instit, prof where
 course.CourseTitle or course.CourseDesc or disc.DiscName like '%$search%'
 and course.DiscID = disc.DiscID and course.InstitID = instit.InstitID and
 course.ProfID = prof.ProfID order by $orderby;
 
 
 
 
 




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




Re: [PHP-DB] A Simple Question

2002-07-09 Thread Tony

Suppose you are using PHP.
A link like this:

http://yourdomain.com/yourpage.php?var1=value1var2=value2var3=value3

will do the trick.
And in the page that receives this link (yourpage.php that is), use $_GET[]
to get the value:

$var1 = $_GET[var1];
$var2 = $_GET[var2];
$var3 = $_GET[var3];

Tony S. Wu


Manuel at [EMAIL PROTECTED] wrote:

 
 I recently discovered that you can pass variables through hyperlinks. (I
 didn't know this could be done) This will be very helpful for the project I'm
 working on but I cannot find any information on this subject.
 
 Does anybody know where I can find information on the syntax and limitations
 of this feature? 
 
 
 
 -
 Do You Yahoo!?
 New! SBC Yahoo! Dial - 1st Month Free  unlimited access




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




Re: [PHP-DB] delete multiple records with one query

2002-07-01 Thread Tony

If you want to delete multiple items, you need to use array name condition
in checkbox.
Here's an example:

form action = delete.php method = post
input type = checkbox name = name_array[] value = value1
input type = checkbox name = name_array[] value = value2

!-- more and more... --

input type = submit name = name value = GO
/form

Of course you can use a while loop to output the form.
Then in your PHP code that processes this form, you need to run a query for
every one of the data you want to delete:

if (count($_POST[name_array])  0)
{
foreach($_POST[name_array] as $name_element)
{
// call a function to delete record
}
else
{
// print message because no checkbox has been selected
exit;
}

Tony S. Wu 


Matt Nigh at [EMAIL PROTECTED] wrote:

 hi, i'm trying to delete multiple records at once from a mysql db and can't
 seem to figure out how to do so.
 here's the code i've been trying to troubleshoot with:
 
 $result_insert = mysql_query(delete from $mysql_table where id = '8' AND
 where id = '18');
 
 
 i've tried various things such as taking away the single quotes, replacing
 AND with a comma, etc.
 after i figure out how to delete multiple records, i need to figure out how
 to go about carrying data from checkboxes and finding a query to delete the
 records that were checked on the previous page:
 
 ex.
 input type=checkbox name=id value=1
 input type=checkbox name=id value=2
 input type=checkbox name=id value=3
 etc.
 
 
 any help would be appreciated.
 
 thanks very much,
 
 
 Matt
 
 




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




Re: [PHP-DB] Problem w/ mysql_pconnect

2002-06-23 Thread Tony

You must create an account in MySQL with root user first, and grant the
account with the privileges you want it to have.

Tony S. Wu

Chris Barnes at [EMAIL PROTECTED] wrote:

 Hi Paul,
 I'm no MySQL expert and i'm only very new to this list but i have had the
 same problem before.
 What i did to fix the problem was replace localhost with the ip address of
 the machine...so on my network i my MySQL server is 10.3.2.1 so i used
 10.3.2.1 instead of localhost and it worked for me.
 
 the real solution i guess would be to grant access for that username from
 the localhost.localdomain address in your MySQL server.
 
 see how u go.
 
 -Original Message-
 From: Paul D [mailto:[EMAIL PROTECTED]]
 Sent: Monday, 24 June 2002 12:07 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Problem w/ mysql_pconnect
 
 
 I'm using PHP 4.2.0 with MYSQL 3.23. When I try to use either the
 mysql_connect or mysql_pconnect to access the database, I get the
 following error message:
 
 Access denied for user: '[EMAIL PROTECTED]' (Using password: YES)
 
 I have tried different user names and nothing seems to work. If I use
 the functions without any parameters, it'll work just fine, and when I
 try access directly from the console, it'll work fine also. The problem
 seems to lie with the function parameters, which is written as follows:
 
 $db = mysql_pconnect(localhost, pauld, any_pwd) or
 die($php_errormsg);
 
 Any suggestions would be very much appreciated.
 
 
 --
 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] Auto-update database records

2002-06-12 Thread Tony

I finally got this auto-update script to work, thanks for your so many
replies.

Tony S. Wu 

Jason Wong at [EMAIL PROTECTED] wrote:

 On Saturday 08 June 2002 21:34, Tony wrote:
 I do appreciate your reply.
 Yes, I've tried to track down the problem.
 I comment-out the fopen() function and use echo to display the URL.
 And it displays fine, so I did get the record from MySQL.
 Then when I put the fopen() back, same problem appears.
 
 You did check that $buffer contains what you expect for each iteration of
 $final_result?
 
 I think it's probably because I have too much data to update at once, over
 a hundred maybe?
 Then it causes the PHP to timeout this script hence the error.
 
 You can use set_time_limit(3000) inside a loop (probably the foreach) as each
 time it is used it will reset the max execution time to 3000secs.
 
 As I said before, see what's happening to the value of $counter. Or simplify
 that loop with a regular expression.





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




[PHP-DB] Auto-update database records

2002-06-08 Thread Tony

Here is my code.
If you see some variables not defined, assume it is:

?
require_once(fn_web.php);
require_once(fn_db.php);

set_time_limit(3000);

set_header(Auto-Update);

$final_result = get_records($_POST[key]);
// getting the records from database

foreach ($final_result as $final)
{
$fp = @ fopen($final[url], r);

if (!$fp)
{
echo font color = \#FF\Error: URL ba href =
\.$final[url].\
target = \blank\.$final[url]./a/b does not
exist./fontbr;
}
else
{
// get rid of html tags
while (!feof($fp))
{
// do something to get rid of html tags
}

fclose($fp);

// find the $ sign
while ($counter  $i)
{
if ($buffer[$counter] == '$')
{
$counter++;
   
while (doubleval($buffer[$counter]) || $buffer[$counter]
== .)
{
$price .= $buffer[$counter];
$counter++;
// $price_array_holder++;
}
//$price_array_holder = 0;
$price_count++;
}
else
$counter++;
}

if ($price_count  1)
// more than one price found
{
echo font color = \#FF\Error: Multiple price found
for partnum b
a href = \.$final[url].\ target =
\blank\.$final[partnum].
/a/b./fontbr;
}
else if ($price_count == 0)
// no price has been found
{
echo font color = \#FF\Error: No price found for
partnum b
a href = \.$final[url].\ target =
\blank\.$final[partnum].
/a./fontbr;
}
else if ($price == $final[price])
{
echo font color = \#00A5C6\No change has made for
partnum b
a href = \.$final[url].\ target = \blank\.
$final[partnum]./a/b, price
remains.$price./fontbr;
}
else
{
if (process_change($final[partnum], $price, $vendor,
$final[url]))
{
echo font color = \#218429\Update price to
.$price. for
partnum ba href = \.$final[url].\ target =
\blank\.
$final[partnum]./a/b./fontbr;
}
}

flush();

}
}

set_footer();
?

Tony S. Wu
[EMAIL PROTECTED]


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




Re: [PHP-DB] Auto-update database records

2002-06-08 Thread Tony

You are being picky on me, huh?
I stated my problem 3 emails ago, browser gives me error attempt to load
MyPage's URL failed.
Could be because of execution timeout.
I tried to set the time longer with no luck.
If I put the flush() after each data, I get the first output only.
But I need to update the database very often, and I don't want to do it by
hands..

Tony S. Wu
[EMAIL PROTECTED]


 On Saturday 08 June 2002 20:35, Tony wrote:
 Here is my code.
 If you see some variables not defined, assume it is:
 
 Hmm, is there a problem with your code? If so could you state what the problem
 is?




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




Re: [PHP-DB] Auto-update database records

2002-06-08 Thread Tony

I do appreciate your reply.
Yes, I've tried to track down the problem.
I comment-out the fopen() function and use echo to display the URL.
And it displays fine, so I did get the record from MySQL.
Then when I put the fopen() back, same problem appears.
I think it's probably because I have too much data to update at once, over a
hundred maybe?
Then it causes the PHP to timeout this script hence the error.
If I can't solve this on PHP, I'll have to find an alternative way to do
this...

Tony S. Wu
[EMAIL PROTECTED]


 On Saturday 08 June 2002 20:52, Tony wrote:
 You are being picky on me, huh?
 
 I'm sorry if you feel offended ...
 
 I stated my problem 3 emails ago,
 
 ... but I delete mail from this list as soon as I've finished with them. As
 you have started a new thread one would naturally assume this is a new
 problem. Please don't expect people to remember dead threads.
 
 browser gives me error attempt to load
 MyPage's URL failed.
 
 Could be because of execution timeout.
 I tried to set the time longer with no luck.
 If I put the flush() after each data, I get the first output only.
 But I need to update the database very often, and I don't want to do it by
 hands..
 
 Have you tried tracking down where it is that the script fails?
 
 Either use echo() or error_log() at various points in the script to monitor
 what the program is doing. For example before starting the while-loops
 echo(Entering while loop) and inside the while-loop echo($counter), and
 when the loop terminates echo someting to that effect. This should at least
 tell you whether you have any infinite loops.
 
 Another thing you can do is simplify the check for the prices. Your present
 method seems to be veru long-winded. I think a single preg_match() could
 replace the while ($counter  $i) loop.





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




[PHP-DB] no subject

2002-06-07 Thread Tony

I have a huge database that some of the content need to be update weekly or
even daily.
I wrote a PHP script for that purpose.
It's supposed to get the data from database, find the URL, fopen() it, find
the information, then update it back into the database.
Unfortunately, everytime I run the script I get an error message from
browser saying attempt loading page MyPage's URL failed.
Some guy indicated the problem is probably caused by PHP execution timeout.
I tried to set the time longer, no luck.
Tried to use flush() after each data, no luck.
Now I gotta think of other ways to do this.
I am thinking about using AppleScript (I am using OS X).
Does anyone know how to communicate with MySQL via AppleScript, if possible?
Thanks.


Tony S. Wu
[EMAIL PROTECTED]


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




[PHP-DB] fopen() question

2002-06-06 Thread Tony

I have a database and I am writing a script to auto-update some information
in the database.
That requires me to read data from database, find the URL, read the URL,
find the information I want, then update it in the database.
My problem is, for example I read one record from database who's URL is
http://www.somedomain.com/.
And I try to read the URL with fopen() for information:

$fp = fopen(³http://www.comedomain.com/², ³r²);

if (!$fp)
{
echo ³URL not available.²;
exit;
}

If the URL is available, things will work fine.
But if the URL is NOT available, I will get a error saying ³attempt to load
file ³MyFile¹s URL² failed² from browser.
It¹s supposed to output the string ³URL not available², isn¹t it?
Anyone know how to get around with this?


Tony S. Wu
[EMAIL PROTECTED]


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




Re: [PHP-DB] Trouble displaying info in a multiline form

2002-06-05 Thread Tony

Text area is controled by col and row size.
If it's not big enough (doesn't look big enough), just make the col or row
size bigger.

Tony S. Wu
[EMAIL PROTECTED]


 Thanks for help. It worked fine.
 But now i have another problem ( i'm new in php/html) : the textarea doesn't
 have the size that i need. I need a bigger textarea.How should i do this?
 
 Thanks again
 Paulo
 
 





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




Re: [PHP-DB] Using functions in SELECT statements

2002-05-02 Thread Tony James

Hi Robin


Instead of using sql to change the case of the search criteria try using php
as in the statement below

$query=
SELECT *
FROM [Organisation Membership]
WHERE lower(organisation) LIKE  '%. strtolower($SearchBox) .%');

Hope this is of some help to you
Tony James

- Original Message -
From: Robin S McKenzie [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 02, 2002 3:11 PM
Subject: Re: [PHP-DB] Using functions in SELECT statements



If only it were that simple - sorry, that was a copying error...

It gives the error  undefined function: lower

R

Robin McKenzie Department of Mechanical Engineering University of Bristol
e:[EMAIL PROTECTED] e:[EMAIL PROTECTED] m:+44(0)7970 058712

Peter Lovatt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...



 Could it be the second $ in the lower('%$SearchBox$%') ?

 Peter



 ---
 Excellence in internet and open source software
 ---
 Sunmaia
 www.sunmaia.net
 [EMAIL PROTECTED]
 tel. 0121-242-1473
 ---

  -Original Message-
  From: Robin S McKenzie [mailto:[EMAIL PROTECTED]]
  Sent: 02 May 2002 14:34
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Using functions in SELECT statements
 
 
 
  I'm trying perform a case-insensitive test for a name.  These are stored
  like Association of ..., and I want to convert both the filter and the
  test data to lower- (or upper-) case.  Why doesn't this work:   ?
 
  SELECT *
  FROM [Organisation Membership]
  WHERE lower(organisation) LIKE lower('%$SearchBox$%')
 
  Robin McKenzie
  Department of Mechanical Engineering
  University of Bristol
  e:[EMAIL PROTECTED]
  e:[EMAIL PROTECTED]
  m:+44(0)7970 058712
  
 
 
 
  --
  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] Count and group ?

2002-05-01 Thread Tony James

Hi Dave

Assuming you are using mysql try the following query


select count(Admin_id) as admin1, Admin_id as admin2 from TABLE_NAME group
by admin2


substituting TABLE_NAME  for whatever you have called your table.

Hope this helps

Cheers

Tony James



- Original Message -
From: Dave Carrera [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 01, 2002 1:02 PM
Subject: [PHP-DB] Count and group ?


Hi All



I have added a row to my table which inputs which admin user has amended
a record in a table on my db.



I have this working but what I would like to do is count how many
instances of the admin id I have stored.



So if my list looks like this..



Admin_id

1

2

2

2

3

3

3

3

3

2

1

1

Then the result I would like to display is this..



Admin (1) = 3 posts

Admin (2) = 4 posts

Admin (3) = 5 posts



Basically displaying the total post each admin has made



Any help or guidance is very appreciated and thank you in advance



Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com








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




RE: [PHP-DB] need help guys

2002-03-14 Thread Tony James

hi Rehab

Because your submitted text on the url contains an '' anthing after this
character will be parsed as a new variable.
Instead of
location.href=additems.php?category=+c
try
location.href=additems.php?category=+escape(c)

this will encode the '' aswell as spaces to preserve the entire string

Hope this helps
TJ

-Original Message-
From: its me [mailto:[EMAIL PROTECTED]]
Sent: 14 March 2002 11:21
To: [EMAIL PROTECTED]
Subject: [PHP-DB] need help guys


i have this
select name=category
option value='Arts'Antiques  Arts/option

then i pass this to next page:
script
c=document.forms[0].category.options[document.forms[0].category.selectedInde
x].text

location.href=additems.php?category=+c
/script

in url it shows like this:

http://localhost/auction/seller/additems.php?category=Antiques%20%20Arts

but in additems.php
when i say
echo $category it give me only Anticues



Rehab M.Shouman





-
Express yourself with a super cool email address from BigMailBox.com.
Hundreds of choices. It's free!
http://www.bigmailbox.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




FW: [PHP-DB] Username

2002-02-05 Thread Tony James

Hi Jennifer

The table defines the uid field as not null.
CREATE TABLE users (
  uid int(10) unsigned NOT NULL auto_increment,
  name varchar(20) NOT NULL default '',
  password varchar(20) NOT NULL default '',
..


However you are trying to insert null into uid field

$query = INSERT INTO users (uid, name) VALUES(NULL, $name);
$result = mysql_query($query);


Since a primary key has to be not null try inserting an empty string instead
of NULL.

HTH

TJ.
-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: 05 February 2002 14:50
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Username


Hi,

It's me bothering you great helpers again! Wondering if you can help me?
I know I am missing something stupid cause I am taking this pretty much
straight out
of  the PHP 4 Bible.

Here is my table dump:


CREATE TABLE users (
  uid int(10) unsigned NOT NULL auto_increment,
  name varchar(20) NOT NULL default '',
  password varchar(20) NOT NULL default '',
  class tinyint(3) unsigned NOT NULL default '0',
  realname varchar(40) default NULL,
  email varchar(50) NOT NULL default '',
  sex enum('Male','Female') default NULL,
  session varchar(15) NOT NULL default '',
  dateregistered datetime NOT NULL default '-00-00 00:00:00',
  dateactivated datetime NOT NULL default '-00-00 00:00:00',
  lastvisit datetime NOT NULL default '-00-00 00:00:00',
  logins int(10) unsigned NOT NULL default '0',
  points int(11) NOT NULL default '1000',
  PRIMARY KEY  (uid),
  UNIQUE KEY name (name,email)
) TYPE=MyISAM;


Here is the php code:

?
// include the database configuration
includeconfig.php;
// connect to database
mysql_connect($db[host],$db[user],$db[password]);
mysql_select_db($db[database])  or die (sorry I couldn't connect to the
database.);

// if no connect then exit
// exit;

// if connect successful

?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN

html
head
titleUntitled/title
/head
body
?
?
if(!IsSet($stage))
  {
?

Please fill out the form below to get an account.
FORM METHOD=POST ACTION=te.php
Username:BRINPUT TYPE=TEXT NAME=name SIZE=15BR
input type=hidden name=stage value=1
INPUT TYPE=SUBMIT
/form
?
$query = INSERT INTO users (uid, name) VALUES(NULL, $name);
$result = mysql_query($query);
if($result == 0)
print(There has been a problem.);
else
print(Your information has been recorded.);
}
 ?
/body
/html

All I want is to get the username into the database.
As soon as test.php shows in browser, the Username, submit button and box ar
e there but also
it prints the There has been a problem. right off the bat. Now I know
there are misprints in the book
and I hope I was smart enough to catch them but maybe not. can someone
please tell me what I have
done wrong?

Thanks for all your time.

Jennifer Downey



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




FW: [PHP-DB] Username

2002-02-05 Thread Tony James


Hi again

The insert statement is incorrectly positioned within the if statement.

?
if(!IsSet($stage))
 {
?
Please fill out the form below to get an account.
FORM METHOD=POST ACTION=te.php
Username:BRINPUT TYPE=TEXT NAME=name SIZE=15BR
input type=hidden name=stage value=1
INPUT TYPE=SUBMIT
/form
?
$query = INSERT INTO users (uid, name) VALUES(NULL, $name);
$result = mysql_query($query);
if($result == 0)
print(There has been a problem.);
else
print(Your information has been recorded.);
}
 ?

should be

?
if(!IsSet($stage))
{
?
Please fill out the form below to get an account.
FORM METHOD=POST ACTION=te.php
Username:BRINPUT TYPE=TEXT NAME=name SIZE=15BR
input type=hidden name=stage value=1
INPUT TYPE=SUBMIT
/form
?
}
else
{
$query = INSERT INTO users (uid, name) VALUES(NULL, $name);
$result = mysql_query($query);
if($result == 0)
print(There has been a problem.);
else
print(Your information has been recorded.);
}

Again HTH
TJ
 ?




-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: 05 February 2002 14:50
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Username


Hi,

It's me bothering you great helpers again! Wondering if you can help me?
I know I am missing something stupid cause I am taking this pretty much
straight out
of  the PHP 4 Bible.

Here is my table dump:


CREATE TABLE users (
  uid int(10) unsigned NOT NULL auto_increment,
  name varchar(20) NOT NULL default '',
  password varchar(20) NOT NULL default '',
  class tinyint(3) unsigned NOT NULL default '0',
  realname varchar(40) default NULL,
  email varchar(50) NOT NULL default '',
  sex enum('Male','Female') default NULL,
  session varchar(15) NOT NULL default '',
  dateregistered datetime NOT NULL default '-00-00 00:00:00',
  dateactivated datetime NOT NULL default '-00-00 00:00:00',
  lastvisit datetime NOT NULL default '-00-00 00:00:00',
  logins int(10) unsigned NOT NULL default '0',
  points int(11) NOT NULL default '1000',
  PRIMARY KEY  (uid),
  UNIQUE KEY name (name,email)
) TYPE=MyISAM;


Here is the php code:

?
// include the database configuration
includeconfig.php;
// connect to database
mysql_connect($db[host],$db[user],$db[password]);
mysql_select_db($db[database])  or die (sorry I couldn't connect to the
database.);

// if no connect then exit
// exit;

// if connect successful

?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN

html
head
titleUntitled/title
/head
body
?
?
if(!IsSet($stage))
  {
?

Please fill out the form below to get an account.
FORM METHOD=POST ACTION=te.php
Username:BRINPUT TYPE=TEXT NAME=name SIZE=15BR
input type=hidden name=stage value=1
INPUT TYPE=SUBMIT
/form
?
$query = INSERT INTO users (uid, name) VALUES(NULL, $name);
$result = mysql_query($query);
if($result == 0)
print(There has been a problem.);
else
print(Your information has been recorded.);
}
 ?
/body
/html

All I want is to get the username into the database.
As soon as test.php shows in browser, the Username, submit button and box ar
e there but also
it prints the There has been a problem. right off the bat. Now I know
there are misprints in the book
and I hope I was smart enough to catch them but maybe not. can someone
please tell me what I have
done wrong?

Thanks for all your time.

Jennifer Downey



--
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] Access to MySQL Conversion question

2001-10-19 Thread Tony McCrory

select max(idfield) from table



 -Original Message-
 From: Brad Harriger [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, October 18, 2001 7:32 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Access to MySQL Conversion question
 
 
 I have several MS Access databases that I need to convert to MySQL.
 Each table is indexed on an ID field.   How do I find the last index
 number in the existing table so that I can increment it for the next
 record that is added?
 
 Thanks,
 
 Brad
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 

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




RE: [PHP-DB] RE: Excel to MySQL

2001-10-18 Thread Tony McCrory

You could try the MyODBC driver.  On the www.mysql.com website I think.
Then you won't need CSV or any other type of import file.

Tony

 -Original Message-
 From: Mikusch, Rita [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 17, 2001 5:05 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] RE: Excel to MySQL


 I do this fairly often (actually from MSSQL to Access to Excel to MySQL --
 I'm sure there's a shorter route!)

 I convert the Excel file to a tab delimited file. I do run into two
 problems:

 a) some of the text entries are surrounded by double quotes and
 some aren't
 (some kind of Excel weirdness). So I open it up in a text editor
 and delete
 all the quotes. I use the programmers file editor which is
 about a zillion
 years old, hasn't been updated for years, but deletes those quotes in
 milliseconds.

 b) sometimes users enter hard-returns into the text data they
 enter into the
 windows database (the source of my excel file). This will convert into a
 hard return in your tab delimited text file. I run through the
 list manually
 to find the hard returns and delete them. My list is only 10,000
 long and it
 is formatted in such a way that makes these hard returns easy to see! I'm
 sure others on the list have a much better way of dealing with this.

 I have an auto increment field in my table so I add an
 additional numbered
 column in Excel and number it appropriately.

 One day when I have time I'll actually find a more efficient way of doing
 all this!

 good-luck
 rita.

 -Original Message-
 From: Chris Payne [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, October 16, 2001 10:58 PM
 To: [EMAIL PROTECTED]
 Subject: Excel to MySQL


 Hi there everyone,

 What is the best way to convert an Excel spreadsheet into a MySQL
 database?
 Should I save it as a comma'd file or is there a better way?  If I have to
 save it as a comma'd text file, is there anything special I
 should do first?

 I would normally enter the data manually on my server, but we are
 talking in
 excess of 15000+ entries here which is way too many to add manually.

 Thanks for all your help.

 Chris

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




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




RE: [PHP-DB] How to do this with PHP

2001-09-22 Thread Tony McCrory

Does anyone know how to achieve this using non-mysql servers?  subqueries?

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 21, 2001 7:48 PM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] How to do this with PHP


SELECT * FROM mytable LIMIT 0,5
SELECT * FROM mytable LIMIT 6,5
SELECT * FROM mytable LIMIT 11,5
SELECT * FROM mytable LIMIT 16,5

-Original Message-
From: Alawi Albaity [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 21, 2001 1:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] How to do this with PHP


I have a table ..
this table have 20 record..
I want to view this record in the 4 pages (5 record by
page)..
how can I do that !! 


__
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

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

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



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




RE: [PHP-DB] Store Procedures

2001-08-24 Thread tony . mccrory


on slashdot.org today...

;)
   

   

 http://software.tangent.org/article.pl?sid=01/08/23/0817244mode=threadthreshold=

   

   

 MySQL Gets Perl Stored Procedures 

   

   

   

 (Embedded image moved to file: pic22355.gif)Posted by CmdrTaco on Friday August 24, 
@11:52AM  
 from the well-isn't-that-special dept.

 ryarger writes Woo Hoo! After a seeming eternity of wait, there is finally an 
implementation of  
 stored procedures for MySQL. It uses Perl as the stored proc language, too! Also 
note that this  
 piece of work was done by OSDNs own Krow. Very cool work I must say.  

   

   

 ( Read More... | 155 of 221 comments )

   






   

Rick Emery 

remery@excelTo: 'Francisco Carvalho' 
[EMAIL PROTECTED],
.com'[EMAIL PROTECTED]' 
[EMAIL PROTECTED]   
 cc:   

08/23/2001   Subject: RE: [PHP-DB] Store Procedures

10:08 PM   

   

   





no

-Original Message-
From: Francisco Carvalho [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 23, 2001 4:20 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] Store Procedures


Newbie question.

I've been developing web application in IIS using ASP and Microsoft SQL
Server 7.0.
I use Stored Procedures  quite extensible is there an equivalent in MySQL

Thanks.
Francisco Carvalho

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




IMPORTANT NOTICE  The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and is not intended
to be relied upon by any person without subsequent written confirmation of
its contents.  Furthermore, the content of this e-mail is the personal view
of the sender and does not represent the advice, views or opinion of our
company.  Accordingly, our company disclaim all responsibility and accept
no liability (including in negligence) for the consequences of any person
acting, or refraining from acting, on such information prior to the receipt
by those persons of subsequent written confirmation.  In particular (but
not by way of limitation) our company disclaims all responsibility and
accepts no liability for any e-mails which are defamatory, offensive,
racist or in any other way are in breach of any third party's rights,
including breach of confidence, privacy or other rights.  If you have
received this e-mail message in error, please notify me immediately by
telephone.  Please also destroy and delete the message from your computer.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message is strictly
prohibited.  Trinity Mirror plc is the holding company for the Trinity
Mirror group of companies and is registered in England No. 82548, with its
address at Kingsfield Court, Chester Business Park, Chester CH4 9RE.


-- 
PHP Database Mailing List 

RE: [PHP-DB] getting ID

2001-08-20 Thread tony . mccrory


With MSSQL I do:

$result=mssql_query(select @@IDENTITY as 'jobNumber');
$row=mssql_fetch_array($result);
$insertid=$row[jobNumber];

May be similar for sybase.. I understand they have similar origins..

Tony



   
 
Walter,   
 
Marcel   To: 'Ian Grant' 
[EMAIL PROTECTED], [EMAIL PROTECTED]  
Marcel.Waltercc:  
 
@drkw.comSubject: RE: [PHP-DB] getting ID 
 
   
 
08/20/2001 
 
11:22 AM   
 
   
 
   
 




Is there a similar function for a Sybase - Database ?

 -Original Message-
 From:   Ian Grant [SMTP:[EMAIL PROTECTED]]
 Sent:   Monday, August 20, 2001 12:20
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] getting ID

 mysql_insert_id([resource link_identifier]) returns the value of the
 auto_increment field for the previous INSERT query. It will return 0 if
 there is not an auto_increment field. If the link_identifier is not
 specified, the last opened connection is used.

 So, use $id = mysql_insert_id(); directly after your $result =
 mysql_query($query); operation (where $query is an INSERT query) to pull
 the
 id value you have just auto inserted back out.


 Ian.

 Manual page: http://www.php.net/manual/en/function.mysql-insert-id.php
 Crosswalkcentral [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I tried this and it gave me an error.
 
  Will this
 
  $id = mysql_insert_id();
 
  allow me to pull out the id?
 
 
  --
  Cross Walk Central
  www.crosswalkcentral.net
  Support Center
  Your Web Hosting Community!
 
  Cynic [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   At 19:19 8/19/2001, CrossWalkCentral wrote the following:
   --
   I have a script where I submit user data to the database in my
script
 I
  need
   to get the id  # how can I do this w/o creating a query that does
the
   following considering that user could have 10 other entires.
  
   mysql_query(insert into ...);
   $id = mysql_insert_id();
  
  
   // Request info
   $result = mysql_query(
   SELECT * FROM supportsys WHERE email = $email);
   if (!$result) {
   echo(PError performing query:  .
   mysql_error() . /P);
   exit();
   }
   
   
   I basicly need to get the id$ of the record just entered
   --
   Cross Walk Central
   www.crosswalkcentral.net
   Support Center
   Your Web Hosting Community!
   
   
   
   
   --
   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]
   --end of quote--
  
  
   [EMAIL PROTECTED]
   -
   And the eyes of them both were opened and they saw that their files
   were world readable and writable, so they chmoded 600 their files.
   - Book of Installation chapt 3 sec 7
  
 
 



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


If you have received this e-mail in error or wish to read our e-mail
disclaimer statement and monitoring policy, please refer to
http://www.drkw.com/disc/email/ or contact the sender.

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




IMPORTANT NOTICE  The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and is not intended
to be relied upon by any person without subsequent written confirmation of
its contents.  Furthermore, the content of this e-mail is the personal view
of the sender and does not represent the advice, views or opinion of our
company.  Accordingly, our company disclaim all responsibility and accept
no liability (including in negligence) for the consequences of any person
actin

[PHP-DB] Querying active directory from PHP

2001-08-14 Thread tony . mccrory

Has anyone done anything with Windows 2000 Active Directory from PHP? I'd
quite like to try this out but I haven't been able to get anything to work!

To begin with I'd like to query basic attributes like user name, phone
number, email address

Any info/pointers whatsoever would be appreciated!


Tony















IMPORTANT NOTICE  The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and is not intended
to be relied upon by any person without subsequent written confirmation of
its contents.  Furthermore, the content of this e-mail is the personal view
of the sender and does not represent the advice, views or opinion of our
company.  Accordingly, our company disclaim all responsibility and accept
no liability (including in negligence) for the consequences of any person
acting, or refraining from acting, on such information prior to the receipt
by those persons of subsequent written confirmation.  In particular (but
not by way of limitation) our company disclaims all responsibility and
accepts no liability for any e-mails which are defamatory, offensive,
racist or in any other way are in breach of any third party's rights,
including breach of confidence, privacy or other rights.  If you have
received this e-mail message in error, please notify me immediately by
telephone.  Please also destroy and delete the message from your computer.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message is strictly
prohibited.  Trinity Mirror plc is the holding company for the Trinity
Mirror group of companies and is registered in England No. 82548, with its
address at Kingsfield Court, Chester Business Park, Chester CH4 9RE.


-- 
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] Re: Image Bank with php mysql!! ??!!

2001-07-30 Thread tony . mccrory


To take it a step further, I would suggest creating a php script
downloadimage.php as follows:

?php
//downloadimage.php
//some code to verify requested download against customers details,
remembering not to send any output to the browser (would upset the header()
function)
//
header(Content-type: image/jpeg);
$image_name=urldecode($requiredimage);
header( Content-Description: JPEG Image from Freds Library ($image_name)
);
header( Content-Disposition: attachment; filename=$image_name );
$the_image=/imagelibrary/highresolution/$image_name;
readfile($the_image);
?


Then link to that with
a href=downloadimage.php?imagename=10293492.jpgcustomerid=11217Download
Image/a


Make sure the images are outside of your webservers document root.  Then
you can programatically decide whether to serve the image to the user.
Removes the possibility of leeching the entire library..

Tony

--
Tony McCrory
IT, Trinity Mirror group (Ireland)
(028) 9068 0168
[EMAIL PROTECTED]


   

Hugh Bothwell

hugh_bothwell@hoTo: [EMAIL PROTECTED]  

tmail.com   cc:   

 Subject: [PHP-DB] Re: Image Bank with 
php  mysql!! ??!!  
07/30/2001 02:14   

PM 

   

   






Koutsogiannopoulos Karolos [EMAIL PROTECTED] wrote in
message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I wan't your opinion regarding a program i am constructing. It is about
an
 image bank for graphic studios or anyone else who needs a program that
can
 insert his pictures or descriptions of it and be able to make a fast and
 reliable search.

http://www.hotscripts.com/PHP/Scripts_and_Programs/Image_Galleries/more2.htm

l


 What would be best.? Inserting the pictures in the DB or in the file
system

I would keep the image name in the database; save the original image
in a dedicated directory with a numeric name like 4920185.jpg and
then the thumbnail either with a suffix (like 4920185b.jpg) or with the
same name in a thumbnails directory; store the number as the picture ID.

The numbers should be large and pseudorandom, ie you don't want
to make it easy for someone to write a script to leech all your
pictures (it'll still be possible, but harder).  Maybe use the database
ID to seed a random number generator, and use the Nth generated
number?

Have a text field for keywords, a text field for description,
a price field?, the author's name, email, and homepage.  If you put
the image directory below the web root directory, then the images
can only be accessed via a script, and you can restore the original
name at download (this solves the problem of name collisions).

If you're going to sell the pictures, you should allow a buyer more
than one download, in case they screw up or accidentally delete
it on their system; I would have a table for 'current purchases' with
a buyer ID and picture ID, and allow them something like access
for a week, up to 20 downloads of that image.

 ? Also notice that it is a reference db and not an actual bank. I mean
that
 there will be only photos of low quality and not the full picture which
 could be very large.

(shrug) as above, keep the images in the filesystem; then it
doesn't matter how large it is.



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




IMPORTANT NOTICE  The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and is not intended
to be relied upon by any person without subsequent written confirmation of
its contents.  Furthermore, the content of this e-mail is the personal view
of the sender and does not represent the advice, views or opinion of our
company.  Accordingly, our company disclaim all responsibility and accept
no liability (including in negligence) for the consequences of any person
acting, or refraining from acting, on such information prior to the receipt
by those persons of subsequent written confirmation.  In particular (but
not by way of limitation) our company disclaims all responsibility and

[PHP-DB] php script showing up on web page!!!!

2001-07-24 Thread tony

Here is the link to the problem page,
http://www.youngsmall.com/cgi-local/shop.pl/page=index222.htm

This PHP script shows up below buy now button.
Can anybody tell me what I am doing wrong?
This is script that I am using on each buy buttons,
?php
$link = mysql_connect(x,xx,xx)
or die (Could not connect);

 if (! @mysql_select_db(x) ) {
 echo( PUnable to locate the inventory  .
  database at this time./P );
  exit();}

  $itemx = 6505;
  $sql = SELECT quantity FROM inventory WHERE item = '$itemx';
  $result = mysql_query($sql,$link);
  $row = mysql_fetch_array($result);
// you have to fetch the result into an array to access the info in the db
  $num = $row[quantity];

// NOW we can compare $num ;)
  if ($num  1) {
  echo bfont color=\#FF\Out of Stock/font/b;
  } else {
  echo bfont color=\#FF\In Stock/font/b;
  }
   mysql_close($link);

?

Thanks for your time.
Tony





-- 
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] Wrong solution!!!!

2001-07-21 Thread Tony

Hello,
I really do appreciate your help.

But, I found out that the solution scrip that you gave me was wrong script
for my purpose.
I guess I didn't describe my problem right.
I didn't mean to get the total number of rows to compare.

Let's say I have a table name inventory and contains two columes.
Here is example,

iteminventory
   15109 0
1511012
145907
This is a script that I tried and didn't work.

$itemx = 15109;
  $num = mysql_query(SELECT quantity FROM inventory WHERE item =
'$itemx',$link);
  if ($num  1) {
  echo bfont color=\#FF\Out of Stock $result/font/b;
  } else {
  echo bfont color=\#FF\In Stock $result/font/b;
  }

I want my inventory quantity with known item number to compare with
($num1), but didn't work.
Can you tell me how about solving this problem?
Thanks for your time again.
Tony



-- 
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] Thank you all for your help!!!

2001-07-21 Thread Tony

I tried both Julie's and David's script, and David's script worked.
But, I do appreciate both of you and Chris for great help.
Tony



-- 
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] Now, I have new problem!!

2001-07-21 Thread Tony

My server has a cgi-local bin, where all of my cgi scripts have to be stored
in there.
When I input the script into my regular html pages, it doesn't work.
This is the script that I am using and saved as inventory.php,

?php
$link = mysql_connect(,x,x)
or die (Could not connect);

 if (! @mysql_select_db(x) )

 echo( PUnable to locate the inventory  .
  database at this time./P );
  exit();}

  $itemx = 9846;
  $sql = SELECT quantity FROM inventory WHERE item = '$itemx';
  $result = mysql_query($sql,$link);
  $row = mysql_fetch_array($result);
  $num = $row[quantity];

  if ($num  1) {
  echo bfont color=\#FF\Out of Stock/font/b;
  } else {
  echo bfont color=\#FF\In Stock/font/b;
  }

  mysql_close($link);
?

How can I connect from my html page with known value of $itemx =  to
this scrip(inventory.php), and get result back on to my html page with words
In Stock or Out of Stock?
Can anybody help me please?
Thanks for your time again.
Tony



-- 
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] Help!!! Can anybody help me with my script?

2001-07-20 Thread Tony

Thanks for your quick respond and your help.
This is great.
I have one more favor to ask you.  As you know I am a beginner of PHP 
Mysql, do I put that language on all my product pages?  It seems to be too
much work.
Is there way that I can save main language that you wrote in to one file as
stock.php3, and point a link from product html page with known item number
for itemx?
And, print the result back to product html page with Out of Stock or In
Stock.
I will appreciate your help.
Thanks again for your help.
Tony

Christopher Ostmo [EMAIL PROTECTED] wrote in message
3B5858C3.22011.4C90352@localhost">news:3B5858C3.22011.4C90352@localhost...
 Tony pressed the little lettered thingies in this order...

  I am trying to figure out how to read data base(Mysql) with rows of item
  number (item) and quantity, so that when item number was given, it
searched
  for the quantity of the item number. If the quantity number is 0 or
less,
  it will show Out of Stock, else will show In Stock on my web page.
Here
  is part of language that I wrote and didn't work. Please help me what to
  do,
 

 There are two common methods.  One uses PHP and the other uses
 MySQL.  The one that is most efficient depends largely on the design
 and size of the table and the desired output.  See below...

  $result = mysql_query(SELECT * FROM inventory,$link);
 

 Here are the two queries that will work.  The first with PHP:
 $result = mysql_query(SELECT * FROM inventory WHERE item =
 '$itemx',$link);
 $num = mysql_num_rows($result);
 if ($num  1) {
 echo Out of stock;
 } else {
 echo In stock;
 }

 This would be very inneficient because it requires MySQL to do a full
 retrieval from the table. The only reason you would want to do it this way
 is if you wanted to relace the In stock above with actual results from
 the query.

 If you just wanted to say In stock it would be more efficient to use
 MySQL's built-in COUNT(*) function:
 $result = mysql_query(SELECT COUNT(*) FROM inventory WHERE
 item = '$itemx',$link);
 while ($row = mysql_fetch_row($result)) {
 $num = $row[0];
 }
 if ($num  1) {
 echo Out of stock;
 } else {
 echo In stock;
 }

 Note that if you use mysql_num_rows() on the second query, you will
 always get a result of one (1) because the number of rows that MySQL
 returns with this query will always be one (it returns how many records
 matched your query as its one row return), assuming that there are no
 errors. In either case, you can echo $num to display the number of
 records returned.

 Good luck...

 Christopher Ostmo
 a.k.a. [EMAIL PROTECTED]
 AppIdeas.com
 Innovative Application Ideas
 Meeting cutting edge dynamic
 web site needs since the
 dawn of Internet time (1995)

 Business Applications:
 http://www.AppIdeas.com/

 Open Source Applications:
 http://open.AppIdeas.com/



-- 
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] Issue with MSSQL_QUERY()

2001-07-03 Thread tony . mccrory


With mysql you can do mysql_insert_id.  The following code should do what
you need in mssql.


$query=InsertRequest
'1','2','3','4/11/01','5','6','7','8','9/11/01','10/11/01','11','12','13','1

4','15','';
$return=MSSQL_QUERY($query);

$id=mssql_query(select @@IDENTITY as 'taskid');
$taskid=mssql_fetch_array($id);


$taskid will then be whatever mssql set your identity/autoincrement field
to be.

Regards,

Tony
--
Tony McCrory
IT, Trinity Mirror group (Ireland)
(028) 9068 0168
[EMAIL PROTECTED]



   

Ryan Marrs 

rmarrs@strtrTo: '[EMAIL PROTECTED]' 
[EMAIL PROTECTED]   
ade.com cc:   

 Subject: [PHP-DB] Issue with 
MSSQL_QUERY()
07/03/2001 

08:14 PM   

   

   





I've run into an issue using MSSQL_QUERY() that I cannot seem to figure out
a work-around for.  The last field in the query is an auto-increment
starting at 100,000.  I need the MSSQL_QUERY($query) statement to print out
the result of the query (which is a stored procedure in case that wasn't
obvious).  Instead it returns True (1) or False (0?).  Does anyone have
suggestions?  I am completely stumped at this point.

Thanks!

Ryan

$query=InsertRequest
'1','2','3','4/11/01','5','6','7','8','9/11/01','10/11/01','11','12','13','1

4','15','';
$return=MSSQL_QUERY($query);

$taskid=$return;

-RESULT -
$taskid = 1



IMPORTANT NOTICE  The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and is not intended
to be relied upon by any person without subsequent written confirmation of
its contents.  Furthermore, the content of this e-mail is the personal view
of the sender and does not represent the advice, views or opinion of our
company.  Accordingly, our company disclaim all responsibility and accept
no liability (including in negligence) for the consequences of any person
acting, or refraining from acting, on such information prior to the receipt
by those persons of subsequent written confirmation.  In particular (but
not by way of limitation) our company disclaims all responsibility and
accepts no liability for any e-mails which are defamatory, offensive,
racist or in any other way are in breach of any third party's rights,
including breach of confidence, privacy or other rights.  If you have
received this e-mail message in error, please notify me immediately by
telephone.  Please also destroy and delete the message from your computer.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message is strictly
prohibited.  Trinity Mirror plc is the holding company for the Trinity
Mirror group of companies and is registered in England No. 82548, with its
address at Kingsfield Court, Chester Business Park, Chester CH4 9RE.


-- 
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] Issue with MSSQL_QUERY()

2001-07-03 Thread tony . mccrory


sorry bum info in my last post, it should have read

$id=mssql_query(select @@IDENTITY as 'taskid');
$result=mssql_fetch_array($id);
$taskid=$result[taskid];


Tony


   

tony.mccrory@  

mgn.co.ukTo: Ryan Marrs [EMAIL PROTECTED]  

 cc: '[EMAIL PROTECTED]' 
[EMAIL PROTECTED]   
07/03/2001   Subject: Re: [PHP-DB] Issue with 
MSSQL_QUERY()
08:25 PM   

   

   






With mysql you can do mysql_insert_id.  The following code should do what
you need in mssql.


$query=InsertRequest
'1','2','3','4/11/01','5','6','7','8','9/11/01','10/11/01','11','12','13','1


4','15','';
$return=MSSQL_QUERY($query);

$id=mssql_query(select @@IDENTITY as 'taskid');
$taskid=mssql_fetch_array($id);


$taskid will then be whatever mssql set your identity/autoincrement field
to be.

Regards,

Tony
--
Tony McCrory
IT, Trinity Mirror group (Ireland)
(028) 9068 0168
[EMAIL PROTECTED]




Ryan Marrs
rmarrs@strtrTo: '[EMAIL PROTECTED]'
[EMAIL PROTECTED]
ade.com cc:
 Subject: [PHP-DB] Issue with
MSSQL_QUERY()
07/03/2001
08:14 PM






I've run into an issue using MSSQL_QUERY() that I cannot seem to figure out
a work-around for.  The last field in the query is an auto-increment
starting at 100,000.  I need the MSSQL_QUERY($query) statement to print out
the result of the query (which is a stored procedure in case that wasn't
obvious).  Instead it returns True (1) or False (0?).  Does anyone have
suggestions?  I am completely stumped at this point.

Thanks!

Ryan

$query=InsertRequest
'1','2','3','4/11/01','5','6','7','8','9/11/01','10/11/01','11','12','13','1


4','15','';
$return=MSSQL_QUERY($query);

$taskid=$return;

-RESULT -
$taskid = 1



IMPORTANT NOTICE  The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and is not intended
to be relied upon by any person without subsequent written confirmation of
its contents.  Furthermore, the content of this e-mail is the personal view
of the sender and does not represent the advice, views or opinion of our
company.  Accordingly, our company disclaim all responsibility and accept
no liability (including in negligence) for the consequences of any person
acting, or refraining from acting, on such information prior to the receipt
by those persons of subsequent written confirmation.  In particular (but
not by way of limitation) our company disclaims all responsibility and
accepts no liability for any e-mails which are defamatory, offensive,
racist or in any other way are in breach of any third party's rights,
including breach of confidence, privacy or other rights.  If you have
received this e-mail message in error, please notify me immediately by
telephone.  Please also destroy and delete the message from your computer.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message is strictly
prohibited.  Trinity Mirror plc is the holding company for the Trinity
Mirror group of companies and is registered in England No. 82548, with its
address at Kingsfield Court, Chester Business Park, Chester CH4 9RE.


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



IMPORTANT NOTICE  The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and is not intended
to be relied upon by any person without subsequent written confirmation of
its contents.  Furthermore, the content of this e-mail is the personal view
of the sender and does not represent the advice, views or opinion of our
company.  Accordingly, our company disclaim all responsibility and accept
no liability (including in negligence) for the consequences of any person
acting, or refraining from acting, on such information prior to the receipt
by those persons of subsequent written confirmation.  In particular (but
not by way of limitation) our company disclaims all responsibility and
accepts no liability for any e-mails which