Re: [PHP-DB] SQL update help

2002-09-21 Thread Ignatius Reilly

When in doubt, bracket :

$sql = UPDATE $table SET pages = '{$PHP_SELF}' WHERE session =
'{$holy_cow}';

Less cute, but more readable.

Ignatius

- Original Message -
From: Dave Smith [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, September 21, 2002 2:07 AM
Subject: Re: [PHP-DB] SQL update help


 Jeffrey is right, but here's an easier way:

 $sql = UPDATE $table SET pages = '$PHP_SELF' WHERE session =
'$holy_cow';

 Be sure you use double-quotes to build the string (so that all variables
get interpolated) and single-quotes within. Any non-numeric value has to be
quoted for an SQL statement to work properly.

 Good luck!

 --Dave

 [EMAIL PROTECTED] wrote:

 if you put quotes around the variable $PHP_SELF it should work...try
this.
 
 UPDATE $table SET pages = '.$PHP_SELF.' WHERE session = $holy_cow
 
 hth
 


 --
 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] SQL file,

2002-09-21 Thread Bryan McLemore

in an example I saw in a book while I was leafing through it at barnes and nobles I 
saw a .sql file.  It appeared to have the schema for a db in it.  I was wondering what 
exactly what it is and how one could use it in a php application like he was doing.  

Thanks,
Bryan 



Re: [PHP-DB] SQL file,

2002-09-21 Thread Brad Bonkoski

