Re: [PHP-DB] Problem with mysql and php

2011-11-28 Thread Phil Dobbin
On 29/11/11 02:08, "Jason Pruim"  wrote:

>> PostgreSQL?
>> 
>> ;-)...
> 
> In all seriousness... Would it help or change it in anyway? :)
> 
> I am free to use what I want (I believe) on this project...

It's well worth looking into. Postgres can handle far bigger db's much
quicker than MySQL but the downside is that it's a very steep learning curve
after coming from mysql.

It's relatively easy to install & there are the drivers of course for PHP
but it'll take up a lot of your time to learn it to the extent of being
confident with it in my experience.

Good luck,

Cheers,

Phil...
-- 
Nothing to see here... move along, move along


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



Re: [PHP-DB] Problem with mysql and php

2011-11-28 Thread Phil Dobbin
On 29/11/11 01:38, "Jason Pruim"  wrote:

> Given the following 2 queries:
> 
> "SELECT DISTINCT areacode FROM main WHERE state = '{$query_exploded[0]}'";
> 
> "SELECT DISTINCT areacode FROM main";
> 
> The second displays ALOT faster Like by minutes... the first one is what I
> really want though Currently working with a dataset of 89 million records,
> will be expanding that to many many more times that... To the tune of possibly
> a couple billion records...
> 
> Any ideas? :)

PostgreSQL?

;-)...

Cheers,

Phil...

-- 
Nothing to see here... move along, move along


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



[PHP-DB] How to test PHP form for proper input

2007-08-03 Thread Phil Matt
I've got a mail form that automatically pulls in the addressee from a MySQL db, 
and lets the sender
fill in his/her own info before sending. I figured out how to set up tests for 
legal input in the
different fields, but I don't know how to incorporate the test results into my 
form submission code.
(Sorry for the dumb question, but I'm not an experienced PHP coder...)

Here the basic stuff:

//SENDS MAIL
\r\n" .
"Reply-to: $from_email\r\n" .   
"X-Mailer: PHP/" . phpversion());
echo "Your message has been sent!";}
?>
//FORM USED



Send e-mail to: 

  Your Name
  


  Your Email Address
  


  Subject
  


Message
  



  
  
  
  


  

//TESTING CODE


TIA for your help!

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



[PHP-DB] Mailto and PHP

2007-06-14 Thread Phil Matt


De-lurking here. I am trying to modify a mailing script that I originally wrote to use a small form 
to send mail to different people from a MySQL database. I would like to modify it so that instead of 
using a form, the user's regular default email program opens on activating the link. I can't quite 
figure out how to pass the right parameters. Here's the relevant part of the existing script:


echo'
'.$myrow[0].''.$myrow[1].''.$myrow[2].'
'. $myrow[4].'
	".$myrow[1].", ".$myrow[2]).'">height="17" alt="Click to send mail to this person" />';



I want to change the link to mailto: instead of the other PHP page, and then pass the recipient 
email address and recipient name and title, which are already there from the MySQL connection.


I've looked around for the right syntax, but it just escapes me. I have the Welling & Thompson book, 
but it only mentions that this can be done, without a clue as to how to do it. Pardon my ignorance, 
but this is not my area of expertise.


TIA for your collective wisdom!


--- P. Matt

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



Re: [PHP-DB] Get Confused : Use Transaction or not

2005-04-26 Thread Phil
Thanks for your suggestion,Bastien !!
You guide me a new way to thought how to design it.

Before receiving your response,there are many question marks in my
mind.In my opinion,lock and transaction are the key points I focused
on.Privilege of
locking table can be granted to database owner in MySQL.However,there
are two
things I doubted as follows:

1.Can database owner who has been given lock privilege lock row??
2.I am not sure that using transaction as queries in PHP script is
the correct way to keep data's unity.



Regards,

Phil



Bastien Koert wrote:

> Transactions are not necessarily the answer, though they are useful.
> What you need to do is decide if your design should allow multiple
> users to access the same record at the same time. Concurrency is the
> real issue, not the use of transactions. If users should not be
> allowed access to the same row at the same time (as if becomes
> difficult to manage whose changes should be made to 'stick'), then you
> should flag the row in some manner to allow other users to 'see' the
> data (read consistency) but not to change the data. and they should be
> informed that another user has locked the record against changes.
>
> One option is to consider adding a row in the table called 'locked'
> which is a tinyint with values of 1 for locked and 0 for open, and a
> datestamp of when its status changed. When the record is locked the 1
> is returned in the dataset and a message is passed to the user to
> notify them the record is locked against their changes (perhaps the
> record only gets displayed in a non-editable form like a straight echo
> or as disabled imput elements.)
>
> When the user who locked the record, is finished with the record,
> update that col to set it to 0 to allow other users access to that
> record.
>
> The thing to watch out for here is that its possible for that record
> to become locked indefinitely if that user doesn't finish with that
> record. Like if the user goes home and simply closes the browser or
> never hits the submit button to make the changes. You will need a
> mechanism to unlock those records automatically if possible thru a
> cron job or a scheduled task. You would need to decide how long a user
> to hold a record locked, whether its 20 minutes or a few hours,
> whatever, but at predefined intervals, a script should be run to
> checked for those locked records and unlock them when they exceed the
> time out value.
>
> Bastien
>
>> From: Phil <[EMAIL PROTECTED]>
>> To: php-db@lists.php.net
>> Subject: [PHP-DB] Get Confused : Use Transaction or not Date: Mon, 25
>> Apr 2005 16:07:36 +0800
>>
>> Hi,
>>
>> I want to develop a multiuser system using PHP(5.04),MySQL(4.1.10) and
>> PEAR(DataObject).
>> There is only one MySQL account for PHP to operate data.
>> All user's information will be stored in database,include id,passwd
>> and etc.
>> However,I get confused when I write queries in PHP script.
>> Because one data row may be modified by different user at the same time.
>>
>> Should I use Transaction in my queries ?
>>
>> Regards,
>> Phil
>>
>> -- 
>> 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] Get Confused : Use Transaction or not

2005-04-25 Thread Phil
Hi,

I want to develop a multiuser system using PHP(5.04),MySQL(4.1.10) and
PEAR(DataObject).
There is only one MySQL account for PHP to operate data.
All user's information will be stored in database,include id,passwd and etc.
However,I get confused when I write queries in PHP script.
Because one data row may be modified by different user at the same time.

Should I use Transaction in my queries ?

Regards,
Phil

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



[PHP-DB] PHP and mail forms

2004-01-30 Thread Phil Matt
Ricardo Lopes wrote: 

> There are several ways to do this. 
> Some people like the approach: 
>  
> if ($submit) { send_email(); } 
>  
> or you can put a hidden field in your form, like op: 
>  
>  
>  
> and use: 
>  
> if (isset($HTTP_GET_VARS['op']) && ($HTTP_GET_VARS['op'] == 'send')) 
> { 
> send_email(); 
> } 

Thanks again, Ricardo. I now have the form communicating with the server. 

I think that I might have an error in my script: 

Where I join together the value of the passed variable ("$myrow[3]") and the string  
containing the domain ( $string="@somedomain.com")  I used: 

 $to_name="$myrow[3]$string" 

If the passed variable's value is, for instance, "smith", then does my $to_name 
become: 

[EMAIL PROTECTED] 

On hitting the submit button, I see the server being called and data being sent, but  
nothing is being received. I'm just wondering if I've appended those two things 
correctly. 

TIA for your continued assistance. 

Cheers --- Phil 

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



[PHP-DB] PHP and mail forms

2004-01-29 Thread Phil Matt
Hello to all.

I am trying to write a simple (at least I thought it was simple...) "Contact Us" form 
that 
sends an email when it is submitted.

The $to_name variable was passed from a previous page. I am sure that the variable 
was passed, as I can echo it and it is being passed correctly - thanks to this list!

The problem I am having is this: I cannot quite figure out how an html form handles 
this 
mail function when the "to" field is filled with an existing variable.

This is what I've got: (I removed all of the table formatting to make it clearer here)








  

