[PHP-DB] undefined function error

2005-03-18 Thread Chip Wiegand
I have a web site that connects to a mysql database using this connect 
script -



When I access the page it gives me this error -

Fatal error: Call to undefined function: mysql_connect() in 
/usr/local/www/data-dist/connect on line 1 

Using mysql-4.1.10a for FreeBSD-5.3 with php-4.3.9

Any idea why I'm getting this error? (the same connect string works fine 
on a differant web server running  FreeBSD-5.2.1/php-4.3.6/mysql-3.23.49)

Thanks,
Chip

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



[PHP-DB] regex question

2005-03-07 Thread Chip Wiegand
I am writing some regex on a php form to validate input and have come up 
with this, for example -

if (empty($first) || !eregi("^[A-Za-z]+[- ]?[A-Za-z]+$", $first))

for checking a persons name. This allows a single name, or a hyphenated 
double name, or a non-hyphenated double name, and it works. My question is 
this - why is the third set followed by a '+' optional? I thought the + 
meant the preceding group is present 1 or more times. The ? means the 
preceding group is present 0 or more times. Why is it that when I put a ? 
in the place of the + after the last ] 

if (empty($first) || !eregi("^[A-Za-z]+[- ]?[A-Za-z]?$", $first))

the regex is broken?

Regards,
Chip

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



RE: [PHP-DB] odd results when running this

2005-01-28 Thread Chip Wiegand
Thanks, I did use your code as is, and it works perfectly.
Regards,
Chip

"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/28/2005 09:56:35 AM:

> What you should do then is to compare some value to only write the image 

> data if that value matchesin my code snippet, since you are writing 
the 
> same data, i just loop thru it and increment the image counter to output 
the 
> correct image. A better way to manage this might be to put the image 
name in 
> the db with all the other data as a separate field...then you just fill 
in 
> the image dataand reduce the code to pretty much what i had...
> 
> bastien
> 
> >From: Chip Wiegand <[EMAIL PROTECTED]>
> >To: php-db@lists.php.net
> >Subject: RE: [PHP-DB] odd results when running this
> >Date: Fri, 28 Jan 2005 09:17:35 -0800
> >
> >Thanks for the tips.
> >I find this confusing - I have 3 statements pulling 3 differant images, 
so
> >I don't understand why the script would run 3 times if there is not 
loop
> >telling it to do so. Shouldn't it just load each image and then stop?
> >Doesn't the while loop stop when it hits the last row?
> >--
> >Chip
> >
> >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/28/2005 08:37:58 
AM:
> >
> > > it runs three times because there are three rows of data and you are
> >setting
> > > the same thing for each set of data.
> > >
> > > try this
> > >
> > >  > > $sql="select * from hotspots";
> > > $result = mysql_query($sql);
> > > $x = 1;
> > >
> > > while ( $row = mysql_fetch_array($result))
> > >{
> > >  printf(" > > title=\"%s\">%s", $row["alt-text"],
> > > $row["title-text"], $row["desc-text"]);
> > >$x++;
> > >}
> > > ?>
> > >
> > > bastien
> > >
> > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > >To: "PHP DB" 
> > > >Subject: [PHP-DB] odd results when running this
> > > >Date: Fri, 28 Jan 2005 07:41:30 -0800
> > > >
> > > >Okay, so I have got the php bits working in this web page but it is
> > > >running 3 times every time the page loads, and I see no reason why 
(I
> >have
> > > >opened this page in two differant browsers). The code for the 
entire
> >page
> > > >is pasted below, it includes some calls to include files which are 
not
> > > >included in this message of course (and this file is itself 
included in
> > > >another file), the page can be seen at this address:
> > > >http://www.simradusa.com/index-test.php
> > > >If anyone can see any reason for the script to run 3 times please 
let
> >me
> > > >know.
> > > >Thanks,
> > > >Chip
> > > 
>==
> > > > > > >align="center"
> > > >summary="table that contains the body of the page">
> > > >
> > > >
> > > >
> > > >Welcome to Simrad, Inc
> > > >
> > > >Simrad is one of the world's largest manufacturers of marine
> >electronics
> > > >for the yachting,
> > > >fishery and commercial marine markets, offering sales and service
> > > >worldwide. A complete
> > > >range of products from Simrad is available for many different types 
of
> > > >marine activity,
> > > >including auto steering, navigation, hydro acoustic and 
communication
> > > >equipment. Ranging
> > > >from pleasure boating, through fishing and into commercial craft.
> >Please
> > > >select the type
> > > >of activity that you are interested in using the links on the left.
> > > >
> > > >
> > > >Read  > > >href="SimradNews/Spring2004/SimradNews-p1.html" target="_new"> > > >class="red">SimradNews - Your
> > > >quarterly guide to today's marine electronics (opens in a new
> >window) > > >/>
> > > >
> > > >
> > > > > > >/>
> > > >
> > > > > > >onclick="window.open('simnet.html','simnet','toolbar=no,width=450,
> > > height=500,left=0,top=0,screenX=0,screenY=0,status=no,
> > > scrollbars=yes,resize=yes');return
> > > >false"
> > 

RE: [PHP-DB] odd results when running this

2005-01-28 Thread Chip Wiegand
Thanks for the tips. 
I find this confusing - I have 3 statements pulling 3 differant images, so 
I don't understand why the script would run 3 times if there is not loop 
telling it to do so. Shouldn't it just load each image and then stop? 
Doesn't the while loop stop when it hits the last row?
--
Chip

"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/28/2005 08:37:58 AM:

> it runs three times because there are three rows of data and you are 
setting 
> the same thing for each set of data.
> 
> try this
> 
>  $sql="select * from hotspots";
> $result = mysql_query($sql);
> $x = 1;
> 
> while ( $row = mysql_fetch_array($result))
>{
>  printf(" title=\"%s\">%s", $row["alt-text"],
> $row["title-text"], $row["desc-text"]);
>$x++;
>}
> ?>
> 
> bastien
> 
> >From: Chip Wiegand <[EMAIL PROTECTED]>
> >To: "PHP DB" 
> >Subject: [PHP-DB] odd results when running this
> >Date: Fri, 28 Jan 2005 07:41:30 -0800
> >
> >Okay, so I have got the php bits working in this web page but it is
> >running 3 times every time the page loads, and I see no reason why (I 
have
> >opened this page in two differant browsers). The code for the entire 
page
> >is pasted below, it includes some calls to include files which are not
> >included in this message of course (and this file is itself included in
> >another file), the page can be seen at this address:
> >http://www.simradusa.com/index-test.php
> >If anyone can see any reason for the script to run 3 times please let 
me
> >know.
> >Thanks,
> >Chip
> >==
> > >align="center"
> >summary="table that contains the body of the page">
> >
> >
> >
> >Welcome to Simrad, Inc
> >
> >Simrad is one of the world's largest manufacturers of marine 
electronics
> >for the yachting,
> >fishery and commercial marine markets, offering sales and service
> >worldwide. A complete
> >range of products from Simrad is available for many different types of
> >marine activity,
> >including auto steering, navigation, hydro acoustic and communication
> >equipment. Ranging
> >from pleasure boating, through fishing and into commercial craft. 
Please
> >select the type
> >of activity that you are interested in using the links on the left.
> >
> >
> >Read  >href="SimradNews/Spring2004/SimradNews-p1.html" target="_new"> >class="red">SimradNews - Your
> >quarterly guide to today's marine electronics (opens in a new 
window) >/>
> >
> >
> > >/>
> >
> > >onclick="window.open('simnet.html','simnet','toolbar=no,width=450,
> height=500,left=0,top=0,screenX=0,screenY=0,status=no,
> scrollbars=yes,resize=yes');return
> >false"
> >  onmouseover="window.status='ANNOUNCING THE NEW SIMNET NETWORK';return
> >true;"
> >onmouseout="window.status='ANNOUNCING THE NEW SIMNET NETWORK'; return
> >true;"
> >  title="Read more about the SimNet" 
class="special-links">ANNOUNCING
> >THE NEW SIMNET NETWORK
> >
> >
> >
> >What's New
> > >$sql="select * from hotspots";
> >$result = mysql_query($sql);
> >while ( $row = mysql_fetch_array($result))
> >{
> >  printf(" >title=\"%s\">%s", $row["alt-text"],
> >$row["title-text"], $row["desc-text"]);
> >printf(" >title=\"%s\">%s", $row["alt-text"],
> >$row["title-text"], $row["desc-text"]);
> >printf(" >title=\"%s\">%s", $row["alt-text"],
> >$row["title-text"], $row["desc-text"]);
> >  }
> >?>
> >
> >
> >
> > >cellpadding="10" width="80%">
> >
> >
> >
> >
> > >onmouseover="window.status='Some Background information about
> >Simrad';return true;"
> >title="Some Background information about Simrad"
> >class="special-links">Simrad has built its name on
> >products which do what they are designed to do, whatever the 
conditions.
> >As part of  >href="http://www.kongsberg.com/";
> >onmouseover="window.status='The Kongsberg Maritime Corporate Home
> >Page';return true;"
> >title="Our corporate parent company home page" target="_blank"
> >class="special-links">Kongsberg Maritime, the largest
> >manufacturer of marine electronics in the world, Simrad manufactures
> >products which are
> >developed and built on the same principles as the company's 
sophisticated
> >electronics
> >for the demanding commercial shipping and fisheries market.
> >
> >
> >
> >
> >
> >--
> >PHP Database Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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



[PHP-DB] odd results when running this

2005-01-28 Thread Chip Wiegand
Okay, so I have got the php bits working in this web page but it is 
running 3 times every time the page loads, and I see no reason why (I have 
opened this page in two differant browsers). The code for the entire page 
is pasted below, it includes some calls to include files which are not 
included in this message of course (and this file is itself included in 
another file), the page can be seen at this address: 
http://www.simradusa.com/index-test.php
If anyone can see any reason for the script to run 3 times please let me 
know.
Thanks,
Chip
==




Welcome to Simrad, Inc

Simrad is one of the world's largest manufacturers of marine electronics 
for the yachting, 
fishery and commercial marine markets, offering sales and service 
worldwide. A complete 
range of products from Simrad is available for many different types of 
marine activity, 
including auto steering, navigation, hydro acoustic and communication 
equipment. Ranging 
from pleasure boating, through fishing and into commercial craft. Please 
select the type 
of activity that you are interested in using the links on the left.


Read SimradNews - Your 
quarterly guide to today's marine electronics (opens in a new window)




ANNOUNCING 
THE NEW SIMNET NETWORK



What's New
%s", $row["alt-text"], 
$row["title-text"], $row["desc-text"]);
   printf("%s", $row["alt-text"], 
$row["title-text"], $row["desc-text"]); 
   printf("%s", $row["alt-text"], 
$row["title-text"], $row["desc-text"]);
 } 
?>








Simrad has built its name on
products which do what they are designed to do, whatever the conditions. 
As part of http://www.kongsberg.com/";
onmouseover="window.status='The Kongsberg Maritime Corporate Home 
Page';return true;"
title="Our corporate parent company home page" target="_blank" 
class="special-links">Kongsberg Maritime, the largest
manufacturer of marine electronics in the world, Simrad manufactures 
products which are
developed and built on the same principles as the company's sophisticated 
electronics
for the demanding commercial shipping and fisheries market.





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



RE: [PHP-DB] storing images in database

2005-01-26 Thread Chip Wiegand
Thanks for all the tips guys. I'll keep the last couple for future 
reference.
--
Chip

Gareth Heyes <[EMAIL PROTECTED]> wrote on 01/26/2005 05:30:45 AM:

>  >> if(isset($_GET['id'])) {
>   >> $id=$_GET['id'];
>  >>  $query = "select bin_data, filetype from binary_data where id=$id";
> 
> This is a really bad example, anybody can inject your query with 
> malicious sql commands.
> Never trust user supplied data.
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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



RE: [PHP-DB] storing images in database

2005-01-25 Thread Chip Wiegand
I have done it an easier way, and probably a better way all-around anyway. 
I am storing the images in a directory and have the script call the 
file/alt text/title text and a description text in a paragraph below the 
image. It works quite well this way.
What I'm doing is on this home page there is a place for a 'hotspot', a 
special mention area for the latest news about a particular item. So I 
have a directory and in it will store an image file called 'latest.gif', 
so any new image that gets put here will overwrite the existing image. 
This will be fine for the purposes and the site.
Here is the code I have used -
%s", $row["alt-text"], 
$row["title-text"], $row["desc-text"]); 
   } 
