[PHP-DB] OpenbaseSQL with PHP

2001-01-24 Thread Ninjaman



Lots of questions for whoever has any experience.

I was wondering if anyone is running OpenBaseSQL with PHP?
Any support for Openbase in PHP on the cards?
Has anyone managed to setup Openbase with any of the generic ODBC
configurations?

I am no UNIX wiz but I am starting to get along with them OK.

/Martin


-- 
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] LDAP

2001-01-24 Thread Tom

Hello all,

I've got a problem with PHP and LDAP.
Every times, i want to connect to the serveur: I've got an error. It's
"call to undefined funcion ldap_connect" !
I have tried the php manual example but the error is the same...

I think i've forget to put something like ./configure --ldap chen i
havec compiled PHP4, no?

(I have installed Apache+PgSQL+PHP4 before LDAP...)

Thanks,
Thomas
[= http://www.56k.fr.st :=]

PS: I'm  french, excuse me for my horrible english ;-)



-- 
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] File retrieval from DB

2001-01-24 Thread nuitari

Beau Lebens wrote:
 
 Greetings all,
 
 I am having great difficulties with an online app that I am developing.
 
 To avoid issues with file permissions etc, I am saving files into a MySQL
 database (soon to be PostgreSQL), which works marvellously. Along with the
 contents of the file, I save the name, mime-type and size.
 
 When it comes time to get the files back out, I have a script that gets hit
 using a URL something like "download.php?file=17" and looks like this;
 
 --- start script 
 ?php
 include("conf/preferences.php");
 include("lib/generic.php");
 header("Expires: 0");
 header("Cache-Control: no-cache");
 
 // Get the file from the database into a standard result set
 $getSQL = "SELECT * FROM Files WHERE id='$file'";
 $fileResult = db_query($getSQL);
 $theFile = db_fetch_array($fileResult);
 
 // If the file is intended as a download, then tell the browser to download it
 // rather than display it.
 if ($download == "yes")
  header("Content-Disposition: attachment; filename=\"" .
 $theFile["name"] . "\"");
 
 // Send a header telling the browser what type of file is coming and some
 details
 header("Content-Type: " . $theFile["type"]);
 header("Content-Description: PCS Database Saved File");
 header("Content-Length: " . $theFile["size"] . "");
 
 // Then pipe the file contents to the browser.
 echo $theFile["contents"];
 
 ?
 -- end script ---
 
 Now this all works perfectly well on a normal (insecure) server, the file
 gets downloaded, the mime-type is correct, the filename presents itself for
 download and everything in sweet.
 
 The problem is that the system I am developing is actually running on a
 secure server, and this does NOT work in that environment. I am testing on
 Internet Explorer 5 and it throws an error after you tell it you want to
 download the file, saying this;
 
  error message 
 Internet Explorer cannot download ...load.php?file=17download=yes from
 www.yourserver.com.
 
 Internet Explorer was not abl to open this Internet site. The requested
 site is either unavailable or cannot be found.
 Please try again later.
  end message 
 
 Not very helpful at all.
 
 SO now I am at a standstill, I am completely stuck, and no one else I know
 has come up with anything that can solve the problem yet - any assistance
 would be fantastic - thanks all.
 
 Beau


I know that IE is very peculiar about the order of headers that it
receives, 
so you may want to check that.

Maybe test it and get it working with NetScape first, than mess around
with the
order of the headers and it may start working with IE.

-- 
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] This query makes never gets done... and it keeps a thread open in the processlist for a long time!!! Very annoying!

2001-01-24 Thread Trond Erling Hundal

This query can sometimes draw back the whole database causing some, or all,
data that is extracted from the database to not show.

Can u experts scan through this for me?

I really need some help!
SQL-
--
SELECT DISTINCT $this-artikkeltbl.artikkelid as artikkelid,
$this-artikkeltbl.tittel as tittel,
$this-artikkeltbl.hovedingress as hovedingress,
$this-artikkeltbl.dato as dato
# Selects different parts of newsarticles: id field, date, title, toptext
and main text

FROM $this-artikkeltbl, $this-relasjonstbl
# from two different tables the article table and the relation table

WHERE $this-artikkeltbl.tittel LIKE '%$sqlx%'
OR $this-artikkeltbl.ingress LIKE '%$sqlx%'
OR $this-artikkeltbl.hovedingress LIKE '%$sqlx%'
OR $this-artikkeltbl.brodtekst LIKE '%$sqlx%'
# var $sqlx is the search string varying from page to page.

AND $this-artikkeltbl.artikkelid = $this-relasjonstbl.artikkelid
# Relation to the relation table

AND $this-relasjonstbl.portalid = $portalid
# Only selects articles within a spesific category.