So, I think that this sets up the form for processing, AFAIK.

Then, I added the stuff that pulls the email address associated with the id in 
$to_name 
from the MySQL database, and adds the string for the proper domain. I've left out the 
connection stuff for clarity:

$id=$_GET['id'];
$string="@somedomain.com";
$result= mysql_query("SELECT * FROM mydatabase WHERE ID=$id",$db);
while ($myrow = mysql_fetch_row($result)){
$to_name="$myrow[3]$string"; } ?>

I know that the "thing" that actually sends mail looks like this:

mail($to_name, $from_name, $subject, $message, "From: $from_email\nX-Mailer: PHP/" 
.. phpversion());   

But how do I get this all to happen when the user hits the submit button? Where does 
that mail function (is it a function?)  go? I have read a lot of stuff on the various 
PHP lists 
and sources, but I just cannot figure out this piece of the puzzle.

TIA for your suggestions, and for your patience with my lack of knowledge here.

-- Phil Matt

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



Re: [PHP-DB] Problem with passing variables

2004-01-27 Thread Phil Matt
On 27 Jan 2004 at 15:56, Ricardo Lopes wrote:

> If you have something like this:
> 
> echo ' class="imglink" alt="Click to send mail to this person" />';
> 
> It wont work. Use instead:
> 
> echo ' src="graphics/mail.gif" class="imglink" alt="Click to send mail to this
> person" />';
> 
> Notice the '. before the $myrow[0] and the .' after, any doubt see the
> documentation about operators.
> 
> This is caused because the ' doesnt parse variables to values like the "
> does.
> 

Ricardo - That's it!  I did read a lot of PHP docs and mailing list posts before I 
posted my 
question to this list, but never stumbled (and that's the word, I'm afraid!) on the 
syntax 
explanation that would untangle this for me.

If I want to pass additional variables for processing on the second page, I'm assuming 
that the syntax would be (where $foo is another variable)



Thanks again for restoring my sanity!

Cheers --- Phil Matt



[PHP-DB] Problem with passing variables

2004-01-27 Thread Phil Matt
Hello to all.

I am a relative newcomer to PHP. I am trying to pass the value of a variable from a 
MySQL database from one PHP page to another PHP page. On the first page, I've made 
the connection to the database, and the query works just fine, displaying the correct 
values from the $myrow fields.

This is the code to that point:


NameTitlePhoneE-mail';
while ($myrow = mysql_fetch_row($result)){
echo'
'. $myrow[0].'
'. $myrow[1].'
'. $myrow[2].'

This works just fine. Then I try to pass the variable $myrow[0] to a second page, 
where 
the value of the variable (a string that contains a name) is supposed to appear. 
Here's 
the line of code:

';


The page receiving this variable, email.php, uses this to retrieve the value of 
$myrow[0]:

Send e-mail to 


However, all this manages to do is to print out this:

Send e-mail to $myrow[0]

Instead of the VALUE contained in the variable!

What am I doing wrong?

TIA --- Phil Matt






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



[PHP-DB] Showing Average Visitors Per day

2003-09-27 Thread Phil Dowson
[I apologize if this comes through twice, the first time I sent it did not
appear to go through]

My problem is what I am trying to show the average number of visitors I am
getting on a daily basis over a given month.  So for example, I would like
to be able to display the average number of visitors that came to my web
site on a Monday.

Included below is the table I am working with, also below there is the SQL
statement I am trying to work with to produce the results.

I have worked out how to show how many total visited my site on a Monday,
but I cannot work out how to (a) show how many Monday's (for example) there
were in a given month and therefore (b) how to turn the totals into an
average.

CREATE TABLE `stat` (
  `statid` int(11) NOT NULL auto_increment,
  `stat01` varchar(100) default '',
  `stat02` varchar(100) default '',
  `stat03` datetime default '-00-00 00:00:00',
  PRIMARY KEY  (`statid`)
) TYPE=MyISAM;

select count(weekday(stat03)) AS dayname from stat where and
date_format(rms03,'%m %Y') = '09 2003' and weekday(stat03) = '0'

I hope this is a simple question, I've googled for over an hour and I'm
drawing blanks.

Thanks!

Phil Dowson

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



Re: [PHP-DB] Need For SPEED

2003-08-21 Thread Phil Driscoll
I'm not familiar with PHPList but... 
You might be able to get a significant speed increase by creating indexes in 
MySQL on some more of the fields in the table. For example, if the list code 
checks for duplicate email addresses, and the email address field is not 
indexed, then creating an index on that field will speed things up lots - 
especially as the table becomes big.

-- 
Phil Driscoll


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



Re: [PHP-DB] % operator

2003-08-14 Thread Phil Driscoll
On Tuesday 12 August 2003 10:27 am, Doug Thompson wrote:
> The "%" is called the Modulus operator.  It is very briefly explained in
> the PHP manual in table 11-2.
>
> In your example, $mod = $a % $b  ==> $mod = 0.8
The modulus is the remainder after division hence 5 into 24 goes 3 times with 
a remainder of 4, hence
$mod=25%4
gives $mod=4

Cheers
-- 
Phil Driscoll


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



Re: [PHP-DB] % operator

2003-08-14 Thread Phil Driscoll
On Tuesday 12 August 2003 10:39 am, Phil Driscoll wrote:
> The modulus is the remainder after division hence 5 into 24 goes 3 times
> with a remainder of 4,

oops - 4 times with a remainder of 4 :(

-- 
Phil Driscoll


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



[PHP-DB] Re: Create Temporary Table

2003-07-06 Thread Phil Dowson
The IP address CAN change, but doesn't change on such a basis that it would
cause a problem. You see the issue also appears whether I am [EMAIL PROTECTED]
or [EMAIL PROTECTED] it doesn't matter where I am coming from.

Thx


- Original Message - 
From: "Stephen March" <[EMAIL PROTECTED]>
To: "Phil Dowson" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, July 06, 2003 2:29 am
Subject: Re: [PHP-DB] Create Temporary Table


> Does the ip address of where you are trying to access the mysql database
> from (client), change?If you have a dynamic ip address
> your ISP should have a grant something to the effect of:
>
> grant all on database.* to [EMAIL PROTECTED] identified by 'password';
>
> This would allow your client to be any address on the 10.1.X.X  network.
>   You can just grant access to the database to [EMAIL PROTECTED] if you want that
> user to be able to access the database from any ip address.   This might
> have some security implications for you, if it's wide open on the
> Internet.   That's the only reason I can think for intermittent problems.
>
> Cheers,
> ~Steve
>
> Phil Dowson wrote:
>
> >Hi,
> >
> >PHP Version 4.3.1
> >Mysql Version 4.0.13
> >
> >When I try and run the following query
> >
> >CREATE TEMPORARY TABLE temptable AS SELECT * FROM permtable;
> >
> >on each database, the first one will run it with no problems at all. The
> >second returns the error:
> >
> >[server] ERROR 1044: Access denied for user: '[EMAIL PROTECTED]' to database
> >'database'
> >
> >I have tried running the same query from MySQL at my site, from via the
PHP
> >interface I am working with and also via PHPMyAdmin, each returns the
same
> >error.
> >
> >One thing I should note. The CREATE TEMPORARY TABLE syntax does not work,
> >however if I were to use the CREATE TABLE syntax, it works fine. But I'd
> >rather use the TEMPORARY tables.
> >
> >This problem appears to be intermittent, it will work fine for a few
days,
> >then fail for an undetermined amount of time. I have checked with my ISP,
> >they are sure that the rights haven't changed, and I have CREATE
TEMPORARY
> >TABLE rights.
> >
> >Any ideas why this is intermittent?
> >
> >Thanks for your help!
> >
> >Phil Dowson
> >
> >
> >
> >
> >
>
>
>
>



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



[PHP-DB] Create Temporary Table

2003-07-05 Thread Phil Dowson
Hi,

PHP Version 4.3.1
Mysql Version 4.0.13

When I try and run the following query

CREATE TEMPORARY TABLE temptable AS SELECT * FROM permtable;

on each database, the first one will run it with no problems at all. The
second returns the error:

[server] ERROR 1044: Access denied for user: '[EMAIL PROTECTED]' to database
'database'

I have tried running the same query from MySQL at my site, from via the PHP
interface I am working with and also via PHPMyAdmin, each returns the same
error.

One thing I should note. The CREATE TEMPORARY TABLE syntax does not work,
however if I were to use the CREATE TABLE syntax, it works fine. But I'd
rather use the TEMPORARY tables.

This problem appears to be intermittent, it will work fine for a few days,
then fail for an undetermined amount of time. I have checked with my ISP,
they are sure that the rights haven't changed, and I have CREATE TEMPORARY
TABLE rights.

Any ideas why this is intermittent?

Thanks for your help!

Phil Dowson



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



[PHP-DB] mail()

2003-07-04 Thread Phil Dowson
Hi,

Could someone let me know if it is possible to pass a resultset of a query
to a single variable so it can be included as the message part of the mail
function?

Thanks!

Phil Dowson



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



[PHP-DB] Cant load MSSQL extension (Win, PHP, Apache)

2001-08-05 Thread Phil

Hi everybody,

If I edit the php3.ini and activate a extension, I can see the effect with
the function phpinfo(). This works with all extensions, exept mssql.dll and
mssql70.dll. What am I doing wrong?? I dont think this is a general
problem!!

And, ladies and gentleman, I need help... thx!!


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] problems connecting to remote oracle database

2001-07-03 Thread phil

On Tue, Jul 03, 2001 at 09:43:52AM -0400, Brian S. Dunworth wrote:
> Hi Phil...
> 
>Since you have the server name (vs. the IP address) in the HOST= verb, 
> make sure you have an entry in /etc/hosts for a server called 'staging'

yes, that's there, otherwise, I wouldnt be able to use sqlplus with the
name in the same fashion, from the same client machine.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] problems connecting to remote oracle database

