[PHP-DB] Problem with update-command

2004-04-22 Thread Ruprecht Helms
Hi,

In the attached file I've a problem with the update-procedure.
The procedured gets its values from a formular an should update an
articlerecordset as needed. After update I get not the result of the updating, the
old value is stored in the database.

How have I to rewrite the lines for proper work.

Regards,
Ruprecht
Ruprecht Helms IT-Service  Softwareentwicklung

Tel./Fax +49[0]7621 16 99 16

Web:  http://www.rheyn.de
email:[EMAIL PROTECTED]



?
echo Artikelid ;
echo $id;
echo  Chorid ;
echo $chorid;
echo   Beschreibung ;
echo $beschreibung;
echo   Preis   ;
echo $preis;
mysql_connect(localhost,web172,fbn7__1);
//$result=mysql_db_query(usr_172_1,UPDATE artikel SET Beschreibung='$beschreibung' 
WHERE Chorid=$chorid AND ID=$id);
$result=mysql_db_query(usr_172_1,UPDATE artikel SET Preis='\$preis\' WHERE 
ID='\$id\');
//mysql_error($result);
?

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

Re: [PHP-DB] Problem with update-command

2004-04-22 Thread jeffrey_n_Dyke




$result=mysql_db_query(usr_172_1,UPDATE artikel SET Preis='\$preis\'
WHERE ID='\$id\');
//mysql_error($result);

Here you're escaping the $ and then the ', have you tried

$result=mysql_db_query(usr_172_1,UPDATE artikel SET Preis='{$preis}'
WHERE ID='{$id}');
with those escapes this is the actual query you're sending
UPDATE artikel SET Preis='$preis\' WHERE ID='$id\'

HTH
Jeff


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

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



[PHP-DB] Re: Selecting Null columns

2004-04-22 Thread pete M
 SELECT * FROM questions WHERE answer IS  NULL
 SELECT * FROM questions WHERE answer IS NOT NULL
Pambos Nicolaou wrote:
Hi everyone

I am a new user of this mail list and I hope that it will be helpful.

I am trying to show the content of a MySQL table(raw) where the content 
of a column is NOT NULL. I used the commands below but the result shows 
the content of the whole table for the first case and nothing in the 
second case.

 SELECT * FROM questions WHERE answer IS NOT NULL ;
 SELECT * FROM questions WHERE answer  NULL ;


Thanks in advance

Nicolaou Pambos

_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Problem with update-command

2004-04-22 Thread Torsten Roehr
Jeffrey N Dyke [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 $result=mysql_db_query(usr_172_1,UPDATE artikel SET Preis='\$preis\'
 WHERE ID='\$id\');
 //mysql_error($result);

 Here you're escaping the $ and then the ', have you tried

 $result=mysql_db_query(usr_172_1,UPDATE artikel SET Preis='{$preis}'
 WHERE ID='{$id}');
 with those escapes this is the actual query you're sending
 UPDATE artikel SET Preis='$preis\' WHERE ID='$id\'

Good point, Jeff. As the id is probably an int one doesn't need quotes at
all:

UPDATE artikel SET Preis=' . $preis . ' WHERE ID= . $id

Regards,
Torsten


 HTH
 Jeff

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



[PHP-DB] Remove white space?

2004-04-22 Thread Robert Sossomon
I am pulling data from a MySQL DB and I need to remove the whitespace on
the variable and turn it to lowercase.

! Code Snippet

$get_items = select * from PFS_items;
$get_items_res = mysql_query($get_items) or die(mysql_error());
while ($items = mysql_fetch_array($get_items_res))
{
 $item_id = $items[id];
 $item_num = $items[item_num];

! End Code Snippet

Overtime I need to rewrite my DB loading script to handle this for me,
but right now I need to band-aid it so that I can auto-generate pages
and get them loaded into a catalog.

Thanks!

Robert

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



RE: [PHP-DB] Remove white space?

2004-04-22 Thread Hutchins, Richard
Robert,

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

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

Rich


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

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



[PHP-DB] Re: Remove white space?

2004-04-22 Thread Torsten Roehr
Robert Sossomon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am pulling data from a MySQL DB and I need to remove the whitespace on
 the variable and turn it to lowercase.

 ! Code Snippet

 $get_items = select * from PFS_items;
 $get_items_res = mysql_query($get_items) or die(mysql_error());
 while ($items = mysql_fetch_array($get_items_res))
 {
  $item_id = $items[id];
  $item_num = $items[item_num];

 ! End Code Snippet

 Overtime I need to rewrite my DB loading script to handle this for me,
 but right now I need to band-aid it so that I can auto-generate pages
 and get them loaded into a catalog.

 Thanks!

 Robert

Use trim() to remove white space at the beginning and end of the string and
strtolower() to convert to lower case.

Regards, Torsten

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



Re: [PHP-DB] Remove white space?

2004-04-22 Thread Miles Thompson
1. Don't cross-post!
2. Read the string functions in the php manual. You probably don't want to 
remove all white space, just trim. Have a look at
http://ca3.php.net/manual/en/function.trim.php
3. You will find a function to do exactly what you want.

Regards - Miles Thompson

At 10:51 AM 4/22/2004 -0400, Robert Sossomon wrote:

I am pulling data from a MySQL DB and I need to remove the whitespace on
the variable and turn it to lowercase.
! Code Snippet

$get_items = select * from PFS_items;
$get_items_res = mysql_query($get_items) or die(mysql_error());
while ($items = mysql_fetch_array($get_items_res))
{
 $item_id = $items[id];
 $item_num = $items[item_num];
! End Code Snippet

Overtime I need to rewrite my DB loading script to handle this for me,
but right now I need to band-aid it so that I can auto-generate pages
and get them loaded into a catalog.
Thanks!

Robert

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


[PHP-DB] Adding includes to files

2004-04-22 Thread Robert Sossomon
I need to add PHP calls to include a file to each page as it is
generated, the only thing is I can't get the includes to come through
correctly:

! Code
   $display_block .= ?php include(\nav/top_nav.html\); ?;
   $display_block .= ?php include(\nav/side_nav.html\); ?;
! End Code

At the end of the generation I write $display_block to a file as
$display_block holds all the data it accumulates through the run.  How
do I rewrite the inlclude to work, or do I need to find another way to
make the includes?  The includes are all template files that I used on
the site to keep everything consistent.

Thanks,
Robert

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



[PHP-DB] Re: [PHP] Adding includes to files

2004-04-22 Thread John W. Holmes
From: Robert Sossomon [EMAIL PROTECTED]

 I need to add PHP calls to include a file to each page as it is
 generated, the only thing is I can't get the includes to come through
 correctly:
 
 ! Code
$display_block .= ?php include(\nav/top_nav.html\); ?;
$display_block .= ?php include(\nav/side_nav.html\); ?;
 ! End Code
 
 At the end of the generation I write $display_block to a file as

You can use output buffering:

ob_start();
include(nav/top_nav.html); 
include(nav/side_nav.html); 
$display_block = ob_get_contents();
ob_end_clean();

---John Holmes...

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



[PHP-DB] RE: [PHP] Remove white space?

2004-04-22 Thread Chris W. Parker
Robert Sossomon mailto:[EMAIL PROTECTED]
on Thursday, April 22, 2004 7:51 AM said:

 I am pulling data from a MySQL DB and I need to remove the whitespace
 on the variable and turn it to lowercase.

remove whitespace *on* the variable??

i don't get it.




chris.

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



[PHP-DB] RE: [PHP] Adding includes to files

2004-04-22 Thread Robert Sossomon
Output buffering isn't going to help, the files, when completed need to
look like:  

! HTML CODE
HTML
HEAD
TITLECategories of Items/TITLE
BODY
?php
 include(nav/top_nav.html);
?
?php
 include(nav/side_nav.html);
?
Html content

?php
 include(nav/bottom_nav.html);
?

! END HTML CODE

If all I was trying to do was pull in the files I could do that without
a problem, but what I need to do is generate the whole page with the
information.

I attached the php file that does the site generation and maybe it will
shed some light on what I am trying to do as well.

TIA!!

Robert

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 22, 2004 11:33 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] Adding includes to files


From: Robert Sossomon [EMAIL PROTECTED]

 I need to add PHP calls to include a file to each page as it is 
 generated, the only thing is I can't get the includes to come through
 correctly:
 
 ! Code
$display_block .= ?php include(\nav/top_nav.html\); ?;
$display_block .= ?php include(\nav/side_nav.html\); ?; ! 
 End Code
 
 At the end of the generation I write $display_block to a file as

You can use output buffering:

ob_start();
include(nav/top_nav.html); 
include(nav/side_nav.html); 
$display_block = ob_get_contents();
ob_end_clean();

---John Holmes...

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

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

[PHP-DB] RE: [PHP] Adding includes to files

2004-04-22 Thread Robert Sossomon
OK, so I figured out where it was barfing.  I looked deeper into the log
files as well as the generated pages, and found that somewhere the path
to the include files had become mangled, and the reason the files
weren't showing correctly in the HTML pages in the browser was because
it couldn't find the right files.  It's on track and working all neat
and tidy now.

Thanks for the help guys! I still feel like a doofus though...  

Robert

-Original Message-
From: Richard Harb [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 22, 2004 11:46 AM
To: Robert Sossomon
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] Adding includes to files


You could either include the files without assigning the contents to a
variable - but that would display those right away:
   ?php include('nav/top_nav.html'); ?

or you could read the contents of the file like:

   ?php $display_block .= is_readable('nav/top_nav.html') ?
   file_get_contents('nav/top_nav.html') : ''; ?

Richard
   
Thursday, April 22, 2004, 5:12:21 PM, thus was written:
 I need to add PHP calls to include a file to each page as it is 
 generated, the only thing is I can't get the includes to come through
 correctly:

 ! Code
$display_block .= ?php include(\nav/top_nav.html\); ?;
$display_block .= ?php include(\nav/side_nav.html\); ?; ! 
 End Code

 At the end of the generation I write $display_block to a file as 
 $display_block holds all the data it accumulates through the run. How 
 do I rewrite the inlclude to work, or do I need to find another way to

 make the includes?  The includes are all template files that I used on

 the site to keep everything consistent.

 Thanks,
 Robert

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

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



[PHP-DB] Include Files Solution

2004-04-22 Thread Robert Sossomon
Here's the solution I came up with that works for the site:

code snippet
   $display_block .= ?php\n;
   $display_block .= \n include(\../nav/top_nav.html\);;
   $display_block .= \n;
   $display_block .=  include(\../nav/side_nav.html\);;
   $display_block .=  \n?;
end code snippet

I am only using the PHP parser once instead of twice, the \n makes the
whole thing nicely readable in the HTML source files that are generated,
and the paths were modified (and the navigation templates were as well)
to give the correct paths to all the images and files concerned.

The biggest reason I had path problems was that I set the page
generation in the home directory, the generated pages in their own
directory (as well as the rest of the pieces of the online catalog quote
request form) and the navigation sits in it's own directory off the root
folder.

/
 page generation
/catalog
 pages
/nav
 templates
/images
 images
/product_images
 images

What had me perplexed was I coded the product images correctly to work
right from the beginning with the leading '/' character and so since I
did it correct at the beginning it should hold true that I coded it
correctly throughout, right?  WRONG!  I completely bungled the whole
paths and was left with a bunch of garbage.  Now I have the paths all
loaded correctly, the templates were all modified to call images and
pages with a leading '/' character, and everything is working fluidly.

Now I'm ready to call it a week and go to the beach!!!  Who's with me?!

BTW, if you want to see the output pages then feel free to click here:
http://www.pfssales.com/catalog.html and click on any of the links.

Robert

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



[PHP-DB] What's wrong with this IF statement?

2004-04-22 Thread Robert Sossomon
My IF statement should be picking up on the numbers, and if the number
matches not be displaying out the information, however I look at the
outputted page and the information is still there, what have I got wrong
on the code?

CODE SNIPPET
//Show categories first
$get_cats = select id_num, id_name, description, cat_code from
categories order by id_name;
$get_cats_res = mysql_query($get_cats) or die(mysql_error());

if (mysql_num_rows($get_cats_res)  1)
{
 $display_block = PemSorry, no categories to browse./em/P;
}
else
{
 while ($cats = mysql_fetch_array($get_cats_res))
 {
  $cat_id = $cats[id_num];
  if ($cat_id != 53 || $cat_id != 54 || $cat_id != 55 || $cat_id
!= 117 || $cat_id != 118 || $cat_id != 74)
  {
  $cat_title = strtoupper(stripslashes($cats[id_name]));
  $cat_desc = stripslashes($cats[description]);
  $display_block .= stronga
href=$_SERVER[PHP_SELF]?cat_id=$cat_id$cat_title
$cat_desc/a/strongbr\n;
  while ($items = mysql_fetch_array($get_items_res))
   {
$item_id = $items[id];
$item_num = $items[item_num];
$item_desc = stripslashes($items[description]);
if ($item_num != ABC-R37 || $item_num !=  ABC-R42 || $item_num
!= HB-99100 || $item_num != RO-PUMPS || $item_num != ML-HDGALJUG
|| $item_num != PFS-CAC21 || $item_num != PFS-CO2)
{
$item_num = ltrim($item_num);
$item_num = rtrim($item_num);
$display_block .= nbsp;nbsp;nbsp;nbsp;emstronga
href=\catalog/$item_id.html\$item_num/a/strong -
$item_desc/embr\n;
} 
   }
END SNIPPETS

My assumption is that BOTH IF statements are not working correctly since
the logic is that if they are built the same they would react the same.
HELP!

TIA!
Robert

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



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

2004-04-22 Thread Torsten Roehr
Robert Sossomon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 My IF statement should be picking up on the numbers, and if the number
 matches not be displaying out the information, however I look at the
 outputted page and the information is still there, what have I got wrong
 on the code?

 CODE SNIPPET
 file://Show categories first
 $get_cats = select id_num, id_name, description, cat_code from
 categories order by id_name;
 $get_cats_res = mysql_query($get_cats) or die(mysql_error());

 if (mysql_num_rows($get_cats_res)  1)
 {
  $display_block = PemSorry, no categories to browse./em/P;
 }
 else
 {
  while ($cats = mysql_fetch_array($get_cats_res))
  {
   $cat_id = $cats[id_num];
   if ($cat_id != 53 || $cat_id != 54 || $cat_id != 55 || $cat_id
 != 117 || $cat_id != 118 || $cat_id != 74)

First of all remove the double quotes because you are dealing with integers.

Regards, Torsten

   {
   $cat_title = strtoupper(stripslashes($cats[id_name]));
   $cat_desc = stripslashes($cats[description]);
   $display_block .= stronga
 href=$_SERVER[PHP_SELF]?cat_id=$cat_id$cat_title
 $cat_desc/a/strongbr\n;
   while ($items = mysql_fetch_array($get_items_res))
{
 $item_id = $items[id];
 $item_num = $items[item_num];
 $item_desc = stripslashes($items[description]);
 if ($item_num != ABC-R37 || $item_num !=  ABC-R42 || $item_num
 != HB-99100 || $item_num != RO-PUMPS || $item_num != ML-HDGALJUG
 || $item_num != PFS-CAC21 || $item_num != PFS-CO2)
 {
 $item_num = ltrim($item_num);
 $item_num = rtrim($item_num);
 $display_block .= nbsp;nbsp;nbsp;nbsp;emstronga
 href=\catalog/$item_id.html\$item_num/a/strong -
 $item_desc/embr\n;
 }
}
 END SNIPPETS

 My assumption is that BOTH IF statements are not working correctly since
 the logic is that if they are built the same they would react the same.
 HELP!

 TIA!
 Robert

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



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

2004-04-22 Thread Daniel Clark
What about removing the quotes around the numbers.

 if ($cat_id != 53 || $cat_id != 54 || $cat_id != 55 etc...


 My IF statement should be picking up on the numbers, and if the number
 matches not be displaying out the information, however I look at the
 outputted page and the information is still there, what have I got wrong
 on the code?

 CODE SNIPPET
 //Show categories first
 $get_cats = select id_num, id_name, description, cat_code from
 categories order by id_name;
 $get_cats_res = mysql_query($get_cats) or die(mysql_error());

 if (mysql_num_rows($get_cats_res)  1)
 {
  $display_block = PemSorry, no categories to browse./em/P;
 }
 else
 {
  while ($cats = mysql_fetch_array($get_cats_res))
  {
   $cat_id = $cats[id_num];
   if ($cat_id != 53 || $cat_id != 54 || $cat_id != 55 || $cat_id
 != 117 || $cat_id != 118 || $cat_id != 74)
   {
   $cat_title = strtoupper(stripslashes($cats[id_name]));
   $cat_desc = stripslashes($cats[description]);
   $display_block .= stronga
 href=$_SERVER[PHP_SELF]?cat_id=$cat_id$cat_title
 $cat_desc/a/strongbr\n;
   while ($items = mysql_fetch_array($get_items_res))
{
 $item_id = $items[id];
 $item_num = $items[item_num];
 $item_desc = stripslashes($items[description]);
 if ($item_num != ABC-R37 || $item_num !=  ABC-R42 || $item_num
 != HB-99100 || $item_num != RO-PUMPS || $item_num != ML-HDGALJUG
 || $item_num != PFS-CAC21 || $item_num != PFS-CO2)
 {
 $item_num = ltrim($item_num);
 $item_num = rtrim($item_num);
 $display_block .= emstronga
 href=\catalog/$item_id.html\$item_num/a/strong -
 $item_desc/embr\n;
 }
}
 END SNIPPETS

 My assumption is that BOTH IF statements are not working correctly since
 the logic is that if they are built the same they would react the same.
 HELP!

 TIA!
 Robert

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



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



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

2004-04-22 Thread John W. Holmes
From: Robert Sossomon [EMAIL PROTECTED]

   if ($cat_id != 53 || $cat_id != 54 || $cat_id != 55 || $cat_id
 != 117 || $cat_id != 118 || $cat_id != 74)

Okay, if $cat_id is 53, this will work out to:

if(FALSE || TRUE || TRUE || TRUE || TRUE || TRUE)

which results in TRUE overall. 

You want  instead of ||

if ($cat_id != 53  $cat_id != 54  $cat_id != 55  $cat_id
!= 117  $cat_id != 118  $cat_id != 74)

which results in

if(FALSE  TRUE  TRUE  TRUE  TRUE  TRUE)

which results in FALSE overall.

---John Holmes...

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



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

2004-04-22 Thread Chris Shiflett
--- Robert Sossomon [EMAIL PROTECTED] wrote:
 if ($cat_id != 53 || $cat_id != 54 || $cat_id != 55 || $cat_id
 != 117 || $cat_id != 118 || $cat_id != 74)

That looks like a pretty big logical flaw to me. Just read that out loud
to yourself. It should be clear that this statement is equivalent to:

if (true)

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP-DB] using a define value

2004-04-22 Thread J. Alejandro Ceballos Z.
Then, is not possible to use a definition table for errors or equivalents?. 
It must be a variable value or a hash?

I am using this for error messages after a CGI execution. That is why 
planning to use a code for error, and definition table show the specific 
message.

Like http://myphppage.php?error=ERROR1;

 [snip...]
 But while trying to be called based on parameter, is not possible to 
call them via:

 $myerror = ERROR1;

   That would be $myerror= ERROR1;

 echo strongERROR._$myerror./strong;

   ... and that would be echo strong.ERROR.._$myerror./strong;
--

saludos,

 J. Alejandro Ceballos Z.   |
 ---+---
 http://alejandro.ceballos.info |
  [EMAIL PROTECTED] |  La persona más patética del
 ---+  mundo es alguien que tiene
|  vista, pero no visión.
|
|   -- Hellen Keller
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Problem after upgrading php ...

2004-04-22 Thread Hugh Taylor
I recently upgraded an existing 4.0.2 php installation to 4.3.6. 
Everything seemed to go OK (except I couldn't configure --with-imap, I'm 
not sure I have the imap source installed), but once I restarted 
everything some php pages that connect to a mysql database stopped 
working. The application that I upgraded php for (eGroupware) works 
fine, phpMyAdmin works, just the old php scripts we had someone else 
develop don't. MySQL is version 3.23.54, the OS is a Cobalt Qube 3 which 
is a version of Redhat LINUX.

It looks like the mysql_pconnect isn't working correctly. Any ideas?

--

Hugh
mailto: [EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Inserting a date in to DATE field

2004-04-22 Thread Pambos Nicolaou
Hi everyone,

Is there any MySQL command which inserts the date into a DATE field of a 
table automatically. For example the user inserts into the table several 
values (name, age, etc) and the date is inserted automatically.

Thanks in advance

Pambos.

_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


Re: [PHP-DB] Inserting a date in to DATE field

2004-04-22 Thread George Patterson
On Fri, 23 Apr 2004 01:32:36 +
Pambos Nicolaou [EMAIL PROTECTED] wrote:

 Hi everyone,
 
 Is there any MySQL command which inserts the date into a DATE field of
 a table automatically. For example the user inserts into the table
 several values (name, age, etc) and the date is inserted
 automatically.
 

Pambos,

Short answer not really.

You can get around it by using a timestamp data type. in you insert query, don't worry 
about setting the timestamp to a value and mysql will set it to the time and date as 
the time that the record was inserted.

The other way is to alter your insert queries to
insert into table set  date_field=now()

George Patterson

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



[PHP-DB] assigning variables after one-to-many query

2004-04-22 Thread Rachel Rodriguez
Hi!

I have a one-to-many relationship between two tables
(table1 and table3) with a linking table between
them (table2):

table1:  table2  
+---++   +---++  
|id | f_name |   |id | emailID|  
+---++   +---++  
| 1 | bill   |   | 1 |   1|  
| 2 | john   |   | 1 |   4|  
| 3 | diana  |   | 1 |   3|  
| 4 | victor |   | 2 |   2|  
| 5 | renata |   | 4 |   5|  
+---++   +---++  

table3
++-+
|emailID | email   | 
++-+
|   1| [EMAIL PROTECTED]|
|   2| [EMAIL PROTECTED] |   
|   3| [EMAIL PROTECTED]  |
|   4| [EMAIL PROTECTED] |
|   5| [EMAIL PROTECTED] | 
++-+

I would like to write a query that matches table1.id
with records
from table3.emailID via the linking table (table2) and
then 
assign each match to a variable.

Here is what I have:

$query = SELECT t3.email
  FROM   table3 AS t3
  LEFT JOIN table2 AS t2
  ON (t3.emailID = t2.emailID)
  LEFT JOIN table1 AS t1
  ON (t2.id = t1.id)
  WHERE t1.id = 1;

$result = @myql_query($query, $db_connection);

$num = mysql_num_rows($result);

$email1 = ;
$email2 = ;
$email3 = ;

if ($num  0)
{
while ($row = mysql_fetch_array($result))
{
   // do something here to assign
   // $email1 = $row[email] and 
   // $email2 = $row[email], etc.
}
}

Of course, the problem I am having is as I am going
through the while loop, I am assigning $email1,
$email2, and so on the 

same e-mail address.

I would like to get: $email1 = [EMAIL PROTECTED],
$email2 = [EMAIL PROTECTED], and $email3 =
[EMAIL PROTECTED]

I would prefer to do that rather than what I have seen
in most examples which is similar to the following:

// snippet of code

 while ($row = mysql_fetch_array($result))
 {
  echoBill's email is $row[email].;
 }

// end of snippet

Any assistance is greatly appreciated.

Thanks,
Rachel




__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash

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



Re: [PHP-DB] Inserting a date in to DATE field

2004-04-22 Thread John W. Holmes
Pambos Nicolaou wrote:

Is there any MySQL command which inserts the date into a DATE field of a 
table automatically. For example the user inserts into the table several 
values (name, age, etc) and the date is inserted automatically.
Set the column equal to NOW() or use a TIMESTAMP column (which will be 
set to NOW() when the row is created or updated unless you specify a 
specific value).

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

php|architect: The Magazine for PHP Professionals  www.phparch.com

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