ORDER by artikler.dato DESC LIMIT $x2,$x1
# u know...
SQL-
--

I have divided the website into different portions, and assigned them with
unique id`s ($portalid).
I am trying to search through articles that are only assosciated with that
spescific portalid.

What am I doing wrong?

This is meant to be a simple search utility on the page.


-- 
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] OCI-24324 in apache error log

2001-01-24 Thread Matthias Kopolt

For some strange reason I get an :
Warning: failed to rollback outstanding transactions!: ORA-24324 : Service handle not 
initialised in ... on line 0

I'm running 4.0.3pl1 as server module with OCI8-support for apache 1.3.14 and had no 
problems with the same script under php3.

After some error() calls and debugging I found it.
If you got this error too check your script for double calls of ocilogogg. For some 
reason the second ocilogoff call is executed after the scripts output to the webserver 
has finished. Therefor the error message is placed only in the apache logfile and not 
on the page.

cu





RE: [PHP-DB] LDAP

2001-01-24 Thread Chris Andrew

Hi Thomas,

You are correct. You need to install ldap (openldap) prior to your PHP
install. Don't forget to install the ldap development files if you're
installing from rpm's. Then, when you configure your PHP:
/configure --with-ldap=your ldap install directory, probably /usr plus
other options ...

Chris

 -Original Message-
 From: Tom [mailto:[EMAIL PROTECTED]]
 Sent: 24 January 2001 11:56
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] LDAP


 Hello all,

 I've got a problem with PHP and LDAP.
 Every times, i want to connect to the serveur: I've got an error. It's
 "call to undefined funcion ldap_connect" !
 I have tried the php manual example but the error is the same...

 I think i've forget to put something like ./configure --ldap chen i
 havec compiled PHP4, no?

 (I have installed Apache+PgSQL+PHP4 before LDAP...)

 Thanks,
 Thomas
 [= http://www.56k.fr.st :=]

 PS: I'm  french, excuse me for my horrible english ;-)



 --
 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] Viewing the DB

2001-01-24 Thread Scott Fletcher

Does anyone know what is the sql command that would allow me to view all of
the tables in the database?

Scott



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




AW: [PHP-DB] Viewing the DB

2001-01-24 Thread Michael Rudel

Hi Scott,

Try:

SELECT * FROM TAB

... it works with Oracle and Access, don't know what
with other SQL-Servers.

Greetinx,
  Mike
(Germany)

-Ursprngliche Nachricht-
Von: Scott Fletcher [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 24. Januar 2001 16:40
An: [EMAIL PROTECTED]
Betreff: [PHP-DB] Viewing the DB


Does anyone know what is the sql command that would allow me to view all of
the tables in the database?

Scott



-- 
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] Viewing the DB

2001-01-24 Thread Alarion

This was taken from one of the doc's on IBM's site:

SYSTABLES contains a row for every table and view in the SQL collection. It 
tells you if the object is a table or view, the object name, the owner of 
the object, what SQL collection it is in, and so forth.
The following sample statement displays information for the 
CORPDATA.DEPARTMENT table:
  SELECT *
FROM CORPDATA.SYSTABLES
WHERE NAME = 'DEPARTMENT'

so a "select * from schema.systables" should get you a list of all table 
names (theoretically) ;P

Sean

-Original Message-
From:   Scott Fletcher [SMTP:[EMAIL PROTECTED]]
Sent:   Wednesday, January 24, 2001 3:48 PM
To: [EMAIL PROTECTED]
Subject:Re: [PHP-DB] Viewing the DB

I'm using IBM DB2.  No Oracle, No mySQL.

Scott
""Scott Fletcher"" [EMAIL PROTECTED] wrote in message
94mt56$skf$[EMAIL PROTECTED]">news:94mt56$skf$[EMAIL PROTECTED]...
 Does anyone know what is the sql command that would allow me to view all
of
 the tables in the database?

 Scott



 --
 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] Viewing the DB

2001-01-24 Thread Peter J. Krawetzky

SELECT * FROM SYSIBM.SYSTABLES OR SELECT * FROM SYSCAT.TABLES.

The first select statement will also show views.
-Original Message-
From: Alarion [EMAIL PROTECTED]
To: 'Scott Fletcher' [EMAIL PROTECTED]; [EMAIL PROTECTED]
[EMAIL PROTECTED]
Date: Wednesday, January 24, 2001 11:23 AM
Subject: RE: [PHP-DB] Viewing the DB


This was taken from one of the doc's on IBM's site:

SYSTABLES contains a row for every table and view in the SQL collection. It
tells you if the object is a table or view, the object name, the owner of
the object, what SQL collection it is in, and so forth.
The following sample statement displays information for the
CORPDATA.DEPARTMENT table:
  SELECT *
FROM CORPDATA.SYSTABLES
WHERE NAME = 'DEPARTMENT'

so a "select * from schema.systables" should get you a list of all table
names (theoretically) ;P

Sean

-Original Message-
From: Scott Fletcher [SMTP:[EMAIL PROTECTED]]
Sent: Wednesday, January 24, 2001 3:48 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Viewing the DB

I'm using IBM DB2.  No Oracle, No mySQL.

Scott
""Scott Fletcher"" [EMAIL PROTECTED] wrote in message
94mt56$skf$[EMAIL PROTECTED]">news:94mt56$skf$[EMAIL PROTECTED]...
 Does anyone know what is the sql command that would allow me to view all
of
 the tables in the database?

 Scott



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




-- 
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] Problem with mssql, stored procedures and temp tables

2001-01-24 Thread Sanders, Nicholas

Hi there,

I have a slight problem with a stored procedure in mssql to does 2 selects
into temporary tables and then does another select  joining them with
another table from the database to return the data.

when this is run in query analyzer it returns the following 


(86 row(s) affected)


(86 row(s) affected)


then the data...


I have run this in asp and it returns the data but in php it seems to see
the '(86 row(s) affected)' and returns nothing.

Anyone any ideas

Thanks

Nick

-- 
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] MS-SQL Error Message Replacement

2001-01-24 Thread ryan . sinn

I'm working with MS-SQL 7 and IIS 4 as well as PHP4.0.4 ---

My question is that when a message is received while attempting to delete a
row in [table x] while it is tied to [table y.column a] by a foreign key
relationship [see below]

Warning: MS SQL message: DELETE statement conflicted with COLUMN REFERENCE
  constraint 'FK_COMPONENT_INDEX_page'. The conflict occurred in database
   'corplan', table 'COMPONENT_INDEX', column 'pid'. (severity 16) in D:
  \Inetpub\wwwroot\admin\intranet.php on line 122

 Warning: MS SQL: Query failed in D:\Inetpub\wwwroot\admin\intranet.php on
 line 122



How can I put in my own custom message when these errors occur?  Should I
be looking for a failed query message and then acting on that?  I like the
protection that the foreign key relationship enables, because you can't
delete "parent" objects without removing the children first.

I'm sure this really isn't a difficult question, I'm looking for for
suggestions on how I should approach this.


Thanks,


Ryan Sinn
US Bank




-- 
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] MS-SQL Error Message Replacement

2001-01-24 Thread Alarion

well, one way would be to place a check before the delete statement. check 
to see if there are any child records and then only send the delete 
statement if it is ok to delete :)


-Sean

-Original Message-
From:   [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
Sent:   Wednesday, January 24, 2001 7:22 PM
To: [EMAIL PROTECTED]
Subject:[PHP-DB] MS-SQL Error Message Replacement

I'm working with MS-SQL 7 and IIS 4 as well as PHP4.0.4 ---

My question is that when a message is received while attempting to delete a
row in [table x] while it is tied to [table y.column a] by a foreign key
relationship [see below]

Warning: MS SQL message: DELETE statement conflicted with COLUMN REFERENCE
  constraint 'FK_COMPONENT_INDEX_page'. The conflict occurred in database
   'corplan', table 'COMPONENT_INDEX', column 'pid'. (severity 16) in D:
  \Inetpub\wwwroot\admin\intranet.php on line 122

 Warning: MS SQL: Query failed in D:\Inetpub\wwwroot\admin\intranet.php on
 line 122



How can I put in my own custom message when these errors occur?  Should I
be looking for a failed query message and then acting on that?  I like the
protection that the foreign key relationship enables, because you can't
delete "parent" objects without removing the children first.

I'm sure this really isn't a difficult question, I'm looking for for
suggestions on how I should approach this.


Thanks,


Ryan Sinn
US Bank




--
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] MS-SQL Error Message Replacement

2001-01-24 Thread Andreas Karajannis

[EMAIL PROTECTED] wrote:


How can I put in my own custom message when these errors occur?
  Should I  be looking for a failed query message and then acting on
  that?  I like the  protection that the foreign key relationship
  enables, because you can't  delete "parent" objects without
  removing the children first.
Prepend "@" to the php function call to supress error messages. If your 
statement fails, you could get the error number  via some other mssql 
call and decide what to do.

  -Andreas

-- 
Andreas Karajannis
mediaworx berlin  AG

Fon (0 30) 2 75 80 - 266
Fax (0 30) 2 75 80 - 200


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




AW: [PHP-DB] MS-SQL Error Message Replacement

2001-01-24 Thread Matthias Kopolt

So you like to let the SQL check for those constraints and you want only the
PHP to deal with that ugly error:

 - disable the error output by placing @ before your php-function

 - catch the error either by checking $php_errormsg (works only if
error-tracking is enabled) or by the result code or mssql_get_last_message

  - find your keyword and print an adapted message


 I'm working with MS-SQL 7 and IIS 4 as well as PHP4.0.4 ---

 My question is that when a message is received while
 attempting to delete a
 row in [table x] while it is tied to [table y.column a] by a
 foreign key
 relationship [see below]

 Warning: MS SQL message: DELETE statement conflicted with
 COLUMN REFERENCE
   constraint 'FK_COMPONENT_INDEX_page'. The conflict occurred
 in database
'corplan', table 'COMPONENT_INDEX', column 'pid'.
 (severity 16) in D:
   \Inetpub\wwwroot\admin\intranet.php on line 122

  Warning: MS SQL: Query failed in
 D:\Inetpub\wwwroot\admin\intranet.php on
  line 122



 How can I put in my own custom message when these errors
 occur?  Should I
 be looking for a failed query message and then acting on
 that?  I like the
 protection that the foreign key relationship enables, because
 you can't
 delete "parent" objects without removing the children first.

 I'm sure this really isn't a difficult question, I'm looking for for
 suggestions on how I should approach this.


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




AW: [PHP-DB] PHP PopUp Window

2001-01-24 Thread Matthias Kopolt

This is not exactly a DB-Problem but:

   What I'm trying to do is after a user submits a form,
 PHP validates the
 form and if an error open a JavaScript popup window.
 I'm having trouble-getting PHP to either run the JavaScript
 or send the
 information to the browser so it can execute the JavaScript.

Remember that PHP can't execute Javascripts !! it can only produce
javascripts like
$error = "No Name entered";
echo "scriptalert ('Your error is : $error !! ');/script";

 Also on another note is it possible to hide the search
 portion of a URL that
 is sent using:
 ? header("Location: /index.php?hideme=yes"); ?

 I don't like the user seeing the sometimes-long URL that is
 sent using this
 manner.

If you'd needn't the Redirect you could simply POST your formdata instead of
GET. Since you stick on that Location:... try using a frameset around ;-)


-- 
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] Newbie - 2 tables one insert

2001-01-24 Thread JJeffman

Are you trying to get the auto_increment "id" used in the last Insert ? If
so, try this function:
// int mysql_insert_id(int [link_identifier] );
$last_id = mysql_insert_id($result);
$sql2 = "INSERT INTO pages page_id values($last_id );
$result2 = mysql_query($sql2);

HTH

Jayme.

http://www.conex.com.br/jjeffman



-Mensagem Original-
De: Rubanowicz, Lisa [EMAIL PROTECTED]
Para: Rubanowicz, Lisa [EMAIL PROTECTED]; [EMAIL PROTECTED]
Enviada em: tera-feira, 23 de janeiro de 2001 11:54
Assunto: RE: [PHP-DB] Newbie - 2 tables one insert


 I realised I just sent my password out needless to say I am just about to
 change it.
 All the Best
 Lisa

 -Original Message-
 From: Rubanowicz, Lisa [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 23, 2001 1:54 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Newbie - 2 tables one insert


 Hi all,
 Could you please help me out on this one.
 I want to create a web site using two tables.
 1. page_creation - Stores page_id and page_name to be shown on all
 navigation bars.
 2. pages - Contains pg_id, page_id, etc etc.
 I want to do an insert into page_creation to create a new page and then
pass
 the page_id to pages, so I know the info stored in "pages" relates to a
 certain page (one to many relationship).  In the code below I want this to
 be an "Add a New web Page" where the user types in a Page Name shown in
the
 nav bar and it enters data as above.
 I have been trying for three days now with different methods and it is
 driving me mad.
 Thank you in advance for your assistance


 ?
 if ($page_name) {

 $host="db9.pair.com";
 $user="c3po";
 $password="13Balreask";
 $dbasename="c3po_test";

 mysql_pconnect("$host","$user","$password")
 or die("Unable to connect to SQL server");
 mysql_select_db("$dbasename") or die("Unable to select database");

 $sql1 = "INSERT INTO page_creation pagename";
 $sql1 = "values('$page_name')";
 $result = mysql_query($sql1);
 $sql2 = "INSERT INTO pages page_id values('$result');
 $result2 = mysql_query($sql2);
 }
 else {
 ?
 HTML
 HEAD
 /HEAD
 BODY BGCOLOR="#FF"
 FORM ACTION="test_2_tables.php" METHOD="POST"
 INPUT TYPE=TEXT name="page_name" VALUE="?echo $page_name ?" SIZE=20
 INPUT TYPE=SUBMIT VALUE="Add a New Page"
 /FORM
 /BODY
 /HTML
 ? }
 ?




 Lisa Rubanowicz
 Case ITC,
 Navan, Ireland
 Tel: #353 (0)46 77663

 [EMAIL PROTECTED] mailto:[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] substring equiv in PHP

2001-01-24 Thread Lucas Rockwell

Hello,

I am wondering what PHP's equilivent of the SQL substring function is.

I poked around on the PHP site, but i did not come up with anything. The
UNIX equiv would be awk for those who do not know substring.

I really appreciate it.

-lucas



-- 
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] failure notice

2001-01-24 Thread Mike

Hi. This is the qmail-send program at toye.php.net.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

[EMAIL PROTECTED]:
ezmlm-manage: fatal: message already has a Mailing-List header (maybe I should be a 
sublist) (#5.7.2)

--- Below this line is a copy of the message.

Return-Path: [EMAIL PROTECTED]
Received: (qmail 27556 invoked from network); 24 Jan 2001 17:35:01 -
Received: from unknown (HELO snipe.prod.itd.earthlink.net) (207.217.120.62)
  by va.php.net with SMTP; 24 Jan 2001 17:35:01 -
Received: from michaelbowman (sdn-ar-011orportP206.dialsprint.net [63.180.14.118])
by snipe.prod.itd.earthlink.net (EL-8_9_3_3/8.9.3) with SMTP id JAA19084
for [EMAIL PROTECTED]; Wed, 24 Jan 2001 09:37:28 -0800 (PST)
From: "Mike" [EMAIL PROTECTED]
Received: from toye.php.net ([198.186.203.33]) by vespasian.mspring.net (Mindspring 
Mail Service) with SMTP id t1lb6s.ebe.37kbpqe for [EMAIL PROTECTED]; Tue, 21 
Nov 2000 12:11:56 -0500 (EST)
To: [EMAIL PROTECTED]
Received: (qmail 20675 invoked by uid 1013); 21 Nov 2000 17:10:09 -
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: mailto:[EMAIL PROTECTED]
List-Unsubscribe: mailto:[EMAIL PROTECTED]
list-post: mailto:[EMAIL PROTECTED]
Delivered-To: mailing list [EMAIL PROTECTED]
Received: (qmail 20664 invoked from network); 21 Nov 2000 17:10:08 -
X-Priority: 3
X-MSMail-Priority: Normal
Priority: Normal
MIME-Version: 1.0
Content-Type: text/plain;
charset="ISO-8859-1"
X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Content-Transfer-Encoding: quoted-printable
X-Mailer: Microsoft Outlook Express 5.50.4522.1200
Date: Wed, 24 Jan 2001 09:39:06 -0800
Subject: Re: [PHP-DB] Get all the enum values from a Mysql column?
Message-ID: [EMAIL PROTECTED]

Addressed to: John Guynn [EMAIL PROTECTED]
  [EMAIL PROTECTED]

** Reply to note from John Guynn [EMAIL PROTECTED] Tue, 21 Nov 2000=
 10:32:43 -0600
   
 Is there an easy way to get all the enum values from a column?
   
 For example I have an enum column with the values
 "Astro","Camaro","Firehawk","Neon" and I would like to pull those values
 out to put in as options in a html form with select.
   
 I've read the mysql maunal about pulling all the values from and enum
 column, "If you want to get all possible values for an ENUM column, you
 should use: SHOW COLUMNS FROM table_name LIKE enum_column_name and parse
 the ENUM definition in the second column." For some reason I can't make
 heads or tails of this.


Do you have access to command line MySQL?  If so, the first thing to do is
fire it up and try a query or two till you get something that works.

For example, I have a table  Types,  that includes an enum field  Free.  I
would get the possible values for Free like this:


   SHOW COLUMNS FROM Types LIKE 'Free';


This returns:

+---+--+--+-+-+---+
| Field | Type | Null | Key | Default | Extra |
+---+--+--+-+-+---+
| Free  | enum('No','Yes') | Yes  | | Null|   |
+---+--+--+-+-+---+


As you can see, the second column contains the vaules, and some extra
stuff.  The trick is to parse the values out of the junk...


Once you get a query that returns the desired results in the MySQL
interpreter, you can convert it to PHP.



$Result =3D mysql_query( "SHOW COLUMNS FROM Types LIKE 'Free'" );

while( list( $Field, $Type, $Null, $Key, $Default, $Extra ) 
 =3D mysql_fetch_row( $Result )) {

   list( $junk, $Type ) =3D explode( '(', $Type ); 
   #  Type is now  'No','Yes')

   list( $Type ) =3D explode( ')', $Type );
   #  Type is now  'No','Yes'

   $Type =3D str_replace( "'", '', $Type );
   #  Type is now  No,Yes

   $Types =3D explode( ',', $Type );
   #  Types is now an array containing the values allowed for the enum.
   #  $Types[0] =3D No   $Types[1] =3D 'Yes'
   }


mysql_free_result( $Result );


This may not be the the easiest or best way to parse the data, but it
should work.  I have not actually tried it...
   
Using a while may seem unusual when I already know there should only be one
row returned, but I use it because it will not throw an error message or
warning if no rows are returned.  




Rick Widmer
Internet Marketing Specialists
www.developersdesk.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]




[PHP-DB] failure notice

2001-01-24 Thread Mike

Hi. This is the qmail-send program at toye.php.net.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

[EMAIL PROTECTED]:
ezmlm-manage: fatal: message already has a Mailing-List header (maybe I should be a 
sublist) (#5.7.2)

--- Below this line is a copy of the message.

Return-Path: [EMAIL PROTECTED]
Received: (qmail 27585 invoked from network); 24 Jan 2001 17:35:09 -
Received: from unknown (HELO snipe.prod.itd.earthlink.net) (207.217.120.62)
  by va.php.net with SMTP; 24 Jan 2001 17:35:09 -
Received: from michaelbowman (sdn-ar-011orportP206.dialsprint.net [63.180.14.118])
by snipe.prod.itd.earthlink.net (EL-8_9_3_3/8.9.3) with SMTP id JAA19495
for [EMAIL PROTECTED]; Wed, 24 Jan 2001 09:37:35 -0800 (PST)
From: "Mike" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Received: from toye.php.net ([198.186.203.51]) by antoninus (Mindspring Mail Service) 
with SMTP id t6qfg3.7hl.37kbpq6 for [EMAIL PROTECTED]; Tue, 23 Jan 2001 
03:17:06 -0500 (EST)
Received: (qmail 19191 invoked by uid 1013); 23 Jan 2001 08:14:43 -
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
list-help: mailto:[EMAIL PROTECTED]
list-post: mailto:[EMAIL PROTECTED]
Content-Transfer-Encoding: quoted-printable
List-Subscribe: mailto:[EMAIL PROTECTED]
Date: Wed, 24 Jan 2001 09:39:09 -0800
X-Mailer: Microsoft Outlook Express 5.50.4522.1200
Message-ID: [EMAIL PROTECTED]
X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Delivered-To: responder for [EMAIL PROTECTED]
Received: (qmail 19185 invoked from network); 23 Jan 2001 08:14:43 -
Received: from unknown (HELO mxrelay1.ptc.com) (12.11.148.30)  by va.php.net with 
SMTP; 23 Jan 2001 08:14:43 -
Received: from india.ptc.com (cvimail.india.ptc.com [130.21.47.97]) by 
mxrelay1.ptc.com (8.9.0/8.9.0) with ESMTP id DAA12943 for 
[EMAIL PROTECTED]; Tue, 
23 Jan 2001 03:17:04 -0500 (EST)
Received: from mboxsrvr.india.ptc.com (mboxsrvr.india.ptc.com [130.21.47.167]) by 
india.ptc.com (8.9.2/8.9.2) with ESMTP id NAA00611 for 
[EMAIL PROTECTED]; Tue, 
23 Jan 2001 13:46:38 +0530 (IST)
Received: from india.ptc.com ([130.21.47.136]) by mboxsrvr.india.ptc.com  
(Netscape Messaging Server 3.6)  with ESMTP id AAA444D  for 
[EMAIL PROTECTED];   
   Tue, 23 Jan 2001 13:46:37 +0530
MIME-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Subject: confirm subscribe to [EMAIL PROTECTED]

Hi! This is the ezmlm program. I'm managing the
[EMAIL PROTECTED] mailing list.

I'm working for my owner, who can be reached
at [EMAIL PROTECTED]

Oops, that confirmation number appears to be invalid.

The most common reason for invalid numbers is expiration. I have to
receive confirmation of each request within ten days. Also, make sure
the entire confirmation number was in the reply you sent me. Some=20
e-mail programs have a habit of cutting off some of the reply address,
which can be quite long.

I've set up a new confirmation number. To confirm that you would like

   [EMAIL PROTECTED]

added to the php-db mailing list, please send
an empty reply to this address:

   =
[EMAIL PROTECTED]=
hp.net

or click here:
=
mailto:php-db-sc.980237683.pajmafijjeeipjeobmdd-Mike=3Dvalves-source.com@=
lists.php.net

Again, check the reply address carefully to make sure it is all included =

before you confirm your subscription.

Sorry for the trouble.

php-db-Owner [EMAIL PROTECTED]


--- Administrative commands for the php-db list ---

I can handle administrative requests automatically. Please
do not send them to the list address! Instead, send
your message to the correct command address:

To subscribe to the list, send a message to:
   [EMAIL PROTECTED]

To remove your address from the list, send a message to:
   [EMAIL PROTECTED]

Send mail to the following for info and FAQ for this list:
   [EMAIL PROTECTED]
   [EMAIL PROTECTED]

Similar addresses exist for the digest list:
   [EMAIL PROTECTED]
   [EMAIL PROTECTED]

To get messages 123 through 145 (a maximum of 100 per request), mail:
   [EMAIL PROTECTED]

To get an index with subject and author for messages 123-456 , mail:
   [EMAIL PROTECTED]

They are always returned as sets of 100, max 2000 per request,
so you'll actually get 100-499.

To receive all messages with the same subject as message 12345,
send an empty message to:
   [EMAIL PROTECTED]

The messages do not really need to be empty, but I will ignore
their content. Only the ADDRESS you send to is important.

You can start a subscription for an alternate address,
for example "[EMAIL PROTECTED]", just add a hyphen and your
address (with '=3D' instead of '@') after the command word:
[EMAIL PROTECTED]

To stop subscription for this address, mail:
[EMAIL PROTECTED]

In both cases, I'll send a confirmation message to that address. When
you receive it, simply reply to it to complete your subscription.

If despite following these instructions, you do not get 

[PHP-DB] failure notice

2001-01-24 Thread Mike

Hi. This is the qmail-send program at toye.php.net.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

[EMAIL PROTECTED]:
ezmlm-manage: fatal: message already has a Mailing-List header (maybe I should be a 
sublist) (#5.7.2)

[EMAIL PROTECTED]:
confirm unsubscribe from [EMAIL PROTECTED]: fatal: message already has a 
Mailing-List header (maybe I should be a sublist) (#5.7.2)

--- Below this line is a copy of the message.

Return-Path: [EMAIL PROTECTED]
Received: (qmail 19378 invoked from network); 24 Jan 2001 22:54:50 -
Received: from unknown (HELO scaup.prod.itd.earthlink.net) (207.217.121.49)
  by va.php.net with SMTP; 24 Jan 2001 22:54:50 -
Received: from michaelbowman (sdn-ar-012orportP142.dialsprint.net [63.180.14.206])
by scaup.prod.itd.earthlink.net (EL-8_9_3_3/8.9.3) with SMTP id OAA16057;
Wed, 24 Jan 2001 14:57:17 -0800 (PST)
From: "Mike" [EMAIL PROTECTED]
Received: from toye.php.net ([198.186.203.51]) by antoninus (Mindspring Mail Service) 
with SMTP id t6u4mt.hnb.37kbpq6 for [EMAIL PROTECTED]; Wed, 24 Jan 2001 
12:37:33 -0500 (EST)
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Received: (qmail 27578 invoked by uid 1013); 24 Jan 2001 17:35:05 -
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
List-Help: mailto:[EMAIL PROTECTED]
List-Post: mailto:[EMAIL PROTECTED]
List-Subscribe: mailto:[EMAIL PROTECTED]
Date: Wed, 24 Jan 2001 14:58:11 -0800
Message-ID: [EMAIL PROTECTED]
Content-Transfer-Encoding: quoted-printable
Delivered-To: responder for [EMAIL PROTECTED]
Received: (qmail 27572 invoked from network); 24 Jan 2001 17:35:04 -
Received: from unknown (HELO snipe.prod.itd.earthlink.net) (207.217.120.62)  by 
va.php.net with SMTP; 24 Jan 2001 17:35:04 -
Received: from michaelbowman (sdn-ar-011orportP206.dialsprint.net [63.180.14.118]) by 
snipe.prod.itd.earthlink.net (EL-8_9_3_3/8.9.3) with SMTP id JAA19272 for 
[EMAIL PROTECTED]; Wed, 24 Jan 2001 09:37:32 -0800 (PST)
X-Mailer: Microsoft Outlook Express 5.50.4522.1200
Received: from toye.php.net ([198.186.203.51]) by vespasian.mspring.net (Mindspring 
Mail Service) with SMTP id t6pbio.bvk.37kbpqe for [EMAIL PROTECTED]; Mon, 22 
Jan 2001 17:04:08 -0500 (EST)
Received: (qmail 22777 invoked for bounce); 22 Jan 2001 22:01:10 -
MIME-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Subject: confirm unsubscribe from [EMAIL PROTECTED]

Hi! This is the ezmlm program. I'm managing the
[EMAIL PROTECTED] mailing list.

I'm working for my owner, who can be reached
at [EMAIL PROTECTED]

To confirm that you would like

   [EMAIL PROTECTED]

removed from the php-db mailing list, please send an empty reply=20
to this address:

   =
[EMAIL PROTECTED]=
hp.net

Usually, this happens when you just hit the "reply" button.
If this does not work, simply copy the address and paste it into
the "To:" field of a new message.

or click here:
=
mailto:php-db-uc.980357705.ihkbaponkpadihjfphio-Mike=3Dvalves-source.com@=
lists.php.net

I haven't checked whether your address is currently on the mailing list.
To see what address you used to subscribe, look at the messages you are
receiving from the mailing list. Each message has your address hidden
inside its return path; for example, [EMAIL PROTECTED] receives messages
with return path: =
php-db-return-number[EMAIL PROTECTED]

Some mail programs are broken and cannot handle long addresses. If you
cannot reply to this request, instead send a message to
[EMAIL PROTECTED] and put the entire address listed above
into the "Subject:" line.


--- Administrative commands for the php-db list ---

I can handle administrative requests automatically. Please
do not send them to the list address! Instead, send
your message to the correct command address:

To subscribe to the list, send a message to:
   [EMAIL PROTECTED]

To remove your address from the list, send a message to:
   [EMAIL PROTECTED]

Send mail to the following for info and FAQ for this list:
   [EMAIL PROTECTED]
   [EMAIL PROTECTED]

Similar addresses exist for the digest list:
   [EMAIL PROTECTED]
   [EMAIL PROTECTED]

To get messages 123 through 145 (a maximum of 100 per request), mail:
   [EMAIL PROTECTED]

To get an index with subject and author for messages 123-456 , mail:
   [EMAIL PROTECTED]

They are always returned as sets of 100, max 2000 per request,
so you'll actually get 100-499.

To receive all messages with the same subject as message 12345,
send an empty message to:
   [EMAIL PROTECTED]

The messages do not really need to be empty, but I will ignore
their content. Only the ADDRESS you send to is important.

You can start a subscription for an alternate address,
for example "[EMAIL PROTECTED]", just add a hyphen and your
address (with '=3D' instead of '@') after the command word:
[EMAIL PROTECTED]

To stop subscription for this address, mail:
[EMAIL 

[PHP-DB] can connect but error in retrieving data from mysql database

2001-01-24 Thread Scott

Hi, 

I have mysql, apache and php on my redhat 7 box and when I try to retrieve some
data from the database and display it on a webage, it doesn't display anything.
I seem to be able to connect to it fine but not pull any data. Here is the main
part of the code I am using:

html
  head
title  This is a PHP test  /title
  /head
body bgcolor="blue"

?php
//db_connect.php

include "common_db.inc";
error_reporting(1);

$link_id = db_connect("phptest");
if (!$link_id) {
die (sql_error());
}

else echo "Successfully made a connection to $dbhost using $default_dbname . br";

if (!$result=mysql_query("select * from user",$link_id)) {
echo "No! I selected nada from the user table";
}
else echo "Yes I can connect! Amen!";
?

/body
/html

Basically what happens is I get the message saying that I successfully
connected to the database and then underneath I get the "No! I selected
nada..." message. Could someone point me in the right direction? 

Thanks,

Scott

-- 
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] can connect but error in retrieving data from mysqldatabase

2001-01-24 Thread Wayne Bastow

Scott,

You probably need to add something like:

while ($row = mysql_fetch_row($result))
{
   print ("$row[0], $row[1]br\n");
}

which will print out the first two columns from the query.

Wayne

On Thu, 25 Jan 2001 14:02, Scott wrote:
 Hi,

 I have mysql, apache and php on my redhat 7 box and when I try to retrieve
 some data from the database and display it on a webage, it doesn't display
 anything. I seem to be able to connect to it fine but not pull any data.
 Here is the main part of the code I am using:

 html
   head
 title  This is a PHP test  /title
   /head
 body bgcolor="blue"

 ?php
 //db_connect.php

 include "common_db.inc";
 error_reporting(1);

 $link_id = db_connect("phptest");
 if (!$link_id) {
   die (sql_error());
 }

 else echo "Successfully made a connection to $dbhost using $default_dbname
 . br";

 if (!$result=mysql_query("select * from user",$link_id)) {
 echo "No! I selected nada from the user table";
 }
 else echo "Yes I can connect! Amen!";
 ?

 /body
 /html

 Basically what happens is I get the message saying that I successfully
 connected to the database and then underneath I get the "No! I selected
 nada..." message. Could someone point me in the right direction?

 Thanks,

 Scott

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