2001-07-02 Thread phil

a little more info...

I've just tried a few public oracle-sql tools.
Seems to have the same problem.
I can connect just fine to the database using sqlplus.
But when I try the hand-compiled tools, linked against
libclntsh.so, it doenst properly authenticate to the remote system.

Hey... $ORACLE_HOME/bin/sqlplus isnt linked against
libclntsh.so, funnily enough.

any ideas? Some special magic I need to put in tnsnames.ora, thta I've
othrewise left out?

sample, that works fine with sqlplus;

TEST2.STAGING.our.com =
  (DESCRIPTION =
(ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = staging)(PORT = 1521))
)
(CONNECT_DATA =
  (SERVICE_NAME = test2.staging.our.com)
  (SID =  test2)
)
  )


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] problems connecting to remote oracle database

2001-07-02 Thread phil

On Mon, Jul 02, 2001 at 02:07:38PM -0400, Brian S. Dunworth wrote:
> Hi Phil,
> 
>Make sure that the web user (usually 'nobody' on an Apache installation) 
> has access to the $ORA_HOME/bin directory and permissions to execute the 
> binaries within.  Also, be sure that ORA_HOME and ORACLE_SID are set in the 
> 'nobody' user environment...

why should I have to set the ORACLE_SID env var, if it is specified in
tnsnames.ora?

I dont have to set ORACLE_SID if I use sqlplus from the command line
(as nobody, even)
I can log in just fine with

sqlplus user/pw@machinename

So I'm figuring ocilogon("user","pw","machinename") should work just dandy.

Is ocilogon broken in that way? I would think not, since it should be
using the oracle libraries to automatically read tnsnames.ora and set that
kind of stuff automatically.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] problems connecting to remote oracle database

2001-07-02 Thread phil

On Mon, Jul 02, 2001 at 10:53:55AM -0400, Anthony Carlos wrote:
> Phil,
> 
> Perhaps I'm being nit-picky, but shouldn't it be OCILogon("$user",
> "$PASSWORD", "$connect_string"); ?

I have tried both


$user="realuser";
$password="actualpassword";
$dbname="oraclename"
ocilogon($user,$password,$dbname);


AND simply calling ocilogon "hardcoded", with the actual values directly
in the quotes.

both give the same error.

> > From: [EMAIL PROTECTED]
> > Date: Sat, 30 Jun 2001 09:39:11 -0700
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] problems connecting to remote oracle database
> > 
> > Hi folks,
> > ... I can use "sqlplus user/name@shorthostname" to connect just fine, as
> > a regular user.

> > But when I try
> > ocilogin("user","name","shorthostname");
> > 
> > on a php page, I get a printout of oracle error 01017: authentication
> > failed. 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] problems connecting to remote oracle database

2001-06-30 Thread phil

Hi folks,

I'm having difficulties getting php4 to connect to a remote oracle
database.

I have an entry in tnsnames.ora, along the lines of

shorthostname = (etc, etc)

and I can use "sqlplus user/name@shorthostname" to connect just fine, as
a regular user. Even without ORACLE_SID set, since I have it set in
tnsnames.ora for that entry

But when I try
 ocilogin("user","name","shorthostname");

on a php page, I get a printout of oracle error 01017: authentication
failed. 
The listener log on that oracle machine confirms that I am actually
attempting to connect. But no details on what's going wrong.

Any suggestions?

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] MySQL Error???

2001-06-28 Thread Phil Driscoll

The error is probably caused by you inserting a value (127) nto a unique or 
key field which is identical to one in another record.
-- 
Phil Driscoll

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Is MySQL in 4.0.6?

2001-06-26 Thread Phil Driscoll

On Tuesday 26 June 2001 10:43, Karsten Dambekalns wrote:

> The small size package contains only the binary without any additional
> modules. Get the full size version, or compile yourself. BTW: I think
> that is explained on the download page.

The small size package *does* include MySQL support (but as with all versions 
of php, it does not include MySQL itself).

Cheers
-- 
Phil Driscoll

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] undefined index

2001-05-01 Thread Phil Driscoll

Your best bet is to do some isset() calls:

eg

if(isset($row['imageurl']))
{
 $image=$row['imageurl'];
}
else
{
 /*maybe report the problems or handle it like this...*/
 $image=$default_image_url;
 /*where you have already set up $default_image_url to point somewhere
sensible*/
}

Cheers

--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] PHP and Access to DB2.

2001-04-30 Thread Phil Jackson

Check www.p2p.wrox.com...more later on this
Phil J.

Nicolas Machado wrote:

> Hy, somebody knows if exist a driver for database access to DB2/400, running
> on AS/400.
> Something like a module.
>
> Thanks.
>
> ---
> Este Mail NO contiene Virus.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.250 / Virus Database: 123 - Release Date: 18/04/01
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] linking images

2001-04-30 Thread Phil Jackson

And store the file type - it does make a difference when you go to display
it..i.e. *.gif or *.jpg..
Phil J.



olinux o wrote:

> Best way to do it is to store the filename in the db,
> faster and really simple.
>
> What I have done at my site is write a script that
> uploads the file. Uploading generates something like
> three variables [filesize, filetype, and filename] the
> only one I am concerned with is filename. The
> variables are named the same as the file upload
> fieldname plus an extension like this:
>
> say my upload field is NAME="upload_image" when i
> upload the filename can be referenced by
> upload_image_name - size by upload_image_size at least
> from what i can remember quickly.
>
> so i insert this filename [upload_image_name] into a
> table that references the associated ID. something
> like this:
>
> IMG_TABLE
>
> apartment_id   filename
>
> k, so this will store the filename, now you just need
> to grab the filename from this table and echo the
> filename into the  or  like
> this: 
>
> HTH,
> probably a bit confusing, lemme know if you would like
> my script.
>
> olinux
>
> --- Sharmad Naik <[EMAIL PROTECTED]> wrote:
> > I m using postgresql-7.0.2 with php,My problem is
> > that this database
> > doesn't allow more than 4k images to be stored .
> > I wanted to know how to store images in a
> > directory and keep its link in the dbase or if
> > anyone can tell me how to split
> > the image so that it can be kept in the dbase
> > -Thanks
> > --
> > The secret of the universe is @*&í!'ñ^#+ NO CARRIER
> > ___  _  _  _
> > |_|_||_||_||\/||_|| \
> > _|| || || \|  || ||_/
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > To contact the list administrators, e-mail:
> > [EMAIL PROTECTED]
> >
>
> __
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Designing a database