?>
I'm sure there are many ways to do this sort of thing, but this is quick 
and easy, and works.
Thanks guys,
--
Chip
"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 01:06:01 PM:

> And how are you feeding the $id?are you setting a value for that 
> element?
> 
> In the sample code the default is the record_id that corresponds back to 
the 
> id of the row with the image blob field.
> 
> Bastien
> 
> 
> 
> 
> >From: Chip Wiegand <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >CC: "PHP DB" 
> >Subject: RE: [PHP-DB] storing images in database
> >Date: Tue, 25 Jan 2005 12:57:40 -0800
> >
> >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 12:46:12 
PM:
> >
> > > yes goes back to the whole header problem which is why you are here.
> > >
> > > If you could post the code, it would be simpler to help you...
> > >
> > > Bastien
> >
> >This is in the main page -
> > >printf(" >images\">%s", $row["text"]);
> >?>
> >and this is in a new included page -
> > >if($_GET['id']) {
> >$id = $_GET['id'];
> >$query = "select * from hotspots where id=$id";
> >$result = @MYSQL_QUERY($query);
> >
> >$data = @MYSQL_RESULT($result,0,"image");
> >$type = @MYSQL_RESULT($result,0,"type");
> >
> >Header( "Content-type: $type");
> >echo $data;
> >};
> >?>
> >The database connection statements are in an include file called at the
> >top of the main page. In the first statement shown above the alt text 
for
> >the image appears on the web page just fine, the image itself shows a
> >broken image icon. FWIW, I have the image stored in the database in a 
blob
> >field, is that correct?
> >--
> >Chip
> >
> > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > >To: [EMAIL PROTECTED]
> > > >Subject: RE: [PHP-DB] storing images in database
> > > >Date: Tue, 25 Jan 2005 12:44:44 -0800
> > > >
> > > >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 
12:39:15
> >PM:
> > > >
> > > > > Its not src='id=$id'> that will defnintely blow up
> > > > >
> > > > > echo '';
> > > > >
> > > > > where $id is the id of the record you are trying to get the 
image
> >to...
> > > > >
> > > > > Bastien
> > > >
> > > >So the code has to be a seperate included page I guess?
> > > >--
> > > >Chip
> > > >
> > > > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > > > >To: [EMAIL PROTECTED]
> > > > > >CC: php-db@lists.php.net
> > > > > >Subject: RE: [PHP-DB] storing images in database
> > > > > >Date: Tue, 25 Jan 2005 12:37:15 -0800
> > > > > >
> > > > > >Thanks Bastien,
> > > > > >In testing this I have added the code samples to a page and 
have it
> > > > > >working except the path statement is not correct. For now, I've
> >just
> > > >added
> > > > > >all the code to one page, rather than including a second page. 
The
> > > > > >statement - echo ''; is resulting in this 
error -
> >The
> > > > > >requested URL /id=$id was not found on this server. Any
> >suggestions?
> > > > > >Thanks,
> > > > > >Chip
> > > > > >
> > > > > >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005
> >09:45:39
> > > >AM:
> > > > > >
> > > > > > > the best way

RE: [PHP-DB] storing images in database

2005-01-25 Thread Chip Wiegand
"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 12:46:12 PM:

> yes goes back to the whole header problem which is why you are here.
> 
> If you could post the code, it would be simpler to help you...
> 
> Bastien

This is in the main page -
%s", $row["text"]);
?>
and this is in a new included page -

The database connection statements are in an include file called at the 
top of the main page. In the first statement shown above the alt text for 
the image appears on the web page just fine, the image itself shows a 
broken image icon. FWIW, I have the image stored in the database in a blob 
field, is that correct?
--
Chip

> >From: Chip Wiegand <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: RE: [PHP-DB] storing images in database
> >Date: Tue, 25 Jan 2005 12:44:44 -0800
> >
> >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 12:39:15 
PM:
> >
> > > Its not src='id=$id'> that will defnintely blow up
> > >
> > > echo '';
> > >
> > > where $id is the id of the record you are trying to get the image 
to...
> > >
> > > Bastien
> >
> >So the code has to be a seperate included page I guess?
> >--
> >Chip
> >
> > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > >To: [EMAIL PROTECTED]
> > > >CC: php-db@lists.php.net
> > > >Subject: RE: [PHP-DB] storing images in database
> > > >Date: Tue, 25 Jan 2005 12:37:15 -0800
> > > >
> > > >Thanks Bastien,
> > > >In testing this I have added the code samples to a page and have it
> > > >working except the path statement is not correct. For now, I've 
just
> >added
> > > >all the code to one page, rather than including a second page. The
> > > >statement - echo ''; is resulting in this error - 
The
> > > >requested URL /id=$id was not found on this server. Any 
suggestions?
> > > >Thanks,
> > > >Chip
> > > >
> > > >"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 
09:45:39
> >AM:
> > > >
> > > > > the best way to do this is to move the image processing code to 
a
> > > >separate
> > > > > page and include it like this
> > > > >
> > > > > echo '';
> > > > >
> > > > > then the image page looks like this:
> > > > >  > > > >
> > > > > if($_GET['id']) {
> > > > > $id = $_GET['id'];
> > > > > // you may have to modify login information for your database
> >server:
> > > > > @MYSQL_CONNECT("localhost","root","password");
> > > > >
> > > > > @mysql_select_db("binary_data");
> > > > >
> > > > > $query = "select bin_data,filetype from binary_data where 
id=$id";
> > > > > $result = @MYSQL_QUERY($query);
> > > > >
> > > > > $data = @MYSQL_RESULT($result,0,"bin_data");
> > > > > $type = @MYSQL_RESULT($result,0,"filetype");
> > > > >
> > > > > Header( "Content-type: $type");
> > > > > echo $data;
> > > > >
> > > > > };
> > > > > ?>
> > > > >
> > > > > bastien
> > > > >
> > > > >
> > > > >
> > > > > >From: Chip Wiegand <[EMAIL PROTECTED]>
> > > > > >To: "PHP DB" 
> > > > > >Subject: [PHP-DB] storing images in database
> > > > > >Date: Tue, 25 Jan 2005 09:11:07 -0800
> > > > > >
> > > > > >I have stored a .jpg image in a database, then when I make a 
sql
> > > >statement
> > > > > >to display that image on a web page all I get is the cryptic 
code
> >in
> > > >place
> > > > > >of the image. I am storing it in a row configured as a blob, 
mime
> >type
> > > > > >image/jpeg and binary (using phpMyAdmin). What am I doing 
wrong?
> > > > > >Regards,
> > > > > >Chip
> > > > > >
> > > > > >--
> > > > > >PHP Database Mailing List (http://www.php.net/)
> > > > > >To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > >
> > > > >
> > > > > --
> > > > > PHP Database Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > >
> > >
> > >
> >
> 
> 

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



RE: [PHP-DB] storing images in database

2005-01-25 Thread Chip Wiegand
Thanks Bastien,
In testing this I have added the code samples to a page and have it 
working except the path statement is not correct. For now, I've just added 
all the code to one page, rather than including a second page. The 
statement - echo ''; is resulting in this error - The 
requested URL /id=$id was not found on this server. Any suggestions?
Thanks,
Chip

"Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 09:45:39 AM:

> the best way to do this is to move the image processing code to a 
separate 
> page and include it like this
> 
> echo '';
> 
> then the image page looks like this:
>  
> if($_GET['id']) {
> $id = $_GET['id'];
> // you may have to modify login information for your database server:
> @MYSQL_CONNECT("localhost","root","password");
> 
> @mysql_select_db("binary_data");
> 
> $query = "select bin_data,filetype from binary_data where id=$id";
> $result = @MYSQL_QUERY($query);
> 
> $data = @MYSQL_RESULT($result,0,"bin_data");
> $type = @MYSQL_RESULT($result,0,"filetype");
> 
> Header( "Content-type: $type");
> echo $data;
> 
> };
> ?>
> 
> bastien
> 
> 
> 
> >From: Chip Wiegand <[EMAIL PROTECTED]>
> >To: "PHP DB" 
> >Subject: [PHP-DB] storing images in database
> >Date: Tue, 25 Jan 2005 09:11:07 -0800
> >
> >I have stored a .jpg image in a database, then when I make a sql 
statement
> >to display that image on a web page all I get is the cryptic code in 
place
> >of the image. I am storing it in a row configured as a blob, mime type
> >image/jpeg and binary (using phpMyAdmin). What am I doing wrong?
> >Regards,
> >Chip
> >
> >--
> >PHP Database Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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



[PHP-DB] storing images in database

2005-01-25 Thread Chip Wiegand
I have stored a .jpg image in a database, then when I make a sql statement 
to display that image on a web page all I get is the cryptic code in place 
of the image. I am storing it in a row configured as a blob, mime type 
image/jpeg and binary (using phpMyAdmin). What am I doing wrong?
Regards, 
Chip

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



RE: [PHP-DB] query of two tables returns too many rows, many more than the two tables contain

2004-11-11 Thread Chip Wiegand
"Gryffyn, Trevor" <[EMAIL PROTECTED]> wrote on 11/11/2004 
01:39:37 PM:

> This is a common join issue.  If you don't specify ANYTHING to connect
> between the two tables, it'll do one row from the first table, then ALL
> the rows from the second.  Row #2 from the first, then ALL the rows from
> the second.

> Just read the last thing you wrote.. Let me revise what I said then.
> 
> You say you want everything where there's an entry in Dealers, but no
> corresponding entry in blackgate_users eh?  That's an outer join.  Try
> this (syntax happy with SQL Server, I don't use MySQL a lot so it might
> be slightly different):
> 
> SELECT dealers.account_no,
>dealers.DealerName,
>blackgate_users.User_Name, 
>blackgate_users.DealerName
> FROM dealers left join blackgate_users on dealers.DealerName =
> blackgate_users.DealerName
> WHERE blackgate_users.DealerName is null
 
Thanks for the help. That gets me much closer. I did a count in both 
tables and figured there should be 121 rows returned by the query. The 
above select statement gets me 141 rows returned. With a little sleuthing 
around in there I will probably figure out what the extra 10 rows are.
Thanks you very much.
Regards,
Chip
 
> What this says is take everything in Dealers, left join it against
> blackgate_users (left join says to take everything from the left side..
> And match against the right side but leave NULL entries where there's no
> match).   Then we tell it that the field we want to compare is
> DealnerName in both cases.  The WHERE clause says only show us where
> DealerName is null (meaning no corresponding record in blackgate_users).
> 
> 
> I think that'll do it for ya.
> 
> -TG
> 
> 
> > -Original Message-
> > From: Chip Wiegand [mailto:[EMAIL PROTECTED] 
> > Sent: Thursday, November 11, 2004 4:28 PM
> > To: PHP DB
> > Subject: [PHP-DB] query of two tables returns too many rows, 
> > many more than the two tables contain
> > 
> > 
> > I have two tables I want to get out the rows that are 
> > different between 
> > them. The results I am getting is almost 50,000 rows, but the 
> > two tables, 
> > combined, contain only about 600 rows total. Here is the 
> > select statement 
> > -
> > 
> > SELECT dealers.account_no, dealers.DealerName, 
> > blackgate_users.User_Name, 
> > blackgate_users.DealerName
> > FROM dealers, blackgate_users
> > WHERE dealers.account_no NOT 
> > LIKE blackgate_users.User_Name
> > 
> > in these tables the 
> > dealers.account_no is the same data as the blackgate_users.User_Name
> > dealers.DealerName is the same data as the blackgate_users.DealerName
> > I just want the rows that are in the dealers table but not in the 
> > blackgate_users table. 
> > 
> > Thanks for any help,
> > Chip Wiegand
> > Computer Services
> > Simrad, Inc
> > 425-778-8821 
> > 425-771-7211 (FAX)
> > 
> > -- 
> > 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] query of two tables returns too many rows, many more than the two tables contain

2004-11-11 Thread Chip Wiegand
I have two tables I want to get out the rows that are different between 
them. The results I am getting is almost 50,000 rows, but the two tables, 
combined, contain only about 600 rows total. Here is the select statement 
-

SELECT dealers.account_no, dealers.DealerName, blackgate_users.User_Name, 
blackgate_users.DealerName
FROM dealers, blackgate_users
WHERE dealers.account_no NOT 
LIKE blackgate_users.User_Name

in these tables the 
dealers.account_no is the same data as the blackgate_users.User_Name
dealers.DealerName is the same data as the blackgate_users.DealerName
I just want the rows that are in the dealers table but not in the 
blackgate_users table. 

Thanks for any help,
Chip Wiegand
Computer Services
Simrad, Inc
425-778-8821 
425-771-7211 (FAX)

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



Re: [PHP-DB] How to do an update with arithmetic from a user input

2004-08-12 Thread Chip Wiegand
Justin Patrin <[EMAIL PROTECTED]> wrote on 08/12/2004 01:37:35 PM:

> Unless $part_number is a number, you're going to want to put quotes
> around it. Well, actually, you want to run mysql_real_escape_string()
> on it.
> 
> You also don't seem to have an end to that if statement. Usually,
> people use curly braces around those:
> 
> if(true) {
>   //do something
> }

Thanks, I'm making headway. This time when I entered a value and 
submitted, the database value for the qty field was not changed, but 
instead the description field was cleared. The database table has columns 
titled qty as well as description and others.

Regards,
Chip

The newest version of the code is this -





Part Number
Description
Quantity
List Price
Special Price
Put on Hold


%s\n\n", $row["part_number"]); 
printf("%s\n\n", $row["description"]);
printf("%s\n\n", $row["qty"]);
printf("%s\n\n", $row["list"]);
printf("%s\n\n", $row["special"]);
printf(" 
\n");
} 
?>








Re: [PHP-DB] How to do an update with arithmetic from a user input

2004-08-12 Thread Chip Wiegand
Justin Patrin <[EMAIL PROTECTED]> wrote on 08/12/2004 12:55:24 PM:

> On Thu, 12 Aug 2004 12:46:19 -0700, Chip Wiegand
> <[EMAIL PROTECTED]> wrote:
> > I have an existing database and web page showing the query results. I 
have
> > added another field to allow a user to input a two digit number. I 
want
> > that number to change the number in one of the existing columns for 
the
> > item it was input next to.
> > I have these columns -
> > 
> > Part Number Description QuantityList Price  Put on
> > hold
> > 
> > I want the Quantity column changed according to the number the user 
input
> > in the Put on hold column.
> > I'm stuck in the query to write, trying to do
> > 
> > $sql1 = "update refurbs set qty(qty - $qty) order by 'description'";
> 
> Perhaps:
> $sql1 = "update refurbs set qty = qty - $qty";
> 
> Also,
> 1) you have no WHERE there, so this will update *all* records.
> 2) why are you trying to order an update??

