RE: [PHP-DB] Linked tables and fields in a form

2002-07-02 Thread José Moreira



use this on the first SELECT :

select name=SELECT onChange=window.navigate('?=$PHP_SELF
??choice='+this.value)

when u choose an option the page will be refreshed and the $choice will be
available thru HTTP_GET_VARS[choice]

all u have to do is check if the var exists and execute the second MySql
SELECT acording to the $choice


-Mensagem original-
De: Peter Goggin [mailto:[EMAIL PROTECTED]]
Enviada: terça-feira, 2 de Julho de 2002 2:00
Para: [EMAIL PROTECTED]
Assunto: [PHP-DB] Linked tables and fields in a form


I have two related tables. The first has about 12 records, each of which is
related to about 12 records in the second table.  I want to have two
interconnectedt dropdown list fields. The fist is used to select from the
first table and when the value has been selected, use it to determine the
contents of the second drop down list.

Obviously I can do this by having interrelated pages where the value from
the first fiels is carried to the second page and used to populate the
second drop down list.

Is there any way of doing this so within a single page?


Regards


Peter Goggin


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



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




Re: [PHP-DB] blob versus file

2002-07-02 Thread Pierre-Alain Joye

On Tue, 2 Jul 2002 05:45:40 +0200
Andy [EMAIL PROTECTED] wrote:

 is the increase of the network traffic noticable? The query is pretty small
 just text. Do u really think this might increase the traffic?
Try to heavely charge a DB with images inside it.
Do the same without DB, that depends if the dbms is in another server or not, note 
localhost server can use the network interface and not the socket.

then compare the two methods, and use the best :).

Tests are always the best way to get the best methods :).


 I also noticed that the image is not cached anymore. Is this true for all
 blobs, or do I just access them in a wron way?
Cached ? Client side ?


hth

pa

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




Re: [PHP-DB] blob versus file

2002-07-02 Thread Michael Bretterklieber

Hi,

one point that you should keeped in mind is, if you have a cluster of 
webservers connecting to the same db-server, then you have to mount the 
filesystems, where you store the images on all webservers.

On the other hand many db's like oracle have many restrictions with 
lobs. In oracle you can have only one LOB per table. And also functions 
like SELECT DISTINCT or GROUP BY are not supported on LOB-fields.

MySQL is here the positive exception, because MySQL supports such 
functions also on LOB-fields.

We store images and other documents on the filesystem, but text-data 
like session-data ist stored in LOB's,


bye,

Pierre-Alain Joye schrieb:
 On Tue, 2 Jul 2002 05:45:40 +0200
 Andy [EMAIL PROTECTED] wrote:
 
 
is the increase of the network traffic noticable? The query is pretty small
just text. Do u really think this might increase the traffic?
 
 Try to heavely charge a DB with images inside it.
 Do the same without DB, that depends if the dbms is in another server or not, note 
localhost server can use the network interface and not the socket.
 
 then compare the two methods, and use the best :).
 
 Tests are always the best way to get the best methods :).
 
 
 
I also noticed that the image is not cached anymore. Is this true for all
blobs, or do I just access them in a wron way?
 
 Cached ? Client side ?
 
 
 hth
 
 pa
 


-- 
--
Michael Bretterklieber
LCP
JAWA Management Software GmbH
Liebenauer Hauptstr. 200
A-8041 GRAZ
Tel: ++43-(0)316-403274-12
Fax: ++43-(0)316-403274-10
GSM: ++43-(0)676-93 96 698
[EMAIL PROTECTED]
homepage: http://www.jawa.at
- privat ---
E-mail:   [EMAIL PROTECTED]
homepage: http://www.inode.at/mbretter
--
...the number of UNIX installations has grown to 10, with more expected...
   - Dennis Ritchie and Ken Thompson, June 1972


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




Re: [PHP-DB] blob versus file

2002-07-02 Thread Pierre-Alain Joye

On Tue, 02 Jul 2002 12:57:56 +0200
Michael Bretterklieber [EMAIL PROTECTED] wrote:

 Hi,
 
 one point that you should keeped in mind is, if you have a cluster of 
 webservers connecting to the same db-server, then you have to mount the 
 filesystems, where you store the images on all webservers.
For multi-server images/docs server, we usually create a virtual host 
(images.domain.net), and avoid counter productive nfs or network filesystem.

Generally, the method you choose depends of the portability level, maintenance, 
recovery system, ... Just test   valident the different methods provided in this 
thread, you find the one fit to your needs.


hth

pa

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




[PHP-DB] storing content data outside the application

2002-07-02 Thread Andy

Hi there,

I have a problem with content data. Currently I do store images inside a
data folder.
/data