2001-04-22 Thread Phil Jackson

Duke,
The best thing is to get a good book on the subject.  There is 1st normal
form, 2nd normal formetc. (quite a few).

I would think that 1st normal form should do (i.e. no repeating groups as in
address1, address2...addressN)  Look at how the data relates to each other.
The nature of relationships - one to one, one to many, many to one.

Example - database of students, classes, and class schedules - at minimum you
would have a table of student data, a table of all course offerenings as
classes, and a table that
associated a student with a particular class for a particular date/time.
Take that further, you might want to break out the class descriptions, etc.
into a separate table, associate
by the course-id, and perhaps a section number uniquely identifies a class,
ex. - Computer Science 302 at 10:00 am MWF...

The key is to create your tables so that there is maximum flexiblity, but
keep it simple enough that you don't have to join 30 tables together to
display one studen't class schedule...

Phil J.

Duke Normandin wrote:
I asked this a year or so ago, but never did receive a "practical" reply

> that I could understand. So I'll give it another shot...
>
> What are the "nuts-and-bolts" of normalization? In a "practical" sense,
> how do you guys go about doing it? Do you create a spreadsheet or
> something, and start creating 'test' tables and see how they pan out?
>
> I understand what the 'goal' of normalization is suppose to be, I just
> never stumbled on a method of achieving it. Know what I mean?
> Tia...
> --
> -duke
> Calgary, Alberta, Canada
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] mysql --> Commercial DBs, When will I need to upgrade?

2001-04-22 Thread Phil Jackson

Some good advice already given, and I quite agree.  MySQL is no light-weight - 
comparable to MS SQLServer and Oracle in performance.  Also, running the DB on a 
dedicated DB server may buy some performance.  If you must check out SQLServer, then 
http://www.sqlteam.com is a good place to start.  At work we are an ASP shop, and have 
used Access for some lightweight apps, but the mandate now is to use IBM's DB2 UDB 
product - a DB2 database server, also, a mainframe IBM OS-390 DB2 database.  Don't 
know the price tag, but they are very robust databases, if a bit quirky getting 
Microsoft stuff to talk to IBM stuff...
You could connect via the ODBC functions of PHP.
Also try looking at http://www.4guysfromrolla.com and http://www.asptoday.com - not 
trying to sell ASP - just good and varied resources with good articles about
databases in general can be found there in addition to asp material...

Phil J.


Doug Schasteen wrote:

> I've been programming PHP w/ mysql for almost 2 years now for my company. We develop 
>online testing and surveying software. We are currently running operations for a few 
>specific companies where maybe 20-30 tests will be taken online per day (it requires 
>pulling the test questions out of the database in random order, and then putting all 
>of their answers into the database at the end of the test.) This is currently running 
>on a shared webserver using php3 and mysql. Recently we've been talking about some 
>projects that will require a lot more use. (Could be 100 people taking a test at once 
>or it could be 1000 people taking a test at once. We don't know yet.)
>
> If anyone has had some experience with upgrading as your operations grow, I'd 
>appreciate if you could answer ANY of the following questions:
>
> 1. At what point will mysql blow up (how many tests could be taken at once? How many 
>rows of results could be stored in a table before it bogs down?)
>
> 2. At what point will we need a dedicated server instead of shared-hosting?
>
> 3. How fast of a server do we need? Will a 1ghz server outperform a 500mhz server 
>when using apache-php-mysql?
>
> 4. If we need a new database, what is the next step above mysql? I have some 
>experience with Oracle but it is too expensive. Is there anything inbetween that is 
>friendly to PHP?
>
> 5. If MS-SQL is an option for a database-upgrade. What are the implications of 
>switching our server to a win32-based server? Will we have problems with PHP on 
>windows when all of our scripts were programmed for unix?
>
> I realize these are a lot of questions and that we probably need some consulting 
>work done, but if any of you could share your knowledge on any one of those topics I 
>would really appreciate it. I just need something to give me a head start in my 
>research. Point me in the right direction!
>
> - Doug Schasteen
>   [EMAIL PROTECTED]
>
> P.S. - if you know of any good articles online that compare different servers or 
>databases please share.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] PROBLEM IN INSERTING TEXT WITH SINGLE QUOTE

2001-04-22 Thread Phil Jackson

Try stripslashes(fieldname) to "unescape" those slashes when retieving from DB

Phil J.


Jennifer Arcino Demeterio wrote:

> Hello all,
>
> I am having a problem in inserting text with apostrophe to mysql database.
>
> When a user fills out a form field that includes an apostrophe ,
> the verify screen shows it as   and it
> is then input into the database as  - automatically adding
> the backslash.  The problem is that when the record is pulled out of the MySQL
> database into my display script it also shows up as  - with
> the backslash - but I want viewers to see it as  - without the
> slash.  Then, if I modify the record and don't take out the slash, it adds
> an additional slash so I wind up with .
>
> Can someone help me with my problem?
>
> Thanks in advance,
> Jen


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Designing a database

2001-04-22 Thread Phil Jackson

Well to start with, I would examine the nature of the data you want to
store, it's datatype, size, ect.  Follow the other reccommendations as to
not repeating data
across tables.  I tend to use autonumber fields for keys quite often.  Also,
think about what data could go into "domain" tables where you have a fairly
non-volitile
and finite set of values, and you plan on searching on this, and don't want
to risk the vagaries of a user spelling it a dozen different ways when
entereing the datafor example - if you have a fixed number of locations,
or computer make - i.e.Dell, Compaq, etc.  Also, be sure and provide admin
pages to update these domain tables...maybe next month your company starts
buying ABC-brand pcs - add it to the domain table.  When entereing or
searching - the values in these domain tables populate drop-down listboxes -
not left to chance to be entered in a text field

Phil J.

Joni Järvinen - Wandu wrote:

> Hey
>
> I'm quite new to databases so I though I'd ask you for
> some tips in designing a database.
>
> The db that I'm supposed to design holds information
> about workstations: Motherboard (Motherboard id, # of pci slots,
> agp slot etc etc.), Harddisks (Size, in what ide and master/slave, etc),
> the physical location of the workstation and it's hardware configuration
> etc.
>
> So if you could give me some tips and pointers for what tables to create
> etc I would be grateful.
>
> TIA
>
> -Joni-
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] PHP question needing info

2001-04-22 Thread Phil Jackson

Paul,
You upload the script to your server and request the page in your browser,
as you would any typical html page.  The server retrieves the page, sees the
php or php3 tag, knows to kick in the php interpreter, tries to parse the
script within the various tags, if successfull, and returns to your browser
an html document - perhaps a page generated dynamicaly from a
databasejust a rough, general idea  of what should happen...an exception
might be when the source of an image is a php file...

In repsonse to an earlier reply expecting "flames" to Paul's question - I
hope that type behavior will not be tolerated -  the goal here is to share
info and all benefit and become more proficient - folks come into this from
all levels of experience - The only really stupid questions are those that
go un-asked!

My Thoughts,

Phil J.


Paul S wrote:

> I have a question that I need help with.
>
> The question is that how do I execute a script in PHP.
>
> __
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Designing a database

2001-04-22 Thread Phil Jackson

Good Point, Richard - sensible normalization - if duplicating a value here
and there saves you from having to reference 12 tables instead of 3, yes, by
all means.  Also, adapting some standards as to using meaningfull names for
columns - if fieldWidgetSize is char(25) - don't call it something else if
it appears elsewhere - and don't change it's type!

Phil J.

- Original Message -
From: "Richard Scott Crawford" <[EMAIL PROTECTED]>
To: "Phil Jackson" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, April 22, 2001 1:17 AM
Subject: Re: [PHP-DB] Designing a database