Thanks for the quick reply. The order by stuff is gone now, it was an 
'artifact'. hehe. Anyway, I added the where clause so my query looks like 
this:

$sql = "update refurbs set qty = qty - $buy where part_number = 
$part_number"; 

But when I try to run this I get an error -

Parse error: parse error, unexpected $ in 
/usr/local/www/data-dist/auth_dealers/refurbs-test.php on line 102 

I don't see an rogue $'s in the code.
(Eventually the form will submit to another page which will email the info 
to a person here in our office).
--
Chip
Now the code looks like this -
===




Part Number
Description
Quantity
List Price
Special Price
Put on Hold


%s\n\n", $row["part_number"]); 
printf("%s\n\n", $row["description"]);
printf("%s\n\n", $row["qty"]);
printf("%s\n\n", $row["list"]);
printf("%s\n\n", $row["special"]);
printf(" 
\n");
} 
?>








[PHP-DB] How to do an update with arithmetic from a user input

2004-08-12 Thread Chip Wiegand
I have an existing database and web page showing the query results. I have 
added another field to allow a user to input a two digit number. I want 
that number to change the number in one of the existing columns for the 
item it was input next to.
I have these columns -

Part Number Description QuantityList Price  Put on 
hold

I want the Quantity column changed according to the number the user input 
in the Put on hold column.
I'm stuck in the query to write, trying to do 

$sql1 = "update refurbs set qty(qty - $qty) order by 'description'";

but that doesn't work. I have pasted in the main part of the code below...
Thanks for any help you can provide,

Chip Wiegand
Computer Services
Simrad, Inc
425-778-8821 
425-771-7211 (FAX)

BTW, thanks for the replys to the first message, I was expecting the list 
to be much more busy.
===





Part Number
Description
Quantity
List Price
Special Price
Put on Hold


%s\n\n", $row["part_number"]); 
printf("%s\n\n", $row["description"]);
printf("%s\n\n", $row["qty"]);
printf("%s\n\n", $row["list"]);
printf("%s\n\n", $row["special"]);
printf(" 
\n");
} 
?>








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

2004-08-12 Thread Chip Wiegand
I just subscribed to the list yesterday and have yet to receive any 
messages from the list. Any ideas?
--
Chip Wiegand
Computer Services
Simrad, Inc
425-778-8821 
425-771-7211 (FAX)

RE: [PHP-DB] address info, forms, maintanance

2003-06-06 Thread chip . wiegand
"John W. Holmes" <[EMAIL PROTECTED]> wrote on 06/04/2003 05:24:22 
PM:

> > Thanks to everyone for the suggestions. Got it fixed. Just added a
> couple
> > lines of code -
> > $sql1 = "select * from endusers where name like '$name'";
> >$result1 = mysql_query($sql1);
> >  $count1 = mysql_num_rows($result1);
> >  if ($count1 == "0" )
> >$sql = "insert into endusers..blah blah blah
> 
> > Now it works fine, no more duplicate entries. 
> 
> But now you're doing two queries for every insert. If you simply made
> your columns unique and let the database handle it, you'd only have to
> do one INSERT. Then check affected_rows() or mysql_error() to see if
> either no rows were affected (no rows inserted) or the error mentions
> duplicate. If either is the case, the row wasn't inserted because of a
> unique constraint. If there is an error but it's not "duplicate" or
> whatever, then it's another error and you should show it. 
> 
> ---John W. Holmes...

Thanks for the tips, I'll work on that. In the meantime, this database is 
pretty
low useage, very specialized information for a small market segment, so 
for now
it will be okay. It'll never have hundreds or thousands of hits per day. 
But I 
will look into making the suggested changes.
Thanks,
Chip

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



Re: [PHP-DB] address info, forms, maintanance

2003-06-05 Thread chip . wiegand
Thanks to everyone for the suggestions. Got it fixed. Just added a couple 
lines of code - 
$sql1 = "select * from endusers where name like '$name'";
   $result1 = mysql_query($sql1); 
 $count1 = mysql_num_rows($result1);
 if ($count1 == "0" )
   $sql = "insert into endusers..blah blah blah

Now it works fine, no more duplicate entries. Just for those who asked - 
this is a database of end-user names
and addresses for a mailing list. The questions posted are kept by the 
department that responded to them. 
No one here has ever asked or implied a need to have the messages saved to 
the database, what they do
with the message is their game, not mine. I'm just cleaning up their 
existing code a bit.
--
Chip 

Miles Thompson <[EMAIL PROTECTED]> wrote on 06/04/2003 
08:31:14 AM:

> Chip,
> 
> Given that you have duplicate entries, then one field, or a combination 
of 
> several fields, will probably be unique.
> 
> Before adding a record execute a SELECT, using the values from the form 
> against that combination. If the number of records returned is greater 
than 
> 0, then execute an UPDATE query, otherwise an INSERT.
> 
> Now, that information is so vague to be almost useless, for it begs a 
> number of other questions, such as
> How many questions are end users allowed to ask?
> How are questions flagged for expiration or completion/solution?
> What kind of mix of questions do you allow?
> 
> Cookies only store a bit of information on the user's browser. There's 
> nothing magic about them - google for "netscape cookies". I don't think 
> they'd be much help to you here.
> 
> HTH - Miles Thompson
> 
> At 01:13 PM 6/4/2003 -0700, [EMAIL PROTECTED] wrote:
> >I need to modify some company web pages that include a form for asking 
the
> >company departments questions, such as service dept, etc. As the forms 
are
> >currently built there is some field validation but no cookies. This 
info
> >is saved in a mysql database, problem is, there are duplicate entries,
> >every time an  end-user posts a question. What kind of code do I need 
to
> >add to these existing pages to prevent duplicate entries in the 
database?
> >(Manually scanning through and deleting dupes is a real drag.) And what
> >about cookies? Could I make use of these on these pages? I haven't 
worked
> >with cookies yet, so am not sure where to start with that part.
> >Thanks,
> >--
> >Chip
> >
> >--
> >PHP Database Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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



Re: [PHP-DB] address info, forms, maintanance

2003-06-05 Thread chip . wiegand
Dan Brunner <[EMAIL PROTECTED]> wrote on 06/04/2003 01:24:13 PM:

> Hello!!
> Are talking about the same "Post Question"???
> On another words, what is being duplicated??
> If not, you can use auto_increment.
> Dan

This pertains to every time a person visits the page and fills in the form 
- today, tommorrow, next week, next month, whenever. The address info is 
being written to the database each time they send the form. The message 
body itself isn't saved to the database, only the name and address info.
--
Chip

> On Wednesday, June 4, 2003, at 03:13  PM, [EMAIL PROTECTED] wrote:
> 
> > I need to modify some company web pages that include a form for asking 

> > the
> > company departments questions, such as service dept, etc. As the forms 

> > are
> > currently built there is some field validation but no cookies. This 
> > info
> > is saved in a mysql database, problem is, there are duplicate entries,
> > every time an  end-user posts a question. What kind of code do I need 
> > to
> > add to these existing pages to prevent duplicate entries in the 
> > database?
> > (Manually scanning through and deleting dupes is a real drag.) And 
what
> > about cookies? Could I make use of these on these pages? I haven't 
> > worked
> > with cookies yet, so am not sure where to start with that part.
> > Thanks,
> > --
> > Chip
> >
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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



[PHP-DB] address info, forms, maintanance

2003-06-05 Thread chip . wiegand
I need to modify some company web pages that include a form for asking the 
company departments questions, such as service dept, etc. As the forms are 
currently built there is some field validation but no cookies. This info 
is saved in a mysql database, problem is, there are duplicate entries, 
every time an  end-user posts a question. What kind of code do I need to 
add to these existing pages to prevent duplicate entries in the database? 
(Manually scanning through and deleting dupes is a real drag.) And what 
about cookies? Could I make use of these on these pages? I haven't worked 
with cookies yet, so am not sure where to start with that part.
Thanks,
--
Chip

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



Re: [PHP-DB] Odd browser problem with sessions

2003-01-29 Thread chip wiegand
On Wed, 29 Jan 2003 08:30:31 -0600
[EMAIL PROTECTED] wrote:

> IE 5.01 has an issue with its basic auth. There is no patch, only an
> upgrade path
> 
> 
> Gary Every

I wish it were that simple, it happens in all versions of IE. I've 
tested it myself in the latest versions and it happens. I get at least
one phone call a day from people asking why they can't log in, the 
screen just reloads. I suggest to them to upgrade to Mozilla, Netscape
or Opera.
--
Chip

> Sr. UNIX Administrator
> Ingram Entertainment
> (615) 287-4876
> "Pay It Forward"
> mailto:[EMAIL PROTECTED]
> http://accessingram.com
> 
> 
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 28, 2003 2:02 PM
> To: PHP-DB List
> Subject: [PHP-DB] Odd browser problem with sessions
> 
> 
> I have a web site that is protected using sessions, and it works fine.
> 
> Only occasionally
> when a end-user tries to log in using IE the login screen will just 
> reload, every time they
> try to log in. I found that by closing IE (all windows) then trying
> again, it will go on to the 
> proper page. This behavior appears to only effect IE, I saw it once on
> 
> either Netscape
> or Mozilla (I don't recall which), and no one I've talked to on the
> phone has had this 
> problem in any browser other than IE, and there have been many calls
> about this. Any
> idea what this might be caused by?
> Thanks,
> --
> Chip Wiegand
> Computer Services
> Simrad, Inc
> www.simradusa.com
> [EMAIL PROTECTED]
> 
> "There is no reason anyone would want a computer in their home."
>  --Ken Olson, president, chairman and founder of Digital Equipment
>  
> Corporation, 1977
>  (Then why do I have 8? Somebody help me!)
> 
> -- 
> 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] Odd browser problem with sessions