This is causing a problem, because everytime I installan update of the
application on the server I have to move this folder around to the new
version of my application. I am worried that during this coppy an error will
apear, due to my fault, or whatever might happen. The immages are part of a
dataset stored in a mysqldb. So I tryed to store them to blobs, but this is
causing performance problems. Images apear much quicker while comming from
the filesystem. They also seem not to be cached by the client anymore.

Does anybody know a good method to store the images outside the rootfolder
and still access them the old fashion way?

Any suggestions are appreciated.

Thanx, Andy






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




[PHP-DB] Re: delete multiple records with one query

2002-07-02 Thread Adam Royle

another way to do this is (quicker, using only one query):

$delete_IDs = implode(,,$name_array);
$sql = DELETE FROM $mysql_table WHERE id IN ($delete_IDs);
mysql_query($sql);

or you could delete the first line (implode) and take the square 
brackets out of the name of the form field. this will make a 
comma-delimited string of all your selected ID numbers, and will be 
available in $name_array

your choice

adam


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




RE: [PHP-DB] storing content data outside the application

2002-07-02 Thread Hutchins, Richard

Without knowing what you really are trying to accomplish...

I've had very good results with the following bit of code:

//scan the directory and load its contents into an array
$handle=opendir($dir);
while (false !== ($file = readdir($handle)))
{
$retVal[] = $file;
}

//close the directory read operation then sort the array
closedir($handle);
sort($retVal);

I use this code to look in any directory whose path gets passed to this set
of code. Once the filenames of the contents of the target directory are in
the array, you can pretty much manipulate them however you want. Personally,
I have a simple script that throws down an HTML table of only the thumbnails
in the directory and embeds links to the full size image. Nothing fancy.

None of the images or paths are ever stored in a database. It might help you
out a bit since the path to the images is passed as a variable with error
handling for missing directories. If you can either come up with a slick way
of grabbing the path to the image directory dynamically or wrapping up your
application code in the PHP equivalent of a Java .war file (I don't know
what that would be, by the way) for distribution then you might be able to
solve your problem all the way around.

This alone probably won't solve your problem, but it might give you
something to go on.

Rich

-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 02, 2002 7:42 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] storing content data outside the application


Hi there,

I have a problem with content data. Currently I do store images inside a
data folder.
/data

This is causing a problem, because everytime I installan update of the
application on the server I have to move this folder around to the new
version of my application. I am worried that during this coppy an error will
apear, due to my fault, or whatever might happen. The immages are part of a
dataset stored in a mysqldb. So I tryed to store them to blobs, but this is
causing performance problems. Images apear much quicker while comming from
the filesystem. They also seem not to be cached by the client anymore.

Does anybody know a good method to store the images outside the rootfolder
and still access them the old fashion way?

Any suggestions are appreciated.

Thanx, Andy






-- 
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] Column headers

2002-07-02 Thread Casey Allen Shobe

How can I get the column headers from a query?

For example, on a 'select blah, blah2, blah3, something as blah4 from 
whereever', I would want the blah, blah2, blah3, blah4, preferably in an 
array.

Thanks,

-- 
Casey Allen Shobe / Network Security Analyst  PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
[EMAIL PROTECTED] / http://www.secureworks.net
Content is my own and does not necessarily represent my company.

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




[PHP-DB] PHP Newbee Question

2002-07-02 Thread Jeffrey Norsworthy

Hello All,
  I am new to PHP, and I am trying to design what I thought would be a fairly simple 
form, that queries a MYSQL database for two fields, (first, and last name). It should 
then return the entire results of the entry in the table. This part is actually 5 
fields. 
  If I run the script with static entries for first, and last, the process work 
flawlessly (as it should). If I try using variables for the search values, I do not 
receive any results. I have tried changing the form method from post, to get, and the 
problem continues. Any help would be greatly appreciated. Thank you. The first 
grouping is the html form, the second set is the php form that actually performs the 
search. Also the username, and password are populated in the actual script, I just 
took them out for the email. Thanks again.

html
headtitleContact lookup form/title/head
body
form action=test.php method=post
First Name: input type=text name=firstbr
Last Name: input type=text name=lastbr
input type=submit value=lookup
/form
/body
/html










?php
define ('mysql_host', 'localhost');
define ('mysql_user', '');
define ('mysql_pass', '');
define ('mysql_db', 'chs');

if (! mysql_connect(mysql_host, mysql_user, mysql_pass) )
{
die('Failed to connect to host  ' . mysql_host . '  . ');
}
else
{
echo '' . mysql_host . 'br';
}

mysql_select_db(mysql_db);
if ($http_get_vars['first']  $http_get_vars['last'])
{
   echo $http_get_vars['first'] . ' ' . $http_get_vars['last'] . 'br';
}
$result=mysql_query(select * from chs where first='$first' or last='$last');
echo h2 align='center'Results/h2;