Don't, however, go overboard with trying to normalize your database.
Don't get me wrong: normalization is good because it saves disk and
memory space (and is quite elegant as well); however, too much
normalization can come at a price in PHP in terms of application speed
and server overhead (not to mention creating coding nightmares if you're
using your web-based application to enter data into your database as well
as pull information from it).


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 4/21/01, 10:10:19 PM, Phil Jackson <[EMAIL PROTECTED]> wrote regarding
Re: [PHP-DB] Designing a database:


> Well to start with, I would examine the nature of the data you want to
> store, it's datatype, size, ect.  Follow the other reccommendations as to
> not repeating data
> across tables.  I tend to use autonumber fields for keys quite often.
Also,
> think about what data could go into "domain" tables where you have a
fairly
> non-volitile
> and finite set of values, and you plan on searching on this, and don't
want
> to risk the vagaries of a user spelling it a dozen different ways when
> entereing the datafor example - if you have a fixed number of
locations,
> or computer make - i.e.Dell, Compaq, etc.  Also, be sure and provide
admin
> pages to update these domain tables...maybe next month your company
starts
> buying ABC-brand pcs - add it to the domain table.  When entereing or
> searching - the values in these domain tables populate drop-down
listboxes -
> not left to chance to be entered in a text field

> Phil J.

> Joni Järvinen - Wandu wrote:

> > Hey
> >
> > I'm quite new to databases so I though I'd ask you for
> > some tips in designing a database.
> >
> > The db that I'm supposed to design holds information
> > about workstations: Motherboard (Motherboard id, # of pci slots,
> > agp slot etc etc.), Harddisks (Size, in what ide and master/slave, etc),
> > the physical location of the workstation and it's hardware configuration
> > etc.
> >
> > So if you could give me some tips and pointers for what tables to create
> > etc I would be grateful.
> >
> > TIA
> >
> > -Joni-
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]


> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] uploaded images display

2001-04-22 Thread Phil Jackson

In the last part of a script that loads the image into the database:

 $qs = "FetchImage.php3?nbr=".$lastone;
 echo "";
 echo "";

Where $lastone is a reference to the image just inserted into the DB:
  $lastone = mysql_insert_id($someonnection);

Notice that the  src is a php file - we have to change gears here and fetch
the image from the DB and set the content type accordingly to a binary type

from FetchImage.php3:
 $db = mysql_select_db("fractalv", $someonnection) or die ("db");
 $sql = "SELECT * FROM pictures WHERE picturesID =".$nbr;
 $sql_result = mysql_query($sql,$someonnection) or die ("no result");
 $RecordCount = mysql_num_rows($sql_result);
 $row = mysql_fetch_array($sql_result);
 $thisphoto = $row[picture];
 $contenttype = $row[pictureType];
 mysql_close($fvconnection);
 header("Content-type: $contenttype");
 echo $thisphoto;
  ?>

Make sense?  Follow the link I gave to the previous post for more extensive
info...

Phil J.





Sharmad Naik wrote:

> I have written a small script having connectivity with postgresql which
> can upload an image and display the already uploaded images.
> But it doesn't display the uploaded images. I guess the problem lies somewhere
> in  $file_url.
> Pls help me
>
> 
> 
> 
> 
> 
> $database=pg_connect("dbname=testdb user=postgres")
>
> ?>
>  if ($submit) {
>
> $result = pg_Exec($database,"INSERT INTO ".
> "images (mem_id,mem_image) VALUES(NULL,'$fupload_name')");
>
> $file_dir = "/tmp";
>
> $file_url = "http://sanico.sharmad.org";;
> if (isset($fupload ))
> {
> if ($fupload_type == "image/jpg" ||$fupload_type == "image/jpeg")
> {
>  copy ($fupload, "$file_dir/$fupload_name") or die ("Couldn't copy");
> echo("$file_dir/$fupload_name");
> }
> }
> }
>
> $result=pg_Exec($database,"SELECT mem_image from images");
> for($i=0;$i $images=pg_Result($result,$i,0);
> copy ("$file_dir/$images",$ftupload);
> echo ( $images);
> echo ( $ftupload);
> echo ("");
> }
>
> ?>
> 
>  enctype="multipart/form-data">
> 
> 
> 
> 
> 
> Home page
> 
> 
>
>
> -thanks
> --
> The secret of the universe is @*&í!'ñ^#+ NO CARRIER
> ___  _  _  _
> |_|_||_||_||\/||_|| \
> _|| || || \|  || ||_/
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Loading jpg (etc)

2001-04-22 Thread Phil Jackson

Probably the most efficient method - but if you must see:

http://www.zdnet.com/devhead/stories/articles/0,4413,2643888,00.html

For an excellent tutorial by Julie Meloni - her knowledge of PHP is
impressive!

Phil J.


Johannes Janson wrote:

> Hi,
>
> why storing the pictures in the db. just store the link to
> it.
>
> just a thought
> Johannes
>
> "Sharmad Naik" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi,
> > I wanted to know how to store and retrive images like jpeg,bmp from
> > database.I have a table called member with mem_id and photo.
> > Pls instruct how to do it
> > I m using postgresql but any reference would do
> >
> > --
> > The secret of the universe is @*&í!'ñ^#+ NO CARRIER
> > ___  _  _  _
> > |_|_||_||_||\/||_|| \
> > _|| || || \|  || ||_/
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] selecting from multiple tables on one database

2001-04-22 Thread Phil Jackson

Try using :
SELECT table1.UserName
 , table1.City
 , table1.State
 , table2.Sex
 , table2.Age
 ,table3.SpouseAge
FROM   table1
, table2
, table3
WHERE table1.UserName = table2.UserName
AND table1.UserName = table3.UserName

You have to have a common field upon which to join the tables - I'm suprised you only
got 12 rows back - you haven't given any selection criteria for tables 2 and
3!  Also, if you'll format your queries as above (with whatever line continuation
character PHP requires, if any...don't remember!)  you will find them easier to read,

maintain, and also spot obvious errors.

Hope this helps,
Phil J.


Todd Pillars wrote:

> I have checked the mysql.com docs and phpbuilder.com and zend.com and I am
> more confused than ever on selecting a single common record from multiple
> tables. Here is what I have so far.
>
> MySQL 3.23.22
> PHP 4.0.3pl1
> RedHat 6.1
>
> members
>
> table1
> ID  # auto_increment
> UserName# unique
> Name
> Address
> City
> State
> ZIP
>
> table2
> ID  # auto_increment independent of table1
> UserName# unique
> Birthday
> Sex
> Age
>
> table3
> ID  # auto_increment independent of table1 and table2
> UserName
> SpouseName
> SpouseBirthay
> SpouseAge
> DateTime# last update
>
> I am trying to pull out UserName, City, State from table1 - Sex, Age from
> table2 - and Age from table3 where the ID number of table1 is '1'; Meaning I
> only want one row containing the common information.
>
> If I use the following select statement I get 12 rows of data that do not
> contain what I am looking for!
>
> SELECT table1.UserName, table1.City, table1.State, table2.Sex, table2.Age,
> table3.SpouseAge FROM table1, table2, table3 WHERE table1.ID = '1'
>
> Can someone help please, or at least send me in the right direction?
>
> t.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Uploading file into database

2001-04-12 Thread Phil Jackson

Hi,
ok, first of all make sure your form tag is like :


The ENCTYPE is important!

Next, make sure you have a field like:

type="file" is important!  This will present a browse button for the user to browse 
their drives


something like this seems to work - drop the addslashes if it is not a binary file, 
such as an image

$filecontents = addslashes(fread(fopen($txtImage, "r"), filesize($txtImage)));
$thisfiletype = $txtImage_type;
 $db = mysql_select_db("somedb", $someconnection) or die ("db");
 $sql = "INSERT INTO Images (..all the fields...) VALUES ('$filecontents',...and all 
the rest of the fields')";

 $sql_result = mysql_query($sql,$someconnection) or die ("could not insert into DB");
  mysql_close($someconnection);

--

Hope this helps..

