Re: [PHP] include (foo.php) not working

2001-07-25 Thread Andy Warwick

 I am running PHP 4.0.6 on my Mac OSX using apache and MySQL.

 when I include the statement ? include (foo.php); ? then rather than
 parsing the file and displaying the results the whole file is just dumped to
 screen as a text file.  Interesting the same problem occurs whatever the
 file extension so the same thing happens for foo.htm, foo.html and foo.txt!

Jon

Make sure you have Unix line endings on the file, rather than Mac (if you
are using BBedit - which I heartily recommend - you can change this in the
preferences and from the pop-up menu just below the title bar).

I had the same problem the other day and that solved it for me.

Regards

-- 
Andy Warwick   

email: [EMAIL PROTECTED] PGP ID: 0xB1D73499

Creed New Media Designtel: 07976 205085
Nottingham, England   url: http://www.creed.co.uk

website production - internet programming - new media consultancy
cdrom multimedia - graphic design - digital image retouching




-- 
PHP General 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] Loading SQL files (not CSV) into mySQL

2001-04-03 Thread Andy Warwick

I'm after some pointers on how to dump and load SQL files to and from mySQL
using a PHP/HTML form.

I've read the manual about "LOAD DATA INFILE", but as far as I can tell that
won't help in this case. Unfortunately, CSV files are not an option
(client's demands... go figure).

What I'm after is dumping/uploading SQL files of the form:

==
#
# PHP/MySQL Demo - Table Dump
# 

#
# Structure
#

DROP TABLE IF EXISTS demo;
CREATE TABLE demo (
   id tinyint(2) unsigned zerofill NOT NULL auto_increment,
   name char(50) NOT NULL,
   logo_url char(50) NOT NULL,
   page_colour char(6) DEFAULT 'FF' NOT NULL,
   last_order datetime DEFAULT '-00-00 00:00:00' NOT NULL,
   PRIMARY KEY (id),
   KEY id (id),
   UNIQUE id_2 (id)
);

#
# Data
#

INSERT INTO demo (id, name, logo_url, page_colour, last_order) VALUES (
'01', 'CompanyName', 'logo.gif', '99CCFF', '2001-04-06 13:21:31');
==

Complete with table creation and data inserts. In effect, it needs to be
standalone text files full of SQL commands.

I know it can be done, because phpMyAdmin has exactly this facility. But
even after studying the code of that carefully, I can't tell which specific
pieces are handling this enough to extract the facility.

Can anyone point me, or is willing to donate, any articles/code snippets/etc
that will help.

TIA

Andy Warwick


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