Re: [PHP-DB] sql injections/best practises

2008-11-10 Thread mignon hunter
Thank you Christopher - this gives me some much needed direction.

--- On Fri, 11/7/08, Christopher Jones [EMAIL PROTECTED] wrote:

From: Christopher Jones [EMAIL PROTECTED]
Subject: Re: [PHP-DB] sql injections/best practises
To: [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Date: Friday, November 7, 2008, 5:39 PM

mignon hunter wrote:
 I'm am trying to find some definitive best practises on database
connections with php on both mysql and oracle.

 I'm starting to redesign a corporate website and am trying to find out
more about security and the best practises for database queries and user input
form handling.

 For example - what's the best usage - prepared statements? And does it
have to be php 5? I need preferably a one stop shop as opposed to looking at
dozens of different places. Can you advise a particular book? Website?

 I have checked out the security area on the php manual and some users
notes - some were useful. But it didnt really have a lot of info and I dont
think it is comprehenive or all inclusive.

 Thanks in advance. PS I would like to switch the current site from jsp to
php. I was going to look into Zend IDE. Comments? Suggestions?

 thanks


PHP 5.2 is the way to go for new projects: PHP 4 isn't being
maintained.

Binding/preparing statements is the way to go.  Here are quotes about
them with MySQL  Oracle

They are useful for speeding up execution when you are performing
large numbers of the same query with different data.  They also
protect against SQL injection-style attacks.  (From PHP and
MySQL Web Development, 4th Edition, Luke Welling and Laura
Thomson)

If I were to write a book about how to build nonscalable [note
the NON] Oracle applications, then 'Don't Use Bind Variables'
would be the title of the first and last chapters. [...] If you
want to make Oracle run slowly [...] just refuse to use bind
variables (From Expert Oracle Database Architecture, Tom
Kyte)

Depending on the site needs, consider a DB abstraction layer or a
framework.

For high performance connections in PHP OCI8 for Oracle, use
oci_pconnect() and pass the character set.

There are a number of Oracle-PHP books available.  One free,
introductory one is the Underground PHP  Oracle Manual,
http://tinyurl.com/f8jad (A new edition will be released in the next
couple of weeks)

Chris

-- Email: [EMAIL PROTECTED]  Tel: +1 650 506 8630
Twitter:  http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad



  

Re: [PHP-DB] sql injections/best practises

2008-11-10 Thread mignon hunter
thank you so much Fergus for all this great info - this will get me started. 

--- On Sat, 11/8/08, Fergus Gibson [EMAIL PROTECTED] wrote:

From: Fergus Gibson [EMAIL PROTECTED]
Subject: Re: [PHP-DB] sql injections/best practises
To: php-db@lists.php.net
Date: Saturday, November 8, 2008, 12:42 PM

On Fri, Nov 7, 2008 at 3:39 PM, Christopher Jones
[EMAIL PROTECTED] wrote:

 mignon hunter wrote:
 I'm am trying to find some definitive best practises on database
 connections with php on both mysql and oracle.

Most security issues come back to a simple concept.  Assume anything
in your scripts that is not a constant or literal to be a threat.
That means any and all user submitted data is a potential attack.
Ideally you should also assume that any and all data read in from the
database or files is a potential attack.  Assume everything is
tainted.  Your job then is to clean any and all input
through
inspection and filtering before you use it.

I recommend the book Essential PHP Security by Chris Shiflett (ISBN
0-596-00656-X).  It deals with database security and more.

I would be happy to go into more detail on this or provide examples if
it would be helpful.


 For example - what's the best usage - prepared statements? And
does it
 have to be php 5? I need preferably a one stop shop as opposed to
looking at
 dozens of different places. Can you advise a particular book? Website?

Prepared statements will prevent SQL injection, but that is only one
potential vector for attack.  Keep in mind too that prepared
statements are not necessary to prevent SQL injection and they aren't
always the most appropriate way to do it.  That said, they are the
simplest way to protect your database.

I'll outline a way that a database was used to attack an application.
The attack wasn't particularly dangerous, but it was embarrassing for
the company involved.  In this case, the application took form input
from a site visitor and saved it in the database.  Then the site owner
could retrieve the input and view it.  Unfortunately, some visitors
decided to put script tags in containing a Javascript redirect.
Since the application trusted the data coming back from the database
(not a best practice), it didn't attempt to filter it in anyway before
sending it to the browser.  The result was that when the site owner
tried to retrieve the form submission data, he would find himself
redirect to another website of the attacker's choosing.  While no data
was compromised in the attack, it did raise doubts about the security
of that company's products.

This kind of attack could easily be prevented by assuming that the
data coming out of the database is tainted and then filtering it with
htmlentities().  The result of that would have been that the script
didn't run and didn't redirect the browser.  This was the solution
that the company implemented.

I hope this example highlights why it's important to have a full
understanding of security and related best practices.  Just
understanding methods to defeat SQL injection is not enough to ensure
that your application is secure, and the aforementioned book will give
you a security mindset that you can apply to all threat vectors.

You also asked about PHP versions.  I do recommend you use PHP 5.  As
mentioned, PHP 4.4.9 is the last release of PHP 4.  There is no
promise to address any further security issues in PHP 4 if they are
discovered.  PHP 5 also has other, non-security advantages over PHP 4.
 Most notable is a robust object model for we OOP types, but I also
like decisions they made to bundle in certain modules missing from PHP
4.


 Thanks in advance. PS I would like to switch the current site from jsp
to
 php. I was going to look into Zend IDE. Comments? Suggestions?

Ugh.  That's my comment.  I assume we're discussion Neon
here, the
new Eclipse-based Zend Studio.  The installation is huge and bloated,
and I find it doesn't work very well at all for remote files over FTP.
 I really didn't care for it.  If you love Eclipse, though, you will
probably like it.  I believe there's a free trial of the Studio, so
you should try it rather than listening too much to opinions from the
peanut gallery.

I use UEStudio.  It's not perfect, but it's a very robust, general
programmers' editor.  It's much faster and it makes difficult Eclipse
tasks easy.  It also has full Javascript scripting built into it, so
it's very extensible.  You can download a trial:

http://www.ultraedit.com/downloads/uestudio_download.html


 Depending on the site needs, consider a DB abstraction layer or a
 framework.

You can rely on frameworks to provide security to your application,
but keep in mind that frameworks can contain vulnerabilities and bugs.
 They are made by people who can make mistakes.  More significantly,
if you are making an intensive application, you may find it reaches a
point where the framework isn't scalable.  I love and use abstraction,
but abstraction does come with a performance price.  For simple

Re: [PHP-DB] sql injections/best practises

2008-11-10 Thread mignon hunter
Hi Christopher
 
One other question. Our current site is written in jsp with Oracle. I'd like to 
use PHP. Do you have any thoughts on this?
 
We're not really using Jsp as it was intended ( like using classes ) and I 
think it has alot of overhead and is overkill. It seems Php would be a better 
choice for imbedded html. For the most part the site mainly consist of 
relatively simple db retrieval, for several of our products. Which then lists 
various documentation and reference material for each, all dynamic. And then we 
have a few very simple stand alone user input forms occasionally.
 
Oracle is the db on most of the site - a little mysql too.


--- On Fri, 11/7/08, Christopher Jones [EMAIL PROTECTED] wrote:

From: Christopher Jones [EMAIL PROTECTED]
Subject: Re: [PHP-DB] sql injections/best practises
To: [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Date: Friday, November 7, 2008, 5:39 PM

mignon hunter wrote:
 I'm am trying to find some definitive best practises on database
connections with php on both mysql and oracle.

 I'm starting to redesign a corporate website and am trying to find out
more about security and the best practises for database queries and user input
form handling.

 For example - what's the best usage - prepared statements? And does it
have to be php 5? I need preferably a one stop shop as opposed to looking at
dozens of different places. Can you advise a particular book? Website?

 I have checked out the security area on the php manual and some users
notes - some were useful. But it didnt really have a lot of info and I dont
think it is comprehenive or all inclusive.

 Thanks in advance. PS I would like to switch the current site from jsp to
php. I was going to look into Zend IDE. Comments? Suggestions?

 thanks


PHP 5.2 is the way to go for new projects: PHP 4 isn't being
maintained.

Binding/preparing statements is the way to go.  Here are quotes about
them with MySQL  Oracle

They are useful for speeding up execution when you are performing
large numbers of the same query with different data.  They also
protect against SQL injection-style attacks.  (From PHP and
MySQL Web Development, 4th Edition, Luke Welling and Laura
Thomson)

If I were to write a book about how to build nonscalable [note
the NON] Oracle applications, then 'Don't Use Bind Variables'
would be the title of the first and last chapters. [...] If you
want to make Oracle run slowly [...] just refuse to use bind
variables (From Expert Oracle Database Architecture, Tom
Kyte)

Depending on the site needs, consider a DB abstraction layer or a
framework.

For high performance connections in PHP OCI8 for Oracle, use
oci_pconnect() and pass the character set.

There are a number of Oracle-PHP books available.  One free,
introductory one is the Underground PHP  Oracle Manual,
http://tinyurl.com/f8jad (A new edition will be released in the next
couple of weeks)

Chris

-- Email: [EMAIL PROTECTED]  Tel: +1 650 506 8630
Twitter:  http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/f8jad

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




  

[PHP-DB] sql injections/best practises

2008-11-07 Thread mignon hunter
I'm am trying to find some definitive best practises on database connections 
with php on both mysql and oracle. 
 
I'm starting to redesign a corporate website and am trying to find out more 
about security and the best practises for database queries and user input form 
handling.
 
For example - what's the best usage - prepared statements? And does it have to 
be php 5? I need preferably a one stop shop as opposed to looking at dozens of 
different places. Can you advise a particular book? Website?
 
I have checked out the security area on the php manual and some users notes - 
some were useful. But it didnt really have a lot of info and I dont think it is 
comprehenive or all inclusive.
 
Thanks in advance. PS I would like to switch the current site from jsp to php. 
I was going to look into Zend IDE. Comments? Suggestions?
 
thanks


  

Re: [PHP-DB] Problem Using Sessions

2005-05-04 Thread Mignon Hunter
The browser has already sent headers on line 13 of your code- line 25 must be 
the session_start - it has to come first and be at the very top of your code

 Shawn Singh [EMAIL PROTECTED] 05/04/05 03:13PM 
Hey All,