while ($row = mysql_fetch_array($result))
{
echo 
b{$row['first']}nbsp{$row['last']}nbspnbspnbsp{$row['branch']}nbspnbspnbsp{$row['extension']}nbspnbsp
nbsp{$row['voice_mail']}nbspnbspnbsp{$row['position']}/b br;
}
?



Jeffrey Norsworthy MCP, CCNA
Network Administrator
Community Health Services
[EMAIL PROTECTED]



Re: [PHP-DB] PHP Newbee Question

2002-07-02 Thread Bogdan Stancescu

Variable names are case-sensitive in PHP - try $HTTP_POST_VARS[first] 
- or, for new versions of PHP, $_POST[first].

In another train of thoughts, please use the proper e-mail address - I'm 
sure I'm not the only one using filters to automatically move mail to 
folders and your although probably valid according to the RFC, the way 
you formatted the php list e-mail address doesn't match the filter names...

Thanks!

Bogdan

Jeffrey Norsworthy wrote:

Hello All,
  I am new to PHP, and I am trying to design what I thought would be a fairly simple 
form, that queries a MYSQL database for two fields, (first, and last name). It should 
then return the entire results of the entry in the table. This part is actually 5 
fields. 
  If I run the script with static entries for first, and last, the process work 
flawlessly (as it should). If I try using variables for the search values, I do not 
receive any results. I have tried changing the form method from post, to get, and the 
problem continues. Any help would be greatly appreciated. Thank you. The first 
grouping is the html form, the second set is the php form that actually performs the 
search. Also the username, and password are populated in the actual script, I just 
took them out for the email. Thanks again.

html
headtitleContact lookup form/title/head
body
form action=test.php method=post
First Name: input type=text name=firstbr
Last Name: input type=text name=lastbr
input type=submit value=lookup
/form
/body
/html










?php
define ('mysql_host', 'localhost');
define ('mysql_user', '');
define ('mysql_pass', '');
define ('mysql_db', 'chs');

if (! mysql_connect(mysql_host, mysql_user, mysql_pass) )
{
die('Failed to connect to host  ' . mysql_host . '  . ');
}
else
{
echo '' . mysql_host . 'br';
}

mysql_select_db(mysql_db);
if ($http_get_vars['first']  $http_get_vars['last'])
{
   echo $http_get_vars['first'] . ' ' . $http_get_vars['last'] . 'br';
}
$result=mysql_query(select * from chs where first='$first' or last='$last');
echo h2 align='center'Results/h2;

while ($row = mysql_fetch_array($result))
{
echo 
b{$row['first']}nbsp{$row['last']}nbspnbspnbsp{$row['branch']}nbspnbspnbsp{$row['extension']}nbspnbsp
nbsp{$row['voice_mail']}nbspnbspnbsp{$row['position']}/b br;
}
?



Jeffrey Norsworthy MCP, CCNA
Network Administrator
Community Health Services
[EMAIL PROTECTED]

  




Mail scanat cu RAV Antivirus!

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




Re: [PHP-DB] Column headers

2002-07-02 Thread Bogdan Stancescu

For MySQL, see mysql_num_fields() and mysql_fetch_field() at 
http://www.php.net

HTH

Bogdan

Casey Allen Shobe wrote:

How can I get the column headers from a query?

For example, on a 'select blah, blah2, blah3, something as blah4 from 
whereever', I would want the blah, blah2, blah3, blah4, preferably in an 
array.

Thanks,

  




Mail scanat cu RAV Antivirus!

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




Re: [PHP-DB] Column headers

2002-07-02 Thread Casey Allen Shobe

Whoops, should have been more clear.

I'm looking for something to work with ODBC, and also Sybase.  I'm already 
fetching the data fine, but can't figure out how to get the column headers.

On Tuesday 02 July 2002 09:50 am, Casey Allen Shobe wrote:
 How can I get the column headers from a query?

 For example, on a 'select blah, blah2, blah3, something as blah4 from
 whereever', I would want the blah, blah2, blah3, blah4, preferably in an
 array.

 Thanks,

-- 
Casey Allen Shobe / Network Security Analyst  PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
[EMAIL PROTECTED] / http://www.secureworks.net
Content is my own and does not necessarily represent my company.

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




Re: [PHP-DB] PHP Newbee Question

2002-07-02 Thread Jeffrey Norsworthy

Thanks for the tip. Unfortunately it didn't fix the issue. I am sorry about the way 
the address message is displayed. There unfortunately isn't anything I can do about it.

Jeffrey Norsworthy MCP, CCNA
Network Administrator
Community Health Services
[EMAIL PROTECTED]

 Bogdan Stancescu [EMAIL PROTECTED] 07/02/02 10:15AM 
Variable names are case-sensitive in PHP - try $HTTP_POST_VARS[first] 
- or, for new versions of PHP, $_POST[first].