Typically, it is a text file that has SQL in it.
Like:
CREATE DATABASE some_name (
ID int NOT NULL AUTO_INCREMENT PRIMARY KEY,
NAME varchar(30),
etc

Usually they are used to store the database information, and can be used in many of 
the database systems.  Within the database itself, there is a command to insert from a 
file.  Not sure off the top of my head, but the help menu should provide that
information, then the database would go through your file and execute those commands 
as if you were entering them in manually on the command line.  Espescially helpful for 
huge tables where you might be open to a typo, and have to start all over.
HTH
-Brad

Bryan McLemore wrote:

 in an example I saw in a book while I was leafing through it at barnes and nobles I 
saw a .sql file.  It appeared to have the schema for a db in it.  I was wondering 
what exactly what it is and how one could use it in a php application like he was 
doing.

 Thanks,
 Bryan


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




Re: [PHP-DB] SQL file,

2002-09-21 Thread Brad Bonkoski

I don't think it quite works that way through PHP.  You could send the
_contents_ of the file through PHP, like open the file, and read it into a
buffer, and send that as a query.  I actually create the files and then go into
my database system (MySQL -or- PostgreSQL) and then execute a command.  I think
for MySQL it is:
mysql \i name_of_file
and then that will step through the file executing the SQL statements.
-Brad

Bryan McLemore wrote:

 So I would send the file through with a sql query?

 -Bryan
 - Original Message -
 From: Brad Bonkoski [EMAIL PROTECTED]
 To: Bryan McLemore [EMAIL PROTECTED]
 Cc: PHP DB LIST [EMAIL PROTECTED]
 Sent: Saturday, September 21, 2002 8:18 AM
 Subject: Re: [PHP-DB] SQL file,

  Typically, it is a text file that has SQL in it.
  Like:
  CREATE DATABASE some_name (
  ID int NOT NULL AUTO_INCREMENT PRIMARY KEY,
  NAME varchar(30),
  etc
 
  Usually they are used to store the database information, and can be used
 in many of the database systems.  Within the database itself, there is a
 command to insert from a file.  Not sure off the top of my head, but the
 help menu should provide that
  information, then the database would go through your file and execute
 those commands as if you were entering them in manually on the command line.
 Espescially helpful for huge tables where you might be open to a typo, and
 have to start all over.
  HTH
  -Brad
 
  Bryan McLemore wrote:
 
   in an example I saw in a book while I was leafing through it at barnes
 and nobles I saw a .sql file.  It appeared to have the schema for a db in
 it.  I was wondering what exactly what it is and how one could use it in a
 php application like he was doing.
  
   Thanks,
   Bryan
 
 
  --
  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




Re: [PHP-DB] SQL file,

2002-09-21 Thread John Coder

from the mysql invoked by ? while in the mysql client  the command \. is
what you use. the blurb after is Execute a SQL script file. Takes a
file name as an argument. Dump a file with phpMyAdmin you get a sql
file. at least in Windows you do so I assume you do in non windows OS'es
also.

John
On Sat, 2002-09-21 at 09:27, Brad Bonkoski wrote:
 I don't think it quite works that way through PHP.  You could send the
 _contents_ of the file through PHP, like open the file, and read it into a
 buffer, and send that as a query.  I actually create the files and then go into
 my database system (MySQL -or- PostgreSQL) and then execute a command.  I think
 for MySQL it is:
 mysql \i name_of_file
 and then that will step through the file executing the SQL statements.
 -Brad
 
 Bryan McLemore wrote:
 
  So I would send the file through with a sql query?
 
  -Bryan
  - Original Message -
  From: Brad Bonkoski [EMAIL PROTECTED]
  To: Bryan McLemore [EMAIL PROTECTED]
  Cc: PHP DB LIST [EMAIL PROTECTED]
  Sent: Saturday, September 21, 2002 8:18 AM
  Subject: Re: [PHP-DB] SQL file,
 
   Typically, it is a text file that has SQL in it.
   Like:
   CREATE DATABASE some_name (
   ID int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   NAME varchar(30),
   etc
  
   Usually they are used to store the database information, and can be used
  in many of the database systems.  Within the database itself, there is a
  command to insert from a file.  Not sure off the top of my head, but the
  help menu should provide that
   information, then the database would go through your file and execute
  those commands as if you were entering them in manually on the command line.
  Espescially helpful for huge tables where you might be open to a typo, and
  have to start all over.
   HTH
   -Brad
  
   Bryan McLemore wrote:
  
in an example I saw in a book while I was leafing through it at barnes
  and nobles I saw a .sql file.  It appeared to have the schema for a db in
  it.  I was wondering what exactly what it is and how one could use it in a
  php application like he was doing.
   
Thanks,
Bryan
  



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




RE: [PHP-DB] Form response

2002-09-21 Thread Peter Lovatt

Missed most of the thread, so hope this hits the mark!

If one form works and one doesn't are they both called .php ? If one is
.php3 and one .php and the webserver is only configured to parse onr then
the other will show as plain text.

just a thought

Peter

---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
tel. 0121-242-1473
---

-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED]]
Sent: 20 September 2002 21:16
To: 'Warren Massengill'
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Form response


You have to run the scripts through a web server like Apache.

---John Holmes...

 -Original Message-
 From: Warren Massengill [mailto:[EMAIL PROTECTED]]
 Sent: Friday, September 20, 2002 1:08 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Form response


 John,

 If you're seeing PHP source code when you pull up a page, your server
is
 not
 configured correctly. What if you try a basic .php page like echo
Hello
 World;, does that work?

 No. Just prints the source code. What is really strange (to me) is
that
 the
 simple form and a more complex form (not shown here) works pefectly.
The
 forms open, accept input, and when you press submit ... the next
script
 reverts to source code, just like hello world, phpinfo(), and
everything
 else. ;--(

 You are running a web server right, not just using File-Open?? ---

 No again, just using the browser in Linux.

 John Holmes...


 From: Cornelia Boenigk [EMAIL PROTECTED]
 Reply-To: Cornelia Boenigk [EMAIL PROTECTED]
 To: Warren Massengill [EMAIL PROTECTED]
 Subject: Re:  [PHP-DB] Form response
 Date: Fri, 20 Sep 2002 13:31:46 +0200
 
 Hi Warren
 
 Did you change the php.ini? There must be the line
 
 default_mimetype = text/html

 I checked. The line already exists as default_mimetype = text/html
 . I did find the mod_mime_magic module in Apache (see below for the
gory
 details) and installed it - to no effect as you might imagine (both
Apache
 and PHP are configured to accept html,php,etc...)
 
 It seems that the browser doesn't recognize the correct type and
 displays the source. Did you try to display the forms in another
 browser.

 Netscape gave the same result.

 Thanks,
 Warren

 
 Regards
 Conni












 LoadModule mime_magic_module  modules/mod_mime_magic.so
 ---
 AddModule mod_mime_magic.c
 
 #
 # TypesConfig describes where the mime.types file (or equivalent) is
 # to be found.
 #
 IfModule mod_mime.c
 TypesConfig /etc/mime.types
 /IfModule
 ---
 #
 # The mod_mime_magic module allows the server to use various hints
from
 the
 # contents of the file itself to determine its type.  The
MIMEMagicFile

 IfModule mod_mime_magic.c
MIMEMagicFile /usr/share/magic.mime
 MIMEMagicFile conf/magic
 /IfModule



 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.com


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

2002-09-21 Thread Michael Conway

 

I am trying to use text and images from separate files to populate
descriptions and images for specific queries.  I have used something
like  echo img src=$row[image]; with little success (parse error
expecting , or ;  - on the line in question).  I assume that I would
have to use fopen for the text but have not found a suitable example.

 

Any help would be greatly appreciated.

 

Thanks.

 

Michael Conway

[EMAIL PROTECTED]

(703) 968-8875

 




RE: [PHP-DB] Opening files

2002-09-21 Thread Nivelvirtual.com

The problem is your  usage, you can do something like

echo img src='$variable_name';

Or

Echo img src=' . $row[image] . '';




Erick Bonilla

P.d. Sorry about my english :P




-Original Message-
From: Michael Conway [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, September 21, 2002 2:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Opening files


 

I am trying to use text and images from separate files to populate
descriptions and images for specific queries.  I have used something
like  echo img src=$row[image]; with little success (parse error
expecting , or ;  - on the line in question).  I assume that I would
have to use fopen for the text but have not found a suitable example.

 

Any help would be greatly appreciated.

 

Thanks.

 

Michael Conway

[EMAIL PROTECTED]

(703) 968-8875

 



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




[PHP-DB] date format to dateformat

2002-09-21 Thread CrossWalkCentral

I am having problems coverting the followign date format. Does any one have
any insight on this.

$date= 10 01 2002

I need to conver this to Y-m-d

any help would be great




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




Re: [PHP-DB] how do I echo this statement to the browser? -solved

2002-09-21 Thread Chip Wiegand

Thanks for the tip, I solved it a little differently -

sql1=select f_name, l_name, count(*) as 'Attendance' from kids group by
l_name;
sql2=select count(distinct kids_id) as 'total' from kids;

I added a new column to the database called kids_id, so when a new kid
is added he/she gets assigned a number, if a record is added for an
existing kid the new record keeps the existing kids_id, making it simple
to count only distinct kids_id's.

The input form lists the kids_id, f_name, l_name as a link to edit their
record, and delete for a delete link, in the left column, and in the
right is the form for input/editing. The kids list is ordered by
kids_id, making it easy to know what id's already exist, or don't yet.
--
Chip

On Sat, 2002-09-21 at 01:39, Ignatius Reilly wrote:
 This is a query requiring two different levels of aggregation. MySQL does
 not support it.
 
 You can reduce it to two different queries
 
 SELECT f_name, l_name, COUNT(*) AS Total_Kids
 FROM kids
 GROUP BY l_name
 
 and
 
 SELECT COUNT(*) AS Total_Rows
 FROM kids
 
 your result will have columns $row1['Total_Kids'] and $row2['Total_Rows']
 
 When MySQL supports subqueries, you can write:
 
 SELECT f_name, l_name, COUNT(*) AS Total_Kids
 FROM kids
 GROUP BY l_name
 JOIN
 SELECT COUNT(*) AS Total_Rows
 FROM kids
 
 HTH
 Ignatius
 
 - Original Message -
 From: Chip Wiegand [EMAIL PROTECTED]
 To: phpdb [EMAIL PROTECTED]
 Sent: Saturday, September 21, 2002 7:18 AM
 Subject: [PHP-DB] how do I echo this statement to the browser?
 
 
  I want to get the first name, last name, total row count, and total time
  a name appears in the database. Something like this -
 
  select f_name, l_name, count(*) as 'Total Kids', count distinct l_name
  from kids group by l_name
 
  it doesn't work of course, the count distinct l_name part is completely
  wrong. The database has kids names in it appearing multiple times,
  whence the need for distinct, I want the total number of times it
  appears though. Plus, how do I echo the number for 'Total Kids' on the
  browser? I don't have a column heading to reference like with f_name and
  l_name.
 
  I s'pose this is clear as mud.
 
  Thanks for any help you all can provide,
  Chip
 
 
 
 
  --
  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] ob_gzhandler

2002-09-21 Thread kras

Hello!
Is there any possibility to apply more than one callback function in output
buffer?
For example, first should convert one characterset to another and the last
one would be gzhandler to compress all converted content.

regards
kras


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