Phil J.








Zeus wrote:

> I'm trying to do a filexchange script.
>
> Does anyone know how to upload a file into the database such that when I do a 
>'select *' query, I can click on a link the download that file.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] sessions and page has expired warning

2001-04-12 Thread Phil Jackson

Here, I think you may be over - using session variables a bit...have not used them in 
php, as I have version 3, which doesn't support them.  However, by day I am an ASP 
developer, and article after article I read warns about session variables!  They are 
great, but can hog
memory, especially if you have many users concurrently, so I would use them sparingly, 
just when you have to.

The "back" button problem - here is where a session variable might be usefull, if you 
want to force a particular order of website traversal and not allow them to go back - 
when leaving, say page 1 - set a session variable $visitedPageOne = true
On the top of that page, first thing - check for the value of $visitedPageOne, if 
true, redirect to the next page, ect.

Phil J.


olinux wrote:

> I am using sessions to store variables until all forms have been filled out. at this 
>point they are put into the db.
> I would like to know how i can eliminate the problem that occurs when the user 
>presses the back button.  I receive a "warning, page has expired... press refresh" I 
>know that pressing refresh works fine, but some people do not understand and get 
>confused. How can i fix this?
>
> thanks much
> olinux


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] MSSQL + IIS

2001-04-12 Thread Phil Jackson

If you are speaking of Microsoft SQLServer, there are some lists that
specialize in this product at http://www.sqlteam.com

Also - try www.4guysfromrolla.com and asp101.com

hope this helps a little,
Phil J.


"André M.S.\"

> How can i use MSSQL + IIS?
> i´m having some problems...
>
> tks
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] insert binary file into MSSQL

2001-04-06 Thread Phil Jackson

Hi,
Check out
http://www.zdnet.com/devhead/stories/articles/0,4413,2643888,00.html
for a good workable example of using PHP/MySql to do this - the principles
should
be the same.

Also, search www.asptoday.com for the word "blob" to find some good articles

on the topic.

Phil J.


Marcel Liberda wrote:

> Anybody got a sample script for store/retrieve binary data (images, wav
> files, mp3) to/from a MSSQL database (7.0)?
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] mysql_result()

2001-04-04 Thread Phil Jackson

Looks reasonable enough
LeTourneau - hmmm - Longview, Texas?
Phil J.


Mark Roedel wrote:

> > -Original Message-
> > From: Jordan Elver [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, April 04, 2001 10:46 AM
> > To: PHP Database Mailing List; PHP General Mailing List
> > Subject: [PHP-DB] mysql_result()
> >
> >
> > If I knnow that a query will only retrun one row, can I do
> > this (below) rather than using a while loop for one record?
> >
> > $id = @mysql_result($result, 0, 'id');
> > $name = @mysql_result($result, 0, 'name');
> > $email = @mysql_result($result, 0, 'email');
> > $address1 = @mysql_result($result, 0, 'address1');
> > $address2 = @mysql_result($result, 0, 'address2');
> > $town_city = @mysql_result($result, 0, 'town_city');
> > $postcode = @mysql_result($result, 0, 'postcode');
>
> Looks reasonable to me...what happens when you try it?
>
> ---
> Mark Roedel ([EMAIL PROTECTED])  ||  "There cannot be a crisis next week.
> Systems Programmer / WebMaster  ||   My schedule is already full."
>  LeTourneau University  ||-- Henry Kissinger
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Varible insert

2001-04-04 Thread Phil Jackson

Hmmm...given that the form fields all had the same names - i.e. you were
performing
the same sql, you could use and include or "required" file that did all the DB
work.
Or - you could have a generic includr file function that you passed a
connectstring and
sqlstring to as variables

Phil J.


Shannon Doyle wrote:

> Hi People,
>
> It seems like all I am doing lately is going into areas of php that I
> haven't done before and get stuck. Anyway, here is another small request
> that I have.
>
> I have a series of pages that must insert into a mysql database the results
> of the entries. I know how to insert these details into a database, however
> there are over 200 entries across 20 or so pages. What I am in need of doing
> is the following:
>
> Is there a way of creating one insert statement that can be used by all
> pages to insert the data from the fields into the appropriate fields in the
> database? ie the sql insert statement is dynamic and will adapt.
>
> I have an idea that maybe the "get" method on the form will be of some help,
> but not sure.
>
> Any ideas etc would be helpful.
>
> - Shannon
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Oracle vs MS SQL vs MySQL

2001-04-04 Thread Phil Jackson

Brian,
To echo your other replies, there is always a trade-off between cost, ease of
mainenance, usability, and functionality.
PHP seems to go quite hand-in-hand with MySQL, despite some limitations.  I'd
take a look at the MySQL site and
see first if you can live with those limitations.

Ive been living in an ASP/Access world for the past year, for mostly "light"
internet and intranet applications.  Due to the mainfame
side of our IS dept. and the fact that we have a Data Adminstration dept.
that is dedicated to IBM's DB2, we are required to use
the DB2 UDB database (a DB2 server on PC, if you will) for future
development.  Best I can say here to anyone is "stay away"!
My vote is with MySql, unless you'vegot to do triggers, sub-selects, or
views, or simply have to create work for a pre-existing DBA

Phil J.




"Brian.J.Mauter" wrote:

> Hey,
>
> Has anyone tried out all three of these DBMS packages and evaluated them?
> I was wondering what everyone is having the best luck with when writing
> PHP scripts.
>
> I'm using Oracle8i and if you don't mind, it's a pain in the tail.  :-P
>
> While I'm asking, let's not limit it to just those three, if anyone is
> overwhelmingly pleased with something else, name it please! :-)
>
> Thanks,
> Brian
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Validating forms

2001-04-02 Thread Phil Jackson

Julio,

It is much more efficient to do that type of validation client-side, using
Javascript.  No
sense in making another round trip to the server if not necessary.

Here is a quicke example:
  if (document.autoform.txtVehicleNumber.value == ""){
  document.autoform.txtVehicleNumber.focus()
  alert("Enter fleet vehicle number")
  return false
}

Have a look at http://www.wsabstract.com/ for good javascript info.

good luck,

Phil J.

"Julio Cuz, Jr." wrote:

> Hi--
>
> I have a form that cannot have a specific field blank, so I would like to
> add a message box saying "fill out the x field," is there a way to do this
> WITHOUT having to refresh the page?
>
> Julio Cuz, Jr.
> Riverside Community College
> [EMAIL PROTECTED]
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Search results

2001-04-01 Thread Phil Jackson

I've not seen the limit function, but it sounds quite uselfull.  Whatever method,
you could
pass the first or last keys related to the current page and an indication as to
whether you
are going forwards or backwards - I suppose that in PHP it could all be done in
one file,
self-referential-like, as the "arrows" would somehow comprise a form.

Phil J.


CC Zona wrote:

> In article <001301c0bafa$34d15be0$[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED] ("David Drummond") wrote:
>
> > Can anyone tell me what is the best way to implement displaying multiple
> > search results using next and previous buttons to cycle through all the
> > results.  I see this method done on a lot of sites but don't know how to do
> > it in PHP.
>
> "Limit" is how it's commonly done (though what's "best" really depends on
> what you're doing).  In mysql, it would be something like:
>
> mysql_query("select foo from bar limit 5,10",$connect) //show ten records
> from result set, starting with the sixth
>
> I believe phpbuilder.com has a tutorial on this.  If not them, then you
> shouldn't have much trouble finding examples on one of the other PHP
> tutorial sites.
>
> --
> CC
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] retrieving images

2001-04-01 Thread Phil Jackson

Yes, exactly.  What you want are image tags, as in
http://www.fractal-vibes.com
.

"Stuart J. Browne" wrote:

> Hello,
>
> I'm trying to retrieve and output all the binary images in my images table.
> This is what I have,
>
> $result = mysql_query("SELECT * FROM images",$db);
>
> if ($myrow = mysql_fetch_array($result)) {
>
>   // display list if there are records to display
>
>   do {
>$filetype = ($myrow["filetype"]);
>header("Content-type: $filetype");
>echo $myrow["binary_junk"]."\n";
>
>   } while ($myrow = mysql_fetch_array($result));
>
> } else {
>
>   // no records to display
>
>   echo "Sorry, no records were found!";
>
> When I run this, it only returns the first image in the table. Have really
> know idea where to go from here.  Is one image all that can be done?
>
> Ok.. some information for you, as you seem to mis-understand some things
> here...
>
> A web-browser can handle certain pices of information being thrown down it's
> gullett..  The Content-type: is what determines this.
>
> If you start by throwing it an image/gif, then it will expenct a gif to come
> down.  If you start throwing ""'s down, it will not only corrupt the
> image, but not do anything remotely related to HTML.
>
> Basically what you need to do is to set up a second PHP routine which grabs
> the binary data from the dataqbase and displays it, using  tags.
>
> The first routine just sets up the 
> I've got an example of the code required to do something like this if you
> want to take a look..   (http://elfgrove.virtual.net.au/~bekar/test.phps)
>
> hope this helps.
>
> bkx
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] send a html page into an email

2001-03-31 Thread Phil Jackson

I think you will have to send mime mail to send the page as an attachment.
See
http://www.wrox.com/Books/Book_down.asp?section=11_3&isbn=1861002963&subject=&subject_id=

There you can download some source code from the "Proffesional PHP" book as
a zip file.  There will be a "mime_mail.inc" and a "mail.php" file that are
good examples.

Phil J.


"Pedro M. S. Oliveira" wrote:

> hello all. this is what i need to do
> i have a dinamic page, buitl with mysql and php,
> and then i have this form saying, send this page to a friend.
> how can i send the content of the page to an email addy?
> thank you all
>
> ***
> Pedro Miguel Silva Oliveira
> Cell Phone: +351 96 5867227
> SMS: [EMAIL PROTECTED]
> Email: [EMAIL PROTECTED]
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] How to eliminate bad fields from a mysql query?

2001-03-30 Thread Phil Jackson

If there are some fields that you absolutley require, or must be in a valid
format,  I'd
use javascript to edit the form first - no reason to make a round trip to
the server for
something you can do server-side.

**Or** - say the form is for selecting an automobile - make is required but
color isn't
nor is model.
$sql = "Select * from someDB where make =" . $make;

If $model > "" {
  $sql = $sql . " And model = " . $model;
  }

If $color > "" {
  $sql = $sql . " and color=" . $color
  }

Build your sql string incrementally and conditionally - check what you can
client-side..

Phil J.


Bob Stone wrote:

> Dear PHP Helpers,
>
> Can you direct me to a solution for this problem:
>
> How can I eliminate bad (blank or incorrect) fields
> from a mysql query? In other words, if someone leaves
> a form field blank or enters a value that does not
> have a matching entry in the database, how can I
> eliminate that variable from the query?
>
> The query that I am using now works fine if the user
> enters a value in field that exists in the database.
> However if a field is left blank or incorrect data is
> entered, no results will display on the screen.
>
> Here is the code that I am using:
>
> $result = mysql_query("SELECT salutation, first_name,
> mid_name, user_name, cert_deg, job_title, institution,
> address_1, address_2, geo_loc, state, zip, country,
> phone, fax, e_mail FROM svt_members where first_name
> like '$first_name' && user_name like '$user_name' &&
> institution like '$institution' && state='$state' &&
> country like '$country'", $db);
>
> while ($myrow = mysql_fetch_array($result)) {
>
> printf("Name: %s
> %s %s %s\n", $myrow["salutation"],
> $myrow["first_name"], $myrow["mid_name"],
> $myrow["user_name"]);
>
> printf("Credentials and Degrees:  color=\"blue\" size=\2\">%sJob Title:
>  size=\2\">%sCompany/Institution:
>  size=\2\">%sAddress:  color=\"blue\" size=\2\">%s %sCity:
> %s
> State/Province:  size=\2\">%sCountry:  color=\"blue\" size=\2\">%s   Postal Code:
>  size=\2\">%sVoice:  color=\"blue\" size=\2\">%s   Fax:  color=\"blue\" size=\2\">%sE-mail:
> %s\n",
> $myrow["cert_deg"], $myrow["job_title"],
> $myrow["institution"], $myrow["address_1"],
> $myrow["address_2"], $myrow["geo_loc"],
> $myrow["state"], $myrow["country"], $myrow["zip"],
> $myrow["phone"], $myrow["fax"], $myrow["e_mail"]);
> }
>
> So if (for instance) a user enters data for each field
> except institution, how can I get the query to
> disregard $institution?
>
> Or if there is a better approach that I should be
> using instead of the above, please let me know.
>
> Thank you,
>
> Bob
>
> __
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/?.refer=text
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] count function?

2001-03-30 Thread Phil Jackson

What is retrieved if you do a Select Count(*) from myDb where
condition = parameters?

Seems your result set should contain this value...
Phil J.


DC wrote:

> Hi All
> I cant quite work out how to count the number of rows in my mysql db that
> match a certain critieria and the show that number numericaly in my pages.
>
> Checked books, php.net etc.
>
> Any help is appreciated
>
> Yours Dave C
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] $vars to JS in a linked js page.

2001-03-29 Thread Phil Jackson

I think your only choices are to put this value into either a database or if
you are using
php4 - to use a session varible - or use a cookie if you are trying to
persist this value
across multiple pages for multiple users...or pass as a querystring to the
next page..
or as a hidden form variable if processed on the same page...depends


psj


John Starkey wrote:

> I've got 2000 pages that are dependent on one include and I don't wanna
> alter it too much and I'd like to use some JS in a linked file. I don't
> wanna include it in and have it displayed.
>
> Is there a way to do:
>
> $some_number = $mysql_num_rows;
>
> 
>
> And use the $some_number variable in that external.js file?
>
> I've tried several ideas, to no avail. Like: changing the .js to a .php
> and echoing the value, etc.
>
> Thanks,
>
> John
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] PHP on WIN32 with DB2 CLI

2001-03-29 Thread Phil Jackson

Chris - I think to use DB2's CLI interface, you need a compiled langauge, like
some flavor of C++ or VB.  I've seen some examples using the CLI interface, so
my question is why on earth would you chose that over generic ODBC?  That CLI is
nasty-looking,
pages of code versus what you can do in a few lines with ODBC.. - but I have a
project
using both DB2 on a mainframe and DB2 UDB - so I am very interested in your
thoughts on all this!
Phil J.


Chris Book wrote:

> Hi,
>
> I've compiled php before with --with-ibm-db2 to use DB2's CLI driver.  Now
> I'm working on NT with the php binary, and I can't figure out how to connect
> to DB2 except with ODBC.  I would prefer to use the CLI interface than an
> ODBC interface.  Is this possible or am I stuck with ODBC on NT?
>
> Thanks,
> Chris Book
> [EMAIL PROTECTED]
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] variables

2001-03-29 Thread Phil Jackson

Dunno without looking at code, but try storing the value of $customer into a
local variable when the script is invoked - something is wiping it clean.
my thunks,
Phil J.


Scott Kalbach wrote:

> I am having a problem with losing a variables value. What I am doing is
> taking the value from a database, 'customer_id',  and putting it into a
> hidden form value called 'customer'. When I hit submit on the form it sends
> me to a page where it does several queries to several databases and pulls
> information all based on the value $customer.
>
> I have the individual queries in include files. It does the first 2 queries
> fine,but when it gets to the third, the value of $customer seems to be gone,
> so I get no result for the rest of the query's. I looked in my scripts but
> can't figure out any reason it would lose this value.
>
> Any ideas?
>
> Thanks,
>
> Scott Kalbach
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] MySql Connect question

2001-03-29 Thread Phil Jackson

Hi,
If I were to try to connect to a MySQL DB from some scripting language,
in the connection string what do I put in the "provider=" string for
an ODBC connection?