In another train of thoughts, please use the proper e-mail address - I'm 
sure I'm not the only one using filters to automatically move mail to 
folders and your although probably valid according to the RFC, the way 
you formatted the php list e-mail address doesn't match the filter names...

Thanks!

Bogdan

Jeffrey Norsworthy wrote:

Hello All,
  I am new to PHP, and I am trying to design what I thought would be a fairly simple 
form, that queries a MYSQL database for two fields, (first, and last name). It should 
then return the entire results of the entry in the table. This part is actually 5 
fields. 
  If I run the script with static entries for first, and last, the process work 
flawlessly (as it should). If I try using variables for the search values, I do not 
receive any results. I have tried changing the form method from post, to get, and the 
problem continues. Any help would be greatly appreciated. Thank you. The first 
grouping is the html form, the second set is the php form that actually performs the 
search. Also the username, and password are populated in the actual script, I just 
took them out for the email. Thanks again.

html
headtitleContact lookup form/title/head
body
form action=test.php method=post
First Name: input type=text name=firstbr
Last Name: input type=text name=lastbr
input type=submit value=lookup
/form
/body
/html










?php
define ('mysql_host', 'localhost');
define ('mysql_user', '');
define ('mysql_pass', '');
define ('mysql_db', 'chs');

if (! mysql_connect(mysql_host, mysql_user, mysql_pass) )
{
die('Failed to connect to host  ' . mysql_host . '  . ');
}
else
{
echo '' . mysql_host . 'br';
}

mysql_select_db(mysql_db);
if ($http_get_vars['first']  $http_get_vars['last'])
{
   echo $http_get_vars['first'] . ' ' . $http_get_vars['last'] . 'br';
}
$result=mysql_query(select * from chs where first='$first' or last='$last');
echo h2 align='center'Results/h2;

while ($row = mysql_fetch_array($result))
{
echo 
b{$row['first']}nbsp{$row['last']}nbspnbspnbsp{$row['branch']}nbspnbspnbsp{$row['extension']}nbspnbsp
nbsp{$row['voice_mail']}nbspnbspnbsp{$row['position']}/b br;
}
?



Jeffrey Norsworthy MCP, CCNA
Network Administrator
Community Health Services
[EMAIL PROTECTED]

  




Mail scanat cu RAV Antivirus!


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



Re: [PHP-DB] PHP Newbee Question

2002-07-02 Thread Bogdan Stancescu

It was fine this time! Your first message was addressed to 
[EMAIL PROTECTED] instead of simply [EMAIL PROTECTED]

Well, make sure you don't use POST in the form and GET in the PHP - or 
vice-versa. Also, try replacing your debug code in the PHP with 
something like this:
--
echo (bDebug:/bp\n);
echo(First: .$_POST[first].; Last: .$_POST[last].br\n);
echo(hr\n);
--

This way you can fiddle with a single line of code until you get it 
working, instead of risking to make a mistake either when testing or 
when printing.

Bogdan

Jeffrey Norsworthy wrote:

 Thanks for the tip. Unfortunately it didn't fix the issue. I am sorry 
 about the way the address message is displayed. There unfortunately 
 isn't anything I can do about it.
  
 Jeffrey Norsworthy MCP, CCNA
 Network Administrator
 Community Health Services
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

  Bogdan Stancescu [EMAIL PROTECTED] 07/02/02 10:15AM 
 Variable names are case-sensitive in PHP - try $HTTP_POST_VARS[first]
 - or, for new versions of PHP, $_POST[first].

 In another train of thoughts, please use the proper e-mail address - I'm
 sure I'm not the only one using filters to automatically move mail to
 folders and your although probably valid according to the RFC, the way
 you formatted the php list e-mail address doesn't match the filter 
 names...

 Thanks!

 Bogdan

 Jeffrey Norsworthy wrote:

 Hello All,
   I am new to PHP, and I am trying to design what I thought would be 
 a fairly simple form, that queries a MYSQL database for two fields, 
 (first, and last name). It should then return the entire results of 
 the entry in the table. This part is actually 5 fields.
   If I run the script with static entries for first, and last, 
 the process work flawlessly (as it should). If I try using variables 
 for the search values, I do not receive any results. I have tried 
 changing the form method from post, to get, and the problem continues. 
 Any help would be greatly appreciated. Thank you. The first grouping 
 is the html form, the second set is the php form that actually 
 performs the search. Also the username, and password are populated in 
 the actual script, I just took them out for the email. Thanks again.
 
 html
 headtitleContact lookup form/title/head
 body
 form action=test.php method=post
 First Name: input type=text name=firstbr
 Last Name: input type=text name=lastbr
 input type=submit value=lookup
 /form
 /body
 /html
 
 
 
 
 
 
 
 
 
 
 ?php
 define ('mysql_host', 'localhost');
 define ('mysql_user', '');
 define ('mysql_pass', '');
 define ('mysql_db', 'chs');
 
 if (! mysql_connect(mysql_host, mysql_user, mysql_pass) )
 {
 die('Failed to connect to host  ' . mysql_host . '  . ');
 }
 else
 {
 echo '' . mysql_host . 'br';
 }
 
 mysql_select_db(mysql_db);
 if ($http_get_vars['first']  $http_get_vars['last'])
 {
echo $http_get_vars['first'] . ' ' . $http_get_vars['last'] . 'br';
 }
 $result=mysql_query(select * from chs where first='$first' or 
 last='$last');
 echo h2 align='center'Results/h2;
 
 while ($row = mysql_fetch_array($result))
 {
 echo 
 
b{$row['first']}nbsp{$row['last']}nbspnbspnbsp{$row['branch']}nbspnbspnbsp{$row['extension']}nbspnbsp
 nbsp{$row['voice_mail']}nbspnbspnbsp{$row['position']}/b br;
 }
 ?
 
 
 
 Jeffrey Norsworthy MCP, CCNA
 Network Administrator
 Community Health Services
 [EMAIL PROTECTED]
 
  
 



 Mail scanat cu RAV Antivirus!


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




