Re: [PHP] MySQL/PHP problem.

2003-07-22 Thread David Otton
On Tue, 22 Jul 2003 17:08:50 -0400, you wrote:

I am trying to count in mySQL the number of entries in the field day where day=2 or 
3. 

Then I want to check just to see if that returned a value greater than 0 or not.

I am using the code below, but having a problem, I keep getting 0 as the total

What am i doing wrong.   


   $dbqueryshipping1 = select *, COUNT(day) from tempuserpurchase where day=\2\ 
 and day=\3\ GROUP BY itemname;
$resultshipping1 = mysql_db_query($dbname,$dbqueryshipping1); 
 if(mysql_error()!=){echo mysql_error();}
   $shipping1 = mysql_fetch_array($resultshipping1);

You essentially are looking for TRUE or FALSE, right? Nothing else?

a) What's the * for?
b) day can never be 2 AND 3 at the same time. Boolean and/or usage is more
strict than English and/or usage.

Try this

function x() {
$query = SELECT COUNT(*) FROM tempuserpurchase WHERE day=2 OR day=3;

[...]

$a = mysql_fetch_row($r);

if ($a[0]) {
return (TRUE);
}
return (FALSE);
}

That should give you the core of a function that returns TRUE if there are
rows in the db where day = 2 or day = 3. Expand as you wish (eg moving the
magic numbers out of the sql query).


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



RE: [PHP] MySQL/PHP problem.

2003-07-22 Thread Jennifer Goodie
Off the top of my head, try using OR in your query rather than AND

 day=\2\ or day=\3\

day probably won't equal both 2 and 3, which is why you are getting 0.
Also, if you group by item name, you are going to get the total for each
itemname, is that what you want, or just the overall total?

 -Original Message-
 From: Phillip Blancher [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 22, 2003 2:09 PM
 To: PHP List
 Subject: [PHP] MySQL/PHP problem.


 I am trying to count in mySQL the number of entries in the field
 day where day=2 or 3.

 Then I want to check just to see if that returned a value greater
 than 0 or not.

 I am using the code below, but having a problem, I keep getting 0
 as the total

 What am i doing wrong.


$dbqueryshipping1 = select *, COUNT(day) from
 tempuserpurchase where day=\2\ and day=\3\ GROUP BY itemname;
 $resultshipping1 =
 mysql_db_query($dbname,$dbqueryshipping1);
 if(mysql_error()!=){echo mysql_error();}
$shipping1 = mysql_fetch_array($resultshipping1);



 Thanks in advance,

 Phil



 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003



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



Re: [PHP] MySQL datetime extraction

2003-07-19 Thread David Nicholson
Hello,

This is a reply to an e-mail that you wrote on Sat, 19 Jul 2003 at
19:16, lines prefixed by '' were originally written by you.

 Given a date in MySQL datetime format, how do I extract the
elements?
 That is get the month, day, year, hour, ...
 Thanks,
 Yasir

Bit off topic for this list, but see the DATE_FORMAT() function at
http://www.mysql.com/doc/en/Date_and_time_functions.html

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

  Professional Web Development by David Nicholson
http://www.djnicholson.com/

QuizSender.com - How well do your friends actually know you?
 http://www.quizsender.com/
(developed entirely in PHP)

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



Re: [PHP] MySQL datetime extraction

2003-07-19 Thread Yasir Malik
What list do I go to?  I just want store the elements into some variables
in PHP.
Yasir
On Sat, 19 Jul 2003, David Nicholson wrote:

 Date: Sat, 19 Jul 2003 19:22:25 +0100
 From: David Nicholson [EMAIL PROTECTED]
 To: Yasir Malik [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] MySQL datetime extraction

 Hello,

 This is a reply to an e-mail that you wrote on Sat, 19 Jul 2003 at
 19:16, lines prefixed by '' were originally written by you.

  Given a date in MySQL datetime format, how do I extract the
 elements?
  That is get the month, day, year, hour, ...
  Thanks,
  Yasir

 Bit off topic for this list, but see the DATE_FORMAT() function at
 http://www.mysql.com/doc/en/Date_and_time_functions.html

 David.

 --
 phpmachine :: The quick and easy to use service providing you with
 professionally developed PHP scripts :: http://www.phpmachine.com/

   Professional Web Development by David Nicholson
 http://www.djnicholson.com/

 QuizSender.com - How well do your friends actually know you?
  http://www.quizsender.com/
 (developed entirely in PHP)


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



Re: [PHP] MySQL datetime extraction

2003-07-19 Thread John W. Holmes
Yasir Malik wrote:
Given a date in MySQL datetime format, how do I extract the elements?
That is get the month, day, year, hour, ...
You could do it in the query using DATE_FORMAT(), MONTH(), YEAR(), etc.

You can do it in PHP by sending the MySQL timestamp through strtotime() 
and then using date() to extract each component.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals  www.phparch.com





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


Re: [PHP] MySQL datetime extraction

2003-07-19 Thread Yasir Malik
Thanks.  Here's how I did it:
$str = 2003-12-13 12:23:34
$b = localtime(strtotime($str), 1);
printf(seconds: .$a[tm_sec].\n);

On Sat, 19 Jul 2003, John W. Holmes wrote:

 Date: Sat, 19 Jul 2003 14:28:00 -0400
 From: John W. Holmes [EMAIL PROTECTED]
 To: Yasir Malik [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] MySQL datetime extraction

 Yasir Malik wrote:
  Given a date in MySQL datetime format, how do I extract the elements?
  That is get the month, day, year, hour, ...

 You could do it in the query using DATE_FORMAT(), MONTH(), YEAR(), etc.

 You can do it in PHP by sending the MySQL timestamp through strtotime()
 and then using date() to extract each component.

 --
 ---John Holmes...

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

 PHP|Architect: A magazine for PHP Professionals  www.phparch.com





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



Re: [PHP] MySQL query problems

2003-07-16 Thread Marek Kilimajer
Change $email_error to $mysqlerror and hopefully some error message will 
appear.

Beauford.2005 wrote:
		if ($mysqlerror) { 
		$error = $d_base_error$email_error;
			include(trades-input.php);
			exit;
		}	


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


RE: [PHP] MySQL query problems

2003-07-16 Thread Beauford.2005
I tried that, but there is no error to stop the script at this point.
The script continues past this point and to the end of the script -
there are just no values in the variables for the second query, which
obviously gives me the wrong results.

-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED] 
Sent: July 16, 2003 1:18 PM
To: Beauford.2005
Cc: PHP
Subject: Re: [PHP] MySQL query problems


Change $email_error to $mysqlerror and hopefully some error message will

appear.

Beauford.2005 wrote:
   if ($mysqlerror) { 
   $error = $d_base_error$email_error;
   include(trades-input.php);
   exit;
   }   



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



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



Re: [PHP] MySql Rollback in PHP within a website

2003-07-13 Thread John W. Holmes
bruce wrote:
I have a question. I need to be able to try to perform a database update,
but if it doesn't succeed, I need to be able to rollback the changes, and to
inform the user that the changes didn't succeed.
I've looked at the MySql site, and can see somewhat how the Commit/RollBack
functions work. However, I'm not sure how to create the required PHP code to
implement this kind of process...
Basically I need to:

Create query...
Perform Update on the table(s)
Perform my check(s)
If the checks fail
alert user
rollback updates
else
success
It's my understanding that I need to somehow set START TRANSACTION prior
to beginning the update. But I'm not sure how to do that within the PHP
code... Nor am I sure if there's something else I need to do...
$rs1 = mysql_query(START TRANSACTION);

$rs2 = mysql_query($query1);
$rs3 = mysql_query($query2);
if($error)
{ $rsx = mysql_query(ROLLBACK); }
else
{ $rsx = mysql_query(COMMIT); }
Use mysql_error() or mysql_errno() to see if an error occurred.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals  www.phparch.com





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


[PHP] Re: php mysql array question

2003-07-11 Thread Pete Morganic
I use the PEAR db http://pear.php.net/manual/en/package.database.php

This returns arrays - examples here
http://pear.php.net/manual/en/package.database.db.intro-fetch.php
look at the Quick data retreaval down the page

pete

Larry Brown wrote:
Is there any php function to pull a query into an array?  I know there is a
way to get the first row of the results in an array, but I'm having to loop
through each row pushing the row onto an array to get the result I'm looking
for and it seems like a lot of code for something that I would think is used
a lot.
Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388



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


[PHP] Re: php mysql array question

2003-07-11 Thread Rob Adams
It shouldn't take a lot of code to put results into an array:
$query = select * from table;
$r = mysql_result($query);
while ($row = mysql_fetch_object($r))
  $hold[] = $row;
(OR, to index by some id field in the database:)
  $hold[$row-id] = $row;
mysql_free_result($r);

Total of 5 lines.

  -- Rob




Larry Brown [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Is there any php function to pull a query into an array?  I know there is
a
 way to get the first row of the results in an array, but I'm having to
loop
 through each row pushing the row onto an array to get the result I'm
looking
 for and it seems like a lot of code for something that I would think is
used
 a lot.

 Larry S. Brown
 Dimension Networks, Inc.
 (727) 723-8388





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



Re: [PHP] MySQL Results - display issue :S

2003-07-09 Thread Miles Thompson
Brenton,

The short answer: loops, counters and test

Across - td your content /td td and so forth /td
When to stop - a cell counter tested with mod operator
Alternating colour - a row counter tested with mod operator
That should get you pointed in the right direction. (If this is for a 
school project that might be too much info; what does your prof want?)

HTH - Miles Thompson

At 10:45 AM 7/10/2003 +0930, Brenton Dobell wrote:
I know im probibly getting irritating to most of you :P but i thought i may
ask another thing that is on my mind!
I have a sql query bringing back 200 rows for arguments sake, From this i
would like an answer to 2 issues i have.
1) I know how to display it row after row going down :P duh of course :P,
but i have seen sites where it goes across then down across then down ect
ect like X - X then next row ect. How is this done??
2) How can i alternate the colours for each row?? row 1 eg light blue and
the 2nd row dark blue then back to light blue ect ect.
Thanks in advance

Brenton Dobell

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


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


Re: [PHP] MySQL Results - display issue :S

2003-07-09 Thread Philip Olson
On Thu, 10 Jul 2003, Brenton Dobell wrote:

 I know im probibly getting irritating to most of you :P but i thought i may
 ask another thing that is on my mind!
 
 I have a sql query bringing back 200 rows for arguments sake, From this i
 would like an answer to 2 issues i have.
 
 1) I know how to display it row after row going down :P duh of course :P,
 but i have seen sites where it goes across then down across then down ect
 ect like X - X then next row ect. How is this done??

  http://www.faqts.com/knowledge_base/view.phtml/aid/8583

 
 2) How can i alternate the colours for each row?? row 1 eg light blue and
 the 2nd row dark blue then back to light blue ect ect.

  http://www.faqts.com/knowledge_base/view.phtml/aid/783

Regards,
Philip


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



Re: [PHP] mysql detect

2003-07-03 Thread - Edwin -

[EMAIL PROTECTED] wrote:

 helo all ,
 
 what command in linux , to see default direcktory instalation mysql
 database dan mysql library

RPMs?

  $ rpm -ql package-name


- E -
__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/


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



Re: [PHP] mysql detect

2003-07-02 Thread Marco Tabini
locate mysql.lib?

Can you be a bit more specific?


Marco

On Wed, 2003-07-02 at 03:05, [EMAIL PROTECTED] wrote:
 helo all ,
 
 what command in linux , to see default direcktory instalation mysql
 database dan mysql library
 
 
 ##
 With best regards !
 Roy Daniel , ST
 IT Application Support  Development Engineer - PT BERCA
 [EMAIL PROTECTED]  // [EMAIL PROTECTED]
 ICQNumber : # 103507581 // Phone Cell : 0816-1192832
 ##
-- 

Marco Tabini
President

Marco Tabini  Associates, Inc.
28 Bombay Avenue
Toronto, ON M3H 1B7
Canada

Phone: (416) 630-6202
Fax: (416) 630-5057
Web: http://www.tabini.ca


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



RE: [PHP] MySQL Query

2003-06-30 Thread Jay Blanchard
[snip]
$sql1 = SELECT * from `admin` where `admin`.user = 
'$_POST['validuser']' AND `admin`.pwd = '$_POST['password']';

$sql1 = SELECT * from `admin` where user = $_POST['validuser'] AND 
pwd = $_POST['pass'];
[/snip]

subtle differences

$sql1 = SELECT * from `admin` where `admin`.user = 
'.$_POST['validuser'].' AND `admin`.pwd = '.$_POST['password'].' ;

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



RE: [PHP] MySQL Query

2003-06-30 Thread Ford, Mike [LSS]
 -Original Message-
 From: Pushpinder Singh Garcha [mailto:[EMAIL PROTECTED]
 Sent: 30 June 2003 19:10
 
 Can someone tell me what is wrong with the following querys ?  I am 
 pretty sure its got something to do with the quotes around $_POST[] 
 variables.
 
 $sql1 = SELECT * from `admin` where `admin`.user = 
 '$_POST['validuser']' AND `admin`.pwd = '$_POST['password']';
 
 $sql1 = SELECT * from `admin` where user = $_POST['validuser'] AND 
 pwd = $_POST['pass'];

Too many quotes, not enough curly braces:

  $sql1 = SELECT * from `admin` where user = '{$_POST['validuser']}' AND
pwd = '{$_POST['pass']}';

Cheers!

Mike

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

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



Re: [PHP] MySQL Query

2003-06-30 Thread Thorsten Körner
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi
Am Montag, 30. Juni 2003 20:10 schrieb Pushpinder Singh Garcha:
 Hello ,

 Can someone tell me what is wrong with the following querys ?  I am
 pretty sure its got something to do with the quotes around $_POST[]
 variables.

 $sql1 = SELECT * from `admin` where `admin`.user =
 '$_POST['validuser']' AND `admin`.pwd = '$_POST['password']';

 $sql1 = SELECT * from `admin` where user = $_POST['validuser'] AND
 pwd = $_POST['pass'];
You have forgotten to set the 'dots' 8-)