I'm fairly new to PHP Programming. I have compiled and installed
postgres version 8.0.1, and with that compiled postgres support into
my postgres (I'm using PHP version 5.0.4), and I've compiled support
for PHP into Apache (version 2.0.53) and all is working (in that I can
embed PHP into my HTML documents and get the expected results).

Recently I started working on a website in which I would like there to
be an administration page where the person who is logged in can add
and delete records. I figured that the best way to do this would be to
establish a session, (at the login page) then if the user login is
successful, I would then register the username and password and
redirect the user to the admin page. I chose not to use cookies, b/c
everyone may not have cookies enabled on their browser and I didn't
want that to be a hurdle that a user would have to jump over.

I've written the code but when I try to login to the site I get this message:

Warning: Cannot modify header information - headers already sent by
(output started at /export/home/www/htdocs/login.php:13) in
/export/home/www/htdocs/login.php on line 25

Warning: Unknown: Your script possibly relies on a session side-effect
which existed until PHP 4.2.3. Please be advised that the session
extension does not consider global variables as a source of data,
unless register_globals is enabled. You can disable this functionality
and this warning by setting session.bug_compat_42 or
session.bug_compat_warn to off, respectively. in Unknown on line 0

Information I've seen on the web for these types of messages would
indicate that I don't have a /tmp directory, but such is not the case.
 Other messages have indicated that my session variables are not
getting written to /tmp, but that is not true either, as I have seen
them in there...as I see entries such as:

sess_ec2249332b8b29863f161461cf8c1409

So, I'm guessing that there aren't problems with my /tmp filesystem.

Please excuse the lack of style as I have mainly been trying to hack
out something, but plan to clean it up later.

My source code for the login page is as follows:

?php
session_start();
echo html
  titleJoshua Generation Login Page/title
  body bgcolor='#9C9C9C'
  form action='login.php' method='POST'
  table border='1'
trtdEnter Username:/tdtdinput type='text'
name='username'/td/tr
trtdEnter Password:/tdtdinput type='text'
name='password'/td/tr
input type='hidden' name='login' value='1'
input type='submit'value='Login'
  /table
  /form;
if ( $_POST )
{
  $username = $_POST['username'];
  $password = $_POST['password'];
  if ( $username == test  $password == test )
  {
global $username, $password;
session_register(username);
session_register(password);

echo h1Authorized Entry/h1;
header(Location: http://joshua1and8.homelinux.org/admin.php;);
  }
  else
  { echo $username;
echo br;
echo $password;
echo br;
echo h1Login FAILED/h1;
  }
}
echo /body
  /html;
?


My source code for the admin page is as follows:

?php
  session_start();
  global $username, $password;
  session_register(username);
  session_register(password);
?
html
head
titleJoshua Generation Admin Page/title
/head
body bgcolor='#9C9C9C'
?php
/*
 * Radesh N. Singh
 * Admin Page
 */
if (isset($username))
{
  echo h1Joshua Generation Admin's Corner/h1
  form action=\admin.php\ method=\POST\
  table border=\1\
trtdName/td
tdCell Phone/td
tdWork Phone/td
tdHome Phone/td
tdEmail Address/td
/tr
trtdinput type=\text\ name=\name\//td
  tdinput type=\text\ name=\cphone\//td
  tdinput type=\text\ name=\wphone\//td
  tdinput type=\text\ name=\hphone\//td
  tdinput type=\text\ name=\emailaddr\//td
/tr
trinput type=\hidden\ name=\proc\ value=\add\
  input type=\submit\ value=\Add Member Records\
  input type=\hidden\ name=\proc\ value=\del\
  input type=\submit\ value=\Delete Member Records\
  /tr
  /table
  /form;

  if ($_POST)
  {
$conn_string = dbname=joshua_generation user=admin password=admin;
$conn_hndl = pg_connect($conn_string);

switch ($_POST['proc'])
{
  case 'add':
$name = $_POST['name'];
$cphone = $_POST['cphone'];
$wphone = $_POST['wphone'];
$hphone = $_POST['hphone'];
$emailaddr = $_POST['emailaddr'];

  /*
To add a member a name is all that is needed.
Based on the name that is entered, the next nameid
will be generated by the dbms, and the insert will
be done into:
NAMES, PNUMBERS, 

Re: [PHP-DB] PHP Sessions

2005-04-14 Thread Mignon Hunter


 Ian McGhee [EMAIL PROTECTED] 04/14/05 04:23AM 
Hi All, 

 

I have been looking into PHP sessions and I have noticed you can
actually use a database for storing the sessions instead of flat files I
will be using MS SQL for the database can any one give be a clue as to
how I would go about this or point me in the direction of a good
tutorial?


Start with the manual and read everything on Sessions.

A search on google returns a few good examples. The second is very simple and 
anwers to the Database aspect

http://www.oreilly.com/catalog/webdbapps/chapter/ch08.html

http://www.comptechdoc.org/independent/web/php/intro/phpsessions.html

 

Any Help would be greatly appreciated, 

 

Ian McGhee 


Email: [EMAIL PROTECTED] 

 

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



Re: [PHP-DB] Session in URL

2005-03-16 Thread Mignon Hunter
Hello

I have tested this app on my machine but it doesnt do this - but when testing 
on development server, my script is displaying the session in the url.  I was 
reading in man about session.use_only_cookies can keep this from happening but 
the dev server has php 4.1.2

Is there another way to stop this?

My script is such:

 while($row = mysql_fetch_row($res))
{
echo lia href = 
sess_downloads_p2.php?$row[0]$row[1]/a/li;
}

where $row[0] is a filename like filename.pdf 

But when sess_download_p2.php loads in browser the URL has ...PHPSESSID=(rand 
number)

Thanks for any help

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



Re: [PHP-DB] - Session in URL - wrong list

2005-03-16 Thread Mignon Hunter
Sorry 

I posted this to wrong list - meant to send to general...should I re-post or no.

*

Hello

I have tested this app on my machine but it doesnt do this - but when testing 
on development server, my script is displaying the session in the url.  I was 
reading in man about session.use_only_cookies can keep this from happening but 
the dev server has php 4.1.2

Is there another way to stop this?

My script is such:

 while($row = mysql_fetch_row($res))
{
echo lia href = 
sess_downloads_p2.php?$row[0]$row[1]/a/li;
}

where $row[0] is a filename like filename.pdf 

But when sess_download_p2.php loads in browser the URL has ...PHPSESSID=(rand 
number)

Thanks for any help

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



[PHP-DB] sanitizing data

2005-03-04 Thread Mignon Hunter
What method do mosto of you use to sanitize data ?  What do you normally check 
for when, say for example, your getting basic user data like name, address, 
email.

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



[PHP-DB] suggestions

2005-03-03 Thread Mignon Hunter
Hello 

I need to dev a small app and I can think of a couple different ways to handle 
it but not sure the best way.  I need to register those who come to our site 
that want to download .pdf's. They will fill out some information before I 
redirect to the pdf.

I'm thinking the best way to handle this is sessions, but is it appropriate to 
store all of the users info - so that if he downloads 2 items - I can 
re-populate the fields so he doesnt have to? So if they click on an additional 
pdf I'll need to somehow check for the session and re-populate 11 fields, and 
they will only have to fill in one field at that time.

Or would cookies be better ?  I need to store probably 11 different form 
variables. Also - would you store the variables in an array in the session? 
This seems neat and tidy...

Hope this is clear.

Any advice/guidance/sample scripts would be appreciated.

Thanks

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



[PHP-DB] [PMX:55%] Re: [PHP-DB] get rid of the HTML tags

2004-04-12 Thread Mignon Hunter
Why are my posts not getting through?  I got 3 Delivery Report Failures on Thursday 
all due to 

Diagnostic was Unable to transfer, Message timed out
Information Message timed out

 Daniel Clark [EMAIL PROTECTED] 04/12/04 11:54AM 
Try strip_tags()

http://www.phpbuilder.com/manual/function.strip-tags.php 


 I have this string:

 $my_string = bhello world/ba href='teste.php'this is a test for a
 link with a image img src='test.jpg'/a

 Is there any function that retrieves only the string without the html
 tags?!

-- 
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] [PMX:55%] Re: [PHP-DB] get rid of the HTML tags

2004-04-12 Thread Mignon Hunter
Yes - they are from [EMAIL PROTECTED]



 Hutchins, Richard [EMAIL PROTECTED] 04/12/04 12:09PM 
Mignon,

Are you getting the delivery report failures from [EMAIL PROTECTED] 
I get those almost every day and I'm never really sure if my posts get
through either (although I think they do). If you're getting these
bouncebacks from the btconnect.com server, then maybe this is a problem that
is more widespread than you and I and should be brought to the attention of
the list admin?

Rich Hutchins

 -Original Message-
 From: Mignon Hunter [mailto:[EMAIL PROTECTED] 
 Sent: Monday, April 12, 2004 1:06 PM
 To: [EMAIL PROTECTED] 
 Subject: [PHP-DB] [PMX:55%] Re: [PHP-DB] get rid of the HTML tags
 
 
 Why are my posts not getting through?  I got 3 Delivery 
 Report Failures on Thursday all due to 
 
 Diagnostic was Unable to transfer, Message timed out
 Information Message timed out
 
  Daniel Clark [EMAIL PROTECTED] 04/12/04 11:54AM 
 Try strip_tags()
 
 http://www.phpbuilder.com/manual/function.strip-tags.php 
 
 
  I have this string:
 
  $my_string = bhello world/ba href='teste.php'this is 
 a test for a
  link with a image img src='test.jpg'/a
 
  Is there any function that retrieves only the string 
 without the html
  tags?!
 
 -- 
 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] Stumped with proper query display

2004-04-08 Thread Mignon Hunter
Tables are listed below the code

I couldnt get the foreach to work properly that Brent sent..I keep getting:

Invalid argument supplied for foreach() .

I've tried lots of different stuff but here's an example:

*

$query = SELECT * FROM cust;
$res = mysql_query($query, $ups_conn) or die(mysql_error());

$query2 = SELECT * FROM contact;
$res2 = mysql_query($query2, $ups_conn) or die(mysql_error());

while ($row = mysql_fetch_assoc($res)) {  
while ($row2 = mysql_fetch_assoc($res2)) {
 $choice_array[] = $row2['choice'];
  //Consolidate your choices into an associative array
foreach($choice_array as $choices) {
 //Get Unique ID for consolodiation
$personID= $choices['id'];
//Save value of fields being consolidated
$choicesList[$personID]['choice'] .= $choices['choice'].', ';
//Add Names and Company
$choicesList[$personID]['Name'] = $row['name'];
$choicesList[$personID]['company'] = $row['company'];
}
}
}

Here's what I have been trying:

*

while ($row = mysql_fetch_assoc($res)) {  
while ($row2 = mysql_fetch_assoc($res2)) {
$choice_array[$row2['id']][] = $row2['choice'];
}
}

print(pre);
print_r($choice_array);
print(/pre);

*
Yields this:

Array
(
[5] = Array
(
[0] = send_rep
)
[4] = Array
(
[0] = 2-3
[1] = send_rep
)
)
*

so I THINK I am close if I can figure out how to grab the cust table info based on id 
and iterate through the $choice_array and display it correctly.  I also couldnt figure 
out how to do only one on query instead of two :(  But I wont sweat the small stuff.

table structure:

CUST TABLE

id: 5
name: jane doe
company: ibm

id: 4
name:  mignon hunter
company: tic

CONTACT TABLE

id: 4 
choice: 2-3

id: 4
choice: send_rep

id: 5
choice: send_rep

*

Any ideas or suggestions as always, will be greatly appreciated.  Would love to learn 
a more elegant way do to this.

Thx
Mignon

 Brent Baisley [EMAIL PROTECTED] 03/26/04 12:13PM 
The way I handle queries like this is to use an associative array with 
the ID as the named index key. You then loop through the data 
consolidating the choices and linking the other data based on id. Since 
you are using a named index, it doesn't matter how your data is sorted.

//Consolidate your choices into an associative array
foreach($choiceData as $choices) {
//Get Unique ID for consolodiation
$personID= $choices['id'];
//Save value of fields being consolidated
$choicesList[$personID]['choice'] .= $choices['choice'].', ';
//Add Names and Company
$choicesList[$personID]['Name'] = $names['Name'];
$choicesList[$personID]['company'] = $names['company'];
}

You should now have an array ($choicesList) containing your 
consolidated data. Each array element will contain and array with three 
items: choices, name, company. The 'choices' will have an extra ', ' at 
the end, but that's easy to get rid of with rtrim().

On Mar 26, 2004, at 10:07 AM, Mignon Hunter wrote:

 Can someone please help me or direct me to some scripts that might get 
 me unstuck, as I've not done this kind of query before.

 To simplify:

 Table1
 id 1
 Name   John Doe
 company  IBM

 Table 2
 id1
 choice choice #1
 id1
 choice  choice #2

 So I have 2 records in table 2 that I need to tie in with id # 1 in 
 table 1.

 What's the smartest way to do the query ? I have 5 different tables I 
 need to query.  I guess I can get the data I want by selecting all 
 from the 5 tables then parsing through like:

 while ($row = mysql_fetch_assoc($res)) {
 foreach Table1.id {
 if Table1.id == Table2.id{
 echo tr
 }}}

 I could probably manage if I do 5 different queries with 5 different 
 results sets, but that is obviously inelegant and would create more 
 overhead

 I need to display as:

 John Doe   IBM Choice #1, Choice #2

 Am I even close ?  Need some help with the logic...

 Thx for any guidance

 mignon

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



-- 
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577



CC: [EMAIL PROTECTED]

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



RE: [PHP-DB] Stumped with proper query display

2004-04-08 Thread Mignon Hunter
Thank you FG - this is exactly what I needed.

I think I 've got the query perfect, but how best to display like:

5 jane doe send_rep
4 mignon hunter tic 2-3, send_rep

here's my query:
$query = SELECT cust.id, first, last, company, choice FROM cust, contact
where cust.id = contact.id;
while ($row = mysql_fetch_assoc($res)) {
print_r[4row]
}

this yields me:

Array
(
[id] = 5
[first] = jane
[last] = doe
[company] = 
[choice] = send_rep
)

Array
(
[id] = 4
[first] = mignon
[last] = hunter
[company] = tic
[choice] = 2-3
)

Array
(
[id] = 4
[first] = mignon
[last] = hunter
[company] = tic
[choice] = send_rep
)



 fgc [EMAIL PROTECTED] 04/08/04 11:01AM 
Hi all, new to the list :)

I would try something like this:

Select name, company, choice
From Table1, Table2
Where Table1.id = Table2.id;

Fg



 Can someone please help me or direct me to some scripts that might get 
 me unstuck, as I've not done this kind of query before.

 To simplify:

 Table1
 id 1
 Name   John Doe
 company  IBM

 Table 2
 id1
 choice choice #1
 id1
 choice  choice #2

 So I have 2 records in table 2 that I need to tie in with id # 1 in 
 table 1.

 What's the smartest way to do the query ? I have 5 different tables I 
 need to query.  I guess I can get the data I want by selecting all 
 from the 5 tables then parsing through like:

 while ($row = mysql_fetch_assoc($res)) {
 foreach Table1.id {
 if Table1.id == Table2.id{
 echo tr
 }}}

 I could probably manage if I do 5 different queries with 5 different 
 results sets, but that is obviously inelegant and would create more 
 overhead

 I need to display as:

 John Doe   IBM Choice #1, Choice #2

 Am I even close ?  Need some help with the logic...

 Thx for any guidance

 mignon

-- 
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] Stumped with proper query and display

2004-04-07 Thread Mignon Hunter
I never saw this email come across - I think it got caught in spam software on 4-1



Well I'm still working on this off and on - still having problems :|

I couldnt get the foreach to work properly..I keep getting:

Invalid argument supplied for foreach() .

I've tried lots of different stuff but here's an example:

*

$query = SELECT * FROM cust;
$res = mysql_query($query, $ups_conn) or die(mysql_error());

$query2 = SELECT * FROM contact;
$res2 = mysql_query($query2, $ups_conn) or die(mysql_error());

while ($row = mysql_fetch_assoc($res)) {  
while ($row2 = mysql_fetch_assoc($res2)) {
 $choice_array[] = $row2['choice'];
  //Consolidate your choices into an associative array
foreach($choice_array as $choices) {
 //Get Unique ID for consolodiation
$personID= $choices['id'];
//Save value of fields being consolidated
$choicesList[$personID]['choice'] .= $choices['choice'].', ';
//Add Names and Company
$choicesList[$personID]['Name'] = $row['name'];
$choicesList[$personID]['company'] = $row['company'];
}
}
}

Here's what I have been trying:

*

while ($row = mysql_fetch_assoc($res)) {  
while ($row2 = mysql_fetch_assoc($res2)) {
$choice_array[$row2['id']][] = $row2['choice'];
}
}

print(pre);
print_r($choice_array);
print(/pre);

*
Yields this:

Array
(
[5] = Array
(
[0] = send_rep
)
[4] = Array
(
[0] = 2-3
[1] = send_rep
)
)
*

so I THINK I am close if I can figure out how to grab the cust table info based on id 
and iterate through the $choice_array and display it correctly.  I also couldnt figure 
out how to do only one on query instead of two :(  But I wont sweat the small stuff.

table structure:

CUST TABLE

id: 5
name: jane doe
company: ibm

id: 4
name:  mignon hunter
company: tic

CONTACT TABLE

id: 4 
choice: 2-3

id: 4
choice: send_rep

id: 5
choice: send_rep

*

Any ideas or suggestions as always, will be greatly appreciated.  Would love to learn 
a more elegant way do to this.

Thx
Mignon

 Brent Baisley [EMAIL PROTECTED] 03/26/04 12:13PM 
The way I handle queries like this is to use an associative array with 
the ID as the named index key. You then loop through the data 
consolidating the choices and linking the other data based on id. Since 
you are using a named index, it doesn't matter how your data is sorted.

//Consolidate your choices into an associative array
foreach($choiceData as $choices) {
//Get Unique ID for consolodiation
$personID= $choices['id'];
//Save value of fields being consolidated
$choicesList[$personID]['choice'] .= $choices['choice'].', ';
//Add Names and Company
$choicesList[$personID]['Name'] = $names['Name'];
$choicesList[$personID]['company'] = $names['company'];
}

You should now have an array ($choicesList) containing your 
consolidated data. Each array element will contain and array with three 
items: choices, name, company. The 'choices' will have an extra ', ' at 
the end, but that's easy to get rid of with rtrim().

On Mar 26, 2004, at 10:07 AM, Mignon Hunter wrote:

 Can someone please help me or direct me to some scripts that might get 
 me unstuck, as I've not done this kind of query before.

 To simplify:

 Table1
 id 1
 Name   John Doe
 company  IBM

 Table 2
 id1
 choice choice #1
 id1
 choice  choice #2

 So I have 2 records in table 2 that I need to tie in with id # 1 in 
 table 1.

 What's the smartest way to do the query ? I have 5 different tables I 
 need to query.  I guess I can get the data I want by selecting all 
 from the 5 tables then parsing through like:

 while ($row = mysql_fetch_assoc($res)) {
 foreach Table1.id {
 if Table1.id == Table2.id{
 echo tr
 }}}

 I could probably manage if I do 5 different queries with 5 different 
 results sets, but that is obviously inelegant and would create more 
 overhead

 I need to display as:

 John Doe   IBM Choice #1, Choice #2

 Am I even close ?  Need some help with the logic...

 Thx for any guidance

 mignon

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



-- 
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

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



Re: [PHP-DB] Stumped with proper query display

2004-04-01 Thread Mignon Hunter
Well I'm still working on this off and on - still having problemos :|

I couldnt get the foreach to work properly..I keep getting:

Invalid argument supplied for foreach() .

I've tried lots of different stuff but here's an example:

*

$query = SELECT * FROM cust;
$res = mysql_query($query, $ups_conn) or die(mysql_error());

$query2 = SELECT * FROM contact;
$res2 = mysql_query($query2, $ups_conn) or die(mysql_error());

while ($row = mysql_fetch_assoc($res)) {  
while ($row2 = mysql_fetch_assoc($res2)) {
 $choice_array[] = $row2['choice'];
  //Consolidate your choices into an associative array
foreach($choice_array as $choices) {
 //Get Unique ID for consolodiation
$personID= $choices['id'];
//Save value of fields being consolidated
$choicesList[$personID]['choice'] .= $choices['choice'].', ';
//Add Names and Company
$choicesList[$personID]['Name'] = $row['name'];
$choicesList[$personID]['company'] = $row['company'];
}
}
}

Here's what I have been trying:

*

while ($row = mysql_fetch_assoc($res)) {  
while ($row2 = mysql_fetch_assoc($res2)) {
$choice_array[$row2['id']][] = $row2['choice'];
}
}

print(pre);
print_r($choice_array);
print(/pre);

*
Yields this:

Array
(
[5] = Array
(
[0] = send_rep
)
[4] = Array
(
[0] = 2-3
[1] = send_rep
)
)
*

so I THINK I am close if I can figure out how to grab the cust table info based on id 
and iterate through the $choice_array and display it correctly.  I also couldnt figure 
out how to do only one on query instead of two :(  But I wont sweat the small stuff.

table structure:

CUST TABLE

id: 5
name: jane doe
company: ibm

id: 4
name:  mignon hunter
company: tic

CONTACT TABLE

id: 4 
choice: 2-3

id: 4
choice: send_rep

id: 5
choice: send_rep

*

Any ideas or suggestions as always, will be greatly appreciated.  Would love to learn 
a more elegant way do to this.

Thx
Mignon

 Brent Baisley [EMAIL PROTECTED] 03/26/04 12:13PM 
The way I handle queries like this is to use an associative array with 
the ID as the named index key. You then loop through the data 
consolidating the choices and linking the other data based on id. Since 
you are using a named index, it doesn't matter how your data is sorted.

//Consolidate your choices into an associative array
foreach($choiceData as $choices) {
//Get Unique ID for consolodiation
$personID= $choices['id'];
//Save value of fields being consolidated
$choicesList[$personID]['choice'] .= $choices['choice'].', ';
//Add Names and Company
$choicesList[$personID]['Name'] = $names['Name'];
$choicesList[$personID]['company'] = $names['company'];
}

You should now have an array ($choicesList) containing your 
consolidated data. Each array element will contain and array with three 
items: choices, name, company. The 'choices' will have an extra ', ' at 
the end, but that's easy to get rid of with rtrim().

On Mar 26, 2004, at 10:07 AM, Mignon Hunter wrote:

 Can someone please help me or direct me to some scripts that might get 
 me unstuck, as I've not done this kind of query before.

 To simplify:

 Table1
 id 1
 Name   John Doe
 company  IBM

 Table 2
 id1
 choice choice #1
 id1
 choice  choice #2

 So I have 2 records in table 2 that I need to tie in with id # 1 in 
 table 1.

 What's the smartest way to do the query ? I have 5 different tables I 
 need to query.  I guess I can get the data I want by selecting all 
 from the 5 tables then parsing through like:

 while ($row = mysql_fetch_assoc($res)) {
 foreach Table1.id {
 if Table1.id == Table2.id{
 echo tr
 }}}

 I could probably manage if I do 5 different queries with 5 different 
 results sets, but that is obviously inelegant and would create more 
 overhead

 I need to display as:

 John Doe   IBM Choice #1, Choice #2

 Am I even close ?  Need some help with the logic...

 Thx for any guidance

 mignon

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



-- 
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

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



Re: [PHP-DB] Stumped with proper query display

2004-03-26 Thread Mignon Hunter
Can someone please help me or direct me to some scripts that might get me unstuck, as 
I've not done this kind of query before.

To simplify:

Table 1
id 1
Name   John Doe
company  IBM

Table 2
id1
choice choice #1
id1
choice  choice #2

So I have 2 records in table 2 that I need to tie in with id # 1 in table 1.  

What's the smartest way to do the query ? I have 5 different tables I need to query.  
I guess I can get the data I want by selecting all from the 5 tables then parsing 
through like:

while ($row = mysql_fetch_assoc($res)) {
foreach Table1.id {
if Table1.id == Table2.id{
echo tr
}}}

I could probably manage if I do 5 different queries with 5 different results sets, but 
that is obviously inelegant and would create more overhead

I need to display as:

John Doe   IBM Choice #1, Choice #2

Am I even close ?  Need some help with the logic...

Thx for any guidance

mignon

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



Re: [PHP-DB] Stumped with proper query display

2004-03-26 Thread Mignon Hunter
Ok

Lets say for simplicity sake that I have 3 tables:

table one: contact
id  
choice

table two: cust
id
first
last 
title
company

table three: industry
id
industry
industry_other

So --- for example in table contact I may have:

id - 1
choice - choice#1
id -1
choice -choice#6

in table cust I may have

id - 1
first - John
last - Doe
title - pres
company - ibm

in table industry I may have

id -  1
industry - computers
industry_other - null

So --- I guess I need to run a join query or 3 queries.  I need to display as such:

id name industrycontact
1  John Doe  computers choice#1,choice#6

As you can see, I will need to display more than one record for a given id from the 
contact table.

Does this make more sense?  I'm not sure how to do the query and display the result...

Any guidance is greatly appreciated...I'll name my first born after you !  Or my next 
dog :)

mignon


 Ricardo Lopes [EMAIL PROTECTED] 03/26/04 10:54AM 
i dont understand this part:

What's the smartest way to do the query ? I have 5 different tables I need
to query.  I guess I can get the data I want by selecting all from the 5
tables then parsing

Send your tables structure.

- Original Message -
From: Mignon Hunter [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 26, 2004 3:07 PM
Subject: Re: [PHP-DB] Stumped with proper query  display


Can someone please help me or direct me to some scripts that might get me
unstuck, as I've not done this kind of query before.

To simplify:

Table 1
id 1
Name   John Doe
company  IBM

Table 2
id1
choice choice #1
id1
choice  choice #2

So I have 2 records in table 2 that I need to tie in with id # 1 in table 1.

What's the smartest way to do the query ? I have 5 different tables I need
to query.  I guess I can get the data I want by selecting all from the 5
tables then parsing through like:

while ($row = mysql_fetch_assoc($res)) {
foreach Table1.id {
if Table1.id == Table2.id{
echo tr
}}}

I could probably manage if I do 5 different queries with 5 different results
sets, but that is obviously inelegant and would create more overhead

I need to display as:

John Doe   IBM Choice #1, Choice #2

Am I even close ?  Need some help with the logic...

Thx for any guidance

mignon

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

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

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



[PHP-DB] Re: exporting data to excel

2004-03-25 Thread Mignon Hunter
Hello all
 
I am also needing to do this - I got the xcel ss to generate but it wont tab to the 
next cell in xcel...

Here's what I've tried so far:


?php
  while ($row = mysql_fetch_assoc($res)) {  
  echo $row[first]  . \t  . $row[last] . \n;
//  echo $row[first]  . ,  . $row[last] . \n;
//  echo $row[first],$row[last]\n;
//  echo $row[first]\t$row[last]\t\n;
//  echo $row[first] . , . $row[last];
  }
  ?

***

But I get all the fields in one cell on each of these tries... 

Thanks

 Geir Pedersen - Activio AS [EMAIL PROTECTED] 03/24/04 08:04PM 

Matthew,

 I am looking for the easiest way to export data to an excel file. Is
 the eaiest way to use PHP's file handling functions?

I assume you want to delivery the execl file to a web user.
Then there is no need to write the data to disk, you can
generate the whole thing on the fly while you deliver it to the
user. Here is a basic description on how:

1) Create a PHP document to generate the execl file and make
   sure the script produces HTTP headers telling the user agent
   that it is receiving an excel document. Start the script
   with:

  header (Content-type: application/vnd.ms-excel);
  header (Content-Disposition: attachment );

   The content disposition header says that the execl file is
   to be stored on disk. 

2) Generate the spreadsheet data as a list of newline separated
   rows with tab separated fields:

   echo field1\tfield2\t...\n;

3) Set up a link to the new PHP document. When a user clicks on
   that link, he will be prompted by his user agent on where to
   save the excel file.


---

Geir Pedersen
http://www.activio.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] Re: exporting data to excel

2004-03-25 Thread Mignon Hunter
Here's what I ended up doing that works:



(do all the db connection stuff - get your result, etc..)

table width=100% border=1
  tr
td div align=centerstrongName/strong/div/td
td div align=centerstrongCompany /strong/div/td
td div align=centerstrongAddress /strong/div/td
td div align=centerstrongE-mail/strong/div/td
td div align=centerstrongTelephone/strong/div/td
/tr

?php
  while ($row = mysql_fetch_assoc($res)) {
  ?
tr
td?php echo $row[first] . $row[last]; ?/td
td?php echo $row[company] . $row[title]; ?/td 
td?php echo $row[address1] . , . $row[city] . , . $row[state] . , . 
$row[zip]; ?/td
td?php echo $row[email]; ?/td
td?php echo $row[phone]; ?/td
/tr
?php 
}
? 
/table

**

use the header() info in this post at the top of your page, create another page and 
link to this script. You can either view the excel or save to disk...

Thanks
Mignon




 Geir Pedersen - Activio AS [EMAIL PROTECTED] 03/24/04 08:04PM 

Matthew,

 I am looking for the easiest way to export data to an excel file. Is
 the eaiest way to use PHP's file handling functions?

I assume you want to delivery the execl file to a web user.
Then there is no need to write the data to disk, you can
generate the whole thing on the fly while you deliver it to the
user. Here is a basic description on how:

1) Create a PHP document to generate the execl file and make
   sure the script produces HTTP headers telling the user agent
   that it is receiving an excel document. Start the script
   with:

  header (Content-type: application/vnd.ms-excel);
  header (Content-Disposition: attachment );

   The content disposition header says that the execl file is
   to be stored on disk. 

2) Generate the spreadsheet data as a list of newline separated
   rows with tab separated fields:

   echo field1\tfield2\t...\n;

3) Set up a link to the new PHP document. When a user clicks on
   that link, he will be prompted by his user agent on where to
   save the excel file.


---

Geir Pedersen
http://www.activio.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] Password encryption

2004-03-04 Thread Mignon Hunter
Can anyone recommend, or does anyone have handy, a script that will encrypt passwords 
AND then also be able to retrieve the encrypted password.  

Checking out the docs and some books has confused me mostly.

Thx

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



[PHP-DB] password encryption

2004-03-04 Thread Mignon Hunter
Can anyone recommend, or does anyone have handy, a script that will =
encrypt passwords AND then also be able to retrieve the encrypted =
password. I am not able to use mcrypt.

Checking out the docs and archives and some books has confused me mostly.

Thx

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



[PHP-DB] php-db Forms-Radio problems

2004-01-27 Thread Mignon Hunter
Hello 

I'm having a devil of a time with my form.  I'm able to process checkboxes and fields 
but am having trouble with radio buttons.

Here's how I'm doing the fields which works:

snippet
Your Last Name

input type=text name=last value= size=30 maxlength=40

Title
 
input type=text name=title value= size=30 maxlength=40
/snippet

which produces:

(
[last] = Smith
[title] = Vice President
)

But when I try: 

snippet

input type=radio name=job value=oper
 Operation  Maintenance  
   
 input type=radio name=job value=eng
 Engineering (Including Project Management)   
   
 input type=radio name=job value=mgmt
 Management (other than corporate)  
   
 input type=radio name=job value=other
Other - Please Specify
   input name=job type=text size=30

/snippet

and one is selected, I get:

(
 [job] = 
)

I have searched archives, books, tutorials...cant figure it out.  Are radio buttons 
handled differently?

Can someone please enlighten me?

Thx



Mignon Hunter
Webmaster
Toshiba International Corporation
(713) 466-0277 x 3461
(800) 466-0277 x 3461

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



[PHP-DB] php-db- Forms radion buttons

2004-01-27 Thread Mignon Hunter
Hello 

I'm having a devil of a time with my form.  I'm able to process checkboxes and fields 
but am having trouble with radio buttons.

Here's how I'm doing the fields which works:

snippet
Your Last Name

input type=text name=last value= size=30 maxlength=40

Title
 
input type=text name=title value= size=30 maxlength=40
/snippet

which produces:

(
[last] = Smith
[title] = Vice President
)

But when I try: 

snippet

input type=radio name=job value=oper
 Operation  Maintenance  
   
 input type=radio name=job value=eng
 Engineering (Including Project Management)   
   
 input type=radio name=job value=mgmt
 Management (other than corporate)  
   
 input type=radio name=job value=other
Other - Please Specify
   input name=job type=text size=30

/snippet

and one is selected, I get:

(
 [job] = 
)

I have searched archives, books, tutorials...cant figure it out.  Are radio buttons 
handled differently?

Can someone please enlighten me?

Thx


Mignon Hunter
Webmaster
Toshiba International Corporation
(713) 466-0277 x 3461
(800) 466-0277 x 3461

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



Re: [PHP-DB] php-db Forms-Radio problems

2004-01-27 Thread Mignon Hunter
THANK YOU

duh me

I knew it was something simple  :(

Mignon Hunter
Webmaster
Toshiba International Corporation
(713) 466-0277 x 3461
(800) 466-0277 x 3461


 Stuart [EMAIL PROTECTED] 01/27/04 11:41AM 
Mignon Hunter wrote:
 input type=radio name=job value=oper
  Operation  Maintenance  

  input type=radio name=job value=eng
  Engineering (Including Project Management)   

  input type=radio name=job value=mgmt
  Management (other than corporate)  

  input type=radio name=job value=other
   Other - Please Specify
input name=job type=text size=30

This last field will overwrite the radio setting when PHP reads the form 
fields. Remove it. It's not needed.

-- 
Stuart

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



[PHP-DB] php-db globals turned off

2004-01-27 Thread Mignon Hunter
How do most of you handle variables in next page after passing.

For instance.  What I have right now (very ugly) is:

$email = $_POST['emal'];
$first = $_POST['first'];
$lastl = $_POST['last'];

Then I work with $email, $first etc...

I will have to do this for many, many variables which doesnt seem very efficient.

I tried:

foreach ($_POST as $key = $value)
$key =  $value;

but that didnt work...but I can print them out.

but even if this did work - this wouldnt handle the 2 sets of arrays I have.

Does anybody have any snippets for this ... ???

Thanks


Mignon Hunter
Webmaster
Toshiba International Corporation
(713) 466-0277 x 3461
(800) 466-0277 x 3461

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



Re: [PHP-DB] php-db globals turned off

2004-01-27 Thread Mignon Hunter
So it will be easier to use in my script on this page, where I'm creating several 
query strings with the data.



Mignon Hunter
Webmaster
Toshiba International Corporation
(713) 466-0277 x 3461
(800) 466-0277 x 3461


 John W. Holmes [EMAIL PROTECTED] 01/28/04 01:15PM 
Mignon Hunter wrote:
 How do most of you handle variables in next page after passing.
 
 For instance.  What I have right now (very ugly) is:
 
 $email = $_POST['emal'];
 $first = $_POST['first'];
 $lastl = $_POST['last'];

Why are you recreating variables? You already have a variable 
$_POST['email'], so why do you feel the need to make $email? Now you 
have two variables to keep track of.

-- 
---John Holmes...

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

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

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

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



RE: [PHP-DB] php-db globals turned off

2004-01-27 Thread Mignon Hunter
How would you extract variables from arrays?

before I was doing

$prod[] = $_POST['prod'];
$choice[] = $_POST['choice'];

then I could iterate through $prod[], $choice[]

Mignon Hunter
Webmaster
Toshiba International Corporation
(713) 466-0277 x 3461
(800) 466-0277 x 3461


 Paul Miller [EMAIL PROTECTED] 01/27/04 01:06PM 
I love this one...

extract($_REQUEST);

but it undermines the whole reason PHP moved to the new default
parameter specification.  Be careful with you coding.  I use it, and it
makes things much like the pre 4.3.2 release without changing the ini
files.  You just have to specify the default $_server and file upload
params.  The other option is change the php.ini file for that dir or
globally.

- Paul

-Original Message-
From: Mignon Hunter [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 27, 2004 12:56 PM
To: [EMAIL PROTECTED] 
Subject: [PHP-DB] php-db globals turned off


How do most of you handle variables in next page after passing.

For instance.  What I have right now (very ugly) is:

$email = $_POST['emal'];
$first = $_POST['first'];
$lastl = $_POST['last'];

Then I work with $email, $first etc...

I will have to do this for many, many variables which doesnt seem very
efficient.

I tried:

foreach ($_POST as $key = $value)
$key =  $value;

but that didnt work...but I can print them out.

but even if this did work - this wouldnt handle the 2 sets of arrays I
have.

Does anybody have any snippets for this ... ???

Thanks


Mignon Hunter
Webmaster
Toshiba International Corporation
(713) 466-0277 x 3461
(800) 466-0277 x 3461

-- 
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] need a quick app

2003-10-07 Thread Mignon Hunter
hello all,

I need to find a database app (php/mysql) where outside users can enter
information in a form and then that data can be acted upon by inside
users

We have an app now that I inherited that was originally built from
phpnuke or postnuke.  It cant be used (on our site) with redhat/php
stronghold because of mcrypt so I'm trying to find something that I can
load and customize without too much time.  If I had alot of time for
this I'd build something from scratch :(.  I considered modifying the
current app but dont have alot of faith in that route as the app is
buggy anyway...

Does anyone have any suggestions?  I can find a ton on sourceforge.net
probably but wanted to see if anyone has had to do something similar and
can recommend something. I have been searching the archives for CMS and
am looking into some of these: drupal and typo3... But content
management is a bit overkill for my needs right now...

Any comments are welcomed.

Thx
Mignon

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



[PHP-DB] PHP-DB - calling c function from php app

2003-06-17 Thread Mignon Hunter
Can anyone make a suggestion on how to connect to a c function from a
php app?

I have to connect to sales tax calculation software.  The function
is being written for me but I have to figure how to call it - get the
variable - and use it again in my php app.

Is this even possible ??

Thx
-- 



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



[PHP-DB] php-db Form var perpetually resetting

2003-06-09 Thread Mignon Hunter
hello all

I am trying to customize a shopping cart.  I need to inject a page in
the checkout process that must be checked (terms and conditions), before
continuing.

I have it working halfway.  In checkout_payment.php I have an if stmt

*

//if terms and conditions hasnt been checked redirect to conditions.php
  if ($HTTP_POST_VARS['agree'] != 'true')   {
   tep_redirect(tep_href_link(FILENAME_CONDITIONS, '', 'SSL'));
  }

*

So - if you go to checkout_payment and that box hasnt been checked it'll
send you to conditions.php.  If you go to conidtions.php and dont check
the box - the page keeps reloading, which is ok for now.

In conditions.php I have

*

form name=conditions action = checkout_payment.php method=post
  trtd?php echo tep_draw_checkbox_field('agree','true');?Check
this box to accept Terms and Conditions/td
td align=right class=mainbr
input type= submit value = continue/td/tr
/form

*

If the box is checked it goes to checkout_payment.php Ok, but when you
click continue from checkout_payment it goes back to conditions.php like
the variable has been reset to false. (I think) Essentially because the
script is running again I guess.

Should I try to set this var in the session ? Or do a simple javascript
validation in conditions.php ???

Any suggestions greatly appreciated.


-- 
Mignon Hunter
Web Master and Developer
Toshiba International
713.466.0277 x 3461


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



[PHP-DB] - Shopping cart software

2003-05-30 Thread Mignon Hunter
Can anyone recommend shopping cart software; does not have to be open
source.  I need to set up pretty fast and be able to calculate the
different sales tax for anywhere, USA.  (International should be ok).

Already have cc processor lined up.

Any suggestions would be appreciated.

Thx

-- 
M Hunter


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



Re: [PHP-DB] Starting to hate MySql... thinking about using MS SqlServer instead...... :-(((((((((

2003-04-01 Thread Mignon Hunter
On my ms box at home when I first started with mysql I used 
mysql LOAD DATA INFILE doc.txt INTO TABLE tablename;

instead of 

mysql LOAD DATA LOCAL INFILE (etc...)


delete 'local'

Now I use phpmyadmin at work on my linux box...

M

On Sun, 2003-03-30 at 18:30, Doug Thompson wrote:
 There's nothing like RTFM to douse the fire in a rant.
 
 quote
 4.2.3 Startup Options for mysqld Concerning Security
 The following mysqld options affect security: 
 
 --local-infile[=(0|1)] 
 If one uses --local-infile=0 then one can't use LOAD DATA LOCAL INFILE. 
 end quote
 
 This setting has been defaulted to 0 in recent releases.  You can read more than you 
 probably want to here:
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 
 PHHPmyadmin is a good gui, but I prefer sqlyog which you'll find at 
 http://www.webyog.com/
 
 hth,
 Doug
 
 
 On Sun, 30 Mar 2003 13:46:23 -0700, Sparky Kopetzky wrote:
 
 ARGGHHH!!!
 
 Trying to use INFILE to load a small (125) entry block of data and all MqSql does 
 is puke:
 
 ERROR 1148: The used command is not allowed with this MySql version. (3.23.55)
 
 If this command is no good, then what the hell am I supposed to use
 
 At least with MS, you have a nice, GUI to use...
 
 Robin Kopetzky
 Black Mesa Computers/ISP
 
-- 
Mignon Hunter
Web Developer
Toshiba International
713.466.0277 x 3461


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



[PHP-DB] compare php and perl

2003-03-20 Thread Mignon Hunter
Can anyone out there compare these two using with mysql and web apps -
What I can gather so far from my limited experience with both and a
little googling:

1. Built in mysql_ functions in php (does perl have this?)
2. Php may be faster.
3. Embedded in html - no separate cgi directory needed.
4. Perl is more mature - more support - more depth to language.

Thx

-- 
Mignon Hunter
Web Developer
Toshiba International
713.466.0277 x 3461


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



RE: [PHP-DB] Storing browser stats

2003-03-06 Thread Mignon Hunter
This will work except for those browsers with javascript turned off -
I've seen php examples of how to do this in books, (capture the user
agent anyway, then once captured - just plop it in the db) there should
be some on line somewhere.   

Also if you have access to the web server, I think most web server stat
programs allow for this.  The one we use is http://www.analog.cx/ and we
have it configured to capture user agents.

mignon

On Thu, 2003-03-06 at 08:58, Matthew Moldvan wrote:
 I would say use JavaScript to gather the information (screen resolution,
 browser info, etc) and then store it in a MySQL or similar DB using PHP.  Do
 a search for JavaScript and PHP variables to find out how (it involves
 populating hidden fields with JS and passing to PHP Scripts AFAIK) ... that
 should get you started, at least. :)
 
 Good luck, and for curiosities sake let me know how the project turns out.
 
 Regards,
 Matthew Moldvan
 
 ---
  System Administrator
  Trilogy International, Inc
   http://www.trilogyintl.com/ecommerce/
 --- 
 
 
 -Original Message-
 From: Bruce Levick [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 05, 2003 6:26 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Storing browser stats
 
 
 Is there a method for storing each users browser stats within a database
 table.
 
 So everytime someone visits the browser info is gathered and stored as a
 unique row in the 'browser' table in the database.
 
 Any advice??
 
 Cheers
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
-- 
Mignon Hunter
Web Developer
Toshiba International
713.466.0277 x 3461


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



Re: [PHP-DB] MySQL problem -- new to PHP

2003-02-13 Thread Mignon Hunter
When changing/adding permissions to the mysql db for specific users,
dont forget to do 'flush privileges'...

my 2 cents


On Thu, 2003-02-13 at 07:19, Evan Morris wrote:
 Hi all
 
 I am new to PHP (just basically started yesterday). I am currently having a
 problem connecting to a MySQL database.
 
 My sample code is:
 
 --
 ?php
 mysql_connect(localhost,username,password) or die (Unable to connect to
 MySQL server.);
 $db = mysql_select_db(DB_NAME) or die (Unable to select requested
 database.);
 ?
 ---
 
 This throws the following error:
 
 ---
 Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to
 connect to this MySQL server
 ---
 
 Now, the mySQL server and the web server reside on the same machine. This
 warning is therefore saying that this machine does not have permission to
 connect to itself. Hmm. I have put entries in the host table and the user
 table, using both hostname and ip address, but no luck. I keep getting the
 same error.
 
 What am I doing wrong?
 
 Any and all help appreciated.
 
 Thanks
 
 Evan Morris
 [EMAIL PROTECTED]
 +27 11 792 2777 (tel)
 +27 11 792 2711 (fax)
-- 
Mignon Hunter
Web Developer
Toshiba International
713.466.0277 x 3461


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




Re: [PHP-DB] checking for empty array from a form field?grrrrrrrrrrr!

2003-02-05 Thread Mignon Hunter
I usually use:

while(list($key,$value) = each($products)) {
echo $key:$value;
}


On Wed, 2003-02-05 at 15:03, Aaron Wolski wrote:
 Argh 
  
 
 HOW does one check for an array being empty from a form field??
  
 Tried a billion different things and NOTHING works
  
 I've tried:
  
 if ($products == \n) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
 
 if ($products == ) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
 
 
 if (empty($products)) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
 
 if (!isset($products)) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
 
 if (count($products) == 0) {
  
 echo hello;
 }
  
 else {
  
 echo bye;
  
 }
  
 
 NOTHING works!!!
  
 Any help.. puuulease?
  
 Aaron
-- 
Mignon Hunter
Web Developer
Toshiba International
713.466.0277 x 3461


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




[PHP-DB] what does % mean?

2003-01-31 Thread Mignon Hunter
Hello list,

I am trying to decipher some code written by someone else.  In it there
is a query:

$query = select description from $prodtable where description like '%'
or type like '%' group by description;

I've seen it used as mathematical modulos, but not sure how it's used
here.  

Thx

-- 
Mignon 



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




[PHP-DB] getting client browser info

2003-01-20 Thread Mignon Hunter
Hello all,

I need a quick script to get the client's browser make and model.
ie 5 ns 4.7 etc.

I've found some info in two books but no examples of how to use it to 
get your visitors info.  Not coming up with anything helpful on the php site - 
will continue to look.

If anyone has done this and/or has an example I would be greatful

Thx

Mignon


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




[PHP-DB] getting client browser info

2003-01-20 Thread Mignon Hunter
Thanks everybody. That is what I was needing.

Question:  Why is it that from an IE client I get the following:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Why does it say mozilla ???

Here's my code:

Your are currently using: br
?printf ($_SERVER[HTTP_USER_AGENT]); ?br

You are using : ?printf ($HTTP_USER_AGENT);? browser 


btw - Both produce the same.  Is it because the apache webserver uses
Mozilla in a default sort of way ???   hum .
-- 
Mignon 


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




Re: [PHP-DB] getting client browser info

2003-01-20 Thread Mignon Hunter
Hey guys,

Does anyone know of script or tutorial to point me to that can obtain
client browser info, (got that part)

but then using php, be able to use if statements to distinguish what
they're using.  example msie 5.1 - netscape - aol...And act upon it.

I know the logic but am clueless on the correct syntax to use with the
different browser versions.

Found some for asp and javascript...need php.

I should probably also post this to php general

Thx for any input 

Mignon






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




RE: [PHP-DB] getting client browser info

2003-01-20 Thread Mignon Hunter
Ah, but I wasnt at a mozilla browser, I was accessing this script from a
ie browser client.

From my mozillia client I get the following:

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020918 browser

The script sits on an apache web server?


On Mon, 2003-01-20 at 12:29, Ford, Mike [LSS] wrote:
  -Original Message-
  From: Mignon Hunter [mailto:[EMAIL PROTECTED]]
  Sent: 20 January 2003 16:32
  
  Question:  Why is it that from an IE client I get the following:
  
  Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
  
  Why does it say mozilla ???
 
 The clue here is in the next word: compatible -- that's Microsoft Internet 
Explorer (MSIE) 6.0 claiming it's compatible with Mozilla 4.0 browsers (of course, 
it's not, but that's MS for you!).
 
  
  Here's my code:
  
  Your are currently using: br
  ?printf ($_SERVER[HTTP_USER_AGENT]); ?br
  
  You are using : ?printf ($HTTP_USER_AGENT);? browser 
  
  
  btw - Both produce the same.  Is it because the apache webserver uses
  Mozilla in a default sort of way ???   hum .
 
 Absolutely nothing to do with Apache -- it's just reporting what the user's browser 
is telling it.  They're the same because they *are* the same: $HTTP_USER_AGENT is the 
register_globals copy of the $_SERVER[] element.
 
 Cheers!
 
 Mike
 
 -
 Mike Ford,  Electronic Information Services Adviser,
 Learning Support Services, Learning  Information Services,
 JG125, James Graham Building, Leeds Metropolitan University,
 Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
 Email: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 
-- 
Mignon Hunter
Web Developer
Toshiba International
713.466.0277 x 3461


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




Re: [PHP-DB] javascript and submitting forms

2003-01-14 Thread Mignon Hunter
Thanks again for the advice.  This approach wont work in this case
because I'm launching the window from an app, then I need to close to
return to the app.  If I submit back to my app, it brings a new app into
the addl window.

And no, you're definetly not stupid !

Thanks for the help.

Mignon


On Mon, 2003-01-13 at 15:51, Micah Stevens wrote:
 
 Wait, I'm stupid. You're closing the window upon submission of the form,
 so that will close the session, so the php at the beginning will never
 process after form submission. Make the form submit to another page that
 won't be closed. 
 
 -Micah
 
 On Mon, 2003-01-13 at 13:24, Mignon Hunter wrote:
 
  Unfortunately I havnt gotten it to work yet.  Am I missing something ?
  
  PS the query works without the closewindow()
  
  ?
  include ('dbconn.php');
  if(isset($submit))
   {   
  $query = INSERT INTO `comments` (  `track_id`, `cat_comments` ) VALUES
  ( '0', '$comm' );;
  mysql_query ($query, $link );   
  }  
  ?
  
  
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
  html
  head
  title/title
  /head
  body
  form action=comp_page3.php method=POST
  Enter your details here:br
  textarea name=comm rows=15 cols=30/textareabr
  
  input type=submit name=submit value=Close and Save
  onClick=return window.close(); 
  
  /form
  /body
  /html
  
  
  On Mon, 2003-01-13 at 14:44, Micah Stevens wrote:
   The window.close(); function is not returning control to the form after
   closing the window. You must tell it to do so. Use:
   
   onClick=return window.close();
   
   This will return the window.close() value to the submit button so that
   it can do its thing after the window has been closed.
   
   Use the same thing for the other form items too. 
   
   Hope this helps. 
   -Micah
   
   
   
   On Mon, 2003-01-13 at 12:31, Mignon Hunter wrote:
   
Hello List,

Has anyone had any problems using the onClick=window.close();
function within a input type = submit ?

I'm trying 

input type=submit name=submit value=submit
onClick=window.close(); 

But evidently it's reading the close before the submit because the value
of my form var is not being passed.  

I have also tried it in conjunction with a hidden field too.

input type=hidden value=?echo $comm;? 
input type=submit name=submit value=submit
onClick=window.close(); 

If I dont use the onclick() the variable gets passed and/or entered into
db just fine.

Curious if anyone has had this problem or if anyone has any ideas...Thx
Mignon
   
   -- 
   Raincross Technologies
   Development and Consulting Services
   http://www.raincross-tech.com
   
  
 
 -- 
 Raincross Technologies
 Development and Consulting Services
 http://www.raincross-tech.com
 



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




Re: [PHP-DB] javascript and submitting forms

2003-01-14 Thread Mignon Hunter
This works!

Thanks Adam


On Tue, 2003-01-14 at 03:11, Adam Royle wrote:
 Hi Mignon,
 
 This should work, never closing the window without submitting  
 (foolproof). Just add some error checking, and you'll be sweet as a  
 nut! All I did was add the echo statement underneath the data insert.
 
 Adam
 
 
 ?
 include ('dbconn.php');
 if(isset($submit))
{
   $query = INSERT INTO `comments` (  `track_id`, `cat_comments` )  
 VALUES ( '0', '$comm' );;
   mysql_query ($query, $link );
   
   echo 'htmlheadscript  
 language=JavaScriptwindow.close();/script/headbody/body/ 
 html';
   
   }
 ?
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
 html
 head
 title/title
 /head
 body
 form action=comp_page3.php method=POST
 Enter your details here:br
 textarea name=comm rows=15 cols=30/textareabr
 
 input type=submit name=submit value=Close and Save
 
 /form
 /body
 /html
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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




Re: [PHP-DB] Arrays and forms

2003-01-14 Thread Mignon Hunter
Hello list,

I submitted this problem earlier but got no response so I thought I'd
elaborate.

The code below successfully displays all of the problems from the db. 
Based on what is chosen here, needs to go into another table in the db 
along with a customer tracking id.

for($knt = 0;$row = mysql_fetch_row($res3); $knt++)
{
$cat_detail = $row[0];
echo trtdinput type=\checkbox\ name=\prob[]\ value =
\$cat_detail\/td td $cat_detail /td
.td High input type=\checkbox\ name=\level[]\
value=\1\/td
.td Med input type=\checkbox\ name=\level[]\
value=\2\/td
.td Low input type=\checkbox\ name=\level[]\
value=\3\/td
.tdcenterinput type=\checkbox\  name=\yes\ Yes
/center/td/tr;
}

When this page is submitted, I can successfully capture $prob[]  - but I
am having no luck in pulling the corresponding $level[] (if one was
checked).  So my form - once submitted - may look like:

Problem one (no priority picked)
Problem two High priority
Problem three   Low priority

My $prob[] would be:My $level[] would be:

$prob[0]: Problem one   $level[0]:  High
$prob[1]: Problem two   $level[1]:  Low
$prob[2]: Problem three

So as you can see my second problem does not correctly correspond to the
correct priority.  The first (or all) element(s) in the level array may
be null.

I have read up on and tried some associative arrays but no luck in
utilizing them within a form; been trying all sorts of testing, books,
web tuts, etc. but still come up with the same problem.  

Also in case anyone were to suggest sessions, my supervisor is adamently
opposed to using them on this site, not sure why, not even sure if that
would make my life easier or not since I've never used them.

Any comments (good, bad, indifferent) here would be most appreciated. 
Any suggestions as to other ways of doing this also appreciated.

Many thanks 

Mignon


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




[PHP-DB] problems with Forms again

2003-01-13 Thread Mignon Hunter

Hello all,

Well it's Monday :( and my code wont work.

I have a form that dynamically produces tables.  From each cat_detail
any of the checkboxes can be picked, be it the detail itself, levels 1
or 2 or 3, and or a 'yes'.

I can capture the cat_detail in the prob[] array in the next page.  I
can also echo any of the other check boxes if picked.  My problem is
corresponding the detail with the levels. In other words: say you have
two rows and each item has a checkbox that can be checked.

1.  Bad product  1 2 3 yes
2.  Bad Cust Service 1 2 3 yes
3.  etc
4.  etc

Say the user picks # 2 with level 3 and yes.  I can capture which
details the user picks but am having problems linking the level2 with
that particular detail.

If anyone has any ideas please let me know.  PS my supervisor is not
wanting me to use sessions...

Here's the code snipet producing the tables:



for($knt = 0;$row = mysql_fetch_row($res3); $knt++)
{
$cat_detail = $row[0];
echo trtdinput type=\checkbox\ name=\prob[]\ value =
\$cat_detail\/tdtdnbsp;$cat_detail/td
.tdHighinput type=\checkbox\ name=\level_one[]\
value=\1\/td
.tdMedinput type=\checkbox\ name=\level_two[]\
value=\2\/td
.tdLowinput type=\checkbox\ name=\level_three[]\
value=\3\/td
.tdcenterinput type=\checkbox\
name=\yes\nbsp;Yes/center/td/tr;

}
***

Thanks,
Mignon


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




Re: [PHP-DB] javascript and submitting forms

2003-01-13 Thread Mignon Hunter
Hello List,

Has anyone had any problems using the onClick=window.close();
function within a input type = submit ?

I'm trying 

input type=submit name=submit value=submit
onClick=window.close(); 

But evidently it's reading the close before the submit because the value
of my form var is not being passed.  

I have also tried it in conjunction with a hidden field too.

input type=hidden value=?echo $comm;? 
input type=submit name=submit value=submit
onClick=window.close(); 

If I dont use the onclick() the variable gets passed and/or entered into
db just fine.

Curious if anyone has had this problem or if anyone has any ideas...Thx
Mignon


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




Re: [PHP-DB] javascript and submitting forms

2003-01-13 Thread Mignon Hunter
Unfortunately I havnt gotten it to work yet.  Am I missing something ?

PS the query works without the closewindow()

?
include ('dbconn.php');
if(isset($submit))
 {   
$query = INSERT INTO `comments` (  `track_id`, `cat_comments` ) VALUES
( '0', '$comm' );;
mysql_query ($query, $link );   
}  
?


!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
html
head
title/title
/head
body
form action=comp_page3.php method=POST
Enter your details here:br
textarea name=comm rows=15 cols=30/textareabr

input type=submit name=submit value=Close and Save
onClick=return window.close(); 

/form
/body
/html


On Mon, 2003-01-13 at 14:44, Micah Stevens wrote:
 The window.close(); function is not returning control to the form after
 closing the window. You must tell it to do so. Use:
 
 onClick=return window.close();
 
 This will return the window.close() value to the submit button so that
 it can do its thing after the window has been closed.
 
 Use the same thing for the other form items too. 
 
 Hope this helps. 
 -Micah
 
 
 
 On Mon, 2003-01-13 at 12:31, Mignon Hunter wrote:
 
  Hello List,
  
  Has anyone had any problems using the onClick=window.close();
  function within a input type = submit ?
  
  I'm trying 
  
  input type=submit name=submit value=submit
  onClick=window.close(); 
  
  But evidently it's reading the close before the submit because the value
  of my form var is not being passed.  
  
  I have also tried it in conjunction with a hidden field too.
  
  input type=hidden value=?echo $comm;? 
  input type=submit name=submit value=submit
  onClick=window.close(); 
  
  If I dont use the onclick() the variable gets passed and/or entered into
  db just fine.
  
  Curious if anyone has had this problem or if anyone has any ideas...Thx
  Mignon
 
 -- 
 Raincross Technologies
 Development and Consulting Services
 http://www.raincross-tech.com
 



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




Re: [PHP-DB] javascript and submitting forms

2003-01-13 Thread Mignon Hunter
Nevermind Micah,

Thanks for your input, I just did 2 buttons for the user - one to submit
and one to close the window.

Thanks for your help 

Mignon


On Mon, 2003-01-13 at 15:24, Mignon Hunter wrote:
 Unfortunately I havnt gotten it to work yet.  Am I missing something ?
 
 PS the query works without the closewindow()
 
 ?
 include ('dbconn.php');
 if(isset($submit))
{   
   $query = INSERT INTO `comments` (  `track_id`, `cat_comments` ) VALUES
 ( '0', '$comm' );;
   mysql_query ($query, $link );   
   }  
 ?
 
 
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
 html
 head
 title/title
 /head
 body
 form action=comp_page3.php method=POST
 Enter your details here:br
 textarea name=comm rows=15 cols=30/textareabr
 
 input type=submit name=submit value=Close and Save
 onClick=return window.close(); 
 
 /form
 /body
 /html
 
 
 On Mon, 2003-01-13 at 14:44, Micah Stevens wrote:
  The window.close(); function is not returning control to the form after
  closing the window. You must tell it to do so. Use:
  
  onClick=return window.close();
  
  This will return the window.close() value to the submit button so that
  it can do its thing after the window has been closed.
  
  Use the same thing for the other form items too. 
  
  Hope this helps. 
  -Micah
  
  
  
  On Mon, 2003-01-13 at 12:31, Mignon Hunter wrote:
  
   Hello List,
   
   Has anyone had any problems using the onClick=window.close();
   function within a input type = submit ?
   
   I'm trying 
   
   input type=submit name=submit value=submit
   onClick=window.close(); 
   
   But evidently it's reading the close before the submit because the value
   of my form var is not being passed.  
   
   I have also tried it in conjunction with a hidden field too.
   
   input type=hidden value=?echo $comm;? 
   input type=submit name=submit value=submit
   onClick=window.close(); 
   
   If I dont use the onclick() the variable gets passed and/or entered into
   db just fine.
   
   Curious if anyone has had this problem or if anyone has any ideas...Thx
   Mignon
  
  -- 
  Raincross Technologies
  Development and Consulting Services
  http://www.raincross-tech.com
  
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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




[PHP-DB] insert form data

2003-01-08 Thread Mignon Hunter

Hello list,

I am able to get the query to work by itself but it will not work using
the if (isset ($submit)) and NO errors are outputting...nothing.  

Any suggestions would be greatly appreciated.  I havnt even gotten to
the form variables yet...and yes, my globals are turned on (at least for
now).  Are there error display holes that I have missed?

What am I doing wrong ???...

Here's code:


?
if (isset ($submit) ) 
{

function showerror()
{
die(Error  . mysql_errno() .  :  . mysql_error());
}

$dbhost = 1.1.1.1;
$dbuname = uname;
$dbpass = password;
$dbname = databasename;

$link = mysql_connect ($dbhost, $dbuname, $dbpass) or die (Unable to
connect);
@mysql_select_db($dbname) or die (Unable to select database);


//From other script - this query works but not on this page.
$query = INSERT INTO `cust_info` (  `comp_name` , `city` , `state` )
VALUES ('test3', 'test3', 'test3');;

if (!mysql_query ($query, $link ))
showerror();//nothing
echo Here's query: $query;//nothing
}
else
{

?

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
htmlhead
title/title/head
body
center
h3Welcome tobrToshiba International CorporationbrCustomer
Feedback/center
form name=form1 action=survey_index.php method=post
table align=center cellpadding=5
tr
th colspan=2Please Enter the Information Below and Press the
'Submit' brButton When Finished.br(All Fields
Required)/thtrtdnbsp;/td/tr/trtr
tdb Company Name:  /b/td
tdinput type=text name=comp_name size=50/td/tr
trtdbCity:/b/td
tdinput type=text name=city size=50/td
/tr
trtdbState:/b/tdtd
select name=state size=1
option value=../Choose one
option value=alAL
option value=akAK
/select
/td/tr
trtdbContact Name:  /b/td
tdinput type=text name=contact size=50/td/tr
/table
br
table align=center
tr td
center
input type=submit value=Submit
/center
/form
/table
/body
/html
?
}
?


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




Re: [PHP-DB] insert form data

2003-01-08 Thread Mignon Hunter
Thank you!  - you know (darn it!) I had that submit name in the input
type on previous test pages - must have forgot it on this one. I'm
stressin'...

Thanks again


On Wed, 2003-01-08 at 13:41, 1LT John W. Holmes wrote:
  I am able to get the query to work by itself but it will not work using
  the if (isset ($submit)) and NO errors are outputting...nothing.  
 
 That's because $submit is not set
  
  Any suggestions would be greatly appreciated.  I havnt even gotten to
  the form variables yet...and yes, my globals are turned on (at least for
  now).  Are there error display holes that I have missed?
  
  What am I doing wrong ???...
 [snip]
  input type=submit value=Submit
 
 Name your form element, so $submit will be set.
 
 input type=submit name=submit value=Submit
 
 ---John Holmes...
 
 -- 
 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] insert form data

2003-01-08 Thread Mignon Hunter
Uh - excuse me, Me Again...

When I post to my next page in the survey in the form action, instead of
this page, the data doesnt go into the database.  

Does anyone know a way around this other than rewriting all the pages
into one page?

Many thx
Mignon


On Wed, 2003-01-08 at 13:50, Mignon Hunter wrote:
 Thank you!  - you know (darn it!) I had that submit name in the input
 type on previous test pages - must have forgot it on this one. I'm
 stressin'...
 
 Thanks again
 
 
 On Wed, 2003-01-08 at 13:41, 1LT John W. Holmes wrote:
   I am able to get the query to work by itself but it will not work using
   the if (isset ($submit)) and NO errors are outputting...nothing.  
  
  That's because $submit is not set
   
   Any suggestions would be greatly appreciated.  I havnt even gotten to
   the form variables yet...and yes, my globals are turned on (at least for
   now).  Are there error display holes that I have missed?
   
   What am I doing wrong ???...
  [snip]
   input type=submit value=Submit
  
  Name your form element, so $submit will be set.
  
  input type=submit name=submit value=Submit
  
  ---John Holmes...
  
  -- 
  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] insert form data

2003-01-08 Thread Mignon Hunter
Actually, I dont need these variables in the rest of the form, I just
need to go to the next page...Like a hyperlink on the submit button
maybe ???

Seems like I've seen that...

Mignon


On Wed, 2003-01-08 at 14:12, 1LT John W. Holmes wrote:
  When I post to my next page in the survey in the form action, instead of
  this page, the data doesnt go into the database.  
  
  Does anyone know a way around this other than rewriting all the pages
  into one page?
 
 Use sessions or hidden form fields to transfer the data between pages.
 
 ---John Holmes...



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




RE: [PHP-DB] insert form data

2003-01-08 Thread Mignon Hunter
Ok - thanks. I've just read up on headers, but, where would you put this
in the code?  After the submit input type ??  I get an error.



On Wed, 2003-01-08 at 14:34, Ryan Marrs wrote:
 Or a redirect after submitting:
 
 Header(Location: pagetogoto.php);
 
 
 
 ___
 Ryan Marrs
 Web Developer
 Sandler  Travis Trade Advisory Services, Inc.
 248.474.7200 x 183
 248.474.8500 (fax)
 www.strtrade.com
 
 
 -Original Message-
 From: Mignon Hunter [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, January 08, 2003 3:34 PM
 To: 1LT John W. Holmes
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] insert form data
 
 Actually, I dont need these variables in the rest of the form, I just
 need to go to the next page...Like a hyperlink on the submit button
 maybe ???
 
 Seems like I've seen that...
 
 Mignon
 
 
 On Wed, 2003-01-08 at 14:12, 1LT John W. Holmes wrote:
   When I post to my next page in the survey in the form action, instead of
   this page, the data doesnt go into the database.  
   
   Does anyone know a way around this other than rewriting all the pages
   into one page?
  
  Use sessions or hidden form fields to transfer the data between pages.
  
  ---John Holmes...
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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




[PHP-DB] RE: passing array values in forms

2003-01-06 Thread Mignon Hunter
This is a variation to similar string earlier.  Have been checking
books, online manuals, suggestions here - tutorials and such.

Having issues passing arrays in forms. I have been working on this a few
days and am stuck.  Am trying to pass cat[] and id[] with whatever
checkbox user checks.  cat[] works fine.  My id[] is hidden and am not
able to pass correctly.  cat[] will display correct item on second page
but idid[] just passes 12 (which is the number of initial items in the
result from query) - or it will display 1,2,3,4,5,6,7,8,9,10,11.

Does anyone have suggestions.  I have tried using submit hidden value
among other variations...to no avail.

Thx 

Mignon

CODE BEGINS

page1.php  snipet

form action=comp_page4.php method=post
?
for($knt = 0;$row = mysql_fetch_row($res); $knt++)
{ 
echo trtdinput type=\checkbox\ name=\cat[]\ value =
$row[1]/tdtdnbsp;$row[1]/tdtd$row[2]./td/tr;

echo input type = \hidden\ name = \id[]\ value = $row[0];

}
?

input type=submit value=Next
/form


comp_page4.php snipet

?
echo Hello cat[0] and cat[1] ect...: $cat[0], $cat[1], $cat[2],
$cat[3], $cat[4], $cat[5], $cat[6], $cat[7], $cat[8], $cat[9], $cat[10],
$cat[11]br;
echo br;
echo Here's id:  $id[0], $id[1], $id[2], $id[3], $id[4], $id[5],
$id[6], $id[7], $id[8], $id[9], $id[10], $id[11];
?


CODE ENDS


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




[PHP-DB] form validation

2002-12-20 Thread Mignon Hunter


Hello list,

I am developing a db form that gets passed to another form.  I need to
validate the fields in form(1), before passing on.  The form action
posts to form(2), so that upon hitting submit - form(2) shows up in
browser...(the only way I know how to do this). 

I am trying to use php to validate.  I have been googling and checking
books and archives for 2 days and all examples use the same file to post
to.  In other words, form1.php uses form action=form1.php.  But I need
it to be form(2), but I still need to validate.

Does anyone have any ideas, or does everyone just use javascript with
say...alert boxes.  This will be my last resort.  

Thanks
Mignon

Here's the code for form1.php

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
html
head
title/title
/head
body
form action=form2.php method=post

?
function check_form($comp_name, $city, $state, $contact) {
if (!$comp_name || !$city || !$state || !$contact):
print (Please fill in all Fields);
if (!$comp_name) {
print (Please fill in your company name);
}
if (!$city) {
print (Please fill in your city);
}
if (!$contact) {
print (Please fill in your contact name);
}
endif;
}
?

table align=center cellpadding=5
tr
th colspan=2Please Enter the Information Below and Press the
'Submit' brButton When Finished.br(All Fields Required)/th
trtdnbsp;/td/tr
/tr
tr
tdb

Company Name:  /b/td
td
input type=text name=comp_name size=50
/td
/tr

tr
td
bCity:/b/td
td
input type=text name=city size=50
/td
/tr

tr
td
bContact Name:  /b/td
td
input type=text name=contact size=50
/td
/tr
/table
center
input name=submit value=Submit type=submit
/center

?
//This works with form action form1.php
//if (isset ($submit)) {
//check_form($comp_name, $city, $state, $contact);
//}
//echo $comp_name, $city, $state, $contact;
?

/form
/table

/body
/html


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




Re: [PHP-DB] form validation

2002-12-20 Thread Mignon Hunter
Thanks for your suggestions.  I can see the pros and cons of each.  I
will give each some thought and decide the best way to go.  

Thx
Mignon

On Fri, 2002-12-20 at 08:41, Jason Wong wrote:
 On Friday 20 December 2002 22:25, Mignon Hunter wrote:
  Hello list,
 
  I am developing a db form that gets passed to another form.  I need to
  validate the fields in form(1), before passing on.  The form action
  posts to form(2), so that upon hitting submit - form(2) shows up in
  browser...(the only way I know how to do this).
 
  I am trying to use php to validate.  I have been googling and checking
  books and archives for 2 days and all examples use the same file to post
  to.  In other words, form1.php uses form action=form1.php.  But I need
  it to be form(2), but I still need to validate.
 
  Does anyone have any ideas, or does everyone just use javascript with
  say...alert boxes.  This will be my last resort.
 
  Here's the code for form1.php
 
 [snip]
 
  form action=form2.php method=post
 
 OK when some submits the form the contents are sent to form2.php ...
 
  ?
  function check_form($comp_name, $city, $state, $contact) {
  if (!$comp_name || !$city || !$state || !$contact):
  print (Please fill in all Fields);
  if (!$comp_name) {
  print (Please fill in your company name);
  }
  if (!$city) {
  print (Please fill in your city);
  }
  if (!$contact) {
  print (Please fill in your contact name);
  }
  endif;
  }
  ?
 
 ..., which means this validation doesn't run (it's run when form1.php is first 
 displayed, but that's not what you want).
 
 IOW your validation code must be at wherever you set the form action as.
 
 There are at least a couple of ways you can do this:
 
 1) If your forms are related, have a single page which deals your two (or more 
 forms). You have to keep track of which stage the user is at (ie if they've 
 filled in form1 then you should display form2).
 
 2) Or have it as two pages (like you have now) but in form1.php have the 
 action=form1.php (so it processes its form). After you've processed it, 
 stick the values into some session variables then use header() to redirect to 
 form2.php.
 
 Or you can have a look at www.phpclasses.org for some classes which can build 
 and validate forms for you.
 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 
 
 /*
 Qvid me anxivs svm?
 */
 
 
 -- 
 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] loading includes

2002-10-23 Thread Mignon Hunter
Here's one that will shake your head, mine's about shook off. 

Basic problem:  new site works on my box but not on dev server. Both
boxes have Apache and php loaded. New site is not loading includes and
dynamic data.

The old site copy on dev server has some main pages that include some
files when loaded and loads some dynamic data from a database. I'll call
one of the main pages pgroups.  When old pgroups gets loaded on dev
server, included files are included fine and data gets loaded.  

When I ftp over my modified pgroups - files are not included nor does
data get loaded.  The modifications are small in number, but basically
add a javascript menu to pgroup and some layers in an included file. 
I've tried commenting out the javascript code in pgroup but it still
wont add header.php which has meta tag info, plus other include file
info that does load with old script.  Done some other error checking to
basically prove that the include files are not being included on dev
server. I have also tried including the absolute path when calling the
include, which is in the same directory as pgroup anyway

Additionally, on my box, all of the new files work fine.  All the
includes get loaded and dynamic data gets loaded.

*** my box - only thing in php.ini is register globals = ON

*** dev server - php.ini include path is commented out. But old code   
gets loaded fine.

This code was loaded and configured by someone else that got it from
phpnuke for free. Lucky me. We would start from scratch but have 11/1
deadline.

I can send each page of code, pgroup.old  pgroup.new, both are about 3
pages long. I think we're not supposed to send attachments ?  I cant
remember. 

Both boxes have Apache 1.3 and am assuming php 4 on both.


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