Mail scanat cu RAV Antivirus!

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




Re: [PHP-DB] Column headers

2002-07-02 Thread Casey Allen Shobe

On Tuesday 02 July 2002 10:32 am, Bogdan Stancescu wrote:
 odbc_num_fields() and odbc_field_name() in this case :-)

Thanks, that works!

Now, any advice for sybase?  There's a sybase_num_fields function, but nothing 
to get the columnname that I can see.

Thanks again in advance,

-- 
Casey Allen Shobe / Network Security Analyst  PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
[EMAIL PROTECTED] / http://www.secureworks.net
Content is my own and does not necessarily represent my company.

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




[PHP-DB] Line breaks from a database!

2002-07-02 Thread Ryan Jameson (USA)

Hi guys, maybe I'm missing something silly but when I retrieve a string from my SQL 
server with '\n' in it, they are displayed literally instead of as line breaks. 
StripSlashes only turns them into 'n'.

Any ideas?

 Ryan

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




Re: [PHP-DB] Column headers

2002-07-02 Thread Casey Allen Shobe

Following up.  I found sybase_fetch_field, which fetches field information, 
including the column name, into an object.

So now my question is, what is an object?  And how would I go about getting 
the information I need out of it?

Thanks.

On Tuesday 02 July 2002 11:03 am, Casey Allen Shobe wrote:
 On Tuesday 02 July 2002 10:32 am, Bogdan Stancescu wrote:
  odbc_num_fields() and odbc_field_name() in this case :-)

 Now, any advice for sybase?  There's a sybase_num_fields function, but
 nothing to get the columnname that I can see.

-- 
Casey Allen Shobe / Network Security Analyst  PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
[EMAIL PROTECTED] / http://www.secureworks.net
Content is my own and does not necessarily represent my company.

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




Re: [PHP-DB] Column headers

2002-07-02 Thread Casey Allen Shobe

On Tuesday 02 July 2002 11:09 am, Casey Allen Shobe wrote:
 Following up.  I found sybase_fetch_field, which fetches field information,
 including the column name, into an object.

 So now my question is, what is an object?  And how would I go about getting
 the information I need out of it?

Oh, and what's the difference between [int field_number] and [int 
field_offset] (from odbc_field_name and sybase_fetch_field manual pages)?  
Are they the same, or is the offset one number less than the field number, or 
is it something else entirely?

-- 
Casey Allen Shobe / Network Security Analyst  PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
[EMAIL PROTECTED] / http://www.secureworks.net
Content is my own and does not necessarily represent my company.

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




RE: [PHP-DB] Line breaks from a database!

2002-07-02 Thread Ryan Jameson (USA)

Well, here's what I got, since I put the data into the table directly it had no extra 
slashes so it looked like this '\n' , but when retrieving it i ended up with '\\n'. I 
would have expected stripSlashes to work but that turned them into 'n'. Here's what I 
did as a workaround: 

function strip($string){
  $string = str_replace(\\n,\n, $string);
  return $string;
}

believe it or not, this works when stripSlashes does not. Anyone know why?

 Ryan


Ryan Jameson (USA) [EMAIL PROTECTED] said:

 Hi guys, maybe I'm missing something silly but when I retrieve a string 
from my SQL server with '\n' in it, they are displayed literally instead of 
as line breaks. StripSlashes only turns them into 'n'.
 
 Any ideas?
 
  Ryan
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



-- 




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


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




[PHP-DB] multiple queries in a rov

