[PHP-DB] Insert select Blob field from MySQL

2006-04-14 Thread Robert
Does anyone have an example of how to insert and select a blob field in a 
MySQL 4.1 database ?

-- 
Thanks,
Robert L. Campbell
510 Rook Rd.,West Point, TX 78963
Office: 979-242-3083 

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



RE: [PHP-DB] Web forms

2006-04-14 Thread Giff Hammar
Ron,

One option is to build a list of privs and iterate over that for the form
and processing

To do that, you would iterate over the list and use variables to name the
fields. When you process the form, you would iterate over the same list and
extract the values.

Form building:

$foo = array ('priv1', 'priv2', 'priv3' ...);
...
foreach ($foo as $priv) {
...

...
}

Form processing:

foreach ($foo as $priv) {
if (isset($_POST[$priv])) {
do something here like update the database or build one SQL
statement
}
}

Instead of using a list when you build foo, you could use a hash.

$foo = array('priv1' => 'Man readable priv 1', 'priv2' => 'Man readable priv
2', 'priv3' => 'Man readable priv 3' ...);
...
foreach (array_keys($foo) as $priv) { 
...

...
}

Hope this helps.

Giff

-Original Message-
From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 14, 2006 1:22 PM
To: PHP DB
Subject: [PHP-DB] Web forms

I am creating some web based functions for the staff and volunteers to use.
Access to these functions is designated by those who need it.

I have two tables.  

One table describes the component --- It has a component reference number
column.  

The second table indicates who has access to what --- containing the
component reference number from the component table (described above) and
also the member reference number.  

Essentially if you are logged in your reference number is in a session
variable and using PHP & mySQL the script is checking to see which
components to allow you access to in your menu and only displaying those
menu options.

So far I have been updating this table using phpmyadmin.  I have begun
writing a script to do this in a more smooth fashion.

The script I am writing produces a form in a table.

Column 1 shows the component name.  Column 2 is a check box for the user to
check in if the person whose permissions are being modified should have
access to this component.  I have named the check box the component
reference number --- 1 for example.  There are about 16 components are
growing.  

I am not sure how to check if "$1 = on" indicating the check box was checked
in.  I know you would use an IF ( ) { } statement --- but I want to automate
this so when new components are added in I want have to modify the script
which actually updates who has access to what component.

What I have done so far is selected all the components and started a WHILE
loop --- $i will go from 0 to 15 so I am able to look at each check box to
see if it was selected or not and then I am going to use the INSERT INTO or
DELETE commands to update the table, etc.

How can I find out if $1 and $2 and $3 and ... $15 are "on"?

Ron

--
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] Web forms

2006-04-14 Thread Ron Piggott (PHP)
I am creating some web based functions for the staff and volunteers to
use.  Access to these functions is designated by those who need it.

I have two tables.  

One table describes the component --- It has a component reference
number column.  

The second table indicates who has access to what --- containing the
component reference number from the component table (described above)
and also the member reference number.  

Essentially if you are logged in your reference number is in a session
variable and using PHP & mySQL the script is checking to see which
components to allow you access to in your menu and only displaying those
menu options.

So far I have been updating this table using phpmyadmin.  I have begun
writing a script to do this in a more smooth fashion.

The script I am writing produces a form in a table.

Column 1 shows the component name.  Column 2 is a check box for the user
to check in if the person whose permissions are being modified should
have access to this component.  I have named the check box the component
reference number --- 1 for example.  There are about 16 components are
growing.  

I am not sure how to check if "$1 = on" indicating the check box was
checked in.  I know you would use an IF ( ) { } statement --- but I want
to automate this so when new components are added in I want have to
modify the script which actually updates who has access to what
component.

What I have done so far is selected all the components and started a
WHILE loop --- $i will go from 0 to 15 so I am able to look at each
check box to see if it was selected or not and then I am going to use
the INSERT INTO or DELETE commands to update the table, etc.

How can I find out if $1 and $2 and $3 and ... $15 are "on"?

Ron

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



Re: [PHP-DB] Question regarding the scope of pg_prepare

2006-04-14 Thread chris smith
On 4/14/06, Will Chapman <[EMAIL PROTECTED]> wrote:
> I have a few different pg_prepare statements in my PHP script.  I was
> wondering what scope they lie in.  Im assuming they are not saved in the
> PSQL database, so it is just for the script?  They are inside of
> functions... does it only last until the function exists?  I just dont
> want to keep on calling it if I don't have to.  Or do I need to call it
> each time the function is called.

They are not stored in the database. They are only used to build the
queries to send to the database.

Reading the example(s) on the php page (http://www.php.net/pg_prepare)
you can use them anywhere, they are in the global scope as long as you
give them different names.

stmtname
The name to give the prepared statement. Must be unique
per-connection. If "" is specified, then an unnamed statement is
created, overwriting any previously defined unnamed statement.

I guess the easiest way is to create a simple script :) Prepare some
statements before and inside a function..

--
Postgresql & php tutorials
http://www.designmagick.com/

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



[PHP-DB] Question regarding the scope of pg_prepare

2006-04-14 Thread Will Chapman
I have a few different pg_prepare statements in my PHP script.  I was
wondering what scope they lie in.  Im assuming they are not saved in the
PSQL database, so it is just for the script?  They are inside of
functions... does it only last until the function exists?  I just dont
want to keep on calling it if I don't have to.  Or do I need to call it
each time the function is called.

Trying to do some proper coding :)

Thanks
  Will


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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