[PHP-DB] escape chars continued

2004-03-22 Thread matthew perry
Filip de Waard wrote:

On Mar 22, 2004, at 12:17 PM, Jimmy Brock wrote:

Matt, love your show!

Use the addslahses function to escape '  \ characters. See
http://php.net/addslashes for details.


Actually, you shouldn't use addslashes, but a database specific 
function like mysql_escape_string().

http://phundamentals.nyphp.org/PH_storingretrieving.php

Regards,

Filip de Waard

Jimmy Brock

Matthew Perry [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I am trying to allow my users to enter quotes in their strings.  For
instance instead of writing:2 inch rod, they can write 2  rod.  
The
problem is, of course, that  ends the string and all that is saved is
any value before the .  How do I get around this without using 
textarea?


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


Actually I think the problem is before you can use either addslashes or 
mysql_escape_string() functions.  The value with  or ' never reaches 
the database.  I think I need a way to ignore quotes for input values in 
HTML. 

Say I have this:
input type=text size = 2 name=Q
And my user enters:2  copper tubing
The value for Q will be: 2
When I add it to the database with addslashes there will be no , ' or \ 
to add a slash to!
And when I retreive it from the database and use mysql_real_escape() 
there will be the same problem.

Thank you for your time, and yes I am the real Matthew Perry of course.

Matthew Perry

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


[PHP-DB] exporting data to excel

2004-03-24 Thread matthew perry
I am looking for the easiest way to export data to an excel file.  Is 
the easiest way to use PHP's file handling functions?

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


[PHP-DB] checkboxes and loops

2004-03-28 Thread matthew perry
OK lets see if I can figure out how to ask this:

I am setting up a system for my company to filter through employee 
applications.  Most of the applications do not fit the criteria and I 
want to allow my bosses a checkbox to the right of them which they can 
check or uncheck to remove an applicant.
So I run a loop that generates a bunch of check boxes with the name 
box1, box2, box3... by running a loop that runs this and increments 
counter every time:
{
input type = checkbox name = box?echo $counter;? value = delete
$counter++;
}

But when I try to create my query that updates the table I have a 
problem generating these variable again by referring to them indirectly:

*Bad solution 1 (to much work)***
if ($box1 == 'delete')   do whatever
if ($box2 == 'delete')  do whatever
if ($box3 == 'delete')  do whatever
if ($box4 == 'delete')  do whatever
if ($box5 == 'delete')  do whatever
if ($box6 == 'delete')  do whatever
***
*Bad solution 2 (doesn't work)***
$counter = 1;
while (whatever)
{
if ($box . $counter == 'delete')   do whatever
$counter++;
}
***
How do I get around this problem?
Hopefully someone understands what I am trying to say.
Matt

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


[PHP-DB] to many files!

2004-03-31 Thread matthew perry
I am accumulating way to many PHP files in my home directory.  It is 
very difficult to sift through all the files.
I use a lot of includes and requires so it is difficult to organize 
them in folders even if I change back a directory with my requires 
using  ..\. 
Does anyone know of a better way to organize a huge spiderweb of documents?
Matt

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


[PHP-DB] password input type

2004-04-05 Thread matthew perry
Does using a pasword input type input name=password type=password 
make the transfer more secure from someone sniffing my connection or 
does it only shield an onlooker from seeing what the user enters?
- Matt

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


Re: [PHP-DB] Graphing - bar charts

2004-04-06 Thread matthew perry
Bar graphs are very easy to use with PHP.   It's just a table columns of 
varying height.

I wrote this a long time ago.  To be honest it isn't very good code and 
I think I got the ideas from someone else.
Regardless it should give you an idea.
You basically pass in an array of dollar amounts and it outputs a bar graph.
You can also manually adjust the scale of the graph by varying the 
values $minval and $maxval.
The function bar makes a single bar of the graph.
Use it at your own risk though.   It is pretty poor PHP but it did the 
trick for me!


//graph looks best when values are between 50 and 250
function bargraph ($bararray, $xminval, $xmaxval){
function bar($height,$val, $minval, $maxval){
   $n_bars=count($bararray);
   $newmargin = $maxval - $minval;
   $newdifference = $height - $minval;
   $newchange = $newdifference / $newmargin;
   $newheight = 200 * $newchange + 25;
   echo (td valign=bottom .
  table bgcolor=#aa height= . $newheight .
   cellpadding=0 cellspacing=0);
  echo(trtd align=center valign=bottom);
  echo (font color=#0 size=-1 );
  echo ($);
  printf(%.2f, $val);
  echo (/font);
  echo (/td/tr/table/td);
   }
   $n_bars=count($bararray);
   $border=0;
   echo(table bgcolor=#a0a0a0 height=200 width= .
   $n_bars*$width .  border= . $border .  );
   if (!$xminval) $minval= min ($bararray);
   else $minval = $xminval;
   if (!$xmaxval)$maxval= max ($bararray);
   else $maxval = $xmaxval;
   for ($x = 0; $xcount($bararray); $x++){
   bar($bararray[$x], $bararray[$x], $minval, $maxval);
   }
   echo(/table);
}
--
- Matt



John W. Holmes wrote:

From: Craig Hoffman [EMAIL PROTECTED]

 

I am looking for an open source and simple PHP script that will graph
(bar) a few MySQL fields.  Does anyone have any recommendations?
   

The easiest way is to just have an image that you dynamically vary with
width of
img src=dot.jpg height=10 width=$width

Or take a look at JPGraph, which offers a lot of features.

---John Holmes...

 



[PHP-DB] pdf editor

2004-04-07 Thread matthew perry
Does anyone know a free pdf editor?

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


[PHP-DB] pdf editor

2004-04-07 Thread matthew perry
I use Windows XP.
Really all I need to do is remove a single line in a pdf file and I 
can't convince myself to spend $749  for Acrobat Pro to do it.
- Matt

On 7 Apr 2004, at 16:34, matthew perry wrote:

Does anyone know a free pdf editor?


what platform do you require it for?
--
Mike Karthauser
Managing Director - Brightstorm Ltd
Email  [EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
07939 252144 (mobile)
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] headers already sent

2004-04-14 Thread matthew perry
When I insert the following header:

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

*Warning*: Cannot modify header information - headers already sent by 
(output started at C:\Program Files\Apache Group\Apache2\htdocs\trial.php:2) in 
*C:\Program Files\Apache Group\Apache2\htdocs\trial.php* on line 
*3*

*Warning*: Cannot modify header information - headers 
already sent by (output started at C:\Program Files\Apache 
Group\Apache2\htdocs\trial.php:2) in *C:\Program Files\Apache 
Group\Apache2\htdocs\trial.php* on line *4

*I get similar messages when I use my web host.  How do I use these headers correctly?

Matt





[PHP-DB] links to maps

2004-04-14 Thread matthew perry
Anyone know a quick and easy way to fill in the address on a yahoo maps 
form?
I want a link from my page to fill in all the details I already know so 
my users don't have to enter it.
- Matt

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


[PHP-DB] Macs and sessions

2004-04-20 Thread matthew perry
Macintosh users can't log in on my web site.
I don't require anything unusual for log ins - simply a form with a user 
id and password that queries a MySQL database.
The form is not encripted and I don't even use any security precautions 
for the data transfer (users can't do much anyway).
After the log in I store all information in session data.
The rest of my site's pages work fine including my PHP pages.
Anyone know why macs might have problems with PHP/MySQL data transfers?

Matt

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


[PHP-DB] move_uploaded_file

2004-04-24 Thread matthew perry
I have a file uploading function that works well on my local server.
It finds a picture and uploads it into a defined directory.
Unfortunately this function does not work when I try to upload to my web 
host.
It says I do not have the proper permissions.

I believe this has to do with the fact that my web host requires a user 
name and password for all file transfers for security reasons.
I still want my users to be able to upload files or pictures to my web 
host (if I have granted them proper access through my log in).
How do I indicate the correct login sequence for my web host with a 
function like move_uploaded_file?

- Matt

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


[PHP-DB] First letter

2004-04-27 Thread matthew perry
What PHP function returns just the first letter of a string?
- Matt
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Cursor in text box.

2004-04-27 Thread matthew perry
My users complain about everything. 
The most common is Why do I have to move the mouse over to this box 
every time?  Wh!
How do I get the cursor to que into the first input area of my form?

-Matt

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


[PHP-DB] Scrolling drop down menu

2004-04-27 Thread matthew perry
When my users choose an option in the drop down menu, they sometimes 
accidentally change what they have chosen when the move the center 
scrolling button of their mouse. 
I was giving a presentation in front of my company's owner and did this 
myself. 
5 or so index fingers instantly pointed at me saying See you do that 
to!  Wh!
Is there a way to stop a menu from scrolling with the center scrolling 
mouse button?

- Matt

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


[PHP-DB] scrolling drop down menu

2004-04-27 Thread matthew perry
Then I withdraw the question.
Thank you for your time.
John W. Holmes wrote:

matthew perry wrote:

When my users choose an option in the drop down menu, they sometimes 
accidentally change what they have chosen when the move the center 
scrolling button of their mouse. I was giving a presentation in front 
of my company's owner and did this myself. 5 or so index fingers 
instantly pointed at me saying See you do that to!  Wh!
Is there a way to stop a menu from scrolling with the center 
scrolling mouse button?


Your questions have nothing to do with PHP.

And absolutely nothing to do with DB...






[PHP-DB] Page cannot be displayed problems

2004-04-29 Thread matthew perry
My bosses computer gets a Page cannot be displayed message when she 
uses some of my pages.  I have tried to find a pattern as to why this 
happens on only her computer.  I think the problem only occurs when she 
links to a page that links to a page.

Say I have 3 pages: page1.php, page2.php, and page3.php

On page1.php

form action=page2.php method=PUT
input type=submit value=GO
/form   


And on page2.php

meta http-equiv=refresh content=0;URL=page3.php

If I click go on page1.php I SOMETIMES get the cannot be displayed 
message.  SOMETIMES it works even on her computer!

Anyone know why?

- Matthew Perry

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


[PHP-DB] Page cannot be displayed continues

2004-04-29 Thread matthew perry
Everyone,

Thank you very much for your advice about not using PUT.  I will use 
GET or POST from now on.

I am, however, failing to understand how to use headers to change pages 
instead of meta tags.

After checking if the user has logged in correctly I do this:

if ($loginGood){
   echo 'meta http-equiv=refresh content=0;URL=welcome.php';
}
else {
echo 'meta http-equiv=refresh content=0;URL=loginerror.php';
 }
How can I use a header like the following one to do change pages based 
on variable input?

Thank you for your time and patience,
- Matt
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] headers and if statements

2004-04-30 Thread matthew perry
?if($logIn != 1) {header(Location: loginError.php);}?

Why does this direct me to loginError.php even when $logIn = 1?

- Matt

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


[PHP-DB] ER diagram class

2004-10-11 Thread Matthew Perry
Does anyone know a good class or program that automatically generates an 
ER diagram from all tables in a MySQL database?

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


[PHP-DB] MySQL nested subqueries

2004-10-16 Thread Matthew Perry
Anyone know when there will be a version of MySQL that can handle nested 
subqueries?
-Matt

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


[PHP-DB] PHP functions independant executions

2004-10-16 Thread Matthew Perry
How do I get my PHP funcitons to execute independantly based on what 
time of day it is and not on the user?
This may not be how PHP was designed but I would like to do things like 
send out an email to someone based on suchandsuch criteria, backup DB on 
regular schedule etc.

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


[PHP-DB] which DB to use?

2004-10-01 Thread Matthew Perry
Thank you very much for your help.
If I had to choose between MS SQL Server or or mysql, which would you 
recommend?  I prefer nested subqueries, triggers, procedures etc 
supported by SQL Server but am completely unfamiliar with any problems 
that may be accociated with using Microsoft's product and PHP.

Ideally, I would use Oracle but it is probably outside of our budget.
- matt

Bastien Koert wrote:
Here is a basic connect script. I would stringly recommend against 
using access, use mysql instead.

HTML
 HEAD
 /HEAD
 BODY
   ?php
 // Program to test connecting to a Microsoft Access ODBC Data Source
 $connection = odbc_connect(postcard, , );
 print Connected to datasourceBRBR;
 if ($result = odbc_exec($connection, SELECT * FROM postcard))
   print Command executed successfullyBRBR;
 else
   print Error while executing commandBRBR;
 // Print results
 while(odbc_fetch_row($result))
   print odbc_result($result, 1) . . odbc_result($result, 2) 
. . odbc_result($result, 3) . . odbc_result($result, 4) . 
. odbc_result($result, 5) . BR;

 odbc_close($connection);
 print BRConnection closed.;
   ?
 /BODY
/HTML
bastien

From: Matthew Perry [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] microsoft access
Date: Thu, 30 Sep 2004 21:28:48 -0500
Does anyone know of a good online source for using php and microsoft 
access. I don't want to have to use asp.
Thank you for your time.

Matthew Perry
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
MSNĀ® Calendar keeps you organized and takes the effort out of 
scheduling get-togethers. 
http://join.msn.com/?pgmarket=en-capage=byoa/premxAPID=1994DI=1034SU=http://hotmail.com/encaHL=Market_MSNIS_Taglines 
 Start enjoying all the benefits of MSNĀ® Premium right now and get the 
first two months FREE*.

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


[PHP-DB] Importing Excel and Access data to MySQL

2004-10-07 Thread Matthew Perry
Simple question,
How does one import excel and access data to MySQL?
-- Matthew Perry
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] backing up off of web host

2004-10-17 Thread Matthew Perry
The MySQL database on my web host has only non-sensitive information.
How bad an idea is it to have a backup copy emailed to me at a 
designated time so I don't have to depend on myself and the host for 
backups? 
I am worried this cheep web host will go out of business and take my 
backups with him.

The file will be rediculously huge  for email of course.
Is this the only problem?
What other solutions do I have that do not depend on my web host?
Matt
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php