2002-07-02 Thread Mattia

I would like to make multiple queries in a single mysql_query(...)
statement!! Like in the mysql client given with the distribution, separated
by a ; or a \g !!!
How can I???

Mattia



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




[PHP-DB] Refresh after DB Query

2002-07-02 Thread Hutchins, Richard

OK, loosely related to the database topic on this list.

I have a page that displays the contents of a contact list in an HTML table.
The contents are pulled from a MySQL db with a standard PHP query. Nothing
special happening there. In this table, I put Edit and Delete links to
maintain each line item in the table.

When I click the Delete link (with the unique personID embedded in it), a
query goes out and deletes that entry from the database table. I use
$PHP_SELF?delContact=$personID to trigger the DELETE query on the same page.
However, the page does not completely refresh and the deleted entry still
displays. If I click the Refresh button on the browser (IE 5.5) then the
deleted line disappears.

I know this is less a PHP/DB issue than an HTML issue, but I don't know if
I'm using the $PHP_SELF variable properly or if there's another PHP command
to redraw the page or what?

Aside from the referesh problem, everything else appears to be working fine.

For those of you who need it, the code appears below. 

Any ideas? TIA.

?php
require (templates/db_connect.php);

$sql = SELECT * from contactInfo ORDER BY lastname;

$result = mysql_query($sql);
if (!$result)
{
echo ( pThere has been an error with the
database:  . mysql_error()../p );
exit();
}

echo (
table align='center' width='90%' border='1'
cellpadding='2'
tr
td class='fieldLabel'Actions/td
td class='fieldLabel'Last Name/td
td class='fieldLabel'First Name(s)/td
td class='fieldLabel'e-mail Address/td
td class='fieldLabel'Postal Address/td
td class='fieldLabel'Screen Name/td
/tr
);

while ( $row = mysql_fetch_array($result) ) 
{
$personID = $row[personID];
$lastname = $row[lastname];
$firstnames = $row[firstnames];
$street1 = $row[street1];
$street2 = $row[street2];
$city = $row[city];
$state = $row[state];
$zip = $row[zip];
$emailaddress = $row[emailaddress];
$screenname = $row[screenname];


echo (tr);
echo (td align='center' class='bodySmall'a
href='foo.php'Edit/anbsp;|nbsp;a
href='.$PHP_SELF.?delContact=$personID'Delete/a/td);
echo (td class='bodySmall'.$lastname./td);
echo (td class='bodySmall'.$firstnames.nbsp;/td);
echo (td class='bodySmall'a
href='mailto:.$emailaddress.;'.$emailaddress./anbsp;/td);
echo (td class='bodySmall'.$street1.br);
if ($street2 != )
{
echo ($street2.br);
}
echo ($city.nbsp;.$state.nbsp;.$zip./td);
echo (td class='bodySmall'.$screenname.nbsp;/td);
echo (/tr);
}
echo (/table);
echo (/div);

require( templates/bottom.php );

if (isset($delContact))
{
require ( templates/db_connect.php );
$sql = mysql_query(DELETE FROM contactInfo WHERE
personID='$delContact');

if (!$sql)
{
/*
Should probably open another window to show
this message since it'll be buried at the end of the table otherwise.
*/
echo (There was a problem communicating with the
database. Please try again later.);
}

}
?


Rich Hutchins


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




Re: [PHP-DB] multiple queries in a rov

2002-07-02 Thread Martin Clifford

Load the query into a variable, usually $query.

$query = SELECT * FROM table; SELECT * FROM othertable;;
$result = mysql_query($query, $link_id)
or die(error msg);

 Mattia [EMAIL PROTECTED] 06/27/02 02:19PM 
I would like to make multiple queries in a single mysql_query(...)
statement!! Like in the mysql client given with the distribution, separated
by a ; or a \g !!!
How can I???

Mattia



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



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




Re: [PHP-DB] multiple queries in a row

2002-07-02 Thread Casey Allen Shobe

On Thursday 27 June 2002 02:19 pm, Mattia wrote:
 I would like to make multiple queries in a single mysql_query(...)
 statement!! Like in the mysql client given with the distribution, separated
 by a ; or a \g !!!
 How can I???

You should be able to use it exactly the same.

$foo = mysql_query('
select  something
fromsomewhere;

select  something_else
fromsomewhere_else;
', $link_id);

-- 
Casey Allen Shobe / Network Security Analyst  PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
[EMAIL PROTECTED] / http://www.secureworks.net
Content is my own and does not necessarily represent my company.

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




[PHP-DB] Resolved: [PHP-DB] Column headers

2002-07-02 Thread Casey Allen Shobe

On Tuesday 02 July 2002 11:18 am, Casey Allen Shobe wrote:
 Oh, and what's the difference between [int field_number] and [int
 field_offset] (from odbc_field_name and sybase_fetch_field manual pages)?
 Are they the same, or is the offset one number less than the field number,
 or is it something else entirely?