$sql1 = SELECT * from `admin` where `admin`.user =
 ' . $_POST['validuser'] . ' 
- ---^
AND `admin`.pwd = ' . $_POST['password'] . ';
- ----^
That's it.

CU
Thorsten

have fun
- -- 
Thorsten Körner http://www.123tkShop.org
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQE/AIMZs5R35vLkl/cRAhzpAKCigPBeox92GTtjbGu8Ydiu5NlxIQCgqy27
SFw6/nEAUy4nsAvMzaQiFQk=
=Axl+
-END PGP SIGNATURE-


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



Re: [PHP] MySQL Query ~~ SOLVED

2003-06-30 Thread Pushpinder Singh Garcha
Thanks to all you great ppl out there !!!

have a great weekend ;-) for those in north america

FYI : mine has just started !

cheers
--Pushpinder


On Monday, June 30, 2003, at 02:36 PM, Thorsten Körner wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi
Am Montag, 30. Juni 2003 20:10 schrieb Pushpinder Singh Garcha:
Hello ,

Can someone tell me what is wrong with the following querys ?  I am
pretty sure its got something to do with the quotes around $_POST[]
variables.
$sql1 = SELECT * from `admin` where `admin`.user =
'$_POST['validuser']' AND `admin`.pwd = '$_POST['password']';
$sql1 = SELECT * from `admin` where user = $_POST['validuser'] AND
pwd = $_POST['pass'];
You have forgotten to set the 'dots' 8-)

$sql1 = SELECT * from `admin` where `admin`.user =
 ' . $_POST['validuser'] . '
- ---^
AND `admin`.pwd = ' . $_POST['password'] . ';
- ----^
That's it.
CU
Thorsten
have fun
- --
Thorsten Körner http://www.123tkShop.org
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
iD8DBQE/AIMZs5R35vLkl/cRAhzpAKCigPBeox92GTtjbGu8Ydiu5NlxIQCgqy27
SFw6/nEAUy4nsAvMzaQiFQk=
=Axl+
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


Re: [PHP] mysql lock

2003-06-27 Thread Adam Voigt
Yes you seem to have it figured out, just do the lock in
a normal mysql_query, following the MySQL manual for syntax,
and you can release a lock whenever you want, but the
rule is the sooner the better, since if more then one page
or query tries to do a write, while you have it locked it
has to wait and wait until your lock is released.



On Fri, 2003-06-27 at 11:45, anders thoresson wrote:
 Hi,
 
  I've never used a lock on a MySQL table so far, but need one now. Two 
 questions:
 
  1. Do I set the lock by a normal query, but in the form of LOCK TABLE 
 tablename WRITE, instead of SELECT * FROM tablename WHERE x = 1?
 
  2. Can I set the lock in one query, then perform multiple other queries on 
 the table, in between which I do some PHP work, and then release the lock 
 several queries and lines of PHP code later?
 
  In general, when is it wise to use a lock, and when is it uneeded?
 
 -- 
 anders thoresson
-- 
Adam Voigt ([EMAIL PROTECTED])
Linux/Unix Network Administrator
The Cryptocomm Group


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



RE: [PHP] mysql split?

2003-06-27 Thread Jay Blanchard
use explode()

-Original Message-
From: Andrew McCombe [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 27, 2003 11:06 AM
To: [EMAIL PROTECTED]
Subject: [PHP] mysql split?


Hi

I have a field in mysql that has paths to files such as:

project/entertainment/andrew/job/1.jpg
project/corporate/roberts/job/1.jpg
project/corporate/andrew/job/1.jpg
project/identity/john/job/1.jpg

The first level is always 'projects'.  What I want to do is get the
unique
name for the 3rd level for all entertainment, corporate and identity, so
from the data above I would get returned:

andrew
john
roberts

What's the best way to acheive this? I remember seeing something where
you
can split a field in the mysql into parts (ie, split at /)?  or would a
regex be better ('WHERE REGEX
^projects/corporate|entertainment|identity/'
(this doesnt work))?  Hope someone can help.




Regards
Andrew McCombe
Interactive Web Solutions (Stafford)
Tel: 01785 279921





-
The contents of this e-mail and any attachments are confidential and may
be legally privileged. If you have received this e-mail and you are not
a named addressee, please inform us as soon as possible on
+44 (0) 1785 279920  and then delete the e-mail from your system. If you
are
not a named addressee you must not copy, use, disclose, distribute,
print or rely on this e-mail. Any views expressed in this e-mail or any
attachments may not necessarily reflect those of Interactive Web
Solutions'
management.
Although we routinely screen for viruses, addressees should scan this
e-mail and any attachments for viruses. Interactive Web Solutions makes
no
representation or
warranty as to the absence of viruses in this e-mail or any attachments.
Please note that for the protection of our business, we may monitor and
read e-mails sent to and from our server(s).



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


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



Re: [PHP] mysql split?

2003-06-27 Thread Andrew McCombe
Does mysql have an explode function?  I suppose this is the wrong place to
ask...

Andrew

- Original Message - 
From: Jay Blanchard [EMAIL PROTECTED]
To: Andrew McCombe [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, June 27, 2003 5:08 PM
Subject: RE: [PHP] mysql split?


 use explode()

 -Original Message-
 From: Andrew McCombe [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 27, 2003 11:06 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] mysql split?


 Hi

 I have a field in mysql that has paths to files such as:

 project/entertainment/andrew/job/1.jpg
 project/corporate/roberts/job/1.jpg
 project/corporate/andrew/job/1.jpg
 project/identity/john/job/1.jpg

 The first level is always 'projects'.  What I want to do is get the
 unique
 name for the 3rd level for all entertainment, corporate and identity, so
 from the data above I would get returned:

 andrew
 john
 roberts

 What's the best way to acheive this? I remember seeing something where
 you
 can split a field in the mysql into parts (ie, split at /)?  or would a
 regex be better ('WHERE REGEX
 ^projects/corporate|entertainment|identity/'
 (this doesnt work))?  Hope someone can help.




 Regards
 Andrew McCombe
 Interactive Web Solutions (Stafford)
 Tel: 01785 279921



 
 
 -
 The contents of this e-mail and any attachments are confidential and may
 be legally privileged. If you have received this e-mail and you are not
 a named addressee, please inform us as soon as possible on
 +44 (0) 1785 279920  and then delete the e-mail from your system. If you
 are
 not a named addressee you must not copy, use, disclose, distribute,
 print or rely on this e-mail. Any views expressed in this e-mail or any
 attachments may not necessarily reflect those of Interactive Web
 Solutions'
 management.
 Although we routinely screen for viruses, addressees should scan this
 e-mail and any attachments for viruses. Interactive Web Solutions makes
 no
 representation or
 warranty as to the absence of viruses in this e-mail or any attachments.
 Please note that for the protection of our business, we may monitor and
 read e-mails sent to and from our server(s).



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


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





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



Re: [PHP] mysql split?

2003-06-27 Thread Chris Sherwood
Andrew... I think most likely you will have to pull the information into a
php page and parse it.

you then will be able to get accurate results and I dont know if mysql has
an explode function

it doesnt look like it

http://www.mysql.com/doc/en/Function_Index.html

- Original Message -
From: Andrew McCombe [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 27, 2003 9:16 AM
Subject: Re: [PHP] mysql split?


 Does mysql have an explode function?  I suppose this is the wrong place to
 ask...

 Andrew

 - Original Message -
 From: Jay Blanchard [EMAIL PROTECTED]
 To: Andrew McCombe [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Friday, June 27, 2003 5:08 PM
 Subject: RE: [PHP] mysql split?


  use explode()
 
  -Original Message-
  From: Andrew McCombe [mailto:[EMAIL PROTECTED]
  Sent: Friday, June 27, 2003 11:06 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] mysql split?
 
 
  Hi
 
  I have a field in mysql that has paths to files such as:
 
  project/entertainment/andrew/job/1.jpg
  project/corporate/roberts/job/1.jpg
  project/corporate/andrew/job/1.jpg
  project/identity/john/job/1.jpg
 
  The first level is always 'projects'.  What I want to do is get the
  unique
  name for the 3rd level for all entertainment, corporate and identity, so
  from the data above I would get returned:
 
  andrew
  john
  roberts
 
  What's the best way to acheive this? I remember seeing something where
  you
  can split a field in the mysql into parts (ie, split at /)?  or would a
  regex be better ('WHERE REGEX
  ^projects/corporate|entertainment|identity/'
  (this doesnt work))?  Hope someone can help.
 
 
 
 
  Regards
  Andrew McCombe
  Interactive Web Solutions (Stafford)
  Tel: 01785 279921
 
 
 
  
  
  -
  The contents of this e-mail and any attachments are confidential and may
  be legally privileged. If you have received this e-mail and you are not
  a named addressee, please inform us as soon as possible on
  +44 (0) 1785 279920  and then delete the e-mail from your system. If you
  are
  not a named addressee you must not copy, use, disclose, distribute,
  print or rely on this e-mail. Any views expressed in this e-mail or any
  attachments may not necessarily reflect those of Interactive Web
  Solutions'
  management.
  Although we routinely screen for viruses, addressees should scan this
  e-mail and any attachments for viruses. Interactive Web Solutions makes
  no
  representation or
  warranty as to the absence of viruses in this e-mail or any attachments.
  Please note that for the protection of our business, we may monitor and
  read e-mails sent to and from our server(s).
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



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




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



RE: [PHP] mysql split?

2003-06-27 Thread Carl Furst
There is a mysql function called substring_index() that returns a substring based on 
an index character like space ' '. You have to specify the string, the index 
character, and how many time it has to find it from the left or right (left being 
positive and right being negative, I think) before the substring is complete.

Check out:

http://www.mysql.com/doc/en/String_functions.html

for that and other string functions that might be useful.

Carl.

-Original Message-
From: Andrew McCombe [mailto:[EMAIL PROTECTED]
Sent: Friday, June 27, 2003 12:06 PM
To: [EMAIL PROTECTED]
Subject: [PHP] mysql split?

Hi

I have a field in mysql that has paths to files such as:

project/entertainment/andrew/job/1.jpg
project/corporate/roberts/job/1.jpg
project/corporate/andrew/job/1.jpg
project/identity/john/job/1.jpg

The first level is always 'projects'.  What I want to do is get the unique
name for the 3rd level for all entertainment, corporate and identity, so
from the data above I would get returned:

andrew
john
roberts

What's the best way to acheive this? I remember seeing something where you
can split a field in the mysql into parts (ie, split at /)?  or would a
regex be better ('WHERE REGEX ^projects/corporate|entertainment|identity/'
(this doesnt work))?  Hope someone can help.




Regards
Andrew McCombe
Interactive Web Solutions (Stafford)
Tel: 01785 279921




-
The contents of this e-mail and any attachments are confidential and may
be legally privileged. If you have received this e-mail and you are not
a named addressee, please inform us as soon as possible on
+44 (0) 1785 279920  and then delete the e-mail from your system. If you are
not a named addressee you must not copy, use, disclose, distribute,
print or rely on this e-mail. Any views expressed in this e-mail or any
attachments may not necessarily reflect those of Interactive Web Solutions'
management.
Although we routinely screen for viruses, addressees should scan this
e-mail and any attachments for viruses. Interactive Web Solutions makes no
representation or
warranty as to the absence of viruses in this e-mail or any attachments.
Please note that for the protection of our business, we may monitor and
read e-mails sent to and from our server(s).



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


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



[PHP] RE: PHP Mysql Error Code 1062 - Duplicates found

2003-06-26 Thread Ow Mun Heng
Hi All,

I found out how to do it already. Thanks for the help.

mysql_error() was the key..

Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168


-Original Message-
From: Ow Mun Heng 
Sent: Wednesday, June 25, 2003 10:03 AM
To: [EMAIL PROTECTED]
Subject: PHP  Mysql Error Code 1062 - Duplicates found


Hi PHP'ers,

I've got a question regarding the input of (multiple) data into
mysql through PHP. 

If there is already an entry in the database, then an mysql will generate an
error 1062 stating that the entry is a duplicate. (This will happen only if
I input the data through mySQL using xterm, if I use PHP, then I only get
the 'duplicate entry found', partly cause I don't know how to get the error
code as well as the duplicate entry returned to PHP to be output'ed to the
browser.

Below is my code. $my_query is concatenated from an array.

$my_query = $my_query.
\n('.$SN[$i].','.$DCM[$i].','.$Supp[$i].','.$time_now.'),;
$query = INSERT INTO pioneer(serial_no,dcm,supplier,fa_timestamp) VALUES
$my_query;; 
$result = mysql_db_query('tracker',$query);

if ($result)
echo brbr.mysql_affected_rows(). Drives  DCM combo inserted into
database.;
else
echo \nbrbrDuplicate entry found. Data not inserted.;


Can anyone help me out?


Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168

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



[PHP] Re: PHP Mysql Hit Counter

2003-06-25 Thread Nadim Attari
http://www.hotscripts.com/PHP/Scripts_and_Programs/index.html


Re: [PHP] mysql update not working

2003-06-25 Thread Chris Sherwood
hmmm can you check to see if your field is exactly named desc in the
table... also whether or not it can accept string ie char or varchar.
- Original Message -
From: Steven Efurd [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, June 25, 2003 2:03 PM
Subject: [PHP] mysql update not working


 I have the following code:


 $sql = UPDATE class_sub SET  desc = '$catdesc', sub_cat = '$subcatname'
 WHERE id='$catid';
 echo $sql;
 $sql_result = mysql_query($sql);
 if (!$sql_result)
 {
 echo PCouldn't update record!br/p;
 echo mysql_error();
 exit;
 } else
 {
 header(Location: index.php); /* Redirect browser */
 exit;
 }
 here is the actual sql statement:
 UPDATE class_sub SET desc = 'Come play with us! This class is designed
 to challenge your cardiovascular and muscular endurance. Participants
 will work or \play\ in different activities such as team exercises,
 sprints, obstacle courses, cycling, plyometrics, and core conditioning.
 Challenge yourself like never before!', sub_cat = 'Recess' WHERE id='4'

 And the error:


 Couldn't update record!

 You have an error in your SQL syntax near 'desc = 'Come play with us!
 This class is designed to challenge your cardiovascul' at line 1



 the table is setup ok, i can INSERT data just fine.
 If i remove desc = whatever from the sql statement it works fine. It
 will update all fields in the table except desc. Now for the life of
 me I cannot see a problem here. Could someone please give a pointer in
 the right direction.

 Thanks
 Steve



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




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



RE: [PHP] Re: PHP Mysql Hit Counter

2003-06-25 Thread mwestern
ah thanks.  much appreciated.  i did google and found a few things, but was
really after something that someone else would recommend rather than trying
a few hundred.  :)

regards
m

-Original Message-
From: Nadim Attari [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 25, 2003 3:46 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: PHP Mysql Hit Counter


http://www.hotscripts.com/PHP/Scripts_and_Programs/index.html

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



RE: [PHP] mySQL: Rows and columns

2003-06-18 Thread Aaron Gould
A search on mysql.com reveals.

http://www.mysql.com/search/index.php?q=DELETEfrom=%2Fdocumentation%2Findex
.html

--
Aaron Gould
Web Developer
Parts Canada

 

-Original Message-
From: zavaboy [mailto:[EMAIL PROTECTED] 
Sent: June 18, 2003 1:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP] mySQL: Rows and columns


I know this is more of a mySQL question but, how do I delete and add rows
and columns?

-- 

- Zavaboy
[EMAIL PROTECTED]
www.zavaboy.com



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


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



Re: [PHP] mySQL: Rows and columns

2003-06-18 Thread bbonkosk
http://www.mysql.com/doc/en/ALTER_TABLE.html


 I know this is more of a mySQL question but, how do I delete and add rows
 and columns?
 
 -- 
 
 - Zavaboy
 [EMAIL PROTECTED]
 www.zavaboy.com
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 





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



Re: [PHP] mySQL: Rows and columns

2003-06-18 Thread Lars Torben Wilson
On Wed, 2003-06-18 at 10:03, zavaboy wrote:
 I know this is more of a mySQL question but, how do I delete and add rows
 and columns?
 
 -- 
 
 - Zavaboy
 [EMAIL PROTECTED]
 www.zavaboy.com

Using the mysql_*() function and the SQL language. The mysql_*()
functions are documented here:

   http://www.php.net/mysql

You can find a PHP/SQL tutorial here:

   http://phpdev.gold.ac.uk/tutorial/sql/

There are likely a bunch more on Google.


Good luck,

Torben


-- 
 Torben Wilson [EMAIL PROTECTED]+1.604.709.0506
 http://www.thebuttlesschaps.com  http://www.inflatableeye.com
 http://www.hybrid17.com  http://www.themainonmain.com
 - Boycott Starbucks!  http://www.haidabuckscafe.com -




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



RE: [PHP] mySQL: Rows and columns

2003-06-18 Thread Boaz Yahav
how about :

Start Using MySQL
http://articles.weberdev.com/ViewArticle.php3?ArticleID=247

Beginners guide to PHP/MySQL - Creating a simple guest book
http://articles.weberdev.com/ViewArticle.php3?ArticleID=26

Sincerely

berber

Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.


-Original Message-
From: zavaboy [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 18, 2003 7:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP] mySQL: Rows and columns


I know this is more of a mySQL question but, how do I delete and add
rows and columns?

-- 

- Zavaboy
[EMAIL PROTECTED]
www.zavaboy.com



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


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



Re: [PHP] mySQL: Rows and columns

2003-06-18 Thread Philip Olson

On Wed, 18 Jun 2003, zavaboy wrote:
 I know this is more of a mySQL question but, how do I delete and add rows
 and columns?

Before you touch MySQL or attempt to access it through
PHP, you really should learn basic SQL:

  http://www.sqlcourse.com/
  http://www.w3schools.com/sql/
  http://linux.oreillynet.com/pub/ct/19

Spend some time learning basic SQL syntax and your life
will drastically improve.  Also, perhaps the most popular
tool on this subject is phpmyadmin, it shows the actual
queries as you go which also helps with learning:

  http://www.phpmyadmin.net/

Be sure to keep it secure though as it's a powerful tool.

Regards,
Philip


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



Re: [PHP] MySQL Connection

2003-06-18 Thread moses . johnson
Hello,

Thanks it works now

Regards

Moses

 Hello, This seems not to be working, I am using win2000 and a newbie. please 
 simplify this process.
 
 ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO)
 mysql GRANT ALL PRIVILEGES ON *.* TO [EMAIL PROTECTED]
 - IDENTIFIED BY 'cludiana' WITH GRANT OPTION;
 ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO)
 mysql
 
 Regards
 
 moses


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



Re: [PHP] MySQL Connection

2003-06-17 Thread Lars Torben Wilson
On Tue, 2003-06-17 at 17:13, [EMAIL PROTECTED] wrote:
 Hello,
 
 Would be grateful if someone couldkindly point me in the right direction.

Check the MySQL documentation. You also might want to ask on the MySQL
mailing list.

  http://www.mysql.com/doc/en/Default_privileges.html
  http://www.mysql.com/doc/en/Access_denied.html

It appears, however, that mysqld is not recognizing the authority of
whoever you're connected as to modify the grant tables. Try connecting
as the admin user.


Good luck,

Torben

 Whenever I try to connect to mysql server, I get these messsage back
 
 1.
 mysql GRANT ALL PRIVILEGES ON *.* TO moses@% IDENTIFIED BY cludiana;
 ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO)
 mysql
 
 2.
 mysql GRANT ALL PRIVILEGES ON *.* TO moses@% IDENTIFIED BY cludiana;
 ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO)
 mysql
 
 what could be wrong. Help please .
 
 Regards
 
 Moses
-- 
 Torben Wilson [EMAIL PROTECTED]+1.604.709.0506
 http://www.thebuttlesschaps.com  http://www.inflatableeye.com
 http://www.hybrid17.com  http://www.themainonmain.com
 - Boycott Starbucks!  http://www.haidabuckscafe.com -




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



Re: [PHP] MySQL Connection

2003-06-17 Thread moses . johnson
Hello, This seems not to be working, I am using win2000 and a newbie. please simplify 
this process.

ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO)
mysql GRANT ALL PRIVILEGES ON *.* TO [EMAIL PROTECTED]
- IDENTIFIED BY 'cludiana' WITH GRANT OPTION;
ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO)
mysql

Regards




  from:Lars Torben Wilson [EMAIL PROTECTED]
  date:Wed, 18 Jun 2003 01:17:15
  to:  [EMAIL PROTECTED]
  cc:  [EMAIL PROTECTED]
  subject: Re: [PHP] MySQL Connection
 
 On Tue, 2003-06-17 at 17:13, [EMAIL PROTECTED] wrote:
  Hello,
  
  Would be grateful if someone couldkindly point me in the right direction.
 
 Check the MySQL documentation. You also might want to ask on the MySQL
 mailing list.
 
   http://www.mysql.com/doc/en/Default_privileges.html
   http://www.mysql.com/doc/en/Access_denied.html
 
 It appears, however, that mysqld is not recognizing the authority of
 whoever you're connected as to modify the grant tables. Try connecting
 as the admin user.
 
 
 Good luck,
 
 Torben
 
  Whenever I try to connect to mysql server, I get these messsage back
  
  1.
  mysql GRANT ALL PRIVILEGES ON *.* TO moses@% IDENTIFIED BY cludiana;
  ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO)
  mysql
  
  2.
  mysql GRANT ALL PRIVILEGES ON *.* TO moses@% IDENTIFIED BY cludiana;
  ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO)
  mysql
  
  what could be wrong. Help please .
  
  Regards
  
  Moses
 -- 
  Torben Wilson [EMAIL PROTECTED]+1.604.709.0506
  http://www.thebuttlesschaps.com  http://www.inflatableeye.com
  http://www.hybrid17.com  http://www.themainonmain.com
  - Boycott Starbucks!  http://www.haidabuckscafe.com -
 
 
 


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