I'd like to try this from an ASP application using ADO, but need to know
this.  Before
you boo and hiss - I've duplicated the functionality just fine using PHP
and MySQL at
home to grab the binary data from a posted form and upload images just
fine.  We are
attempting to do this using ASP and an IBM DB2 UDB database, and it
seems to choke on the blob field.If I can show that with some minor
changes, an open-source DB could be used for this...

Many thanks to the folks on the list that directed me to the
"addslashes" function that was the key to getting the binary data
cleaned up and into the DB - ask a question of
IBM folks and they'll either try to sell you another product or chuckle
and offer to send
consultants for hundreds of dollars an hour to tell you what you could
figure out if their
reference manuals weren't circular refernces to obtuse garbage...

Phil J.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Help?

2001-03-25 Thread Phil Jackson

Perhaps the quote marks within quote marks?  PHP,as is javascript, very
particular..
Try:
echo "Name: $row['user_id'].'\n"; or some such.
or
echo "Name".$row[user_id]."\n";
It's the quote marks within that are playing havoc..

Phil J.

Chris Hall wrote:

> I keep getting this error on a little project im working on to learn PHP and
> MySQL better:
> Parse error: parse error, expecting `','' or `';'' in
> f:\inetpub\wwwroot\forums\index.php on line 38
> line 38 would be:
> echo "Name: "$row["user_id"]."\n";
> Can anyone help?
>
> --
> Chris Hall
> sytems administrator
> funnelbox mediaworks
> [EMAIL PROTECTED]
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Inserting Image as Blob in MySql DB

2001-03-25 Thread Phil Jackson

Hi,
Does anyone know the proper method for inserting an image(*.jpg or
*.gif) into a MySql database blob field?  I am recieving the file via an
html form with the usual enctype for this and 
parameters.  I can save it as just a regular file and then display it
fine on the page, but no way can I update the database with this...and
have tried everything imaginable...surely this is done everyday and is
quite simple.

code snippet below - and yes, I am a php beginner...ASP by day and
trying to learn
PHP by night..
-
$photo  = fopen($txtImage, "r");
$filecontents = fread($photo, filesize($txtImage));
echo "";
echo "";
$anotherfile = fopen("/www/htdocs/Survey/$thisfile", "a+");
fputs($anotherfile, $filecontents);
//fclose($anotherfile);
echo "";
echo "";
echo "";
echo $photo;
echo "";
echo "";
$crapola = "101010101";
echo "";



 $connection = mysql_connect("mysql.iticom.net","fractalv","fw348vnj")
or die ("crap!");
 $db = mysql_select_db("fractalv", $connection) or die ("db");
 $sql = "INSERT INTO Images (Image,
ImageType,ImageGallery,ImageLink,ThumbnailLink) VALUES
('$filecontents','$txtImageType', '$txtImageGallery', '$txtImageLink',
'$txtThumbnailLink')";
 $sql_result = mysql_query($sql,$connection) or die ("could not insert
into DB");
 mysql_close($connection);
-ect.

thanks in advance for absolutley any ideas!

Phil J.

.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] csv file with mysql

2001-03-12 Thread Phil Driscoll

Looks like your script is hitting max execution time, as has already been
pointed out.

Rather than increasing the max execution time in php.ini, you can just call
set_time_limit(time in seconds, or 0 for no limit)
which will increase the execution time for just this script, thereby
minimising the possibility of being caught out by errant scripts running
away with your machine.

Cheers
--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] my sql text query

2001-03-10 Thread Phil Driscoll

>Nope, you change the field to not null then it won't allow null values in
>the database. Since the data already has null values, the Alter Table would
>probably fail.

I should have been clearer -  change the text field to non-null - this will
cause the null entries to become empty strings (and hence your
mysql_fetch_array calls will have an entry for that field containing an
entry string) and then back again to null. I've just tried it on my machine
and it works a treat.

Cheers
--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] my sql text query

2001-03-09 Thread Phil Driscoll

Good heavens, another PHP developer in Leeds:)

I think (I haven't tried this!) you could change the field type to
not-null - then your array should get populated with empty strings for any
records where this field is not set.

Cheers
--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: Is there a PHP equivalent of DATE_FORMAT ?

2001-02-21 Thread Phil Daintree

Timothy Wright wrote:

>... so echo date("Y-n-j") would give me the output in the right format, but
>I need to convert the input to a valid timestamp first.

You can use parse out the year, month and day and then use the mktime function - the 
dates
I use are dd/mm/yy format:

/*Make an array of the string TransDate  using the / character as the seperator*/
$Date_array = explode("/", $TransDate);

/*If the year is before 60 then assume we are in 2000 - look out in 2061 ! */
 If ((int)$Date_array[2] <60) {
  $Date_array[2] = "20". $Date_array[2];
 } elseif ((int)$Date_array[2] >59 AND (int)$Date_array[2] <100) {
  $Date_array[2] = "19". $Date_array[2];
 }

/*Make a unix time stamp out of the array elements */
 $TransDate = mktime(0,0,0,$Date_array[1],$Date_array[0],$Date_array[2]);

Phil




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Windoze crashes on this simple logon script.

2001-02-16 Thread Phil Driscoll

I suspect that what is going on is that your code is just going around in
circles - the redirect is just opening the same page over and over again
because your logic is flawed somewhere. Instead of outputting the location
header, output an http://www.dialsolutions.com
http://www.dtonline.org


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] installing php4 on windows and apache 1.3.*

2001-02-08 Thread Phil Driscoll

>How do I get php to work on apache under win98?
>I've tried a lot of manuals but i constantly get the error:
>
>Premature end of script headers: e:/php4/php.exe
>
>What did I do wrong?
It sounds like php did not output anything. Check that you can run php.exe
directly. (From the command line run e:/php4/php.exe -i)
If that works ok (and prints out the phpinfo() html, then double check your
httpd.conf.

Cheers
--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] RESEND - php class to C struct interface possible?

2001-02-04 Thread Phil Rhoades

Hi all,

Thought I would try sending this again - didn't get a reply last time - 
guess I'll give up if this attempt doesn't get a reply . .

I've just subscribed and haven't even got any mail from the list yet so I 
hope this isn't a dumb question . .

The php xBase interface is very basic so:

We have an existing (Linux RH6.2) system that has some conventional dumb 
terminal C programs that have access to a set of CodeBase (xBase) tables 
through a set of functions that I have written (eg putDBFcchq, getDBFmclm, 
topDBFest, etc).  The applications pass the address of a conventional C 
struct and the functions do their job talking to the tables and pass back 
data in the struct.

The question is . . can I make use of these functions somehow from my 
html/php setup?  eg Could I produce a little C program that would accept 
input of a class address from php somehow and then use the appropriate C 
function to talk to the tables and then pass data back to the php class?

Any other way of doing what I want?

Thanks,

Phil.
-
Philip Rhoades

Pricom Pty Limited  (ACN  003 252 275)
GPO Box 3411
Sydney NSW  2001
Australia
Mobile:  +61:0411-185-652
Fax:  +61:2:8923-5363
E-mail:  [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] php class to C struct interface possible?

2001-02-01 Thread Phil Rhoades

Hi all,

I've just subscribed and haven't even got any mail from the list yet so I 
hope this isn't a dumb question . .

The php xBase interface is very basic so:

We have an existing (Linux RH6.2) system that has some conventional dumb 
terminal C programs that have access to a set of CodeBase (xBase) tables 
through a set of functions that I have written (eg putDBFcchq, getDBFmclm, 
topDBFest, etc).  The applications pass the address of a conventional C 
struct and the functions do their job talking to the tables and pass back 
data in the struct.

The question is . . can I make use of these functions somehow from my 
html/php setup?  eg Could I produce a little C program that would accept 
input of a class address from php somehow and then use the appropriate C 
function to talk to the tables and then pass data back to the php class?

Any other way of doing what I want?

Thanks,

Phil.
-
Philip Rhoades

Pricom Pty Limited  (ACN  003 252 275)
GPO Box 3411
Sydney NSW  2001
Australia
Mobile:  +61:0411-185-652
Fax:  +61:2:8923-5363
E-mail:  [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]