I've resolved this, thanks everyone!

// Unified query function, including row count
function db_query ($db_type, $db_query) {
// Uncomment to debug
//echo $db_query.'br';
if ($db_type == 'db2') {
global $db2_conn;
$result = odbc_exec ($db2_conn, $db_query);
while (odbc_fetch_into ($result, $row)) {
$data[0][] = $row;
}
$data[1] = odbc_num_rows ($result);
for ($i = 1; $i = odbc_num_fields ($result); $i++) {
$data[2][$i - 1] = odbc_field_name ($result, $i);
}
odbc_free_result ($result);
} else if ($db_type == 'piv') {
global $piv_conn;
$result = sybase_query ('set textsize 32768'.\n.$db_query, 
$piv_conn);
while ($row = sybase_fetch_array ($result)) {
$data[0][] = $row;
}
for ($i = 0; $i  sybase_num_fields ($result); $i++) {
$temp = sybase_fetch_field ($result, $i);
$data[2][$i] = $temp-name;
unset ($temp);
}
$data[1] = sybase_num_rows ($result);
}
return $data;
}

-- 
Casey Allen Shobe / Network Security Analyst  PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
[EMAIL PROTECTED] / http://www.secureworks.net
Content is my own and does not necessarily represent my company.

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




[PHP-DB] date issue with MsSql

2002-07-02 Thread Jeffrey_N_Dyke

I'm posting info into a SQL Server from a form, all has been working fine
inserting, updating and selecting information for months.  I have recently
added a date field to the table with the type of datetime.  It updates the
table in SQL Server fine, but it keeps pulling it back as this date [Feb 07
2036 06:30AM].  for an example i put in a date of 01/01/2001(which is what
is in the Database)  it doesn't matter the date that i'm inputting, it
always brings back the same date.

set up  - solaris 8/Apache/SQLServer 7/PHP4.12

any ideas?
Thanks
Jeff


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




[PHP-DB] PHP . Mysql form problem

2002-07-02 Thread Chris Payne

Hi there Everyone
 
I have a major problem.  I have a new website for a client which works
great, but when the person selects their holiday it goes to my secure
SSL server.  No problem, all pages and images are located on there so
it’s fully secure.
 
The thing is I’m using Javascript validation and sometimes when you
click submit to go to the next page in the form sequence I get a “Server
not found” but if I go back and click submit again it WORKS !!!
Does anybody know what this could be?
 