2003-01-28 Thread chip . wiegand
I have a web site that is protected using sessions, and it works fine. 
Only occasionally
when a end-user tries to log in using IE the login screen will just 
reload, every time they
try to log in. I found that by closing IE (all windows) then trying again, 
it will go on to the 
proper page. This behavior appears to only effect IE, I saw it once on 
either Netscape
or Mozilla (I don't recall which), and no one I've talked to on the phone 
has had this 
problem in any browser other than IE, and there have been many calls about 
this. Any
idea what this might be caused by?
Thanks,
--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment 
Corporation, 1977
 (Then why do I have 8? Somebody help me!)

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




[PHP-DB] query results page ignores style sheet reference

2002-12-12 Thread chip . wiegand
I have a site I have to convert to frames (*ugh*) (so I'm using php frames,
better
than html frames anyway) and came up with a little problem.
On one page is a list of states, click on the state name and get a list of
dealers in
that state. This works. What doesn't work is the list of dealers page
ignores the
style sheet somewhat, so the original page looks great, the results page
doesn't.
What's happening is the original page has certain font sizes dictated by
the style
sheet, but the results page uses the browsers defaults for the fonts. Other
style
sheet attributes are obeyed by the results page. This is quite strange.
Anyone
seen this behavior before?

--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 8? Somebody help me!)



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




[PHP-DB] database update question

2002-11-15 Thread chip . wiegand
I have a database with several hundred entries of file names that end with
.pdf. I have converted
all those docs to .zip, now I need to change all the entries in the
database to .zip. I tried to use
update table_name set col_name='%.zip' where col_name like '%.pdf' && id
= '11'
but of course that changed the file name for id 11 to %.zip. Is there a way
to change all the
entries from .pdf to .zip without writing an update statement for each
individual row?

--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 8? Somebody help me!)



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




[PHP-DB] database update question

2002-11-15 Thread chip . wiegand
I have a database with several hundred entries of file names that end with
.pdf. I have converted
all those docs to .zip, now I need to change all the entries in the
database to .zip. I tried to use
update table_name set col_name='%.zip' where col_name like '%.pdf' && id
= '11'
but of course that changed the file name for id 11 to %.zip. Is there a way
to change all the
entries from .pdf to .zip without writing an update statement for each
individual row?

--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 8? Somebody help me!)



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




Re: [PHP-DB] a menu item from a database, linked to a list from a anothertable

2002-11-14 Thread chip . wiegand

Jason Wong <[EMAIL PROTECTED]> wrote on 11/13/2002 10:46:32 PM:

> On Thursday 14 November 2002 07:32, [EMAIL PROTECTED] wrote:
> > Is this even possible? I have a menu that is generated from a table.

> What is your menu -- a set of  tags? or a selector box? I suspect you
mean
> the latter ...

Not a list box, but a menu of about 15 category titles, all shown on the
page in
a list, click on category get the category items listed. Both the category
titles
and the individual items will come from a database.
I am trying this to make a faq's page - list the faq categories, click on
the
category and get the list of faq's. The first part is easy, the second part
is
easy, both seperately.
I am wondering if I can make the first part (title) be a link to select the
items
for the category from a database. I've seen this done before, but the app I
was
looking at had so many include files referencing other include files that
getting
it all straight was near impossible.

--
Chip

> > Typically, the menu items are links
> > to html pages. I would like to have the link bring up a list of items
from
> > another table in the database,
> > not an html page. So I guess this would be a select statement linked
from a
> > select statement?
> > Is this even possible?

> Yes, google -> "dynamic linked listbox php".

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

>
> /*
> The early bird who catches the worm works for someone who comes in late
> and owns the worm farm.
>   -- Travis McGee
> */

>
> --
> 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] a menu item from a database, linked to a list from a another table

2002-11-13 Thread chip . wiegand
Is this even possible? I have a menu that is generated from a table.
Typically, the menu items are links
to html pages. I would like to have the link bring up a list of items from
another table in the database,
not an html page. So I guess this would be a select statement linked from a
select statement?
Is this even possible?

--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 8? Somebody help me!)



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




[PHP-DB] alter table statement from within php web page

2002-10-01 Thread Chip Wiegand

I would like to know how to add columns to an existing table. I've tried
this -

$qry = mysql_query("alter table exercises add column $fieldname
char($length) not null") or die(sql_error());

but it doesn't work, I get this error -

1064: You have an error in your SQL syntax near 'lifts, char(25), not
null' at line 1

I don't see any reference to this in the php manual or in the two
php/mysql books that I have.

Anybody know how to do this?

--
Chip




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




Re: [PHP-DB] alter table statement from within php web page

2002-10-01 Thread Chip Wiegand

Forget it, It works, I was entering a field name with a space in it, and
that was causing the problem. Duh!

--
Chip

phpdbOn Tue, 2002-10-01 at 22:01, Chip Wiegand wrote:
> I would like to know how to add columns to an existing table. I've tried
> this -
> 
> $qry = mysql_query("alter table exercises add column $fieldname
> char($length) not null") or die(sql_error());
> 
> but it doesn't work, I get this error -
> 
> 1064: You have an error in your SQL syntax near 'lifts, char(25), not
> null' at line 1
> 
> I don't see any reference to this in the php manual or in the two
> php/mysql books that I have.
> 
> Anybody know how to do this?
> 
> --
> Chip
> 
> 
> 
> 
> -- 
> 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] big sessions problem - page refusing to load, but will if I skip the logonpage

2002-09-30 Thread chip . wiegand

I have a logon screen that starts a session for several other pages and it 
has been working great, 
over the weekend something happened. I checked the site from home and 
after login the main
page would not load, just a white screen and view source showed absolutely 
nothing. Now I'm in the
office and looking at the source code and I don't see anything wrong, 
nothing changed. I can load the
pages by skipping the logon and typing in the complete url manually and 
they all load just fine, soon
as I try to use the logon screen the first main page after it will not 
load, if I enter the full url to another
protected page it will load, then I can use the links for the main page 
and it too will now load. Just after
the logon, the main page will not load. I have tried this with both my own 
login and a users login and
it is happening to all.
Any idea what could be causing this? I've gotta get this fixed ASAP, 
perminently, this is a business web
site. The code for the login screen and the main page are pasted below.
Regards,
--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment 
Corporation, 1977
 (They why do I have 9? Somebody help me!)
=
Code for authorization login:
---



Login



   
  Please log in to access the page you requested.
   
  
 ID
 

 
  
  
 Password
 

 
  
  
 

 
  
   
   



Authorization failed." .
   "Sorry, you must enter a valid userid and password combo. " 
.
   "This site is restricted to Simrad Authorized Dealers 
only.\n";
  echo "Click here to try again.";
  echo "If you are a Simrad Authorized Dealer and \n";
echo "you are not a member yet,please " .
   "call Simrad, Inc and request your login information.\n";
  echo "If you are not a Simrad Authorized Dealer please click on 
the \n";
echo "following link to return to our home page 
\n";
echo "Simrad, 
Inc\n";
  exit;
   }
  // else 
  // { 
//echo "Click here to continue";
//header( 'Location: dealers_page.php' ); 
  // } 
}
?>

==
Code for the main page after the successful login:
-

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

http://www.w3.org/1999/xhtml";>
  
%s", $row["name"]); } 
   ?>




/*<![CDATA[*/
td.small {font-size: 75%}
.red {color: red;
  font-size: 75%; }
.black {color: black;
  font-size: 75%; }
.big {font-size: 150% }
/*]]>*/




http://t.extreme-dm.com/?login=sim100";>
 <!--
EXs=screen;EXw=EXs.width;navigator.appName!="Netscape"?
EXb=EXs.colorDepth:EXb=EXs.pixelDepth;//-->
<!--
EXd=document;EXw?"":EXw="na";EXb?"":EXb="na";
EXd.write("<img src=\"<A  HREF="http://t0.extreme-dm.com"">http://t0.extreme-dm.com"</A>;,
"/0.gif?tag=sim100&j=y&srw="+EXw+"&srb="+EXb+"&",
"l="+escape(EXd.referrer)+"\" height=1 width=1>");//-->
http://t0.extreme-dm.com/0.gif?tag=sim100&j=n";>


   

  

 
 
  


   
  
  
   

  
";
printf("%s", $row["name"]);
print ""; } 
?>





= 118 order by 
'order'";
$result = mysql_query($sql);
while ( $row = mysql_fetch_array($result))
{ 
printf("%s", $row["page"], 
$row["name"]);
} 
?>





















  
   
 Welcome to the Simrad Authorized Dealers web pages. 
Here you will be able to 
 connect to the 
eBusiness Manager web site, read Dealer Bulletins, and more as we 
 continue to build 
this section of our web site. Please feel free to contact us 
 with suggestions 
for what you would like to see in this section.
 
  

[PHP-DB] advise needed for 'authorized only' site

2002-09-23 Thread chip . wiegand

I have set up a section of my company site for use by authorized dealers
only. I am currently using
mysql authorization, which works for the first page, but if someone were to
type in the url of an
underlying page they would be able to get in without authorization. I know
I could use .htaccess
for handling this but with a minimum of 350 -400 users to keep track of
that would be unwieldly to
say the least, especially for my boss who doesn't have a clue about *nix
and has never even heard
of .htaccess.

What other options do I have to keep the underlying pages from being
accessed without the user
being forced to go through the logon screen?

Thanks,

--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 9? Somebody help me!)


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




Re: [PHP-DB] how do I echo this statement to the browser? -solved

2002-09-21 Thread Chip Wiegand

Thanks for the tip, I solved it a little differently -

sql1="select f_name, l_name, count(*) as 'Attendance' from kids group by
l_name";
sql2="select count(distinct kids_id) as 'total' from kids";

I added a new column to the database called kids_id, so when a new kid
is added he/she gets assigned a number, if a record is added for an
existing kid the new record keeps the existing kids_id, making it simple
to count only distinct kids_id's.

The input form lists the kids_id, f_name, l_name as a link to edit their
record, and delete for a delete link, in the left column, and in the
right is the form for input/editing. The kids list is ordered by
kids_id, making it easy to know what id's already exist, or don't yet.
--
Chip

On Sat, 2002-09-21 at 01:39, Ignatius Reilly wrote:
> This is a query requiring two different levels of aggregation. MySQL does
> not support it.
> 
> You can reduce it to two different queries
> 
> SELECT f_name, l_name, COUNT(*) AS Total_Kids
> FROM kids
> GROUP BY l_name
> 
> and
> 
> SELECT COUNT(*) AS Total_Rows
> FROM kids
> 
> your result will have columns $row1['Total_Kids'] and $row2['Total_Rows']
> 
> When MySQL supports subqueries, you can write:
> 
> SELECT f_name, l_name, COUNT(*) AS Total_Kids
> FROM kids
> GROUP BY l_name
> JOIN
> SELECT COUNT(*) AS Total_Rows
> FROM kids
> 
> HTH
> Ignatius
> 
> - Original Message -
> From: "Chip Wiegand" <[EMAIL PROTECTED]>
> To: "phpdb" <[EMAIL PROTECTED]>
> Sent: Saturday, September 21, 2002 7:18 AM
> Subject: [PHP-DB] how do I echo this statement to the browser?
> 
> 
> > I want to get the first name, last name, total row count, and total time
> > a name appears in the database. Something like this -
> >
> > select f_name, l_name, count(*) as 'Total Kids', count distinct l_name
> > from kids group by l_name
> >
> > it doesn't work of course, the count distinct l_name part is completely
> > wrong. The database has kids names in it appearing multiple times,
> > whence the need for distinct, I want the total number of times it
> > appears though. Plus, how do I echo the number for 'Total Kids' on the
> > browser? I don't have a column heading to reference like with f_name and
> > l_name.
> >
> > I s'pose this is clear as mud.
> >
> > Thanks for any help you all can provide,
> > Chip
> >
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 



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




[PHP-DB] how do I echo this statement to the browser?

2002-09-20 Thread Chip Wiegand

I want to get the first name, last name, total row count, and total time
a name appears in the database. Something like this -

select f_name, l_name, count(*) as 'Total Kids', count distinct l_name
from kids group by l_name

it doesn't work of course, the count distinct l_name part is completely
wrong. The database has kids names in it appearing multiple times,
whence the need for distinct, I want the total number of times it
appears though. Plus, how do I echo the number for 'Total Kids' on the
browser? I don't have a column heading to reference like with f_name and
l_name.

I s'pose this is clear as mud.

Thanks for any help you all can provide,
Chip




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




[PHP-DB] update db problem

2002-09-10 Thread chip . wiegand

I am making a web form for entering/editing/deleting items from a database,
the entering and deleting
parts work fine. The editing part is giving me some problems -
Here's the code -

 List