Re: [PHP] MySQL Connection

2003-06-17 Thread daniel
this is a mysql specific question

i think u have to go flush privileges;

after you do that
 Hello, This seems not to be working, I am using win2000 and a newbie.
 please simplify this process.

 ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO)
 mysql GRANT ALL PRIVILEGES ON *.* TO [EMAIL PROTECTED]
- IDENTIFIED BY 'cludiana' WITH GRANT OPTION;
 ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO)
 mysql

 Regards




  from:Lars Torben Wilson [EMAIL PROTECTED]
  date:Wed, 18 Jun 2003 01:17:15
  to:  [EMAIL PROTECTED]
  cc:  [EMAIL PROTECTED]
  subject: Re: [PHP] MySQL Connection

 On Tue, 2003-06-17 at 17:13, [EMAIL PROTECTED] wrote:
  Hello,
 
  Would be grateful if someone couldkindly point me in the right
  direction.

 Check the MySQL documentation. You also might want to ask on the MySQL
 mailing list.

   http://www.mysql.com/doc/en/Default_privileges.html
   http://www.mysql.com/doc/en/Access_denied.html

 It appears, however, that mysqld is not recognizing the authority of
 whoever you're connected as to modify the grant tables. Try connecting
 as the admin user.


 Good luck,

 Torben

  Whenever I try to connect to mysql server, I get these messsage back
 
  1.
  mysql GRANT ALL PRIVILEGES ON *.* TO moses@% IDENTIFIED BY
  cludiana; ERROR 1045: Access denied for user: '@127.0.0.1' (Using
  password: NO) mysql
 
  2.
  mysql GRANT ALL PRIVILEGES ON *.* TO moses@% IDENTIFIED BY
  cludiana; ERROR 1045: Access denied for user: '@127.0.0.1' (Using
  password: NO) mysql
 
  what could be wrong. Help please .
 
  Regards
 
  Moses
 --
  Torben Wilson [EMAIL PROTECTED]+1.604.709.0506
  http://www.thebuttlesschaps.com  http://www.inflatableeye.com
  http://www.hybrid17.com  http://www.themainonmain.com
  - Boycott Starbucks!  http://www.haidabuckscafe.com -





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




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



Re: [PHP] MySQL Connection

2003-06-17 Thread Lars Torben Wilson
On Tue, 2003-06-17 at 18:19, [EMAIL PROTECTED] wrote:
 Hello, This seems not to be working, I am using win2000 and a newbie. please 
 simplify this process.
 
 ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO)
 mysql GRANT ALL PRIVILEGES ON *.* TO [EMAIL PROTECTED]
 - IDENTIFIED BY 'cludiana' WITH GRANT OPTION;
 ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO)
 mysql
 
 Regards

You've read the MySQL documentation, right? If not, do so. Trust me.
You'll need it. Right now it looks like you need this section:

  http://www.mysql.com/doc/en/General_security.html

Also, I was serious when I suggested asking on the MySQL mailing list.
This list is for PHP.

Finally, when you do ask, be sure to provide some more information. You
need to tell them what you've done so far, where on the network the
database server is, and your username when logged in.


Good luck,

Torben

-- 
 Torben Wilson [EMAIL PROTECTED]+1.604.709.0506
 http://www.thebuttlesschaps.com  http://www.inflatableeye.com
 http://www.hybrid17.com  http://www.themainonmain.com
 - Boycott Starbucks!  http://www.haidabuckscafe.com -




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



Re: [PHP] mysql - get actual row

2003-06-10 Thread Tom Woody
On Tue, 2003-06-10 at 17:18, Harry.de wrote:
 Hi,
 if i insert into a mysql table a row e.g.
mysql_query(INSERT into TEST (testfield) VALUES ('This is a test'));
 and the first field is an auto increment (e.g. NR),
 how can i get the value of the auto increment NR i've actually inserted?

mysql_insert_id()

in the future a search of the archive first, or a search of php.net
would have found this.
 
-- 
Tom

In a world without boundaries why
do we need Gates and Windows?


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



RE: [PHP] mysql backup solution

2003-06-06 Thread Luis Lebron
This is what I use http://members.lycos.co.uk/wipe_out/automysqlbackup/