The PHP and form elements all work fine, but I’m very concerned the
Jscript could be sending the data maybe out of sync so the server is
missing the request?  I’m confused, please help :-(
 
Chris

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002
 



[PHP-DB] PDF/FDF Support

2002-07-02 Thread Jefferson Cowart

I'm trying to write a PDF form that people can fill in. I want to then
take the data, store it in my database, and then recall the data, and
display a filled in form with that data. I see two options. The first is
to have acrobat post the entire PDF file and store the entire file. This
option seems to be to be a little bit of a waste as much of the data is
the same (the form). The second option is to have it post FDF data and
then later turn that around and put it back into a form for people to
view. Does anyone know of any good documentation on how to do this with
PDF files, PHP, and a DB backend?


Thanks
Jefferson Cowart
[EMAIL PROTECTED] 

Support Open Instant Messaging Protocols
http://www.petitiononline.com/openIM/petition.html


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




[PHP-DB] Binding host variable to Oracle Object type (Nested Table)

2002-07-02 Thread Prince

Hi!

I have an oracle object type as follows,

create or replace type my_objtype as object (col1 number, col2 number)
/

create or replace type my_arrtype as table of my_objtype
/

I couldn't get this bound in php.

If I have an simple oracle object type (see the below one), I could bind it
and pass the object to oracle procedure.

create or replace type my_arrtype as table of number;


How do I bind if my object is a NESTED TABLE OF OBJECTS (my_arrtype).?


code snippet:
===
?
$arr = OCINewCollection($conn,'MY_ARRTYPE');
//populate the $arr. Note: I tried various ways here.
$arr-append(array(10,100));
$arr-append(array(20,200));

$stmt = OCIParse($conn,begin my_p(:my_arrBindVar); end; ) ;

arr-append(array(10,100));

 $ok = OCIBindByName($stmt,':my_arrBindVar',$arr,32,OCI_B_SQLT_NTY);
//$ok = OCIBindByName($stmt,':my_arrBindVar',$arr,32,OCI_B_SQLT_NTY);
OciExecute($stmt,OCI_DEFAULT);
?

I get the following error:
Call to a member function on a non-object in ...

Thanks.



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




Re: [PHP-DB] multiple queries in a row

2002-07-02 Thread Jason Wong

On Wednesday 03 July 2002 04:36, Casey Allen Shobe wrote:
 On Thursday 27 June 2002 02:19 pm, Mattia wrote:
  I would like to make multiple queries in a single mysql_query(...)
  statement!! Like in the mysql client given with the distribution,
  separated by a ; or a \g !!!
  How can I???

 You should be able to use it exactly the same.

 $foo = mysql_query('
 selectsomething
 from  somewhere;

 selectsomething_else
 from  somewhere_else;
 ', $link_id);

IIRC php only allows you to pass a single query at a time to mysql.

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


/*
Every program is a part of some other program, and rarely fits.
*/


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




[PHP-DB] Strange MySQL Query Problem

2002-07-02 Thread eat pasta type fasta

I have a simple form which queries the database based on 2 pop-up menu 
choices and keywords entered by the user,
it passes on the variables as follows:

pop-up1=choice1, pop-up2=choice2, textfield=user specified data

the query is as follows

$result = mysql_query(SELECT some_id, some_description, some_feature 
FROM '$pop-up1' WHERE some_description LIKE '%$texfield%' AND 
some_feature LIKE '%$pop-up2');

it tells me that column which equals to the $texfield does not exists,

a bit buffled I am, I've these queries before on larger web servers, this 
is the first time on my workstation and it does just that, simpler 
queries work fine...

thanks in advance,

R

ps. the form is guarded against empty entries
ps2. RedHat 7.3, Mysql 3.23.51, Apache 1.3+ wik PHP 4.2.1 configured for 
MySQL

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




Re: [PHP-DB] Strange MySQL Query Problem

2002-07-02 Thread Jason Wong

On Wednesday 03 July 2002 12:42, eat pasta type fasta wrote:
 I have a simple form which queries the database based on 2 pop-up menu
 choices and keywords entered by the user,
 it passes on the variables as follows:

 pop-up1=choice1, pop-up2=choice2, textfield=user specified data

 the query is as follows

 $result = mysql_query(SELECT some_id, some_description, some_feature
 FROM '$pop-up1' WHERE some_description LIKE '%$texfield%' AND
 some_feature LIKE '%$pop-up2');

 it tells me that column which equals to the $texfield does not exists,

 a bit buffled I am, I've these queries before on larger web servers, this
 is the first time on my workstation and it does just that, simpler
 queries work fine...

Print out $result

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


/*
Support your local police force -- steal!!
*/


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




[PHP-DB] DATE vs INT

2002-07-02 Thread Russ

Hi all:

Our company uses for reasons of experience, an INT(10) field for storing
dates in a MySQL DB. ((We just DO OK! ;-))
However I it is because the date isn't stored as a DATE or DATETIME
(etc) that I can't do an accurate ORDER BY name_of_date_field - as
MySQL doesn't recognise the field's content as a valid date simply an
integer (that we modify for display using PHP)

Does anyone know of a way (kludge or otherwise) I may be able to perform
such an ORDER BY, so that the dates in an HTML display table column are
ordered AS dates while using an INT field format??

Cheers folks.
Russ


Mr Russ Michell
Web Applications Developer

Itomic.com 
Email: [EMAIL PROTECTED] 
Tel: +61 (0)8 9321 3844 
Fax: +61 (0)8 6210 1364 
Post: PO Box 228, Innaloo, WA 6918, Australia 
Street: Suite 24, 158 William St, Perth, WA 6000, Australia

No proof of existence is not proof of non-existence.
(Physicist: Stanton T. Friedman on Debunking Ufology)


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




Re: [PHP-DB] DATE vs INT

2002-07-02 Thread Jason Wong

On Wednesday 03 July 2002 12:55, Russ wrote:
 Hi all:

 Our company uses for reasons of experience, an INT(10) field for storing
 dates in a MySQL DB. ((We just DO OK! ;-))

I'm curious to know if there are any other reasons why your company doesn't 
store dates as dates. In absence of any other reasons, For reasons of 
experience, seems to me to be saying we're too lazy to change legacy code, 
we'd rather kludge something here and kludge something there and hope it all 
hangs together. :) Very similar to the way Windows is built -- and we all 
know how stable that is.

 However I it is because the date isn't stored as a DATE or DATETIME
 (etc) that I can't do an accurate ORDER BY name_of_date_field - as
 MySQL doesn't recognise the field's content as a valid date simply an
 integer (that we modify for display using PHP)

 Does anyone know of a way (kludge or otherwise) I may be able to perform
 such an ORDER BY, so that the dates in an HTML display table column are
 ordered AS dates while using an INT field format??

What format are your dates? If they are of the form 'MMDD' then ORDER BY 
should work.

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


/*
Marxist Law of Distribution of Wealth:
Shortages will be divided equally among the peasants.
*/


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