RMA's";
} elseif ($delete) {
 // delete a record
$sql = "DELETE FROM rma WHERE id=$id";
$result = mysql_query($sql);
echo "Deleted!List RMA's";
} else {
  // this part happens if we don't press submit
  if (!$id) {
// print the list if there is not editing
$result = mysql_query("SELECT * FROM rma",$db);
while ($myrow = mysql_fetch_array($result)) {
  printf("%s %s \n", $PHP_SELF, $myrow["id"],
$myrow["rma_no"], $myrow["rma_name"], $myrow["rec_date"], $myrow
["rma_status"]);
   printf("(DELETE)",
$PHP_SELF, $myrow["id"]);
}
  }

  if ($id) {
// editing so select a record
$sql = "SELECT * FROM rma WHERE id=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$id = $myrow["id"];
$rma_no = $myrow["rma_no"];
$rma_name = $myrow["rma_name"];
$rec_date = $myrow["rec_date"];
$rma_status = $myrow["rma_status"];
// print the id for editi
?>

  

What is happening is when I click on an item on the list it will display
all the fields except rma_status (a textarea form field).
When I make any changes and press submit, the changes to fields other than
rma_status, those fields are updated or left
as is, but the rma_status textarea is wiped out.
Also, instead of updating the current item in the db, it is submitting
another row into the database, giving multiple rows of
the same rma, but with each one showing it's edits over time. This would be
fine for historical purposes, but not what I want.

What am I doing wrong?

--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 9? Somebody help me!)


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




Re: [PHP-DB] verify text entry in a textarea doesn't work

2002-08-27 Thread chip . wiegand


Thankyou Jason, the problem was indeed in the html code. The code was
broken
into multiple lines and indented, by moving it all onto one line with no
spaces between the >< it now works. Also, when I tab or place the cursor
inside
the textarea, the cursor now is placed in the upper left corner, whereas
before
it was one tab furthor into the box, now I know why that happens also.

thanks,
--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 9? Somebody help me!)

Jason Wong <[EMAIL PROTECTED]> wrote on 08/27/2002 09:24:35 AM:

> On Tuesday 27 August 2002 23:26, [EMAIL PROTECTED] wrote:
> > I have some error checking routines for my web forms, and they are
working
> > great except for one
> > field, a textarea field. I am using the following code, but it does not
> > give an error when the field is
> > empty:
> >
> > if (empty($feedback))
> > {
> > $errmsg .= "You might want to enter some
> > comments\n";
> > }

> Presumably $errmsg is not appended to because empty($feedback) is FALSE.
IOW
> $feedback is not empty, IOW $feedback contains something. What I'm
getting at
> is when trying to debug some code, use a liberal dose of common-sense and
> logic.

> Print it out to see what it contains. Most likely it's whitespace. To
convince
> yourself that it does contain something use strlen().

> > I use the same type of checking on input type="text" boxes and it works
> > fine.
> > Any ideas why it doesn't work on a textarea field?

> What HTML code are you using to display the textarea field? Make sure
there
> are no spaces and/or newlines in there.

> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk


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




[PHP-DB] verify text entry in a textarea doesn't work

2002-08-27 Thread chip . wiegand

I have some error checking routines for my web forms, and they are working
great except for one
field, a textarea field. I am using the following code, but it does not
give an error when the field is
empty:

if (empty($feedback))
{
$errmsg .= "You might want to enter some
comments\n";
}

I use the same type of checking on input type="text" boxes and it works
fine.
Any ideas why it doesn't work on a textarea field?

--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 9? Somebody help me!)


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




Re: [PHP-DB] form validation question - regex not working

2002-08-21 Thread chip . wiegand

Jason Wong <[EMAIL PROTECTED]> wrote on 08/21/2002 12:10:02 PM:
> It's only checking for addresses of the form [EMAIL PROTECTED]

> As you can see, the list address ([EMAIL PROTECTED]), and my address
> ([EMAIL PROTECTED]) would be treated as invalid. Not very clever is
it?

Got it figured out, and foreign address do work now -
if (empty($useremail) ||
!eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])+\.([A-Za-z])+\.([a-z])*$",
$useremail))

--
Chip


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




Re: [PHP-DB] form validation question - regex not working

2002-08-21 Thread chip . wiegand

Jason Wong <[EMAIL PROTECTED]> wrote on 08/21/2002 10:00:23 AM:

> On Thursday 22 August 2002 00:29, [EMAIL PROTECTED] wrote:
> > I hope this isn't too far off topic -
> >
> > I have a regex for validating email addresses -
> >
> > if (empty($useremail) || !eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])
+\.
> > ([A-Za-z]{2,3})+$", $useremail))
> >
> > Notice the {2,3} which is supposed to limit the last part to 2 or 3
> > letters, but I have been testing this and
> > it allows as many letters as I put in there, but not 1 only.
> > What's wrong?
> > Also, when using eregi do I need to specify A-Za-z or just a-z, since
it is
> > case-insensitive?

> You're strongly advised not to write your own regex for validating email
> addresses. Your regex (once you get it working) will invalidate a lot of
> valid email addresses. Search archives, or google for some tried and
tested
> regex which will do the job properly.

> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

This is from a php/mysql book. I added the parenthesis simply to group the
sections, and added the {2,3} because a web site tutorial shows that will
limit the preceding section to that many characters (2 or 3 only in this
case).
The script works fine without the {2,3}, and I may have to use it that way,
since another response mentioned foreign addresses, I hadn't taken into
account.
I'd just like to know why it doesn't work, becuase the it's supposed to.

--
Chip

> /*
> The most important things, each person must do for himself.
> */

Interesting tag considering your respoonse that I shouldn't do this mysqlf,
eh? :-)


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




[PHP-DB] form validation question - regex not working

2002-08-21 Thread chip . wiegand

I hope this isn't too far off topic -

I have a regex for validating email addresses -

if (empty($useremail) || !eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])+\.
([A-Za-z]{2,3})+$", $useremail))

Notice the {2,3} which is supposed to limit the last part to 2 or 3
letters, but I have been testing this and
it allows as many letters as I put in there, but not 1 only.
What's wrong?
Also, when using eregi do I need to specify A-Za-z or just a-z, since it is
case-insensitive?

--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 9? Somebody help me!)


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




Re: [PHP-DB] keeping form field data when reloading a form

2002-08-21 Thread chip . wiegand

Thanks, that works great.

--
Chip

"Stuart McDonald" <[EMAIL PROTECTED]> wrote on 08/20/2002 05:55:40
PM:

> Are you setting the variables in the form?

> Something like this - note the value field in the username field:

>  
>align="center" cellpadding="1" cellspacing="0" border="0" bgcolor="
#ff">
>   
>   Username:
>   
>   
>   
>Password:
>size="15" style="width: 120px; font-size: 12px">
>   
>   
>     
>style="width: 50px; heigth: 18px; font-size: 12px">
>   
>   
>  

> This way, depending on how youare refreshing the login form, if the
> $username variable passed your validation tests it should be set
> automatically into the form.

> Cheers

> Stuart

>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: "PHP_DB" <[EMAIL PROTECTED]>
> Sent: Wednesday, August 21, 2002 12:58 AM
> Subject: [PHP-DB] keeping form field data when reloading a form

>
> > I have my email checker working now, and all the other fields are
checked
> > also, but when I do enter
> > some wrong data the form is reloaded with all blank fields. I'm sure
there
> > is a way to keep the existing
> > data in the fields so the end-user will only have to change the
incorrect
> > fields, and not have to re-enter
> > all the data. But how?
> >
> > --
> > Chip Wiegand
> > Computer Services
> > Simrad, Inc
> > www.simradusa.com
> > [EMAIL PROTECTED]
> >
> > "There is no reason anyone would want a computer in their home."
> >  --Ken Olson, president, chairman and founder of Digital Equipment
> > Corporation, 1977
> >  (They why do I have 9? Somebody help me!)
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >

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


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




[PHP-DB] keeping form field data when reloading a form

2002-08-20 Thread chip . wiegand

I have my email checker working now, and all the other fields are checked
also, but when I do enter
some wrong data the form is reloaded with all blank fields. I'm sure there
is a way to keep the existing
data in the fields so the end-user will only have to change the incorrect
fields, and not have to re-enter
all the data. But how?

--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 9? Somebody help me!)


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




Re: [PHP-DB] what's wrong with this ereg?

2002-08-20 Thread chip . wiegand

Steve Cayford <[EMAIL PROTECTED]> wrote on 08/20/2002 10:28:46 AM:

> Well, one thing is you've got mismatched parentheses. You need another
> another opening paren right after the "if".

> Also, don't you need to escape the last hyphen in your character sets?
> As well as the . before the third character set?

> -Steve

Got it fixed like this:

if (empty($useremail) || !eregi("^[A-Za-z0-9\.\_-]+@[A-Za-z0-9\_-]
+\.[A-Za-z0-9\_-]+$", $useremail))

--
Chip

> On Tuesday, August 20, 2002, at 11:11  AM, [EMAIL PROTECTED] wrote:

> > I am trying an email verification function, like this:
> >
> >  if (empty($useremail)) || !eregi("^[A-Za-z0-9\_-]+@[A-Za-z0-9\_-]
> > +.[A-Za-z0-9\_-]+.*", $email))
> >   {
> >$errmsg .= "The email address appears to be invalid\n";
> >   }
> >
> > But it will not work, on one server I get this error:
> > Parse error: parse error in
> > /home/virtual/site109/fst/var/www/html/auth_dealers/user_input2.php on
> > line
> > 70
> > and on another server I get this error:
> > Parse error: parse error, unexpected T_BOOLEAN_OR in
> > /usr/local/apache/htdocs/auth_dealers/user_input2.php on line 70
> >
> > What do I need to do to fix this?
> >
> > --
> > Chip Wiegand
> > Computer Services
> > Simrad, Inc
> > www.simradusa.com
> > [EMAIL PROTECTED]
> >
> > "There is no reason anyone would want a computer in their home."
> >  --Ken Olson, president, chairman and founder of Digital Equipment
> > Corporation, 1977
> >  (They why do I have 9? Somebody help me!)
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >

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


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




[PHP-DB] what's wrong with this ereg?

2002-08-20 Thread chip . wiegand

I am trying an email verification function, like this:

 if (empty($useremail)) || !eregi("^[A-Za-z0-9\_-]+@[A-Za-z0-9\_-]
+.[A-Za-z0-9\_-]+.*", $email))
  {
   $errmsg .= "The email address appears to be invalid\n";
  }

But it will not work, on one server I get this error:
Parse error: parse error in
/home/virtual/site109/fst/var/www/html/auth_dealers/user_input2.php on line
70
and on another server I get this error:
Parse error: parse error, unexpected T_BOOLEAN_OR in
/usr/local/apache/htdocs/auth_dealers/user_input2.php on line 70

What do I need to do to fix this?

--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 9? Somebody help me!)


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




Re: [PHP-DB] oddity with insert multiple input fields - olved

2002-08-18 Thread Chip Wiegand

On Sun, 2002-08-18 at 01:20, Joni Järvinen wrote:
> > if (!isnull($date_am || $exercise_am || $reps_am)) then
> > mysql_query($sql_am) or die
> > ("Error in this query >>$sql<< : " .mysql_error());
> 
> Try:
> 
> if(!isnull($date_am) && !isnull($exercise_am) && !isnull($reps_am))
> 
> This should IMO work :)
> 
> -Joni-

Got it working like this -

  $sql_am = "insert into absmachine (today,exercise,reps,comments)
values ('$date_am','$exercise_am','$reps_am','$comments_am')";
if(!empty($date_am) && !empty($exercise_am) && !empty($reps_am)
  mysql_query($sql_am) or die ("Error in this query >>$sql<< : "
.mysql_error());

Thanks to everyone for pointing me in the right direction.

--
Chip


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




Re: [PHP-DB] oddity with insert multiple input fields tomultipletables

2002-08-18 Thread Chip Wiegand

On Sun, 2002-08-18 at 01:20, Joni Järvinen wrote:
> > if (!isnull($date_am || $exercise_am || $reps_am)) then
> > mysql_query($sql_am) or die
> > ("Error in this query >>$sql<< : " .mysql_error());
> 
> Try:
> 
> if(!isnull($date_am) && !isnull($exercise_am) && !isnull($reps_am))
> 
> This should IMO work :)
> 
> -Joni-

I was looking at the php manual and noticed the function is actually
is_null, not isnull. Yet it still does not work, I tried this:

  $sql_am = "insert into absmachine (today,exercise,reps,comments)
values ('$date_am','$exercise_am','$reps_am','$comments_am')";
if(!is_null($date_am))
  mysql_query($sql_am) or die ("Error in this query >>$sql<< : "
.mysql_error()); 

And it still inserts the row no matter what, as long as submit is
pressed a row is written, with or without any data.

--
Chip



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




Re: [PHP-DB] oddity with insert multiple input fields tomultipletables

2002-08-18 Thread Chip Wiegand

On Sun, 2002-08-18 at 01:20, Joni Järvinen wrote:
> > if (!isnull($date_am || $exercise_am || $reps_am)) then
> > mysql_query($sql_am) or die
> > ("Error in this query >>$sql<< : " .mysql_error());
> 
> Try:
> 
> if(!isnull($date_am) && !isnull($exercise_am) && !isnull($reps_am))
> 
> This should IMO work :)
> 
> -Joni-

Here's the error that results from using that:

Fatal error: Call to undefined function: isnull() in
/usr/local/apache/htdocs/workout-abs.php on line 111

--
Chip

> --
> // Joni Järvinen
> // [EMAIL PROTECTED]
> // http://www.reactorbox.org/~wandu
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 



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




Re: [PHP-DB] oddity with insert multiple input fields tomultipletables

2002-08-17 Thread Chip Wiegand

On Sat, 2002-08-17 at 21:25, Jason Wong wrote:
> You have to check them before inserting.
> 
>   if ($value !== "") {
> insert_value();
>   }
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

Okay, so I tried this -

if ($date_am || $exercise_am || $reps_am !== "") 
{
  $sql_am = "insert into absmachine (today,exercise,reps,comments)
values ('$date_am','$exercise_am','$reps_am','$comments_am')";
  mysql_query($sql_am) or die ("Error in this query >>$sql<< : "
.mysql_error());
}

and this -

  $sql_am = "insert into absmachine (today,exercise,reps,comments)
values ('$date_am','$exercise_am','$reps_am','$comments_am')";
if ($date_am || $exercise_am || $reps_am !== "") 
{
  mysql_query($sql_am) or die ("Error in this query >>$sql<< : "
.mysql_error());
}

But I still get empty rows inserted into the tables.

--
Chip

> > > -Original Message-
> > > From: Chip Wiegand [mailto:[EMAIL PROTECTED]]
> > > Sent: Sunday, 18 August 2002 7:08 AM
> > > To: phpdb
> > > Subject: [PHP-DB] oddity with insert multiple input fields to multiple
> > > tables
> > >
> > >
> > >
> > > I have a web page interface to a mysql database. In this web page I have
> > > about a dozen form input fields. On submit these are submitted to
> > > multiple tables, a differant table for each input field. If I leave any
> > > fields blank, and insert only some of the fields, the database will
> > > insert an empty row to all the effected tables that didn't have any data
> > > from the input fields.
> > >
> > >
> > > I have another page that generates graphs from the tables, the empty
> > > rows show up as breaks in the graphs lines, if I manually delete all the
> > > empty rows the graphs work fine.
> > >
> > >
> > >
> > > What do I need to do to prevent these empty rows from being written to
> > > the tables?
> 
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> 
> 
> /*
> Between grand theft and a legal fee, there only stands a law degree.
> */
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 



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




Re: [PHP-DB] oddity with insert multiple input fields to multipletables

2002-08-17 Thread Chip Wiegand

On Sat, 2002-08-17 at 19:49, John Coder wrote:
> 
> This may or may not work but what the h***. If you have multiple insets
> commands test for ! isnull() on each input field ,i.e. variable.
> 
> if (! isnull($input_field)) 
> then  "insert_query"
> 
> as I said this will only work with an insert query for each field.

I see how that would work with individual insert querys for individual
fields, but in my case there are four input fields per query, so it
won't work, even then it is possible for one field to be left empty in
each query (the comments field). And that is okay. If I try this -

if (!isnull($date_am || $exercise_am || $reps_am)) then
mysql_query($sql_am) or die 
("Error in this query >>$sql<< : " .mysql_error());

I get this error -

Parse error: parse error, unexpected T_STRING in
/usr/local/apache/htdocs/workout-abs.php on line 111

I have 4 fields, 3 will always be filled, 1 is optional. I thought I
would try to test for any of the 3 being empty but it didn't work.

--
Chip

> On Sat, 2002-08-17 at 17:08, Chip Wiegand wrote:
> > I have a web page interface to a mysql database. In this web page I have
> > about a dozen form input fields. On submit these are submitted to
> > multiple tables, a differant table for each input field. If I leave any
> > fields blank, and insert only some of the fields, the database will
> > insert an empty row to all the effected tables that didn't have any data
> > from the input fields. 
> > 
> > I have another page that generates graphs from the tables, the empty
> > rows show up as breaks in the graphs lines, if I manually delete all the
> > empty rows the graphs work fine.
> > 
> > 
> > What do I need to do to prevent these empty rows from being written to
> > the tables? 
> > 




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




[PHP-DB] oddity with insert multiple input fields to multiple tables

2002-08-17 Thread Chip Wiegand

I have a web page interface to a mysql database. In this web page I have
about a dozen form input fields. On submit these are submitted to
multiple tables, a differant table for each input field. If I leave any
fields blank, and insert only some of the fields, the database will
insert an empty row to all the effected tables that didn't have any data
from the input fields. 

I have another page that generates graphs from the tables, the empty
rows show up as breaks in the graphs lines, if I manually delete all the
empty rows the graphs work fine.


What do I need to do to prevent these empty rows from being written to
the tables? 

--
chip w
www.wiegand.org
[EMAIL PROTECTED]

(my web server died and the hard drive crashed hard, and is running from
an incomplete backup on another machine, what a drag) :-(


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




[PHP-DB] user authentication problem

2002-08-13 Thread chip . wiegand

I have this script which is giving me a couple of problems -
1 - I cannot use include "../connect.inc", I get headers already sent error
2 - I can use this script once, but if I try to reload the page to continue
testing I get error "Unable to execute query". Clearing the browsers cache
does not help.

Any ideas what's going on here?

http://www.simradusa.com/auth_dealers/dealers_page.php' );
}
?>

--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 9? Somebody help me!)


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




Re: [PHP-DB] odbc connect problem

2002-08-12 Thread chip . wiegand


salamander <[EMAIL PROTECTED]> wrote on 08/09/2002 04:31:35 PM:

> Chip,

> I wonder if you set the ODBCINI environment variable with the putenv()?

Yep, they are there and I am getting this error when attempting to load the
web page -

Warning: SQL error: [iODBC][Driver Manager]Specified driver could not be
loaded, SQL state IM003 in
SQLConnect in /usr/local/apache/htdocs/odbctest.php on line 16

Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource
in
/usr/local/apache/htdocs/odbctest.php on line 19

Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result
resource in
/usr/local/apache/htdocs/odbctest.php on line 22

> If you could show the code in your odbctest.php file that would be
> helpful.

The output from /usr/local/bin/iodbc-odbctest

[iodbc][driver manager]dialog failed, SQLSTATE=IM003

> Andrew Hill

Below is the code of the odbctest.php file I am trying to use:


Untitled
Brand
 Part NumberDescription\n";
// fetch the succesive result rows
while( odbc_fetch_row( $result ) ) {
$brand= odbc_result( $result, 1 ); // get the field
"ProductLineDescription"
$number= odbc_result( $result, 2 ); // get the field "ItemNumber"
$description= odbc_result( $result, 3 ); // get the field
"ItemDescription"
echo "$brand$number$description
\n";
 }
 echo "";
 echo "";
?>

--
Chip


> On Friday, August 9, 2002, at 07:31 PM, [EMAIL PROTECTED] wrote:

> >
> > Thanks, that fixed that part of it, now here's the newest error
message:
> >
> >
> > Warning: SQL error: [iODBC][Driver Manager]Specified driver could not
be
> > loaded, SQL
> > state IM003 in SQLConnect in /usr/local/apache/htdocs/odbctest.php on
> > line
> > 7
> >
> > Fatal error: Call to undefined function: error_handler() in
> > /usr/local/apache/htdocs/odbctest.php
> > on line 10
> >
> > I'm outa here, catch up with ya on monday,
> >
> > --
> > Chip
> >
> > salamander <[EMAIL PROTECTED]> wrote on 08/09/2002 04:10:00 PM:
> >
> >> Chip,
> >
> >> You are going to have to rebuild the dso with the options you
specified
> >> before - try cutting and pasting the configure that shows up in your
> >> phpinfo() to make it easier.
> >
> >> Also, you can get the necessary iODBC header files at www.iodbc.org,
as
> >> well as find a HOWTO there for compiling PHP/iODBC on *nix systems.
> >
> >> Cheers,
> >> Andrew
> >
> >> On Friday, August 9, 2002, at 06:08 PM, [EMAIL PROTECTED] wrote:
> >
> >>> Yeah, you're right, I see I need to add --with-iodbc. Now another
> >>> question
> >>> - when I recompile to add
> >>> this support, do I have to add all the other options that I
originally
> >>> had
> >>> listed? Or can I add just this one
> >>> and everything else will be left the same? What about php.ini? Will
it
> >>> be
> >>> changed?
> >>>
> >>> --
> >>> Chip W
> >>>
> >>> Chip Atkinson <[EMAIL PROTECTED]> wrote on 08/09/2002 02:51:10
> > PM:
> >>>
> >>>> It looks like you didn't build php with odbc support.
> >>>> Try putting in a call to
> >>>> phpinfo ();
> >>>> and see if it says that odbc support is compiled in.
> >>>
> >>>> (Another) Chip
> >>>
> >>>> On Fri, 9 Aug 2002 [EMAIL PROTECTED] wrote:
> >>>
> >>>>> I am attempting for the first time, to connect from
> >>>>> freebsd/mysql/php
> >>> box
> >>>>> to a NT box running MAS200. I am able
> >>>>> to connect from another NT workstation with Access and download
> >>>>> data,
> >>> so I
> >>>>> am trying from FreeBSD now.
> >>>>> When I run the code below I get error:
> >>>>>
> >>>>> Fatal error: Call to undefined function: odbc_connect() in
> >>>>> /usr/local/apache/htdocs/odbctest.php on line 7
> >>>>>
> >>>>> What am I doing wrong? There's not much info on this topic in the
> >>>>> mysql
> >>>>> manual.
> >>>>>
> >>>>> 
> >>>>> 
> >>>>> Untitled
> >>>>> 
> >>>>> 
> >>>>>  >>>>> $connect = odbc_connect("localhost", "

Re: [PHP-DB] odbc connect problem

2002-08-09 Thread chip . wiegand


Thanks, that fixed that part of it, now here's the newest error message:


Warning: SQL error: [iODBC][Driver Manager]Specified driver could not be
loaded, SQL
state IM003 in SQLConnect in /usr/local/apache/htdocs/odbctest.php on line
7

Fatal error: Call to undefined function: error_handler() in
/usr/local/apache/htdocs/odbctest.php
on line 10

I'm outa here, catch up with ya on monday,

--
Chip

salamander <[EMAIL PROTECTED]> wrote on 08/09/2002 04:10:00 PM:

> Chip,

> You are going to have to rebuild the dso with the options you specified
> before - try cutting and pasting the configure that shows up in your
> phpinfo() to make it easier.

> Also, you can get the necessary iODBC header files at www.iodbc.org, as
> well as find a HOWTO there for compiling PHP/iODBC on *nix systems.

> Cheers,
> Andrew

> On Friday, August 9, 2002, at 06:08 PM, [EMAIL PROTECTED] wrote:

> > Yeah, you're right, I see I need to add --with-iodbc. Now another
> > question
> > - when I recompile to add
> > this support, do I have to add all the other options that I originally
> > had
> > listed? Or can I add just this one
> > and everything else will be left the same? What about php.ini? Will it
> > be
> > changed?
> >
> > --
> > Chip W
> >
> > Chip Atkinson <[EMAIL PROTECTED]> wrote on 08/09/2002 02:51:10
PM:
> >
> >> It looks like you didn't build php with odbc support.
> >> Try putting in a call to
> >> phpinfo ();
> >> and see if it says that odbc support is compiled in.
> >
> >> (Another) Chip
> >
> >> On Fri, 9 Aug 2002 [EMAIL PROTECTED] wrote:
> >
> >>> I am attempting for the first time, to connect from freebsd/mysql/php
> > box
> >>> to a NT box running MAS200. I am able
> >>> to connect from another NT workstation with Access and download data,
> > so I
> >>> am trying from FreeBSD now.
> >>> When I run the code below I get error:
> >>>
> >>> Fatal error: Call to undefined function: odbc_connect() in
> >>> /usr/local/apache/htdocs/odbctest.php on line 7
> >>>
> >>> What am I doing wrong? There's not much info on this topic in the
> >>> mysql
> >>> manual.
> >>>
> >>> 
> >>> 
> >>> Untitled
> >>> 
> >>> 
> >>>  >>> $connect = odbc_connect("localhost", "", "-");
> >>>  if (!$connect)
> >>>  {
> >>>Error_handler( "Error in odbc_connect" , $connect );
> >>>  }
> >>> $result = odbc_exec($connect, "SELECT ProductLineDescription FROM
> >>> IMA_ProductLine, ItemNumber,
> >>> ItemDescription FROM IM1_InventoryMasterFile where DefaultWhse =
> >>> 004");
> >>> if (!$result) {
> >>> Error_handler( "Error in odbc_exec( no cursor returned ) " ,
> >>> $connect );
> >>> }
> >>> echo "BrandPart
> >>> NumberDescription\n";
> >>>
> >>> // fetch the succesive result rows
> >>> while( odbc_fetch_row( $result ) ) {
> >>> $brand= odbc_result( $result, 1 ); // get the field
> >>> "ProductLineDescription"
> >>> $number= odbc_result( $result, 2 ); // get the field
> > "ItemNumber"
> >>> $description= odbc_result( $result, 3 ); // get the field
> >>> "ItemDescription"
> >>>
> >>>
> >>> echo
> > "$brand$number$description
> >>> \n";
> >>> }
> >>>
> >>> echo "";
> >>>  echo "";
> >>> ?>
> >>>
> >>> --
> >>> Chip Wiegand
> >>> Computer Services
> >>> Simrad, Inc
> >>> www.simradusa.com
> >>> [EMAIL PROTECTED]
> >>>
> >>> "There is no reason anyone would want a computer in their home."
> >>>  --Ken Olson, president, chairman and founder of Digital
Equipment
> >>> Corporation, 1977
> >>>  (They why do I have 9? Somebody help me!)
> >>>
> >>>
> >>> --
> >>> PHP Database Mailing List (http://www.php.net/)
> >>> To unsubscribe, visit: http://www.php.net/unsub.php
> >>>
> >>>
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >

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


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




Re: [PHP-DB] odbc connect problem

2002-08-09 Thread chip . wiegand

Yeah, you're right, I see I need to add --with-iodbc. Now another question
- when I recompile to add
this support, do I have to add all the other options that I originally had
listed? Or can I add just this one
and everything else will be left the same? What about php.ini? Will it be
changed?

--
Chip W

Chip Atkinson <[EMAIL PROTECTED]> wrote on 08/09/2002 02:51:10 PM:

> It looks like you didn't build php with odbc support.
> Try putting in a call to
> phpinfo ();
> and see if it says that odbc support is compiled in.

> (Another) Chip

> On Fri, 9 Aug 2002 [EMAIL PROTECTED] wrote:

> > I am attempting for the first time, to connect from freebsd/mysql/php
box
> > to a NT box running MAS200. I am able
> > to connect from another NT workstation with Access and download data,
so I
> > am trying from FreeBSD now.
> > When I run the code below I get error:
> >
> > Fatal error: Call to undefined function: odbc_connect() in
> > /usr/local/apache/htdocs/odbctest.php on line 7
> >
> > What am I doing wrong? There's not much info on this topic in the mysql
> > manual.
> >
> > 
> > 
> > Untitled
> > 
> > 
> >  > $connect = odbc_connect("localhost", "", "-");
> >  if (!$connect)
> >  {
> >Error_handler( "Error in odbc_connect" , $connect );
> >  }
> > $result = odbc_exec($connect, "SELECT ProductLineDescription FROM
> > IMA_ProductLine, ItemNumber,
> > ItemDescription FROM IM1_InventoryMasterFile where DefaultWhse = 004");
> > if (!$result) {
> > Error_handler( "Error in odbc_exec( no cursor returned ) " ,
> > $connect );
> > }
> > echo "BrandPart
> > NumberDescription\n";
> >
> > // fetch the succesive result rows
> > while( odbc_fetch_row( $result ) ) {
> > $brand= odbc_result( $result, 1 ); // get the field
> > "ProductLineDescription"
> > $number= odbc_result( $result, 2 ); // get the field
"ItemNumber"
> > $description= odbc_result( $result, 3 ); // get the field
> > "ItemDescription"
> >
> >
> > echo
"$brand$number$description
> > \n";
> > }
> >
> > echo "";
> >  echo "";
> > ?>
> >
> > --
> > Chip Wiegand
> > Computer Services
> > Simrad, Inc
> > www.simradusa.com
> > [EMAIL PROTECTED]
> >
> > "There is no reason anyone would want a computer in their home."
> >  --Ken Olson, president, chairman and founder of Digital Equipment
> > Corporation, 1977
> >  (They why do I have 9? Somebody help me!)
> >
> >
> > --
> > 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] odbc connect problem

2002-08-09 Thread chip . wiegand

I am attempting for the first time, to connect from freebsd/mysql/php box
to a NT box running MAS200. I am able
to connect from another NT workstation with Access and download data, so I
am trying from FreeBSD now.
When I run the code below I get error:

Fatal error: Call to undefined function: odbc_connect() in
/usr/local/apache/htdocs/odbctest.php on line 7

What am I doing wrong? There's not much info on this topic in the mysql
manual.



Untitled


BrandPart
NumberDescription\n";

// fetch the succesive result rows
while( odbc_fetch_row( $result ) ) {
$brand= odbc_result( $result, 1 ); // get the field
"ProductLineDescription"
$number= odbc_result( $result, 2 ); // get the field "ItemNumber"
$description= odbc_result( $result, 3 ); // get the field
"ItemDescription"


echo "$brand$number$description
\n";
    }

echo "";
 echo "";
?>

--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 9? Somebody help me!)


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




RE: [PHP-DB] problem getting form input field to become part ofquery statement

2002-08-03 Thread Chip Wiegand

On Sat, 2002-08-03 at 06:05, Rich Hutchins wrote:
> Try referencing the $listbox variable in you SQL statement like this:
> 
> $sql = "insert into ".$listbox."
> values(NULL,'$date','$exercise','$reps','$comments')";
> 
> I'm guessing that it might also work like this:
> 
> $sql = "insert into '$listbox'
> values(NULL,'$date','$exercise','$reps','$comments')";
> 
> I think your core problem is that the $listbox variable is not being
> evaluated properly in the SQL statement. Once you solve that, you're good to
> go.
> 
> Hope this helps.
> 
> Rich

I tried both suggestions and neither are working. I am using the get
format for the form so I can see what is being sent, and I am getting
this:
http://192.168.1.53/workout-absflexor.php?exerciselist=%24listbox&exercise=80
&reps=12&comments=&submit=Send+Data

Notice that the $listbox variable is still not being sent. Just above
this is an echo statement which shows what's in that variable, and it
displays the expected result (see code below). I am at a loss as to why
this is not working.

If I replace the $listbox variable with the table name shown in the echo
statement, a connection is made and the query is completed.

--
Chip W
www.wiegand.org
[EMAIL PROTECTED]


> -Original Message-
> From: Chip Wiegand [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, August 03, 2002 12:51 AM
> To: phpdb
> Subject: [PHP-DB] problem getting form input field to become part of
> query statement
> 
> 
> I have a form with a select list and a hidden field to save the selected
> item. On submit another page is loaded with a few fields to be filled in
> and submitted to a table. Using get I see the data is being passed from
> the first page to the second properly, and the second page sends its
> data properly. The hidden field from the first page is to be used by the
> second page as the name of the table in the query. I have a place where
> I echo the contents of the hidden field just to be sure it is correct,
> and that does indeed show what I expect. I then make the query statement
> point to the variable but it always responds that it cannot find the
> table. The table does exist, the variable does contain the appropriate
> table name, but is not being replaced by the name. What am I doing
> wrong?
> 
> --
> Chip W
> www.wiegand.org
> [EMAIL PROTECTED]
> 
> Below is the code for the first page --
> 
> 
> 
> 
> 
> 
> 
>  $exercises=array("absflexor","absmachine","leglifts");
> 
> echo "";
> echo "";
> echo "Exercise Data Input";
> echo "";
> echo "$exercises[0]";
> echo "$exercises[1]";
> echo "$exercises[2]";
> echo "";
> echo "";
> echo "";
> echo "";
> echo "";
> ?>
> 
> 
> 
> 
> And below is the code for the second page --
> 
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
>   
> Workout Data Entry Form
> 
>  body { background-color: aqua; }
>  div.c1 {text-align: center}
> 
>   
>   
> 
>   Work-Out Data Entry Screen
>   
>  bgcolor="green">
>   
> Weight
>  maxlength="4">
>   
>   
> Reps
>  maxlength="4">
>   
>   
> Comments
>  name="comments">
> 
>   
> 
> 
> 
>   type="reset" />
>   
> 
>  if(isset($submit)):
>   $db = mysql_connect("localhost","root","carvin");
>   if(!$db) error_message(sql_error());
>   mysql_select_db("workout",$db) or die ("Ack! Where's the database?");
>   $date = date("m-d");
>   $sql = "insert into $listbox
> values(NULL,'$date','$exercise','$reps','$comments')";
>   mysql_query($sql) or die ("Ack! No response when I queried the
> server!");
>   endif;
>   ?>
>   
> 
> 
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 



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




[PHP-DB] problem getting form input field to become part of query statement

2002-08-02 Thread Chip Wiegand

I have a form with a select list and a hidden field to save the selected
item. On submit another page is loaded with a few fields to be filled in
and submitted to a table. Using get I see the data is being passed from
the first page to the second properly, and the second page sends its
data properly. The hidden field from the first page is to be used by the
second page as the name of the table in the query. I have a place where
I echo the contents of the hidden field just to be sure it is correct,
and that does indeed show what I expect. I then make the query statement
point to the variable but it always responds that it cannot find the
table. The table does exist, the variable does contain the appropriate
table name, but is not being replaced by the name. What am I doing
wrong?

--
Chip W
www.wiegand.org
[EMAIL PROTECTED]

Below is the code for the first page --







";
echo "";
echo "Exercise Data Input";
echo "";
echo "$exercises[0]";
echo "$exercises[1]";
echo "$exercises[2]";
echo "";
echo "";
echo "";
echo "";
echo "";
?>




And below is the code for the second page --

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml";>
  
Workout Data Entry Form

 body { background-color: aqua; }
 div.c1 {text-align: center}

  
  

  Work-Out Data Entry Screen
  

  
Weight

  
  
Reps

  
  
Comments


  
  


 
  

  
  



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




[PHP-DB] change data before its sent to db?

2002-07-16 Thread chip . wiegand

I have a form with a select box of the 12 months + one for none. It (and
more) are sent to a mysql
database. On another web page a list is displayed and can be sorted by
date, but of course
the month names are not alphabetical. I tried to assign each month a
number, 01,02,03, etc in a
if-elseif statement, then send it to the database but that wouldn't work.

if ($month == 'jan') { $month = '01';}
elseif ($month == 'feb') {$month = '02'};

etc, so I can then sort numerically, and it will display in the correct
order on the web page.
I have tried various versions of the above but it will not work.
I know I could use numbers instead of names for the months - but for this
application that
would not be appropriate.

The sort code ---

if ($orderby == 'month_num'):
$sql = "select * from releases order by 'month'";
elseif ($orderby == 'month_num2'):
$sql = "select * from releases order by 'month' desc";

The html select 

Month:

None
Jan
Feb
etc


--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 9? Somebody help me!)


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




Re: [PHP-DB] extract data from database into an array

2002-07-15 Thread chip . wiegand


"Adam Alkins" <[EMAIL PROTECTED]> wrote on 07/13/2002 07:56:46 PM:

> > I have a database, all the data is numbers. I want to make a query that
> > will extract the data and then make it available in an array, so the
> > array is populated 'real-time'. I could just enter the number into an
> > array manually, but I want to automate the job. I don't know what to
> > start looking for, the 3 books I have either don't talk about this or I
> > just am missing it.
> > Could someone point me in the right direction?

> Well after you SELECT the data and run the query, you can use a few
> functions, it depends on your database type?

> For example, for MySQL, you can use mysql_fetch_array() which will take
your
> data and store it in an array, both numeric and associative.

> i.e. $data = mysql_fetch_array($result) can be accessed like

> $data['column_name']
> $data[column_number]

> You can also fetch an array only as an associative (mysql_fetch_assoc) or
> numeric (mysql_fetch_row). And simply if selecting multiple rows, use a
loop

> while($data = mysql_fetch_array())...

> --
> Adam Alkins

I guess I wasn't very clear on exactly what results I expect. I can get the
data and print all the numbers, that's no problem. What I want is to have
all the numbers inserted into an array that would look like this:
$datax = (50,50,50,60,60,60,70,70,70,65,65,70,75,75,80);
Each number in the array is from a single row in the table (15 rows in this
example).
The database is weights, entered after a work-out, along with their reps.
I only need the weights, as shown above. This array $datax is then
processed
by a php script to create a graph showing the progress of the person's
wieght
lifting over time. I can enter all the numbers into the array manually and
the graph is drawn correctly, but prefer the web interface I made. This is
okay for me, but not others.
So, I made a web form that takes the data and inserts into the database.
That works fine also. The table contains columns:
squats, squats_reps, legpress, legpress_reps, etc etc.
The first is the weight and the second is the number of reps. So after
each workout the appropriate numbers would be entered via the form page,
the graph would be generated with the updated numbers from another page.

Hope this helps to explain it a bit better,

--
Chip

> http://www.rasadam.com
> --

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


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




[PHP-DB] extract data from database into an array

2002-07-13 Thread Chip Wiegand

I have a database, all the data is numbers. I want to make a query that
will extract the data and then make it available in an array, so the
array is populated 'real-time'. I could just enter the number into an
array manually, but I want to automate the job. I don't know what to
start looking for, the 3 books I have either don't talk about this or I
just am missing it. 
Could someone point me in the right direction?

--
Chip




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




Re: [PHP-DB] A problem with insert to mysql from a web interface

2002-07-13 Thread Chip Wiegand

On Sat, 2002-07-13 at 00:52, Jason Wong wrote:
> On Saturday 13 July 2002 14:49, Chip Wiegand wrote:
> > I just set up a pc with mysql-3.23.51/php-4.2.1/apache-1.3.26. I have
> > created a database and tables and a web interface to insert data into
> > it. I can insert data from the command line just fine. From the web
> > interface there is nothing inserted and no error messages. I have tried
> > connection string with root and with user names, both of which can
> > insert data from a remote client as well as on the sql server itself.
> > When I enter data and press submit the page redraws, and I don't get the
> > message the data was entered, and checking the database, I see nothing
> > indeed was entered. I've used post and get, makes no differance. In the
> > database I have set the fields as int, small int, varchar (shows char in
> > describe table_name), makes no differance.
> > I have made other web interfaces to mysql databases before, on slightly
> > older versions of mysql/php/apache and have never had this problem.
> > If anyone has a few minute to review my code below, hopefully someone
> > will find whatever it is I am missing. I have pasted in the html for the
> > web page, and below that a .csv copy/pasted of the database.
> 
> register_globals ?

That was it, Thanks, works fine now.


> > $sql = "INSERT INTO legs
> > (squats,squats_reps,legpress,legpress_reps,legext,legext_reps,legcurls,
> > legcurls_reps,calfraise,calfraise_reps,hipabducter,hipabducter_reps,
> > hipadducter,hipadducter_reps,comments) VALUES('$squats','$squats_reps',
> > '$legpress','$legpress_reps','$legext','$legext_reps','$legcurls',
> > '$legcurls_reps','$calfraise','$calfraise_reps','$hipabducter',
> > '$hipabducter_reps','$hipadducter','$hipadducter_reps','$comments')";
> 
> echo $sql;  # ???

What does that do? And would I put it somewhere in my web page code?
I've not seen this before.

Thanks for the help.

--
Chip
 
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> 
> 
> /*
> Hating the Yankees is as American as pizza pie, unwed mothers and
> cheating on your income tax.
>   -- Mike Royko
> */
> 
> 
> -- 
> 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] A problem with insert to mysql from a web interface

2002-07-13 Thread Chip Wiegand

I just set up a pc with mysql-3.23.51/php-4.2.1/apache-1.3.26. I have
created a database and tables and a web interface to insert data into
it. I can insert data from the command line just fine. From the web
interface there is nothing inserted and no error messages. I have tried
connection string with root and with user names, both of which can
insert data from a remote client as well as on the sql server itself.
When I enter data and press submit the page redraws, and I don't get the
message the data was entered, and checking the database, I see nothing
indeed was entered. I've used post and get, makes no differance. In the
database I have set the fields as int, small int, varchar (shows char in
describe table_name), makes no differance.
I have made other web interfaces to mysql databases before, on slightly
older versions of mysql/php/apache and have never had this problem.
If anyone has a few minute to review my code below, hopefully someone
will find whatever it is I am missing. I have pasted in the html for the
web page, and below that a .csv copy/pasted of the database.
--
Thanks
Chip W
www.wiegand.org
[EMAIL PROTECTED]

Below is the web page -





connected to the server successfully";
mysql_select_db("workout", $db) or die ("Could not get the
database"
 .mysql_error());
$sql = "INSERT INTO legs
(squats,squats_reps,legpress,legpress_reps,legext,legext_reps,legcurls,
legcurls_reps,calfraise,calfraise_reps,hipabducter,hipabducter_reps,
hipadducter,hipadducter_reps,comments) VALUES('$squats','$squats_reps',
'$legpress','$legpress_reps','$legext','$legext_reps','$legcurls',
'$legcurls_reps','$calfraise','$calfraise_reps','$hipabducter',
'$hipabducter_reps','$hipadducter','$hipadducter_reps','$comments')";
mysql_query($sql, $db) or die ("Query failed" .mysql_error());
print "The data has been entered";
endif;
?>
Work-Out Data Entry Screen
Legs Work-out



ExcerciseWeightReps


Squats






Leg Press






Leg Extension






Leg Curls






Calf Raise






Hip Abducter






Hip Adducter






Comments













And here is the database (a mysqlnavigator .csv dump) -

id,int(3),,PRI,,auto_increment
squats,int(3),YES,,,
squats2,char(3)
squats_reps,char(3),YES,,,
legpress,char(3),YES,,,
legpress_reps,char(3),YES,,,
legext,char(3),YES,,,
legext_reps,char(3),YES,,,
legcurls,char(3),YES,,,
legcurls_reps,char(3),YES,,,
calfraise,char(3),YES,,,
calfraise_reps,char(3),YES,,,
hipabducter,char(3),YES,,,
hipabducter_reps,char(3),YES,,,
hipadducter,char(3),YES,,,
hipadducter_reps,char(3),YES,,,
comments,text,YES,,,


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




[PHP-DB] Graphing data

2002-07-10 Thread chip . wiegand

Is there any application available that can take data from my mysql
database and draw graphs?
I am using mysql/php on FreeBSD.

--
Chip



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




[PHP-DB] sql query problem

2002-06-14 Thread chip . wiegand

I have a database layout similar to this-

id  order   title   namepagecat

0   0   title1  blueap
1   2   blue1   page1   ap
2   3   blue2   page2   ap
3   1   blue3   page3   ap

I would like to get title1 (title column only) and blue2 (name column 
only)  like this-
title1 blue2

I am finding it difficult to write the proper select statement to get just 
those items in
a web page using php/mysql.

Suggestions?
--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment 
Corporation, 1977
 (They why do I have 9? Somebody help me!)

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




[PHP-DB] need a solution for web page navigation

2002-06-14 Thread chip . wiegand

I have a database of the menu items used on my web site, there are more 
than 100 entries. 
How do I set up navigation arrows to point to the next appropriate page, 
and the previous
page, from the database? I don't want to use javascript history function, 
navigation is too
important to allow it to be turned off in someones browser. 
Example:
Category 1 with it's own item1, item2, item3
Category 2 with it's own item1, item2, item3
Category 3 with it's own item1, item2, item3
all have next, previous, home links at the top of their pages, so category 
1 links to item 1, 
then item 1 links to item 2 etc. Category 2 has item 1 linked to it's own 
item 2 and so on,
and category 3 has it's own item 1 linked to it's own item 2 etc.
Now if I want to make item 3 in category 3 available on the category 1 
menu in addition to 
category 3, that's easy, but the links will point to category 3 pages, not 
category 1 pages.
Hmm, I'm sure this is clear as mud.
I know how to move forward and backward within the database, like in an 
image database,
I've done that before. But this is a little different, I don't know if it 
is even possible. I am using
php/mysql.
If anyone has any idea what I am trying to do please attempt to help...
--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment 
Corporation, 1977
 (They why do I have 9? Somebody help me!)

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




[PHP-DB] looking for a particular script, or how-to...

2002-03-07 Thread chip . wiegand

I'm looking for a script that will give me this - a web page that shows 
who is currently accessing
my mysql database. If it could provide other details that would be great 
too. I'm not sure how to
go about setting this up. I couldn't find any mysql command that shows the 
users accessing the 
database.
Any suggestions?

--
Chip Wiegand
Computer Services
Simrad, Inc
www.simrad.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment 
Corporation, 1977
 (They why do I have 7? Somebody help me!)


RE: [PHP-DB] Why the following error, yet it works anyway

2002-01-14 Thread chip . wiegand

Rick Emery <[EMAIL PROTECTED]> wrote on 01/14/2002 10:35:37 AM:

> First, if "$submit" is not set, then the "delete" statement will be
> executed.  This will not return an array upon which mysql_fetch_array() 
will
> act.  Therefore $result will not be valid.

I made this change:

if (!isset($submit)): 
$sql = "select news_id, bulletin_subject from dbulletins";
elseif (isset($submit)):
$sql = "delete from dbulletins where news_id = '$newsid'";
endif; 

but still get the same error. Shouldn't this fix the problem so now it 
will
return the database list because the submit button is not pushed (on 
returning
to the page)? 

--
Chip

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 14, 2002 11:18 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Why the following error, yet it works anyway
> 
> I have the following short web page to delete dealer bulletins from a
> database. My page lists
> all the bulletins in the database - id and subject. There is a text 
input
> field to enter the bulletin
> id number and hit the delete button, and the bulletin is deleted. It 
works
> except after the submit
> delete I get an error -
> -
> Warning: Supplied argument is not a valid MySQL result resource in
> /usr/local/apache/htdocs/bulletin_delete.php on line 35
> -
> line 35 is the while statement.
> 
> Here is the complete page -
> -
> 
>   
> 
> Dealer Bulletins, Simrad, Inc
>   
>   
> Simrad Dealer Bulletins - Delete Screen
> NOTE: This is a permanent and
> irreversible
> delete! No second chances here!
>  
>  
>  Enter the bulleting ID Number: 
>  
>  
>  $db = mysql_connect("localhost", "root")
>  or die ("Can't get the database server");
> mysql_select_db("bulletins", $db) or die ("Can't get the database");
> if (isset($submit)):
> $sql = "delete from dbulletins where news_id = '$newsid'";
> else:
> $sql = "select news_id, bulletin_subject from dbulletins";
>     endif;
> $result = mysql_query($sql);
>  while ($row = mysql_fetch_array($result))
>  {
>  print "\nDelete entry
> ".$row["news_id"]."? "
>  .$row["bulletin_subject"]."\n\n";
>  }
> ?>
> 
> 
> Back
> 
> 
> 
> --
> Chip Wiegand
> Computer Services
> Simrad, Inc
> www.simrad.com
> [EMAIL PROTECTED]
> 
> "There is no reason anyone would want a computer in their home."
>  --Ken Olson, president, chairman and founder of Digital Equipment
> Corporation, 1977
>  (They why do I have 7? Somebody help me!)
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


[PHP-DB] Why the following error, yet it works anyway

2002-01-14 Thread chip . wiegand

I have the following short web page to delete dealer bulletins from a 
database. My page lists
all the bulletins in the database - id and subject. There is a text input 
field to enter the bulletin
id number and hit the delete button, and the bulletin is deleted. It works 
except after the submit 
delete I get an error -
-
Warning: Supplied argument is not a valid MySQL result resource in 
/usr/local/apache/htdocs/bulletin_delete.php on line 35 
-
line 35 is the while statement.

Here is the complete page -
-

  

Dealer Bulletins, Simrad, Inc
  
  
Simrad Dealer Bulletins - Delete Screen
NOTE: This is a permanent and 
irreversible 
delete! No second chances here!
 
 
 Enter the bulleting ID Number: 
 
 
 \nDelete entry 
".$row["news_id"]."? "
 .$row["bulletin_subject"]."\n\n";
 }
?>


Back 

 
----
--
Chip Wiegand
Computer Services
Simrad, Inc
www.simrad.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment 
Corporation, 1977
 (They why do I have 7? Somebody help me!)