-Original Message-
From: John Kaspar [mailto:[EMAIL PROTECTED]
Sent: Friday, April 25, 2003 3:48 PM
To: [EMAIL PROTECTED]
Subject: [PHP] mysql backup solution


I've got a large mysql database (~400 megs) on a host that I need to 
backup regularly. If I use phpMyAdmin's dump features, it just freezes.

I've currently got a php script that goes thru each table and backs up 
about 10,000 records iteratively (for example accounts1.txt, 
accounts2.txt).  But it just backs them up to the host itself.

(a) I need it to zip up the files to make them smaller, (b) I would like 
the script to save the zipped files to a designated folder on my local 
harddrive via ftp download (without me having to say where, or giving it 
an okay).

Is that possible? Does someone have a better backup method?
Thanks, John


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


Re: [PHP] MySQL Problem

2003-06-05 Thread Oscar F
Felipe,

I'm replying in spanish so you can understand better.

El problema que tienes es que la variable $nueva_base esta vacia. Si 
deseas especificar el nombre con esa variable debes asignarle algun 
valor antes de llamarla, si lo que quieres es crear una base de datos 
que se llame nueva_base, debes quitarle el $. Ej. 
mysql_create_db(nueva_base).

Espero te ayude.
Oscar F.-
Felipe R. wrote:
Hi everyone,

first, sorry to all if my english is so poor.
second, i have the follow question: when i create a existing MySQL DBase,
what happend??
how can i avoid this problem??

i attached my create_table code. Thanks for all

html
head
titleCreación de una Base de Datos/title
/head
body
h2 Creando Base de Datos/h2
?php
 $connection = mysql_connect(localhost,ferios,ferios) or die (No se
puede conectar a MySQL);
 if (!$connection) {
 die (No se puede conectar a MySQL);
 }
 if (mysql_create_db($nueva_base)) {
 print (nbspnbspnbspnbsp Base de Datos font color=\red\
size=\5\$nueva_base/font Creada Satisfactoriamente!!BRBR);
 $db_list = mysql_list_dbs($connection);
 $indice=0;
 while($row = mysql_fetch_array($db_list)){
 $bases[$indice]=$row[0];
 $indice++;
 }
 mysql_close($connection);

 echo nbspnbspnbspnbspB Las Bases de Datos Disponibles son:
/BBR;
 for($aux = 0; $aux  $indice; $aux++) {
 echo nbspnbspnbspnbspnbspnbspnbspnbsp $bases[$aux]BR;
 }
 }else{
 print (Ërror Creando la Base de Datos: . mysql_error());
 }
?
font size=3 pVolver a a
href=http://localhost/administrador.htm;Administrador de Bases de
Datos/a/font
font size=3 pVolver a a href=http://localhost/nueva_base.htm;Crear
un Base de Datos/a/font
/body
/html






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


Re: [PHP] [MySQL] Code Help Please

2003-06-01 Thread Frappy John
Monfort--

   There lies my problem.
   How do I get mysql to translate:
... where table.username =
 'table2.domain/table2.username' into

See:

http://lists.mysql.com/mysql?sub=1

--Frappy

On Friday 30 May 2003 08:35 pm, [-^-!-%- wrote:
 Hello all !

 Need a little help here. Is there a way to translate
 variables/field names in an SQL statement?

 I need to compare the content of two database fields
 that are in different tables. The trick, though, is that
 I need to join two fields together (as a string) before I
 compare it.

 For example:

 Table 1 has a field named username, with the following
 values:

   id | username | first_name | last_name
   1  | prgn/jason   | jason  | x
   2  | falcon/paul  | pual   | wood

   *The username in table is composed of the user's domain
 name and login name. Those fields are separated in table
 2. Like

 Table 2
   id | username | domain | first_name | last_name
   1  | paul | falcon | paul   | wood
   2  | jason| prgn   | jason  | x


   * the data is rearranged, but it's the same.


   Now, I need to compare the values from table 2 to table
 1. That is, I need to find if table1.username =
 table2.domain/table2.username  is true.

   There lies my problem.
   How do I get mysql to translate:
... where table.username =
 'table2.domain/table2.username' into
...where  'prgn/jason' = 'prgn/jason'
and not into
...where 'prgn/jason' = 'prgn' / 'jason'//
 division.

   That is, I need it to compare 'prgn/jason' (from
 table1.username) to the string representation, of the
 values of table2.domain/table2.username (i.e. prgn/jason)
 and not read it as 'table2.prgn' divided by
 'table2.username' ?




  I have the following code:

  select * from table1 t1, table 2 t2 where t1.username =
 't2.domain/t2.username' 


 ** how do I concatenate the two values, to compare it to
 that of table 1. i.e.  prgn/jason = prgn/jason   and not
 'prgn/jason' = 'prgn' divided by 'jason'?


 Please help.

 -john

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



RE: [PHP] mysql field getting cut off

2003-05-30 Thread John W. Holmes
 If anyone can help I seem to be stuck on a problem getting a mysql
field
 inserted correctly.  For instance the first page would have a field
such
 as...
 
 input type=text name=field size=12
 
 info that is placed into the field is St. Petersburg, FL (without
the
 quotes)
 
 the php code for the statement...
 
 $query = insert into table values( $variable, '$field', $variable2
);
 
 This is where there are 3 fields in the table and the second is the
one
 I
 want populated with St. Petersburg, FL.  It ends up with St. (I'm
not
 sure if the period makes it).  I have verified that the entire
statement
 arrives at the php script in the variable $field and I have used the
mysql
 client to give the same command with St. Petersburg, FL as the value
and
 it accepts it without a problem.

When you run a SELECT from the command line, do you only see St. in
the column? What kind of column is it?

Are you sure it's not fine in the database and you're just showing it
like:

input type=text value=$value name=field

which will end up like

input type=text value=St. Petersburg, FL name=field

and will only show St. in the text box...

---John W. Holmes...

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

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



RE: [PHP] mysql field getting cut off

2003-05-30 Thread Larry Brown
That, indirectly, is exactly what happened.  I have a subsequent screen for
modifying the results.  I must have gone back into that screen to change
something else and since it only pulled the St. when I applied it it changed
the field in the database.  Thanks a lot.  It seemed weird.

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 29, 2003 9:44 PM
To: 'Larry Brown'; 'PHP List'
Subject: RE: [PHP] mysql field getting cut off

 If anyone can help I seem to be stuck on a problem getting a mysql
field
 inserted correctly.  For instance the first page would have a field
such
 as...

 input type=text name=field size=12

 info that is placed into the field is St. Petersburg, FL (without
the
 quotes)

 the php code for the statement...

 $query = insert into table values( $variable, '$field', $variable2
);

 This is where there are 3 fields in the table and the second is the
one
 I
 want populated with St. Petersburg, FL.  It ends up with St. (I'm
not
 sure if the period makes it).  I have verified that the entire
statement
 arrives at the php script in the variable $field and I have used the
mysql
 client to give the same command with St. Petersburg, FL as the value
and
 it accepts it without a problem.

When you run a SELECT from the command line, do you only see St. in
the column? What kind of column is it?

Are you sure it's not fine in the database and you're just showing it
like:

input type=text value=$value name=field

which will end up like

input type=text value=St. Petersburg, FL name=field

and will only show St. in the text box...

---John W. Holmes...

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

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



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



Re: [PHP] MySQL Insert with Auto-Increment

2003-04-04 Thread Marek Kilimajer
use mysql_insert_id(), it keeps its value per connection so you don't 
need to worry about anything

[EMAIL PROTECTED] wrote:

Ok, here's what I have.  I want to insert some values into a table with 
an auto_increment field, but I want to get the Serial of the record I 
just inserted so I can name an image $Serial.jpg.  I could just select 
the serial of the last record entered but what happens (and I know it's 
unlikely but could happen) if someone else inserted another record a 
half a second after this one?  Anyone have any ideas?  Thanks!

Brian

 



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


RE: [PHP] MySQL Insert with Auto-Increment

2003-04-04 Thread Sysadmin
Wonderful!  Thanks!

-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: Friday, April 04, 2003 8:18 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] MySQL Insert with Auto-Increment


use mysql_insert_id(), it keeps its value per connection so you don't 
need to worry about anything

[EMAIL PROTECTED] wrote:

Ok, here's what I have.  I want to insert some values into a table 
with 
an auto_increment field, but I want to get the Serial of the record I 
just inserted so I can name an image $Serial.jpg.  I could just select 
the serial of the last record entered but what happens (and I know 
it's 
unlikely but could happen) if someone else inserted another record a 
half a second after this one?  Anyone have any ideas?  Thanks!

Brian


  



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



Re: [PHP] mysql ending at start up

2003-03-29 Thread Tim Burden
Wow, Joe!

You post to the wrong list, and your problem is sufficiently unusual (you
have no err log?) that we can't give quick supportive answers, and then you
whine at us.

Not too cool. Please use the appropriate list.

- Original Message -
From: Joseph Bannon [EMAIL PROTECTED]
Newsgroups: php.general
To: [EMAIL PROTECTED]
Sent: Saturday, March 29, 2003 2:20 AM
Subject: Re: [PHP] mysql ending at start up


  Please use the appropriate list. If you want a fast
  response take out a mysql support contract.


 Thanks Jason. You're such a supportive individual
 -lol.

 J.



 __
 Do you Yahoo!?
 Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
 http://platinum.yahoo.com


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



RE: [PHP] mySQL query - command LIKE OR =

2003-03-28 Thread Jennifer Goodie
= does not take the wildcard (%). 

-Original Message-
From: Harry.de [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 2:38 PM
To: [EMAIL PROTECTED]
Subject: [PHP] mySQL query - command LIKE OR =


 Hi,
i want to make a mySQL query where the result should be

in $result1
any sting with a phrase of $search

in $result2
any sting with the exact phrase of $search

$result1 works fine, but $result2 gives out an empty sting

 $result1 = mysql_query(SELECT name FROM table WHERE name LIKE
'%.strtolower($search).% );
 $result2 = mysql_query(SELECT name FROM table WHERE name =
'%.strtolower($search).% );


e.g.
row 1 in name = my big appletree in the garden
row 2 in name = my big apple in the garden

so the result should be in $result2 with $search=apple
2


Can anybody help me


Harry



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


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



RE: [PHP] mysql ending at start up

2003-03-28 Thread Don Read

On 29-Mar-2003 Joseph Bannon wrote:
 The mysql support list is slow, so I though I would
 post here since I know this list is more active.
 MySQL shuts down when I start it up...
  
# Starting mysqld daemon with databases
 from /home/mysqldb
 030328 09:29:32  mysqld ended

Joe you got a reply within 20 minutes on the MySQL list asking you this:

What does your hostname.err log have to say about it?

Let's find your database error log, as root type:

find / -name *.err -print | grep mysql

Whatever filename(s) it finds --do tail filename.
That'll give you important clues on why the server shutdown.

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.Don Read   
   [EMAIL PROTECTED]

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



RE: [PHP] mysql ending at start up

2003-03-28 Thread Joseph Bannon
 Joe you got a reply within 20 minutes on the MySQL
 list asking you this:

Yeah, I did, but I'm use to the fast response of thsi
list.

 
 What does your hostname.err log have to say about
 it?

I don't have one.



 Let's find your database error log, as root type:
 
 find / -name *.err -print | grep mysql


Came back with nothing.

__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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



Re: [PHP] mysql ending at start up

2003-03-28 Thread Jason Wong
On Saturday 29 March 2003 14:14, Joseph Bannon wrote:
  Joe you got a reply within 20 minutes on the MySQL
  list asking you this:

 Yeah, I did, but I'm use to the fast response of thsi
 list.

Please use the appropriate list. If you want a fast response take out a mysql 
support contract.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
YOU PICKED KARL MALDEN'S NOSE!!
*/


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



Re: [PHP] mysql ending at start up

2003-03-28 Thread Joseph Bannon
 Please use the appropriate list. If you want a fast
 response take out a mysql support contract.


Thanks Jason. You're such a supportive individual
-lol.

J.



__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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



Re: [PHP] MySQL and phpMyAdmin Issues

2003-03-25 Thread Charles Kline
I am by no means an expert (even remotely) but I do recall instructions 
on exactly how to do this in the documentation for MySQL - I think 
under the how to upgrade section.

- Charles

On Monday, March 3, 2003, at 06:53 PM, Stephen Craton wrote:

Hello,

Yesturday I made a big mistake. I had to import a 60MB file into a 
database
and I used ssh. I'm very unfamiliar with it and when I connected to the
MySQL connection thing, I forgot to switch databases when I imported. 
This
overwrite (I don't know why but it did) the users table in the mysql
database and caused everything to get messy.

For some reason, though, the sites on the server are still working with
their old MySQL username and password (I'm not sure why since I 
imported a
fresh install's mysql database from my local server). Everything seems 
to be
working except phpMyAdmin. When I try logging in using the default 
user as
root and password as nothing, it gives me an access denied error. It 
does
this for every user we had in the database as well. Is there anyway I 
can
fix this is ssh? The only option I can think of is reinstalling MySQL 
but
even then we'll loose all the old databases and I'm not sure how to 
export
the tables to a file in ssh.

Any help here would be most obliging and I need a reply rather 
urgently in
order to allow my hosted sites access to phpMyAdmin once again...

Thanks,
Stephen Craton
http://www.melchior.us
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


Re: [PHP] MySQL qusetion

2003-03-19 Thread Marek Kilimajer
I don't know about the tool, but maximum file upload is set in php.ini - 
upload_max_filesize, post_max_size must be higher. Restart apache afterwards

Marc Bakker wrote:

Hello,

I want have a Apache/PHP/MySQL configuration running on Win2000 (SP3). In my
website I have a file-upload page where uses can upload a file. The max size
of the upload has to be set in the mysql.ini file but I am not able to do
this.
I use winMySQLAdmin v1.4. When I add in the tab 'my.ini Setup' under
[mysqld] 'max_allowed_packet=8M' to increase the max allowed upload filesize
the corresponding value in the tab 'Variables' does not change (it stays at
the default value of 1048567). Also when I restart te server (using the same
winMySQLAdmintool) this value doesn't change.
Funny thing is that in tab 'Environment' under 'Uptime' the value doesn't
change - even after restarting the server.
Is this tool buggy?

Thanks,

Marc

 



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


RE: [PHP] MySQL qusetion

2003-03-19 Thread Mike Hillyer
WinMySQLAdmin has been discontinued, it is replaces by MyCC, also available
from the mysql web site.

Mike Hillyer

-Original Message-
From: Marc Bakker [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 19, 2003 4:13 AM
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL qusetion


Hello,

I want have a Apache/PHP/MySQL configuration running on Win2000 (SP3). In my
website I have a file-upload page where uses can upload a file. The max size
of the upload has to be set in the mysql.ini file but I am not able to do
this.

I use winMySQLAdmin v1.4. When I add in the tab 'my.ini Setup' under
[mysqld] 'max_allowed_packet=8M' to increase the max allowed upload filesize
the corresponding value in the tab 'Variables' does not change (it stays at
the default value of 1048567). Also when I restart te server (using the same
winMySQLAdmintool) this value doesn't change.

Funny thing is that in tab 'Environment' under 'Uptime' the value doesn't
change - even after restarting the server.

Is this tool buggy?

Thanks,

Marc


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


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



RE: [PHP] MySQL Date

2003-03-19 Thread Barajas, Arturo
Shaun,

It should be: date(Y-m-d). MySQL stores the dates as -mm-dd, and that function 
returns the current date on the format you need.

Check the date() function on the php manual.
--
Un gran saludo/Big regards...
   Arturo Barajas, IT/Systems PPG MX (SJDR)
   (427) 271-9918, x448

 -Original Message-
 From: shaun [mailto:[EMAIL PROTECTED]
 Sent: Miercoles, 19 de Marzo de 2003 07:19 a.m.
 To: [EMAIL PROTECTED]
 Subject: [PHP] MySQL Date
 
 
 Hi,
 
 I have a date stored in a table in my MySQL Database using a 
 DATE type for
 the column.
 
 How can i compare the date in the table to today
 
 e.g.
 
 $today = mysql_result($result, $i, Booking_Date);
 
 if($today = *HELP*){
 echo you are booked today;
 }else{
 echo you are free today;
 }
 
 thanks for your help
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



RE: [PHP] MySQL Date

2003-03-19 Thread John W. Holmes
 I have a date stored in a table in my MySQL Database using a DATE type
for
 the column.
 
 How can i compare the date in the table to today

... WHERE your_date = CURDATE() ...

 e.g.
 
 $today = mysql_result($result, $i, Booking_Date);
 
 if($today = *HELP*){

or...

if($today == date('Y-m-d'))

(notice the second equals sign!)

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



Re: [PHP] Mysql Query Question

2003-03-18 Thread CPT John W. Holmes
$string = ' . implode(',',$group) . ';
$query = SELECT * FROM table WHERE groupname IN ($string);

---John Holmes...

- Original Message -
From: Van Andel, Robbert [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 3:51 PM
Subject: [PHP] Mysql Query Question


I am trying to query a database looking for results that match an array of
values I have set.

The variable array is call group and has about 10 elements.  Is there a way
that I can query the database using just $group instead of having to use the
following:
SELECT * FROM `table` WHERE groupname = '$group[1]' OR groupname='$group[2]'
OR groupname='$group[3].

I think I saw the answer once before but can't find it anywhere.

Robbert van Andel




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



RE: [PHP] Mysql Query Question

2003-03-18 Thread Van Andel, Robbert
Thanks, I knew it was something simple but I couldn't find it on the 'Net.

Robbert van Andel 



-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 1:14 PM
To: Van Andel, Robbert; [EMAIL PROTECTED]
Subject: Re: [PHP] Mysql Query Question


$string = ' . implode(',',$group) . ';
$query = SELECT * FROM table WHERE groupname IN ($string);

---John Holmes...

- Original Message -
From: Van Andel, Robbert [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 3:51 PM
Subject: [PHP] Mysql Query Question


I am trying to query a database looking for results that match an array of
values I have set.

The variable array is call group and has about 10 elements.  Is there a way
that I can query the database using just $group instead of having to use the
following:
SELECT * FROM `table` WHERE groupname = '$group[1]' OR groupname='$group[2]'
OR groupname='$group[3].

I think I saw the answer once before but can't find it anywhere.

Robbert van Andel




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



Re: [PHP] mysql and php

2003-03-11 Thread David E.S.V.


great tutorial to do what you want:

http://www.freewebmasterhelp.com/tutorials/phpmysql/4

regards,

David.


On Tue, 11 Mar 2003, Joseph Bannon wrote:

 How can I have php give me all the data in a table as
 I would using the prompt in mysql?
 
 Joseph
 
 
 
 __
 Do you Yahoo!?
 Yahoo! Web Hosting - establish your business online
 http://webhosting.yahoo.com
 
 

-- 

David Elías Sánchez Vásquez
Bachiller en Educación PUCP
[EMAIL PROTECTED]
telf. (51)-1-5255601



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



Re: [PHP] MySQL or PHP question?

2003-03-10 Thread Marek Kilimajer
Should not it be:
$SQL = SELECT * FROM table ORDER BY id asc LIMIT .($autoindex -5). ,5;;
John Taylor-Johnston wrote:

I don't know whether this is a MySQL or PHP quesiton.

$SQL = SELECT * FROM table ORDER BY id asc LIMIT $autoindex -5 ,5;;

I would like to get the autoindex value of my table and use it in my SQL. Can I get the autoindex? :) How?

 



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


Re: [PHP] MySQL and PHP arrays

2003-03-10 Thread Jason Wong
On Monday 10 March 2003 22:30, {R}ichard Ashton wrote:
 Is there a generally recommended way of storing an array created by PHP
 in a MySQL database field ?

serialize() and unserialize().

 What type of field should it be, and how do you get the whole array
 back in one go without reconstructing it row by row, if that is
 possible?

Any text field will do, just make sure it's large enough for your data.

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

[I thought that was differently haired. Ed.]
*/


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



RE: [PHP] MySQL and PHP arrays

2003-03-10 Thread Messay W Asfaw
Serializing it would be the best way: seralize($myArray) 
then you can get the array back using unseralize($serializedarray)

-Original Message-
From: {R}ichard Ashton [mailto:[EMAIL PROTECTED]
Sent: 10 March 2003 14:31
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL and PHP arrays



Is there a generally recommended way of storing an array created by PHP
in a MySQL database field ?

What type of field should it be, and how do you get the whole array 
back in one go without reconstructing it row by row, if that is
possible?

{R} 


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


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



Re: [PHP] MySQL and PHP arrays

2003-03-10 Thread {R}ichard Ashton
On Mon, 10 Mar 2003 22:34:44 +0800, Jason Wong wrote:

On Monday 10 March 2003 22:30, {R}ichard Ashton wrote:
 Is there a generally recommended way of storing an array created by PHP
 in a MySQL database field ?

serialize() and unserialize().

 What type of field should it be, and how do you get the whole array
 back in one go without reconstructing it row by row, if that is
 possible?

Any text field will do, just make sure it's large enough for your data.

Thanks that now makes much more sense. So when I look at the data in
the database I see
a:142:{i:1;s:52:[52characters];i:2;s:37:[37characters] and so on for
the 142 elements of the array.

But getting it out is not so easy.

$result = mysql_query(  select post from posts where id = '$id' )

Gives $result as a Resource id #6 which is OK but I cant find the PHP
MySQL command to get the whole field back to unserialize it :(

{R}



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

   [I thought that was differently haired. Ed.]
*/


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




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



Re: [PHP] MySQL and PHP arrays

2003-03-10 Thread Mike Mannakee
You get at the data through $array = mysql_result($result,0,0);

Mike


{R}Ichard Ashton [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Mon, 10 Mar 2003 22:34:44 +0800, Jason Wong wrote:

 On Monday 10 March 2003 22:30, {R}ichard Ashton wrote:
  Is there a generally recommended way of storing an array created by PHP
  in a MySQL database field ?
 
 serialize() and unserialize().
 
  What type of field should it be, and how do you get the whole array
  back in one go without reconstructing it row by row, if that is
  possible?
 
 Any text field will do, just make sure it's large enough for your data.

 Thanks that now makes much more sense. So when I look at the data in
 the database I see
 a:142:{i:1;s:52:[52characters];i:2;s:37:[37characters] and so on for
 the 142 elements of the array.

 But getting it out is not so easy.

 $result = mysql_query(  select post from posts where id = '$id' )

 Gives $result as a Resource id #6 which is OK but I cant find the PHP
 MySQL command to get the whole field back to unserialize it :(

 {R}



 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 QOTD:
  I'm not bald -- I'm hair challenged.
 
  [I thought that was differently haired. Ed.]
 */
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 





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



RE: [PHP] MySQL and PHP arrays

2003-03-10 Thread Van Andel, Robbert
mysql_fetch_array($result) works too.  It fetches the data from the current row and is 
used in conjunction with a while loop:

while($array=mysql_fetch_array($result))
{
//stuff to do with the current array
}



Robbert van Andel 



-Original Message-
From: Mike Mannakee [mailto:[EMAIL PROTECTED]
Sent: Monday, March 10, 2003 8:45 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] MySQL and PHP arrays


You get at the data through $array = mysql_result($result,0,0);

Mike


{R}Ichard Ashton [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Mon, 10 Mar 2003 22:34:44 +0800, Jason Wong wrote:

 On Monday 10 March 2003 22:30, {R}ichard Ashton wrote:
  Is there a generally recommended way of storing an array created by PHP
  in a MySQL database field ?
 
 serialize() and unserialize().
 
  What type of field should it be, and how do you get the whole array
  back in one go without reconstructing it row by row, if that is
  possible?
 
 Any text field will do, just make sure it's large enough for your data.

 Thanks that now makes much more sense. So when I look at the data in
 the database I see
 a:142:{i:1;s:52:[52characters];i:2;s:37:[37characters] and so on for
 the 142 elements of the array.

 But getting it out is not so easy.

 $result = mysql_query(  select post from posts where id = '$id' )

 Gives $result as a Resource id #6 which is OK but I cant find the PHP
 MySQL command to get the whole field back to unserialize it :(

 {R}



 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 QOTD:
  I'm not bald -- I'm hair challenged.
 
  [I thought that was differently haired. Ed.]
 */
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 





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


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



RE: [PHP] MySQL Alias and PHP

2003-03-07 Thread Rich Gray
 Hi all,

 I have this query:

 SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b
 WHERE x.area_1 = a.id
 AND x.area_2 = b.id

 I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo
 the values for a.id and b.id?

 Thnks
 Charles


I presume you mean area_name...

Try this - SELECT a.area_name as area_a, b.area_name as area_b FROM tbl_1
x, tbl_2 a, tbl_2 b
Then you can refer to the columns as $array['area_a'] and $array['area_b']

HTH
Rich


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



Re: [PHP] MySQL Alias and PHP

2003-03-07 Thread Charles Kline
Thanks for the help. Almost there. Here is what I have:

SELECT x.id, x.headline, x.description, a.area area_a, b.area area_b
FROM tbl_funding x, tbl_dra a, tbl_dra b
GROUP  BY x.id LIMIT 0 , 30
The problem is that $array[area_a] and $array[area_b] display the same 
info.





On Friday, March 7, 2003, at 11:09 AM, Rich Gray wrote:

Hi all,

I have this query:

SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b
WHERE x.area_1 = a.id
AND x.area_2 = b.id
I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo
the values for a.id and b.id?
Thnks
Charles
I presume you mean area_name...

Try this - SELECT a.area_name as area_a, b.area_name as area_b FROM 
tbl_1
x, tbl_2 a, tbl_2 b
Then you can refer to the columns as $array['area_a'] and 
$array['area_b']

HTH
Rich


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


Re: [PHP] MySQL Alias and PHP

2003-03-07 Thread Jim Lucas
Then the information in the DB is the same.

Jim
- Original Message - 
From: Charles Kline [EMAIL PROTECTED]
To: Rich Gray [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, March 07, 2003 10:03 AM
Subject: Re: [PHP] MySQL Alias and PHP


Thanks for the help. Almost there. Here is what I have:

SELECT x.id, x.headline, x.description, a.area area_a, b.area area_b
FROM tbl_funding x, tbl_dra a, tbl_dra b
GROUP  BY x.id LIMIT 0 , 30

The problem is that $array[area_a] and $array[area_b] display the same 
info.





On Friday, March 7, 2003, at 11:09 AM, Rich Gray wrote:

 Hi all,

 I have this query:

 SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b
 WHERE x.area_1 = a.id
 AND x.area_2 = b.id

 I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo
 the values for a.id and b.id?

 Thnks
 Charles


 I presume you mean area_name...

 Try this - SELECT a.area_name as area_a, b.area_name as area_b FROM 
 tbl_1
 x, tbl_2 a, tbl_2 b
 Then you can refer to the columns as $array['area_a'] and 
 $array['area_b']

 HTH
 Rich



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





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



Re: [PHP] MySQL Alias and PHP

2003-03-07 Thread Charles Kline
Thanks for all the suggestions, I have tried all and more and still 
can't get this quite right. If there is a better forum for these 
question, please point me to it and I will take this somewhat off topic 
thread elsewhere.

My table structure is like so:

tbl_1

idarea_1area_2
1  2   3
2  1   2
3  5   0
tbl_2

id area_name
1  funding
2  research
3  new
4  ongoing
5  other
So, I need to display all the records in tbl_1 and show the values for 
the fields area_1 and area_2 as their area_name field from tbl_2. I 
must display each record from tbl_1 only once. I know I am close, but I 
just can't get this to work. The closest I have gotten is this:

SELECT DISTINCT  a.area_name area_a, b.area_name area_b FROM tbl_1 x, 
tbl_2 a, tbl_2 b
WHERE x.area_1 = a.id
OR x.area_2 = b.id GROUP BY x.id

But this ALWAYS returns the area_name (funding) in the value of area_b 
(have no idea why)

Thanks for any help. It is appreciated.

- Charles

On Friday, March 7, 2003, at 01:42 PM, Jim Lucas wrote:

Then the information in the DB is the same.

Jim
- Original Message -
From: Charles Kline [EMAIL PROTECTED]
To: Rich Gray [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, March 07, 2003 10:03 AM
Subject: Re: [PHP] MySQL Alias and PHP
Thanks for the help. Almost there. Here is what I have:

SELECT x.id, x.headline, x.description, a.area area_a, b.area area_b
FROM tbl_funding x, tbl_dra a, tbl_dra b
GROUP  BY x.id LIMIT 0 , 30
The problem is that $array[area_a] and $array[area_b] display the same
info.




On Friday, March 7, 2003, at 11:09 AM, Rich Gray wrote:

Hi all,

I have this query:

SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b
WHERE x.area_1 = a.id
AND x.area_2 = b.id
I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo
the values for a.id and b.id?
Thnks
Charles
I presume you mean area_name...

Try this - SELECT a.area_name as area_a, b.area_name as area_b FROM
tbl_1
x, tbl_2 a, tbl_2 b
Then you can refer to the columns as $array['area_a'] and
$array['area_b']
HTH
Rich


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




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


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


RE: [PHP] MySQL Alias and PHP

2003-03-07 Thread Barajas, Arturo
Let's see:

SELECT
tbl_1.area_1,
areas1.area_name,
tbl_1.area_2,
areas2.area_name
FROM
tbl_1
INNER JOIN tbl_2 areas1 ON tbl_1.area_1 = areas1.id
INNER JOIN tbl_2 areas2 ON tbl_1.area_2 = areas2.id

Maybe if you tinker a little on the sentence. I don't have a place to test it right 
now.
--
Un gran saludo/Big regards...
   Arturo Barajas, IT/Systems PPG MX (SJDR)
   (427) 271-9918, x448

 -Original Message-
 From: Charles Kline [mailto:[EMAIL PROTECTED]
 Sent: Viernes, 07 de Marzo de 2003 04:09 p.m.
 To: Jim Lucas
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] MySQL Alias and PHP
 
 
 Thanks for all the suggestions, I have tried all and more and still 
 can't get this quite right. If there is a better forum for these 
 question, please point me to it and I will take this somewhat 
 off topic 
 thread elsewhere.
 
 My table structure is like so:
 
 tbl_1
 
 idarea_1area_2
 1  2   3
 2  1   2
 3  5   0
 
 
 tbl_2
 
 id area_name
 1  funding
 2  research
 3  new
 4  ongoing
 5  other
 
 
 So, I need to display all the records in tbl_1 and show the 
 values for 
 the fields area_1 and area_2 as their area_name field from tbl_2. I 
 must display each record from tbl_1 only once. I know I am 
 close, but I 
 just can't get this to work. The closest I have gotten is this:
 
 SELECT DISTINCT  a.area_name area_a, b.area_name area_b FROM tbl_1 x, 
 tbl_2 a, tbl_2 b
 WHERE x.area_1 = a.id
 OR x.area_2 = b.id GROUP BY x.id
 
 But this ALWAYS returns the area_name (funding) in the value 
 of area_b 
 (have no idea why)
 
 Thanks for any help. It is appreciated.
 
 - Charles
 
 
 On Friday, March 7, 2003, at 01:42 PM, Jim Lucas wrote:
 
  Then the information in the DB is the same.
 
  Jim
  - Original Message -
  From: Charles Kline [EMAIL PROTECTED]
  To: Rich Gray [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Sent: Friday, March 07, 2003 10:03 AM
  Subject: Re: [PHP] MySQL Alias and PHP
 
 
  Thanks for the help. Almost there. Here is what I have:
 
  SELECT x.id, x.headline, x.description, a.area area_a, b.area area_b
  FROM tbl_funding x, tbl_dra a, tbl_dra b
  GROUP  BY x.id LIMIT 0 , 30
 
  The problem is that $array[area_a] and $array[area_b] 
 display the same
  info.
 
 
 
 
 
  On Friday, March 7, 2003, at 11:09 AM, Rich Gray wrote:
 
  Hi all,
 
  I have this query:
 
  SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b
  WHERE x.area_1 = a.id
  AND x.area_2 = b.id
 
  I am using PEAR DB to get my results as an ASSOC ARRAY. 
 How do I echo
  the values for a.id and b.id?
 
  Thnks
  Charles
 
 
  I presume you mean area_name...
 
  Try this - SELECT a.area_name as area_a, b.area_name as 
 area_b FROM
  tbl_1
  x, tbl_2 a, tbl_2 b
  Then you can refer to the columns as $array['area_a'] and
  $array['area_b']
 
  HTH
  Rich
 
 
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP] MySQL Alias and PHP

2003-03-07 Thread Charles Kline
Wow. That is ALMOST it. The only thing is it does not return the record 
with a 0 in tbl_1.area_2 - can you think of a workaround?

Thanks for the help,
Charles
On Friday, March 7, 2003, at 06:39 PM, Barajas, Arturo wrote:

Let's see:

SELECT
tbl_1.area_1,
areas1.area_name,
tbl_1.area_2,
areas2.area_name
FROM
tbl_1
INNER JOIN tbl_2 areas1 ON tbl_1.area_1 = areas1.id
INNER JOIN tbl_2 areas2 ON tbl_1.area_2 = areas2.id
Maybe if you tinker a little on the sentence. I don't have a place to 
test it right now.
--
Un gran saludo/Big regards...
   Arturo Barajas, IT/Systems PPG MX (SJDR)
   (427) 271-9918, x448

-Original Message-
From: Charles Kline [mailto:[EMAIL PROTECTED]
Sent: Viernes, 07 de Marzo de 2003 04:09 p.m.
To: Jim Lucas
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] MySQL Alias and PHP
Thanks for all the suggestions, I have tried all and more and still
can't get this quite right. If there is a better forum for these
question, please point me to it and I will take this somewhat
off topic
thread elsewhere.
My table structure is like so:

tbl_1

idarea_1area_2
1  2   3
2  1   2
3  5   0
tbl_2

id area_name
1  funding
2  research
3  new
4  ongoing
5  other
So, I need to display all the records in tbl_1 and show the
values for
the fields area_1 and area_2 as their area_name field from tbl_2. I
must display each record from tbl_1 only once. I know I am
close, but I
just can't get this to work. The closest I have gotten is this:
SELECT DISTINCT  a.area_name area_a, b.area_name area_b FROM tbl_1 x,
tbl_2 a, tbl_2 b
WHERE x.area_1 = a.id
OR x.area_2 = b.id GROUP BY x.id
But this ALWAYS returns the area_name (funding) in the value
of area_b
(have no idea why)
Thanks for any help. It is appreciated.

- Charles

On Friday, March 7, 2003, at 01:42 PM, Jim Lucas wrote:

Then the information in the DB is the same.

Jim
- Original Message -
From: Charles Kline [EMAIL PROTECTED]
To: Rich Gray [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, March 07, 2003 10:03 AM
Subject: Re: [PHP] MySQL Alias and PHP
Thanks for the help. Almost there. Here is what I have:

SELECT x.id, x.headline, x.description, a.area area_a, b.area area_b
FROM tbl_funding x, tbl_dra a, tbl_dra b
GROUP  BY x.id LIMIT 0 , 30
The problem is that $array[area_a] and $array[area_b]
display the same
info.





On Friday, March 7, 2003, at 11:09 AM, Rich Gray wrote:

Hi all,

I have this query:

SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b
WHERE x.area_1 = a.id
AND x.area_2 = b.id
I am using PEAR DB to get my results as an ASSOC ARRAY.
How do I echo
the values for a.id and b.id?

Thnks
Charles
I presume you mean area_name...

Try this - SELECT a.area_name as area_a, b.area_name as
area_b FROM
tbl_1
x, tbl_2 a, tbl_2 b
Then you can refer to the columns as $array['area_a'] and
$array['area_b']
HTH
Rich


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




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


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


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


RE: [PHP] MySQL Alias and PHP

2003-03-07 Thread Barajas, Arturo
There are two ways,

Either have a null record on the area names, with a 0 as ID, or use a LEFT JOIN.

The LEFT JOIN clause permits you to have a linked table, and if it doesn't find a 
match, it returns a NULL.

SELECT
tbl_1.area_1,
areas1.area_name,
tbl_1.area_2,
areas2.area_name
FROM
tbl_1
LEFT JOIN tbl_2 areas1 ON tbl_1.area_1 = areas1.id
LEFT JOIN tbl_2 areas2 ON tbl_1.area_2 = areas2.id

HTH
--
Un gran saludo/Big regards...
   Arturo Barajas, IT/Systems PPG MX (SJDR)
   (427) 271-9918, x448

 -Original Message-
 From: Charles Kline [mailto:[EMAIL PROTECTED]
 Sent: Viernes, 07 de Marzo de 2003 05:48 p.m.
 To: Barajas, Arturo
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] MySQL Alias and PHP
 
 
 Wow. That is ALMOST it. The only thing is it does not return 
 the record 
 with a 0 in tbl_1.area_2 - can you think of a workaround?
 
 Thanks for the help,
 Charles
 
 On Friday, March 7, 2003, at 06:39 PM, Barajas, Arturo wrote:
 
  Let's see:
 
  SELECT
  tbl_1.area_1,
  areas1.area_name,
  tbl_1.area_2,
  areas2.area_name
  FROM
  tbl_1
  INNER JOIN tbl_2 areas1 ON tbl_1.area_1 = areas1.id
  INNER JOIN tbl_2 areas2 ON tbl_1.area_2 = areas2.id
 
  Maybe if you tinker a little on the sentence. I don't have 
 a place to 
  test it right now.
  --
  Un gran saludo/Big regards...
 Arturo Barajas, IT/Systems PPG MX (SJDR)
 (427) 271-9918, x448
 
  -Original Message-
  From: Charles Kline [mailto:[EMAIL PROTECTED]
  Sent: Viernes, 07 de Marzo de 2003 04:09 p.m.
  To: Jim Lucas
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP] MySQL Alias and PHP
 
 
  Thanks for all the suggestions, I have tried all and more and still
  can't get this quite right. If there is a better forum for these
  question, please point me to it and I will take this somewhat
  off topic
  thread elsewhere.
 
  My table structure is like so:
 
  tbl_1
 
  idarea_1area_2
  1  2   3
  2  1   2
  3  5   0
 
 
  tbl_2
 
  id area_name
  1  funding
  2  research
  3  new
  4  ongoing
  5  other
 
 
  So, I need to display all the records in tbl_1 and show the
  values for
  the fields area_1 and area_2 as their area_name field from tbl_2. I
  must display each record from tbl_1 only once. I know I am
  close, but I
  just can't get this to work. The closest I have gotten is this:
 
  SELECT DISTINCT  a.area_name area_a, b.area_name area_b 
 FROM tbl_1 x,
  tbl_2 a, tbl_2 b
  WHERE x.area_1 = a.id
  OR x.area_2 = b.id GROUP BY x.id
 
  But this ALWAYS returns the area_name (funding) in the value
  of area_b
  (have no idea why)
 
  Thanks for any help. It is appreciated.
 
  - Charles
 
 
  On Friday, March 7, 2003, at 01:42 PM, Jim Lucas wrote:
 
  Then the information in the DB is the same.
 
  Jim
  - Original Message -
  From: Charles Kline [EMAIL PROTECTED]
  To: Rich Gray [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Sent: Friday, March 07, 2003 10:03 AM
  Subject: Re: [PHP] MySQL Alias and PHP
 
 
  Thanks for the help. Almost there. Here is what I have:
 
  SELECT x.id, x.headline, x.description, a.area area_a, 
 b.area area_b
  FROM tbl_funding x, tbl_dra a, tbl_dra b
  GROUP  BY x.id LIMIT 0 , 30
 
  The problem is that $array[area_a] and $array[area_b]
  display the same
  info.
 
 
 
 
 
  On Friday, March 7, 2003, at 11:09 AM, Rich Gray wrote:
 
  Hi all,
 
  I have this query:
 
  SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b
  WHERE x.area_1 = a.id
  AND x.area_2 = b.id
 
  I am using PEAR DB to get my results as an ASSOC ARRAY.
  How do I echo
  the values for a.id and b.id?
 
  Thnks
  Charles
 
 
  I presume you mean area_name...
 
  Try this - SELECT a.area_name as area_a, b.area_name as
  area_b FROM
  tbl_1
  x, tbl_2 a, tbl_2 b
  Then you can refer to the columns as $array['area_a'] and
  $array['area_b']
 
  HTH
  Rich
 
 
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



RE: [PHP] MYSQL :(

2003-03-06 Thread Jason Murray
 How can I get this to use the next auto_increment of 
 id (Next Autoindex = 52)?

What if you just remove id from your field list?

insert into ccl.ccl_maintest (id,RNum,YR,AU,ST
  ^^^
  Here :)

(Just an idea...)

J

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



Re: [PHP] MYSQL :(

2003-03-06 Thread John Taylor-Johnston
(Just an idea...)
An idea that worked ... BUT :)
I had to leave out id in the insert and the select

INSERT  INTO ccl.ccl_maintest
( RNum, YR, AU, ST, SD, SC, BT, BD, BC, AT, AD, AC, SR, PL, PR, JR, VNum, INum, DT, 
PG, LG, SF, OL, KW, AUS, GEO, AN, RB, CO, RR )
SELECT
id, RNum, YR, AU, ST, SD, SC, BT, BD, BC, AT, AD, AC, SR, PL, PR, JR, VNum, INum, DT, 
PG, LG, SF, OL, KW, AUS, GEO, AN, RB, CO, RR
FROM jdaxell.ccl WHERE id = 24

Thanks.

  How can I get this to use the next auto_increment of
  id (Next Autoindex = 52)?
 What if you just remove id from your field list?
 insert into ccl.ccl_maintest (id,RNum,YR,AU,ST
   ^^^
   Here :)



 J

--
John Taylor-Johnston
-
If it's not open-source, it's Murphy's Law.

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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



RE: [PHP] MySQL Query

2003-03-05 Thread John W. Holmes
 Is there a way of updating a table so that I can add some sort of
 identifier
 to each field, something as simple as x=1 will do. I want to be able
to
 modify the table so I can set a variable for each column so I can tell
 whether I can let a user modify that field. If I modify the fieldname
then
 the web application wont work. The purpose of this is to create a
content
 management system that will allow me to set which fields are editable
by
 the
 user. I don't want to add another field to each table because I want
the
 system to be as portable and pluggable into other web sites as
possible.
 
 Any ideas would be greatly appreciated.

Use a separate table to control permissions and bounce each action off
of that.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



RE: [PHP] MySQL

2003-03-04 Thread Don Read

On 03-Mar-2003 Dan Sabo wrote:
 Thanks Larry,
 
 What are some of the more active MySQL lists?  Do you have a URL or two?
 
 Thanks,
 
 Dan

post to [EMAIL PROTECTED]

or browse http://www.mysql.com/documentation/lists.html

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

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



Re: [PHP] MySQL

2003-03-03 Thread Larry E. Ullman
This is OT, I'm considering buying the MySQL, Second Edition Paul 
DuBois
book.  I'm using MySQL 3.23.  Should I be buying the first edition 
DuBois
book instead or does BuBois cover both 3 and 4 in the second edition?  
Is
there a huge difference between 3 and 4?
Here's a URL for the second edition: http://www.kitebird.com/mysql-book/

It discusses what's new in this edition. Paul DuBois is also very 
active on the MySQL mailing lists so your question would probably get a 
more detailed answer there. Also, in all likelihood, the first edition 
may not even be available anymore.

Larry

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


RE: [PHP] MySQL

2003-03-03 Thread Dan Sabo
Thanks Larry,

What are some of the more active MySQL lists?  Do you have a URL or two?

Thanks,

Dan

-Original Message-
From: Larry E. Ullman [mailto:[EMAIL PROTECTED]
Sent: Monday, March 03, 2003 9:52 AM
To: Dan Sabo
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] MySQL


 This is OT, I'm considering buying the MySQL, Second Edition Paul 
 DuBois
 book.  I'm using MySQL 3.23.  Should I be buying the first edition 
 DuBois
 book instead or does BuBois cover both 3 and 4 in the second edition?  
 Is
 there a huge difference between 3 and 4?

Here's a URL for the second edition: http://www.kitebird.com/mysql-book/

It discusses what's new in this edition. Paul DuBois is also very 
active on the MySQL mailing lists so your question would probably get a 
more detailed answer there. Also, in all likelihood, the first edition 
may not even be available anymore.

Larry


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



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



Re: [PHP] MySQL

2003-03-03 Thread Larry E. Ullman
What are some of the more active MySQL lists?  Do you have a URL or 
two?
http://www.mysql.com/documentation/lists.html



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


[PHP] Re: PHP MySQL Move

2003-03-03 Thread John Taylor-Johnston
Found this for anyone interested.
http://www.mysql.com/doc/en/INSERT_SELECT.html

John Taylor-Johnston wrote:

 I was wondering about this, but decided to ask first first:

 INSERT INTO ccl.ccl_main VALUES (select * from greid.ccl where id=28);
 delete * from greid.ccl where id=28;

 Both tables would have to have the same structure ?

--
John Taylor-Johnston
-
If it's not open-source, it's Murphy's Law.

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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



RE: [PHP] mysql replication + mysql_pconnect

2003-03-02 Thread Dan Rossi
i'll explain

i need a fallbak method where if the master server is down it will goto the
slave i assumed the connection could do this automatically but it doesnt
therefore requires it setup in the php connection  script ,

part of my db class $this-connection = @mysql_pconnect($host,$user,$pass);
say host is localhost:3308 it will still connect to the master on 3306 , or
even localhost:3307 which is the slave it will still get the master server ,
i turn off the master server and i get this localhost:3307Can't connect to
local MySQL server through socket
'/usr/local/etc/mysqlmaster/tmp/mysql.sock' (2) where 3307 is the slave ,
one thing though , i have this in my php configure
'--with-mysql=/usr/local/etc/mysqlmaster' ' is that a problem ?

-Original Message-
From: Rich Gray [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 02, 2003 12:34 PM
To: electroteque; [EMAIL PROTECTED]
Subject: RE: [PHP] mysql replication + mysql_pconnect


 hi there i am setting up a test replication slave server as a mysql db
 master backup if it fails , i would like to know how to
 dynamically connect
 to the slave if the master fails , something really strange i have set the
 host like localhost:3307 for the slave but is still connecting to
 the master
 , and if i shut down the master it wont goto the slave :|



Not sure I understand ... are you saying that
mysql_connect('localhost:3307','user','password') connects to the master
server? Can you describe the problem in more detail?

Rich




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



RE: [PHP] mysql replication + mysql_pconnect

2003-03-02 Thread Dan Rossi
i have worked out the issue , here is my dynamic connection to the slave ,
port does not work i suggest this is a bug ?

localhost:/usr/local/etc/mysqlslave/tmp/mysql.sock this connected to the
slave on 3307 fine

-Original Message-
From: Rich Gray [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 02, 2003 12:34 PM
To: electroteque; [EMAIL PROTECTED]
Subject: RE: [PHP] mysql replication + mysql_pconnect


 hi there i am setting up a test replication slave server as a mysql db
 master backup if it fails , i would like to know how to
 dynamically connect
 to the slave if the master fails , something really strange i have set the
 host like localhost:3307 for the slave but is still connecting to
 the master
 , and if i shut down the master it wont goto the slave :|



Not sure I understand ... are you saying that
mysql_connect('localhost:3307','user','password') connects to the master
server? Can you describe the problem in more detail?

Rich




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



RE: [PHP] mysql replication + mysql_pconnect

2003-03-01 Thread Rich Gray
 hi there i am setting up a test replication slave server as a mysql db
 master backup if it fails , i would like to know how to
 dynamically connect
 to the slave if the master fails , something really strange i have set the
 host like localhost:3307 for the slave but is still connecting to
 the master
 , and if i shut down the master it wont goto the slave :|



Not sure I understand ... are you saying that
mysql_connect('localhost:3307','user','password') connects to the master
server? Can you describe the problem in more detail?

Rich


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



RE: [PHP] MySQL Query Result Question

2003-02-28 Thread Bryan Lipscy
Shouldn't that be:

while($data=mysql_fetch_array($result))
{
//SSLT
}

NOTE: Added ) and changes $query to $result

-Original Message-
From: Van Andel, Robbert [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 28, 2003 3:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL Query Result Question


I have the following query:
$query  = SELECT d.utilization, d.capacity_date, d.day, i.id,
i.interface, cd.date, cd.id ;
   $query .= FROM (capacity_data as d LEFT JOIN interfaces as i ON
d.interface = i.id) ;
   $query .= LEFT JOIN capacity_date as cd ON d.capacity_date=cd.id ;
   $query .= WHERE i.router = '$cmts[$i]' AND cd.date = '$useDate' ;
   $query .= ORDER BY i.interface,cd.date DESC;
 
if(!$result = mysql_query($query)) die(mysql_error());
 
while($data=mysql_fetch_array($query)
{
//SSLT
}
 
The query itself runs just fine.  However, I've run into a problem with
the loop I've created.  During one of the iterations, the query returns
no data so during the subsequent loop the previous query's results is
used in it's place.  I do not want this to happen.  What is the best way
to destroy $result before I run the query?

Robbert van Andel 




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



RE: [PHP] MySQL Query Result Question

2003-02-28 Thread Van Andel, Robbert
Yes, your correction is actually what I have.  So the problem I'm facing is that 
$result doesn't seem to empty when I run the query and nothing is returned by it.

Robbert van Andel 


-Original Message-
From: Bryan Lipscy [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 3:40 PM
To: Van Andel, Robbert; [EMAIL PROTECTED]
Subject: RE: [PHP] MySQL Query Result Question


Shouldn't that be:

while($data=mysql_fetch_array($result))
{
//SSLT
}

NOTE: Added ) and changes $query to $result

-Original Message-
From: Van Andel, Robbert [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 28, 2003 3:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL Query Result Question


I have the following query:
$query  = SELECT d.utilization, d.capacity_date, d.day, i.id,
i.interface, cd.date, cd.id ;
   $query .= FROM (capacity_data as d LEFT JOIN interfaces as i ON
d.interface = i.id) ;
   $query .= LEFT JOIN capacity_date as cd ON d.capacity_date=cd.id ;
   $query .= WHERE i.router = '$cmts[$i]' AND cd.date = '$useDate' ;
   $query .= ORDER BY i.interface,cd.date DESC;
 
if(!$result = mysql_query($query)) die(mysql_error());
 
while($data=mysql_fetch_array($query)
{
//SSLT
}
 
The query itself runs just fine.  However, I've run into a problem with
the loop I've created.  During one of the iterations, the query returns
no data so during the subsequent loop the previous query's results is
used in it's place.  I do not want this to happen.  What is the best way
to destroy $result before I run the query?

Robbert van Andel 




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



Re: [PHP] MySQL Query Result Question

2003-02-28 Thread Ernest E Vogelsinger
At 00:20 01.03.2003, Van Andel, Robbert said:
[snip]
I have the following query:
$query  = SELECT d.utilization, d.capacity_date, d.day, i.id, i.interface, 
cd.date, cd.id ;
   $query .= FROM (capacity_data as d LEFT JOIN interfaces as i ON 
d.interface = i.id) ;
   $query .= LEFT JOIN capacity_date as cd ON d.capacity_date=cd.id ;
   $query .= WHERE i.router = '$cmts[$i]' AND cd.date = '$useDate' ;
   $query .= ORDER BY i.interface,cd.date DESC;
 
if(!$result = mysql_query($query)) die(mysql_error());
 
while($data=mysql_fetch_array($query)
{
//SSLT
}
[snip] 

Simply setting $result=null after the loop should do, or am I off topic?

if(!$result = mysql_query($query)) die(mysql_error());
while($data=mysql_fetch_array($result))
{
   //SSLT
}
$result = null;
// could also use
// unset($result);



-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



RE: [PHP] MySQL Query Result Question

2003-02-28 Thread Van Andel, Robbert
I had the same thought and it didn't work.  I have verified that $cmts[$i] is a 
different value then the previous iteration, but the second time through the same data 
as the first time through is processed.  I've even run the actually query that I 
echoed onto the page through phpMyAdmin and verified that I got nothing back.  I don't 
know at this point.  I'm at a loss.

Robbert van Andel 



-Original Message-
From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 3:51 PM
To: Van Andel, Robbert
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] MySQL Query Result Question


At 00:20 01.03.2003, Van Andel, Robbert said:
[snip]
I have the following query:
$query  = SELECT d.utilization, d.capacity_date, d.day, i.id, i.interface, 
cd.date, cd.id ;
   $query .= FROM (capacity_data as d LEFT JOIN interfaces as i ON 
d.interface = i.id) ;
   $query .= LEFT JOIN capacity_date as cd ON d.capacity_date=cd.id ;
   $query .= WHERE i.router = '$cmts[$i]' AND cd.date = '$useDate' ;
   $query .= ORDER BY i.interface,cd.date DESC;
 
if(!$result = mysql_query($query)) die(mysql_error());
 
while($data=mysql_fetch_array($query)
{
//SSLT
}
[snip] 

Simply setting $result=null after the loop should do, or am I off topic?

if(!$result = mysql_query($query)) die(mysql_error());
while($data=mysql_fetch_array($result))
{
   //SSLT
}
$result = null;
// could also use
// unset($result);



-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



RE: [PHP] MySQL Query Result Question

2003-02-28 Thread Van Andel, Robbert
Thanks to everyone who responded.  I've figured it out.  One of those ID 10 T errors.  
I was not clearing some necessary variables further down in the loop.  

Robbert van Andel 


-Original Message-
From: Van Andel, Robbert 
Sent: Friday, February 28, 2003 3:57 PM
To: Ernest E Vogelsinger
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] MySQL Query Result Question


I had the same thought and it didn't work.  I have verified that $cmts[$i] is a 
different value then the previous iteration, but the second time through the same data 
as the first time through is processed.  I've even run the actually query that I 
echoed onto the page through phpMyAdmin and verified that I got nothing back.  I don't 
know at this point.  I'm at a loss.

Robbert van Andel 



-Original Message-
From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 3:51 PM
To: Van Andel, Robbert
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] MySQL Query Result Question


At 00:20 01.03.2003, Van Andel, Robbert said:
[snip]
I have the following query:
$query  = SELECT d.utilization, d.capacity_date, d.day, i.id, i.interface, 
cd.date, cd.id ;
   $query .= FROM (capacity_data as d LEFT JOIN interfaces as i ON 
d.interface = i.id) ;
   $query .= LEFT JOIN capacity_date as cd ON d.capacity_date=cd.id ;
   $query .= WHERE i.router = '$cmts[$i]' AND cd.date = '$useDate' ;
   $query .= ORDER BY i.interface,cd.date DESC;
 
if(!$result = mysql_query($query)) die(mysql_error());
 
while($data=mysql_fetch_array($query)
{
//SSLT
}
[snip] 

Simply setting $result=null after the loop should do, or am I off topic?

if(!$result = mysql_query($query)) die(mysql_error());
while($data=mysql_fetch_array($result))
{
   //SSLT
}
$result = null;
// could also use
// unset($result);



-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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


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



[PHP] Re: PHP MySQL Move

2003-02-28 Thread John Taylor-Johnston
I was wondering about this, but decided to ask first first:

INSERT INTO ccl.ccl_main VALUES (select * from greid.ccl where id=28);
delete * from greid.ccl where id=28;

Both tables would have to have the same structure ?


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



[PHP] to holmes Re: [PHP] mysql trouble

2003-02-26 Thread Luis A
how is that ??
- Original Message -
From: John W. Holmes [EMAIL PROTECTED]
To: 'Luis A' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Tuesday, February 25, 2003 8:07 PM
Subject: RE: [PHP] mysql trouble


  take a look at this
  ?php
  // process form
  $link = mysql_connect(localhost, root);
  mysql_select_db(mydb,$db);
  $sql = INSERT INTO agenda (nombre, direccion, telefono, email)  +
VALUES ('$nombre', '$direccion', '$telefono', '$email');
  $result = mysql_query($sql);

 You use a period (.) to concatenate strings, not a plus (+) symbol.

 If you displayed $sql, like you should when you're debugging your
 script, you'd of realized this a long time ago.

 ---John W. Holmes...

 PHP Architect - A monthly magazine for PHP Professionals. Get your copy
 today. http://www.phparch.com/



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




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



[PHP] to holmes Re: [PHP] mysql trouble

2003-02-26 Thread Luis A
you mean  i do not need to put the pus on the end of the function

(+)   i dont need to put there that?


- Original Message -
From: John W. Holmes [EMAIL PROTECTED]
To: 'Richard Whitney' [EMAIL PROTECTED]; 'Luis A'
[EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, February 25, 2003 8:21 PM
Subject: RE: [PHP] mysql trouble


  ### ?php
  ### // process form
  ### $link = mysql_connect(localhost, root);
  you need to have the password as the third argument
  $link = mysql_connect(localhost, root, password);
 
  Also, why is it in a variable?
  Just make it:
  mysql_connect(localhost, root, password);

 Sometime there are users that do not have a password. Every parameter to
 mysql_connect() is optional, by the way.

 Also, you want to assign the result of mysql_connect() to a variable so
 you can tell the connections apart. If you only have one connection per
 script, then it's not a big deal. But, if you connect to several
 databases, then you need that result to tell them apart when you do
 queries later so PHP knows what connection to send your query through.

  ### mysql_select_db(mydb,$db);
  ### $sql = INSERT INTO agenda (nombre, direccion, telefono, email) 
 +

 Problem is the plus (+) sign at the end of this line.

 ---John W. Holmes...

 PHP Architect - A monthly magazine for PHP Professionals. Get your copy
 today. http://www.phparch.com/



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




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



RE: [PHP] to holmes Re: [PHP] mysql trouble

2003-02-26 Thread Niklas Lampén
No, he doesn't mean that.

You are doing:
$String = text  + more text;
while you should be doing:
$String = text  . more text;


Niklas

-Original Message-
From: Luis A [mailto:[EMAIL PROTECTED] 
Sent: 26. helmikuuta 2003 16:09
To: [EMAIL PROTECTED]
Subject: [PHP] to holmes Re: [PHP] mysql trouble


you mean  i do not need to put the pus on the end of the function

(+)   i dont need to put there that?


- Original Message -
From: John W. Holmes [EMAIL PROTECTED]
To: 'Richard Whitney' [EMAIL PROTECTED]; 'Luis A'
[EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, February 25, 2003 8:21 PM
Subject: RE: [PHP] mysql trouble


  ### ?php
  ### // process form
  ### $link = mysql_connect(localhost, root);
  you need to have the password as the third argument
  $link = mysql_connect(localhost, root, password);
 
  Also, why is it in a variable?
  Just make it:
  mysql_connect(localhost, root, password);

 Sometime there are users that do not have a password. Every parameter 
 to
 mysql_connect() is optional, by the way.

 Also, you want to assign the result of mysql_connect() to a variable 
 so you can tell the connections apart. If you only have one connection 
 per script, then it's not a big deal. But, if you connect to several 
 databases, then you need that result to tell them apart when you do 
 queries later so PHP knows what connection to send your query through.

  ### mysql_select_db(mydb,$db);
  ### $sql = INSERT INTO agenda (nombre, direccion, telefono, email) 
  
 +

 Problem is the plus (+) sign at the end of this line.

 ---John W. Holmes...

 PHP Architect - A monthly magazine for PHP Professionals. Get your 
 copy today. http://www.phparch.com/



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




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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



Re: [PHP] to paulm Re: [PHP] mysql trouble

2003-02-26 Thread Luis A
i know

the sql server in default does not have password


- Original Message -
From: paulm [EMAIL PROTECTED]
To: Luis A [EMAIL PROTECTED]
Sent: Tuesday, February 25, 2003 8:06 PM
Subject: Re: [PHP] to paulm Re: [PHP] mysql trouble


 k but you still need to do  insted of password, and see if you have a
sql
 password for root, it's not system password
 - Original Message -
 From: Luis A [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, February 26, 2003 2:21 AM
 Subject: [PHP] to paulm Re: [PHP] mysql trouble


 hey i think the root does not need password to connect to mysql

 or yes 

 on my server the root user does not have password
 thats why i dont know why he does not update the database?

 - Original Message -
 From: paulm [EMAIL PROTECTED]
 To: Luis A [EMAIL PROTECTED]
 Sent: Tuesday, February 25, 2003 6:48 PM
 Subject: Re: [PHP] mysql trouble


  you don't have a password for root in mysql_connect
  - Original Message -
  From: Luis A [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Wednesday, February 26, 2003 1:04 AM
  Subject: [PHP] mysql trouble
 
 
  hi pasl i got a troblem here
 
 
  if some one can help me ?
 
  take a look at this
  ?php
  // process form
  $link = mysql_connect(localhost, root);
  mysql_select_db(mydb,$db);
  $sql = INSERT INTO agenda (nombre, direccion, telefono, email)  +
VALUES ('$nombre', '$direccion', '$telefono', '$email');
  $result = mysql_query($sql);
  echo ¡Gracias! Hemos recibido sus datos.\n;
 
  ?
 
 
 
  HE DOES NOT WORKING
 
  any subjest ?
 
 



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




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



[PHP] to Bryan Lipscy Re: [PHP] mysql trouble

2003-02-26 Thread Luis A
the mysql server guives  to me this error now

tk a look


¡Gracias! Hemos recibido sus datos.
Warning: mysql_free_result(): supplied argument is not a valid MySQL result
resource in c:\apache group\apache\htdocs\1\2\registered.php3 on line 39

Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource
in c:\apache group\apache\htdocs\1\2\registered.php3 on line 42

the error is on here

line 39 mysql_free_result($result);

line 42 mysql_close($db);




- Original Message -
From: Bryan Lipscy [EMAIL PROTECTED]
To: 'Luis A' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Tuesday, February 25, 2003 8:25 PM
Subject: RE: [PHP] mysql trouble


 Create a user with appropriate privledges for the database.  DO NOT use
 root.


 ?php

 $DB_HOST = localhost;
 $DB_USER = root;  // Do not do this.  Make a different user.
 $DB_PASS = ;
 $DB_DB = mydb;

 // connect to the database server
 $db= @mysql_pconnect ( $DB_HOST , $DB_USER , $DB_PASS );

 // use the database
 @mysql_select_db ( $DB_DB )  or die ( [ERROR] .mysql_error()
 );

 // process form

 $sql = INSERT INTO agenda (nombre, direccion, telefono, email)
 VALUES ('.$nombre.', '.$direccion.', '.$telefono.',
 '.$email.');

 $result = mysql_query($sql);

 echo ¡Gracias! Hemos recibido sus datos.\n;

 /* Free resultset */
 mysql_free_result($result);

 /* Closing connection */
 mysql_close($db);

 ?


 You did not mention where the $nombre, $direccion, $telefono, or $email
 variables are being initialized.
 To capture the values from a form use $_POST['name'] where name is the
 name of the field on the form.

 HTH

 -Original Message-
 From: Luis A [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 25, 2003 4:21 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] to paulm Re: [PHP] mysql trouble


 hey i think the root does not need password to connect to mysql

 or yes 

 on my server the root user does not have password
 thats why i dont know why he does not update the database?

 - Original Message -
 From: paulm [EMAIL PROTECTED]
 To: Luis A [EMAIL PROTECTED]
 Sent: Tuesday, February 25, 2003 6:48 PM
 Subject: Re: [PHP] mysql trouble


  you don't have a password for root in mysql_connect
  - Original Message -
  From: Luis A [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Wednesday, February 26, 2003 1:04 AM
  Subject: [PHP] mysql trouble
 
 
  hi pasl i got a troblem here
 
 
  if some one can help me ?
 
  take a look at this
  ?php
  // process form
  $link = mysql_connect(localhost, root);
  mysql_select_db(mydb,$db); $sql = INSERT INTO agenda (nombre,
  direccion, telefono, email)  +
VALUES ('$nombre', '$direccion', '$telefono', '$email'); $result =

  mysql_query($sql); echo ¡Gracias! Hemos recibido sus datos.\n;
 
  ?
 
 
 
  HE DOES NOT WORKING
 
  any subjest ?
 
 



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




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



[PHP] to Bryan Lipscy Re: [PHP] mysql trouble

2003-02-26 Thread Luis A
i dont know whyyy  he does not inser into the databse the values ??


take a look

?php

$DB_HOST = localhost;
$DB_USER = db;  // Do not do this.  Make a different user.
$DB_PASS = luisito;
$DB_DB = mydb;

// connect to the database server
$db= @mysql_pconnect ( $DB_HOST , $DB_USER , $DB_PASS );

// use the database
@mysql_select_db ( $DB_DB )  or die ( [ERROR] .mysql_error()
);

// process form

$sql = INSERT INTO opina (nombre, provincia, pais, url, title, email,
comentario)
VALUES ('.$nombre.', '.$provincia.', '.$pais.', '.$url.',
'.$title.', '.$email.', '.$comentario.');

$result = mysql_query($sql);

echo ¡Gracias! Hemos recibido sus datos.\n;


?

aparently hje works all rigth

but when i present this var


?php
$link = mysql_connect(localhost, nobody);
mysql_select_db(mydb, $link);
$result = mysql_query(SELECT * FROM opina, $link);
echo Nombre: .mysql_result($result, 0, nombre).br;
echo Pais: .mysql_result($result, 0, pais).br;
echo Provincia: .mysql_result($result, 0, provincia).br;
echo URL :.mysql_result($result, 0, url).br;
echo Titulo de La Web: .mysql_result($result, 0, title).br;
echo E-mail :.mysql_result($result, 0, email).br;
echo Comentario :.mysql_result($result, 0, comentario).br;
?

on the navigator he present onley that
empty with no results of the database
look

Nombre:
Pais:
Provincia:
URL :
Titulo de La Web:
E-mail :
Comentario :




i dont know



any subjest ???

please help me im newbabe

)



- Original Message -
From: Bryan Lipscy [EMAIL PROTECTED]
To: 'Luis A' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Tuesday, February 25, 2003 8:25 PM
Subject: RE: [PHP] mysql trouble


 Create a user with appropriate privledges for the database.  DO NOT use
 root.


 ?php

 $DB_HOST = localhost;
 $DB_USER = root;  // Do not do this.  Make a different user.
 $DB_PASS = ;
 $DB_DB = mydb;

 // connect to the database server
 $db= @mysql_pconnect ( $DB_HOST , $DB_USER , $DB_PASS );

 // use the database
 @mysql_select_db ( $DB_DB )  or die ( [ERROR] .mysql_error()
 );

 // process form

 $sql = INSERT INTO agenda (nombre, direccion, telefono, email)
 VALUES ('.$nombre.', '.$direccion.', '.$telefono.',
 '.$email.');

 $result = mysql_query($sql);

 echo ¡Gracias! Hemos recibido sus datos.\n;

 /* Free resultset */
 mysql_free_result($result);

 /* Closing connection */
 mysql_close($db);

 ?


 You did not mention where the $nombre, $direccion, $telefono, or $email
 variables are being initialized.
 To capture the values from a form use $_POST['name'] where name is the
 name of the field on the form.

 HTH

 -Original Message-
 From: Luis A [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 25, 2003 4:21 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] to paulm Re: [PHP] mysql trouble


 hey i think the root does not need password to connect to mysql

 or yes 

 on my server the root user does not have password
 thats why i dont know why he does not update the database?

 - Original Message -
 From: paulm [EMAIL PROTECTED]
 To: Luis A [EMAIL PROTECTED]
 Sent: Tuesday, February 25, 2003 6:48 PM
 Subject: Re: [PHP] mysql trouble


  you don't have a password for root in mysql_connect
  - Original Message -
  From: Luis A [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Wednesday, February 26, 2003 1:04 AM
  Subject: [PHP] mysql trouble
 
 
  hi pasl i got a troblem here
 
 
  if some one can help me ?
 
  take a look at this
  ?php
  // process form
  $link = mysql_connect(localhost, root);
  mysql_select_db(mydb,$db); $sql = INSERT INTO agenda (nombre,
  direccion, telefono, email)  +
VALUES ('$nombre', '$direccion', '$telefono', '$email'); $result =

  mysql_query($sql); echo ¡Gracias! Hemos recibido sus datos.\n;
 
  ?
 
 
 
  HE DOES NOT WORKING
 
  any subjest ?
 
 



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




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



Re: [PHP] to Bryan Lipscy Re: [PHP] mysql trouble

2003-02-26 Thread Jason Wong
On Thursday 27 February 2003 01:00, Luis A wrote:

 ?php
 $link = mysql_connect(localhost, nobody);
 mysql_select_db(mydb, $link);
 $result = mysql_query(SELECT * FROM opina, $link);
 echo Nombre: .mysql_result($result, 0, nombre).br;

[snip]

You need to use the mysql_fetch_*() functions as well. See manual for details. 

Aren't you the guy who doesn't have internet access? [sic]. If so let me know 
and I'll email the manual to you, state whether you want:

a) English or Spanish (I see you're using a Cuba domain)
b) Single HTML or Multiple HTML or Windows HTML (CHM format)


-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
His great aim was to escape from civilization, and, as soon as he had
money, he went to Southern California.
*/


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



Re: [PHP] to Jason Wong Re: [PHP] mysql trouble

2003-02-26 Thread Luis A
OK IF no trouble for ud to send it to me the manual ??

in spanish
- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, February 26, 2003 12:17 PM
Subject: Re: [PHP] to Bryan Lipscy Re: [PHP] mysql trouble


 On Thursday 27 February 2003 01:00, Luis A wrote:

  ?php
  $link = mysql_connect(localhost, nobody);
  mysql_select_db(mydb, $link);
  $result = mysql_query(SELECT * FROM opina, $link);
  echo Nombre: .mysql_result($result, 0, nombre).br;

 [snip]

 You need to use the mysql_fetch_*() functions as well. See manual for
details.

 Aren't you the guy who doesn't have internet access? [sic]. If so let me
know
 and I'll email the manual to you, state whether you want:

 a) English or Spanish (I see you're using a Cuba domain)
 b) Single HTML or Multiple HTML or Windows HTML (CHM format)


 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 His great aim was to escape from civilization, and, as soon as he had
 money, he went to Southern California.
 */


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





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



Re: [PHP] to Jason Wong Re: [PHP] mysql trouble

2003-02-26 Thread Jason Wong
On Thursday 27 February 2003 01:32, Luis A wrote:
 OK IF no trouble for ud to send it to me the manual ??

 in spanish

  b) Single HTML or Multiple HTML or Windows HTML (CHM format)

Which format?

Also please do not change the subject (ie putting people's name into the 
subject).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Life -- Love It or Leave It.
*/


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



Re: [PHP] to Jason Wong Re: [PHP] mysql trouble

2003-02-26 Thread Luis A
HTML
b)single
- Original Message - 
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, February 26, 2003 12:38 PM
Subject: Re: [PHP] to Jason Wong Re: [PHP] mysql trouble


 On Thursday 27 February 2003 01:32, Luis A wrote:
  OK IF no trouble for ud to send it to me the manual ??
 
  in spanish
 
   b) Single HTML or Multiple HTML or Windows HTML (CHM format)
 
 Which format?
 
 Also please do not change the subject (ie putting people's name into the 
 subject).
 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 Life -- Love It or Leave It.
 */
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 



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



<    5   6   7   8   9   10   11   12   13   14   >