Re: [PHP-DB] Is this redundant? {OT}

2003-10-06 Thread David Smith
Robin Kopetzky wrote:

Good afternoon.

I found this code in a program I'm renovating and think this is very
redundant. Also, it does slow queries down while doing all of the
conversions.
prod_id in the mysql database is declared an integer.

SQL above
where prod_id = ' . (int)$prod_id . ' and
SQL below
Question: since $prod_is is already an integer, why would someone convert it
into an integer, then convert it into a string to later have mysql convert
it back into an integer?? Could someone shed some light on the intent behind
this weird code??
This is most likely a security measure and not redundant at all. Even if 
someone tries to inject malicious SQL into $prod_id, this code will 
cast it as an integer, discarding any non-numeric characters. For 
example, if $prod_id is 42; drop database foo;, that would be very 
dangerous. With the (int) cast, $prod_id will simply be cast to the 
integer 42. A good idea in my view.

--Dave

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


Re: [PHP-DB] stripping carrige returns with SQL

2003-09-26 Thread David Smith
If you are trying to replace the carriage return it needs to be \r
instead of \ n in your query. Also it may not work because in my
experience the replace function under mysql does not replace them in the
db but in the query results. If you are looking to replace them
permanently you will need a script to do that. I have one if that is
what you want to do.
David
On Fri, 2003-09-26 at 12:50, [EMAIL PROTECTED] wrote: 
 I have a query that is pulling user comments, supplied by via web
 internface and creating a text file out of them.  In these comments are all
 sorts of carrige returns.  I've tried stripping them out with the following
 queries, but once imported into excel, the carrige returns are still there.
 so obviously i'm doing something wrong
 
 I tried doing with the ASCII number .(no idea if this is valid)
 
 SELECT Business_Unit.Business_Unit, Category.Category_Name,
 REPLACE(Comment_Original, ASCII(10),ASCII(32)) FROM `Comment` INNER JOIN
 Cat
 egory ON Comment.Category_ID = Comment.Category_ID INNER JOIN
 Survey_Response ON Comment.Survey_Key = Survey_Response.Survey_Key INNER
 JOIN Business_Unit ON Survey_Response.BUKey = Business_Unit.BUKey WHERE
 Comment_Original  ' ' AND Category.Category_Name IS NOT NULL GROUP BY
 Business_Unit.BUKey, Category.Category_Name, Comment_Original ORDER BY
 Business_Unit.BUKey, Category.Category_ID ASC INTO OUTFILE
 '/export/home/jdyke/comments_NoB.csv' fields terminated by ',' OPTIONALLY
 ENCLOSED BY '' lines terminated by '\n';
 
 Also with the escaped charatcer.
 SELECT Business_Unit.Business_Unit, Category.Category_Name,
 REPLACE(Comment_Original, '\n',' ') FROM `Comment` INNER JOIN Category ON
 Co
 mment.Category_ID = Comment.Category_ID INNER JOIN Survey_Response ON
 Comment.Survey_Key = Survey_Response.Survey_Key INNER JOIN Business_UnitON
 Survey_Response.BUKey = Business_Unit.BUKey WHERE Comment_Original  ' '
 AND Category.Category_Name IS NOT NULL GROUP BY Business_Unit.BUKey,
 Category.Category_Name, Comment_Original ORDER BY Business_Unit.BUKey,
 Category.Category_ID ASC INTO OUTFILE '/export/home/jdyke/comments_NoB.csv'
 fields terminated by ',' OPTIONALLY ENCLOSED BY '' lines terminated by
 '\n';
 
 Is REPLACE the right SQL Function to use?  is there a better way to
 determine this character?
 
 Thanks
 Jeff

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



Re: [PHP-DB] best upload method

2003-09-13 Thread David Smith
If the destination for the uploaded file is on the same host as the web 
server, it will be several orders of magnitude faster to use the first 
method (move_uploaded_file()). Of course, you may have to reorganize 
your permissions to allow the web-server to write to the destination 
directory. If the destination for the uploaded file is on a remote 
server, you must use the second option, unless you want to get fancy and 
use NFS or something which allows the first method to function 
transparently.

With my limted knowledge (limited meaning none) of your setup, I would 
recommend the first method for speed, ease of implementation, and 
reliability (what if the FTP server goes down?). If you cannot configure 
your file system permissions to allow the web server to write to the 
destination directory, then use the FTP option. Keep in mind that it is 
*very* slow to initiate an FTP transation, upload the file (to the same 
machine!) and then close the connection. Copying a file locally will be 
much faster, and probably more reliable.

Good luck.

--Dave

open-mind wrote:

Sorry but I didn't know which is the name of the first method
I will rephrase
which is the best method to upload a file to server ??
this:
//
$result =
move_uploaded_file($HTTP_POST_FILES['img_6'][tmp_name],dir/filename.jpg)
;
$result = $result ? OK:NOT OK;
print $result;

or ... this:
/
$conn_id = ftp_connect($ftp_server);
$upload = ftp_put($conn_id, $destination_file, $source_file,
FTP_BINARY);
ftp_quit($conn_id);

how depends on the application ?

- Original Message -
From: David Smith [EMAIL PROTECTED]
To: open-mind [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, September 12, 2003 9:04 PM
Subject: Re: [PHP-DB] best upload method
 

which is the best upload file method ?
file uploads or FTP commands from PHP
 

Now that's the most open ended question I've read all day. Here, flip a
coin. If it falls heads, FTP. If it falls tails, the other one. Even
still, I'm not sure I understand the question: File uploads or FTP command
from PHP? One of your options is just the question restated...
Regardless and all sarcasm aside, this question depends seriously on the
application.
:)

--Dave

   

 

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


Re: [PHP-DB] best upload method

2003-09-12 Thread David Smith
 which is the best upload file method ?
 file uploads or FTP commands from PHP

Now that's the most open ended question I've read all day. Here, flip a
coin. If it falls heads, FTP. If it falls tails, the other one. Even
still, I'm not sure I understand the question: File uploads or FTP command
from PHP? One of your options is just the question restated...

Regardless and all sarcasm aside, this question depends seriously on the
application.

:)

--Dave

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



Re: [PHP-DB] RH 8.0 Mysql help

2003-09-09 Thread David Smith
One comand and you are done:

   apt-get install mysql-server httpd php php-mysql

Don't have apt for RedHat? Download this:

   
http://ftp.freshrpms.net/pub/freshrpms/redhat/8.0/apt/apt-0.5.5cnc6-fr0.rh80.1.i386.rpm

and run 'rpm -i' on it. There's no better way to install software than 
apt. Prefer a graphical installer? Do this:

   apt-get install synaptic

Good luck!

--Dave

Robin Kopetzky wrote:

Would some kind soul who has installed MySql on a RH8.0 box please email me
(off list) and help me get this running?? I have installed it a dozen times,
followed the post-installation and testing from the Mysql manual and STILL
can't make this run. I need this for a e-commerce site like yesterday!!
Please help...

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020
[EMAIL PROTECTED]

 

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


Re: [PHP-DB] copy tables between db's

2003-09-07 Thread David Smith
Have you tried something like this:

   insert into database1.tablename select * from database2.tablename;

database1 and database2 are the names of the two databases. tablename is 
the name of the table you want to copy from database1 to database2. In 
your case I guess this would be:

   insert into database1.states select * from database2.states;

Good luck!

--Dave

Jeremy wrote:

I need to copy some tables from one mysql database to another mysql database
on the same server.
I looked at the php manual and couldn't find it...I found stuff on
mysqlhotcopy, but it doesn't look like that will do what I need it to do, or
maybe I'm reading the manual wrong.
Can someone please show me how to do this? To be specific, it's just a table
with a list of US states in it...
table name: states
fields: state_id, name, abbreviation
Thanks,

Jeremy

 

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


Re: [PHP-DB] copy tables between db's

2003-09-07 Thread David Smith
David Smith wrote:

   insert into database1.tablename select * from database2.tablename;

database1 and database2 are the names of the two databases. tablename 
is the name of the table you want to copy from database1 to database2. 


Correction: from database2 to database1, not vice versa.

--Dave

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


Re: [PHP-DB] how to recognize user login name?

2003-09-04 Thread David Smith
Spychaa Wojciech wrote:

I have to do user recognizing in m php project. Simplest method i know is to
recognize for example login name (when user is logging into his local PC)
I've tried to use $USERNAME variable but it isnt what i want because it
recognize login name on server not remote user
If you are referring to the Windows login name, this is not possible 
with PHP via the web browser.

--Dave

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


Re: [PHP-DB] copy files (ftp?)

2003-09-04 Thread David Smith
Lars Jedinski wrote:

I have to copy files created with php on www.aaa.com
to another domain, e.g. www.bbb.com
Is and if how is this possible with PHP?
If you have an FTP server running on www.bbb.com, then it is possible. 
Here are the relevant functions:

   http://php.net/ftp

And here's some relevant sample code from that page:

snip

?php
$ftp_server = www.bbb.com;
$ftp_user_name = joeuser;
$ftp_user_pass = secret;
$source_file = somefile.txt;
$destination_file = somefile.txt;
// set up basic connection
$conn_id = ftp_connect($ftp_server); 

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); 

// check connection
if ((!$conn_id) || (!$login_result)) { 
   echo FTP connection has failed!;
   echo Attempted to connect to $ftp_server for user $ftp_user_name; 
   exit; 
   } else {
   echo Connected to $ftp_server, for user $ftp_user_name;
   }

// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); 

// check upload status
if (!$upload) { 
   echo FTP upload has failed!;
   } else {
   echo Uploaded $source_file to $ftp_server as $destination_file;
   }

// close the FTP stream 
ftp_close($conn_id); 
?

/snip

You could also resort to a more platform specific solutions, perahps 
with scp (using exec() or backticks `scp file.txt 
[EMAIL PROTECTED]:/dest/path/file.txt` ).

Good luck.

--Dave

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


Re: [PHP-DB] how to recognize user login name?

2003-09-04 Thread David Smith
quote who=CPT John W. Holmes
 I've tried to use $USERNAME variable but it isnt what i want because it
 recognize login name on server not remote user

 If you are referring to the Windows login name, this is not possible
 with PHP via the web browser.

 Sure it is. It's usually in $_SERVER['LOGON_USER'] or something similar.

Well, if it *is* actually there in some strange case, you can find it like
this:

   ?php
   echo 'pre';
   print_r( $GLOBALS );
   ?

This works great to discover the name of variables that are set by the
system.

I can imagine that the Windows login name will only be avaible in the
strictest of circumstances: IIS server, IE browser, in a domain setup or
something. Good luck. Sounds nuts to me. :)

--Dave

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



Re: [PHP-DB] Problem in executing linux command from PHP

2003-09-02 Thread David Smith
Gnanavel wrote:

I have problem in executing  linux command
$output=exec(ls -a);
echo pre$output/pre;
the above coding works, but

$output=exec(cp file1 file2);
echo pre$output/pre;
does not works. can any one help me out of this problem

When I was executing the cp command it doesn't return anything. 
But it returned the name of the last file when i executed the ls command

cp does not return anything on the command line on success.

--Dave

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


Re: [PHP-DB] Database backup

2003-08-27 Thread David Smith
Just do a mysqldump on the command line. It will dump a whole bunch of 
SQL code that can be used to recreate the database in the event of 
disaster. You could even pipe the output to gzip to compress it.

   mysqldump --all-databases -u root | gzip -c  mysql_backup.gz

That works fine for me. Then just do this to restore the database from 
backup:

   gunzip mysql_backup.gz
   mysql -u root  mysql_backup
I recommend putting this in a shell script cron job that stores each 
backup with the date in the file name.

Enjoy.

--Dave

Chris Payne wrote:

Hi there everyone,

Is there a quick way I can backup all my databases on Linux so I can download them to my HD/Burn them onto CD?

I've started a very large travel project and there is going to be over 100 DB's in the end, each with who knows how many tables and going through PHPMyADMIN and exporting 1 DB at a time is going to take forever.

My Server is the Rehat Linux 8.0 with Apache and MySQL and PHP.

Thanks, any help would be really appreciated (And save me alot of headaches).

Chris
 

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


Re: [PHP-DB] Comparing tables

2003-08-26 Thread David Smith
quote who=Ron Allen
 I would like to compare 2 tables in a database to determine which records
 are different!!!  Any clues out there.  Thanks in advance!

You didn't say which DBMS you are using. If you're using a DBMS which
supports INTERSECT (not MySQL), and assuming the two tables have the same
column names and types, you can do this:

  (SELECT * FROM table1) INTERSECT (SELECT * FROM table2)

For MySQL INTERSECT support, monitor this doc:

  http://www.mysql.com/doc/en/TODO_sometime.html

--Dave

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



Re: [PHP-DB] subtracting dates...

2003-08-02 Thread David Smith
Try this (taken from http://us2.php.net/manual/en/ref.datetime.php):

*menaurus at gmx dot de*
16-Jul-2003 02:37   
|The argument has to be in the standard mysql format (y-m-d)...
function age($date) {

if (!$date) return false;
$year=0+substr($date,0,4);
$month=0+substr($date,5,2);
$day=0+substr($date,8,2);
$t=0;
$d=date(d);
$m=date(m);
$y=date(Y);
$age=$y-$year;
|if ($month$m) $t=-1;
else if ($m==$month AND $day$d) $t=-1;|||
return ($age+$t);
}
|
Good luck.

--Dave

John Ryan wrote:

Hi,

In mySQL, I store dates as -MM-DD, a standard DATE type. It stores users
date of births. I need to calculate in a PHP script, the users age from this
DOB. I get a PHP date in the same format as the mySQL and subtract, which
returns the year rounded off. ie, it doesnt matter if your birthdays in june
of 1983 and the date is januray 2003, your age is still returned as 20, when
it should be 19.
Does anyone know how can i get the right age?



 



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


Re: [PHP-DB] hi (php-SSH)

2003-07-28 Thread David Smith
Suman Aluru wrote:

hi ,
 is there any way to write a PHP program for SSH.
I want to establish a SSH connection and work some commands in the remote 
system and close the connection.

Yes, just do this (uses an SSH key file):

?php
   echo Executing remote command...br /;
   echo `ssh -i /path/to/key/file [EMAIL PROTECTED] ls /tmp`;
   echo Done executing remote command.br /;
?
Use an SSH key file so you won't have to provide a password. I do this 
all the time for system administration, works great for inter-host 
communication.

--Dave

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


RE: [PHP-DB] Formatting numbers

2003-07-24 Thread David Smith

Thanks. That works perfectly.
David Smith



-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 24, 2003 3:36 PM
To: David Smith; php-db
Subject: Re: [PHP-DB] Formatting numbers


  I am a little new to PHP, but I am trying to pull numbers from a database
 that has both phone numbers and social security numbers for a client. My
 Client doesn't want the numbers to come out like 55 but (555)
 555-. My question is can I use format_number() to do this and if so
how
 do I make it change from a comma and every three spaces to fit the formats
 above? I know that this is probably pretty simple, but I can't seem to
find
 the answer anywhere (possibly right under my freakin' nose :D).

Use substr() to grab the pieces you want and add formatting around them.

us2.php.net/substr

---John Holmes...


--
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] Downloading Database?!?!

2003-07-23 Thread David Smith
You can create a batch file like this or if you want it to be in a web
interface much like phpmyadmin, but with your backup scheme you can use
the load data outfile command. This page from the mysql manual describes
both the infile and outfile methods:
http://www.mysql.com/doc/en/LOAD_DATA.html. This will tell you how to
use the syntax for the text files. It will let you do it with tabs,
commas, etc. Then you can use php to create the interface for your new
guy and make it as simple or complex as you like, but you don't even
have to use the filesystem functions to do it this way. Which does make
it a little simpler so that you can plan for 14 weeks of whatever you're
doing.
David Smith

On Wed, 2003-07-23 at 01:32, Stephen March wrote:
 Have you considered using the console-tool,  mysqldump?
 You could write a quick script  ... say
 
 mysqldump -u adminuser -p adminpass --all-databases  backup.sql
 tar -zcvf backup.tar.gz backup.sql
 mv backup.sql  /somepath/backup.sql
 
 if you're on Winders, a batch file:
 
 mysqldump -u adminuser -p adminpass --all-databases  backup.sql
 move backup.sql z:\somepath\backup.sql
 
 If you write a batch script, or shell script, all the new guy would 
 have to do is run it. 
 Create a cron job (on linux) or scheduled task (on windows) and the new 
 guy just has to figure out the coffee machine  :)
 Food for thought,
 
 ~Steve
 
 Brenton Dobell wrote:
 
 Hello all,
 
 I am developing an Intranet page for my workplace, ATM i use phpmyadmin to
 do rutine backups ect, this is cool but i am going on long service leave for
 14 weeks and during that time a new guy will attempt to continue to maintain
 the site and perform regular backups... I tried to show him how to use
 phpmyadmin but has proved too dificult for him to understand, how can i make
 a quick script to implement into a page that prompts you to download the
 entire sctipt in .txt form?? just like php myadmin, and starting tips and
 hints would be great.
 
 
 Cheers in advance
 
 Brenton
 
 
   
 
 
 
 
 
 -- 
 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] Error notice

2003-07-12 Thread David Smith
You are referencing variables that you have not created (or perhaps 
array indexes that don't exist). To suppress these messages, fix your 
code to not do such things, or just put this at the top of your scripts:

   error_reporting( E_ALL ^ E_NOTICE );

Or edit php.ini to make it happen globally:

   error_reporting  =  E_ALL ^ E_NOTICE

--Dave

Marco Mastrorilli wrote:

-Notice: Use of undefined constant data..
-Notice: Use of undefined constant mail...
-Undefined variable
Why in my scripts i always get error notice like this? 
How can i solve this problem?

Thanks



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


Re: [PHP-DB] Using fopen() for internet URL

2003-06-08 Thread David Smith
Tony S. Wu wrote:

I have an auto-update script to gather some information from other web 
pages to update information in my database.
And i use fopen() to open the URL.
as far as i know, the return result contains image, which i don't need.


If you call fopen()/fread() on a web page that contains an image, you 
will _not_ get the image in your result. You will only get the HTML text 
of the web-page.

For example:
$f = fopen( 'http://www.google.com/', 'r' );
$page = fread( $f, 2048 );
fclose( $f );
// $page will _not_ contain the Google image logo, but rather just the 
text of the HTML page.

--Dave



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


Re: [PHP-DB] Removing cart items with hyperlink question

2003-06-08 Thread David Smith
Boa Constructor wrote:

The first line below works but the second one doesn't.  If $quantity were to
equal 0 then I want both of these to do exactly the same thing.
echo Input type=text size=2 name=quantity[$buy] value=$quantity;

echo a href=$PHP_SELF?quantity[$buy]=0Remove Item/abr;
 

Are you using POST or GET on the receiving end of the script? Also, try 
urlencoding the href like this:

echo a href=\ . urlencode( $PHP_SELF?quantity[$buy]=0 ) . 
\Remove Item/abr;

And add this line prior to the echo:

$PHP_SELF = $_SERVER['PHP_SELF'];

In case regiester_globals is off (I hope it is).

--Dave

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


Re: [PHP-DB] Anyone know what Error 502 Bad Gateway means?

2003-04-12 Thread David Smith
Try this out:

http://www.checkupdown.com/status/E502.html

Robert Johnson wrote:

Hi all. I'm getting this error using Dreamweaver MX, php and mysql on a IIS
server over my intranet.  I can't figure out what it means... it happens
when I try to connect to a table using php.
TIA,

Robert



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


Re: [PHP-DB] temporary files

2003-03-23 Thread David Smith
You might consider using tmpnam() instead. tmpnam() doesn't give you a 
file handle (like tmpfile() does), but rather a file name. Just pass it 
a directory (like /tmp) and a prefix to help identify it (can be  ). 
It returns the unique file's name, and you could open a file handle to 
it with fopen(). Keep in mind that you have to unlink() it when you're done.

Hope this helps!

--Dave

Lars Tvedt wrote:

Im trying to create a way of storing php scripts in a mySQL database and
then execute them using temporary files as executable script buffers..
Ive got a mysql table with 4 fields: execID, execName, execDesc and execProc
The last one contains php code.
This is what i have so far:

?php
mysql_connect($host,$user,$pw);
mysql_select_db($db);
$query = SELECT execProc FROM exec WHERE execID = 1;
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
   $proc = $row['execProc'];
}
$handle = tmpfile();
fwrite($handle, $proc);
include(name of the temporary file);
fclose($handle);
?


But i need to get the name of the tempfile in order to include it..
all i have now is the handle_id
any help appreciated.






 



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


Re: [PHP-DB] Display results on html page

2003-03-20 Thread David Smith
You appear to have a ton of extra braces. I've modified your code below. 
That should do it, though keep in mind that your HTML is faulty too, 
though most browsers will probably tolerate it. :)

--Dave

Michelle Whelan wrote:

I am looking to display results of a query inside of an html table.  When I tested to see if this was correct it returned with a blank page on my website. 

Here is my code:

TIA

Michelle 

/* If there was a problem with the query... */
if (!$result || @mysql_num_rows($result)  1)
{
 print(No entries in table $table.);
 exit;
}
print(h3strongRESULTS FOR:'$ZipCode'/strong/h3);
print('table width=300 border=1');
   
/* For each table entry returned... */
while($row = mysql_fetch_array($result))
{
 print(tr);
 print(td width='25'nbsp;/td);
//}
//{ 
 print(tr);
 print(td width='75'strongDirt Type:/strong/td);
 print(td . $row['havedirtype'] . /td); 
 print(td colspan=3nbsp;/td);
//} 
//{
 print(tr);
 print(td width=75strongYards:/strong/td);
 print(td . $row['noyards'] . /td);
 print(td colspan=3nbsp;/td);
//}
//{
 print(tr);
 print(td width=75Contact:/font/strong/td);
 print(td . $row['contactname'] . /td);
 print(td colspan=3nbsp;/td);
//}
//{
 print(tr);
 print(td width=75strongPhone #:/strong/td);
 print(td . $row['areacode'] . /td);
 print(tdnbsp;/td);
 print(td . $row['prefix'] . /td);
 print(tdnbsp;/td);
 print(td . $row['suffix'] . /td);
 print(tdnbsp;/td);
//}
//{
 print(tr);
 print(td width=25nbsp;/td);
 print(td width=75strongZip Code:/strong/td);
 print(td . $row['zipcode'] . /td);
 print(td colspan=3nbsp;/td);
//}
//{
 print(tr);
 print(td width=25nbsp;/td);
 print(td width=75strongExp. Date:/strong/td);
 print(td . $row['date_month'] . /td);
 print(tdnbsp;/td);
 print(td . $row['date_day'] . /td);
 print(tdnbsp;/td);
 print(td . $row['date_year'] . /td);
 print(tdnbsp;/td);
//}
//{
 print(tr);
 print(td colspan=5nbsp;/td);
//}
//{
 print(tr); 
 print(td width=25nbsp;/td);
 print(td width=75strongEmail:/strong/td);
 print(td colspan=3nbsp;/td);
 print(td . $row['email'] . /td);
//}
//{
 print(tr);
 print(td width=25nbsp;/td);
 print(td width=75strongJob City:/strong/td);
 print(td colspan=3nbsp;/td);
 print(td . $row['jobcity'] . /td);
//}
//{
 print(tr);
 print(td width=25nbsp;/td);
 print(td width=75strongX-Streets:/strong/td);
 print(td colspan=3nbsp;/td)
 print(td . $row['xstreets'] . /td);
//}
//{
 print(tr);
 print(td colspan=5nbsp;/td);
}

print(/table);

 



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


Re: [PHP-DB] Not seeing whats wrong with code

2003-03-19 Thread David Smith
Mike Delorme wrote:

Hello,

I am trying to write a script that conects to mysql, then SHA database. Then I need to list ALL the rows of table members. It sais there is a error on line 18. The while statement is on line 18, and I cant firgure out whats wrong with it:

?
$host = localhost;
$uname = sniper;
$pass = starcraft;
$database = SHA;
$tablename = members;
$connect = mysql_connect ($host, $uname, $pass); 
$select = mysql_select_db ($database);
$query = SELECT * from $tablename;
$result = mysql_query ($query)
while ($row = mysql_fetch_row($result))
{
$row

You are missing a semi-colon here. And you are not printing the info. 
Try this instead of $row: print_r( $row );.

}
?
Thanks,
Mike Delorme
--Dave

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


Re: [PHP-DB] mysql_connect() problem

2003-03-17 Thread David Smith
You need to install the php-mysql rpm. You can get this on your RedHat CD,
or through apt-get:

apt-get install php-mysql

Get apt here: http://apt.freshrpms.net/

Does the PHP project ever plan to do something as impressive as CPAN so
users won't have to reinstall or recompile just to extend its
functionality?

--Dave

quote who=Indrajit Paul

 Hi,

   I am using Apache 2 in Linux 8 .Whenever in my php script I want to
 connect to mysql through mysql_connect() function a error occured.

 My script is like that
   $linlid=mysql_connect(localhost,user1,user1)or
 die(Connections
 failed);
 print Connected successfully;

 The script writes this.
 %
 Fatal error: Call to undefined function: mysql_connect()

 Please help me.I have installed Apache and php through RPM.
 Anybody can help me.

 Indrajit





 _
 Get more buddies in your list. Win prizes
 http://messenger.msn.co.in/promo


 --
 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] Authenticating through a php script

2003-01-09 Thread David Smith
Jeremy,

LDAP authentication happens in two stages: connect and bind. The connect
stage is just establishing a connection with the LDAP server
(ldap_connect()). No username or password is necesary in this stage.
Once your connection is established, you attempt a bind (ldap_bind())to
verify a username/password on the LDAP server. Here's some PHP code that
will do it or you:

?php

$ldap_server = example.com; // change to your LDAP server host name
$ldap_port = 389; // might be different for your server
$pw = yourpassword; // change to your password
$dn = cn=dave,ou=people,dc=example,dc=com; // change to the dn you want to 
authenticate

$connect_result = ldap_connect( $ldap_server, $ldap_port );

// Did we connect?
if( ! $connect_result )
{
echo Could not connect to '$server_name' on port '$server_port';
}

$bind_result = ldap_bind( $connect_result, $admin_dn, $admin_pw );

// Did we bind?
if( ! $bind_result )
{
echo Bad username/password;
}
else
{
echo Correct username/password!;
}

?

Here's some good documentation on the topic:
http://www.php.net/manual/en/ref.ldap.php

Let us know how it goes.

--Dave



On Thu, 2003-01-09 at 10:01, Jeremy Peterson wrote:
 I am working on a script that will authenticate on a central system my
 company has devised for us to use (LDAP) and then authenticate them to
 other sites that I want them to access (Online Databases and other
 electronic resources I do not control but pay lots of money for all
 students to access).
 
 I have seen this done on a product produced by Epixtech called RPA
 (Remote Patron Authentication).  This is an authentication system that
 avoids using a proxy server. It basically handles the authentication
 (LDAP) and sends the appropriate information to the other secure
 source (Online Database, Electronic Resources, or my online catalog's
 patron information.)  Typically there are multiple ways it will
 authenticate for the user to other resources.  URL referer, ip
 authentication, fill in an user/password form for the user.  I just
 can't get the user/password portion to work on a protected site.  My tests 
 of sending post information to another one of my scripts works fine.  But 
 it doesn't work as of yet.
 
 I have worked a bit with scripts that send post information through
 sendToHost function (fsockopen and fputs).  But nothing is really
 working here.  Does anyone know how I should go about this?  All
 suggestions will be great!
 
 
 Thanks a bunch,
 
 Jeremy



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




Re: [PHP-DB] Authenticating through a php script

2003-01-09 Thread David Smith
) that is getting 
 posted to.
 ?
 
 
 
 
 
 
 At 10:28 AM 1/9/2003 -0700, David Smith wrote:
 Jeremy,
 
 LDAP authentication happens in two stages: connect and bind. The connect
 stage is just establishing a connection with the LDAP server
 (ldap_connect()). No username or password is necesary in this stage.
 Once your connection is established, you attempt a bind (ldap_bind())to
 verify a username/password on the LDAP server. Here's some PHP code that
 will do it or you:
 
 ?php
 
 $ldap_server = example.com; // change to your LDAP server host name
 $ldap_port = 389; // might be different for your server
 $pw = yourpassword; // change to your password
 $dn = cn=dave,ou=people,dc=example,dc=com; // change to the dn you want 
 to authenticate
 
 $connect_result = ldap_connect( $ldap_server, $ldap_port );
 
 // Did we connect?
 if( ! $connect_result )
 {
  echo Could not connect to '$server_name' on port '$server_port';
 }
 
 $bind_result = ldap_bind( $connect_result, $admin_dn, $admin_pw );
 
 // Did we bind?
 if( ! $bind_result )
 {
  echo Bad username/password;
 }
 else
 {
  echo Correct username/password!;
 }
 
 ?
 
 Here's some good documentation on the topic:
 http://www.php.net/manual/en/ref.ldap.php
 
 Let us know how it goes.
 
 --Dave
 
 
 
 On Thu, 2003-01-09 at 10:01, Jeremy Peterson wrote:
   I am working on a script that will authenticate on a central system my
   company has devised for us to use (LDAP) and then authenticate them to
   other sites that I want them to access (Online Databases and other
   electronic resources I do not control but pay lots of money for all
   students to access).
  
   I have seen this done on a product produced by Epixtech called RPA
   (Remote Patron Authentication).  This is an authentication system that
   avoids using a proxy server. It basically handles the authentication
   (LDAP) and sends the appropriate information to the other secure
   source (Online Database, Electronic Resources, or my online catalog's
   patron information.)  Typically there are multiple ways it will
   authenticate for the user to other resources.  URL referer, ip
   authentication, fill in an user/password form for the user.  I just
   can't get the user/password portion to work on a protected site.  My tests
   of sending post information to another one of my scripts works fine.  But
   it doesn't work as of yet.
  
   I have worked a bit with scripts that send post information through
   sendToHost function (fsockopen and fputs).  But nothing is really
   working here.  Does anyone know how I should go about this?  All
   suggestions will be great!
  
  
   Thanks a bunch,
  
   Jeremy



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




Re: [PHP-DB] Re: blob

2003-01-08 Thread David Smith
On Wed, 2003-01-08 at 06:50, [EMAIL PROTECTED] wrote:
 
 i know this is a bit down the chain, but i'm trying to keep the message
 strings in tact
 
 but can't you set up your directory just like you set up your mysql Grants.
 I have a directory that the web user owns, who is in its own group.  so i
 set the permisssions once, and its done.  Also i don't store the folder
 structure, i have a variable named for that folder structure then if the
 folders move or you need to move your webservers, the path will dynamically
 update, regardless of location.


Here's the problem. You have two choices for permissions with uploads:
1. You can make the upload directory world-writable. This is a major
security risk, as any other user on the system can write to it as well.
2.  You can make the upload directory owned by the apache user (or
whatever user your web-server runs as). This is a problem because you
have to be root in order to make the change. Many users don't have this
option.

Uploading the file to a DB solves both of these problems.

It presents its own problems too, though. Downloads of the binary data
are slow. And it's difficult to get a user's browser to cache the
dynamic pages. For example: Mozilla will cache a URL that looks like
this: http://example.com/image.jpg, but it has trouble caching a URL
like this: http://example.com/image.php?id=3. Does anyone know the right
headers to send to get browsers to cache these dynamic image pages as if
they were static images? 

--Dave


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




Re: [PHP-DB] Re: blob

2003-01-07 Thread David Smith
On Tue, 2003-01-07 at 15:52, [EMAIL PROTECTED] wrote:
 
 I agree with this method.  i have not yet seen an advantage of storing
 blobs in a database.  Is there one?  i'm sure those on this list would have
 an opinion if there was one.  personally, i like storing all this stuff on
 the file system.

There is one advantage. You must either chown the upload directory to
the user that your web-server runs as, or chmod it to be world-writable.
When creating a web-application that you plan to distribute (like
Slashcode), you can't assume that your users will have that privilege.
So, storing it in MySQL is a great option.

--Dave


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




Re: [PHP-DB] Query with optional params

2003-01-05 Thread David Smith
Rich,

When I do searches with multiple fields, I construct the SQL string on
the PHP side. You can do something like this:

$sql = SELECT * FROM docmeta WHERE ;

if( $PartNumber )
$sql .= PartNumber='$PartNumber';

if( $Title )
$sql .=  AND Title='$Title';

and so on...

That has worked well for me in the past. You could make it more general
by creating an array of field names and iterating through that array
checking for the presence of the appropriate variables. Then, if you add
an additional field, just add it to the array of field names.

If there is a way to do this sort of optional search field with MySQL,
then I don't know about it.

--Dave

On Sun, 2003-01-05 at 12:52, Rich Hutchins wrote:
 I have a search page on which I place six fields into which users may enter
 data to perform a search. For ease of explanation, the fields are:
 Part Number
 Title
 Subtitle
 Print Date
 Status
 Type
 
 All of these fields reside in the same table, named docmeta, in a MySQL
 database.
 
 I'm running into a logic problem when a user enters data into only one or
 two of the six fields. The question/problem is how do I write a MySQL query
 when not all of the parameters are filled in each time? Is this a problem
 that needs to be handled on the PHP side with a bunch of IF statements when
 constructing the MySQL string or is there a MySQL command or syntax that
 accommodates variable length parameter sets?
 
 The problem is when a search parameter is left blank by the user. If I
 include the empty parameter in the query (e.g. SELECT * FROM docmeta WHERE
 partnum LIKE % AND title LIKE % AND subtitle LIKE ;) then an empty set
 is returned when subtitle is not blank in the database. This is totally
 understandable, since that's what subtitle LIKE  means, but it's not what
 I want to send.
 
 Essentially, I want to skip sending the subtitle LIKE  part when subtitle
 field is not filled in by the user.
 
 Incidentally, the query works fine if I use OR instead of AND, but switching
 to an all OR query is not an option; I need to be able to perform both.
 
 I've checked the archives and the MySQL manual (especially the language
 reference) and I haven't found anything that answers my question.
 
 I'm fairly certain I'll be able to figure this out if somebody points me in
 the right direction, but I don't think I even know what (or where) to look
 for the answer. Any help would be appreciated.
 
 Thanks,
 Rich
 
 
 -- 
 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] MySQL Ques: default for date field be current date

2002-12-17 Thread David Smith
This can be done using the 'timestamp' type for your column. Note that
this field will be updated to the current time any time the row is
modified (including when it is created).

An alternative is to do it on the scripting side with the MySQL NOW()
command like so:

INSERT INTO your_table (field1,field2,...,create_date) values(
'val1','val2',...,NOW())

The create_date field can be of type time, date, or datetime. I
recommend datetime.

--Dave

On Tue, 2002-12-17 at 22:22, Michael Zornek wrote:
 I'm trying to convert an ASP/Access tutorial to PHP/MySQL and have a
 question regarding MySQL.
 
 In Access one can create a date field and set the default to Date() to get
 the current date but according to the mysql manual:
 
 http://www.mysql.com/doc/en/CREATE_TABLE.html
 
  Default values must be constants. This means, for example, that you cannot set
  the default for a date column to be the value of a function such as NOW() or
  CURRENT_DATE.
 
 Is there any other way to have MySQL automate this? I've heard of something
 called stored procedures but am unfamiliar. -- Must this be done on the
 scripting side?
 
 Thanks,
 ~ Mike
 -- 
 MikeZornek.com
 New blog, new QA column, new content everywhere!
 http://www.mikezornek.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




Re: [PHP-DB] php and mysql

2002-12-07 Thread David Smith
Three words:

php dot net

--Dave

On Fri, 2002-12-06 at 23:19, Jason Wong wrote:
 On Saturday 07 December 2002 11:54, Dallas wrote:
  hey, i'm just new to using php and mysql
 
  i would like to know how to do the following for a assignment of mine
  (shopping site):-
 
  and if I could ask for full codes, and only relevant coding, no extra stuff
  plz
 
 Should you be asking for a quotation as well?
 
  *connect to the mysql database and display results in random areas of the
  page
  (the prices of the items will be displayed in different areas)
 
  *connect to a mysql database and show the results on the form in the text
  fields
  (basically so that they can see the current price on the form before they
  edit it)
 
  *change the prices after submission of the form into the mysql database
 
  THANKS A LOT, it will really help
 
 I bet it will ;-)
 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 
 
 /*
 Most people in this society who aren't actively mad are, at best,
 reformed or potential lunatics.
   -- Susan Sontag
 */
 
 
 -- 
 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 table inserts at the same time

2002-12-07 Thread David Smith
These two methods are nearly identical. Practically, you will probably
never see a performance difference. The time it takes to perform a query
is an order of magnitude greater than the time it takes to allocate
space for and iterate through an array. I would imagine that you will
never notice a difference between these two examples, even under heavy
loads. Perhaps Peter can speak to heavy loads better than I.

--Dave

On Sat, 2002-12-07 at 16:53, rolf vreijdenberger wrote:
 hi there,
 
 I have multiple tables in my mysql db.
 Users register, and after submitting there are multiple tables that need
 inserts.
 
 What is the best way to do this? speedwise, efficiencywise, codewise?
 (pseudo code)
 
 A) $sql[]='insert1';
 $sql[]='insert2';
 $sql[]='insert3';
 foreach($sql as $doMe){
 mysql_query($doMe);//i left safety checks aside for clarity
 }
 
 B)$sql='insert1';
 mysql_query($sql);
 $sql='insert2';
 mysql_query($sql);
 $sql='insert3';
 mysql_query($sql);
 
 I'd prefer the first method, as it makes for easier updating of the queries
 in a centralized place.
 but I am wondering what your methods are, and any advantages or
 disadvantages known to you.
 
 thanks a lot
 
 
 
 -- 
 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] Re: PHP/MySQL not available remotely...

2002-12-04 Thread David Smith
Are you able to connect to the MySQL server from the command line using
a non-php client?

--Dave

On Wed, 2002-12-04 at 09:04, [EMAIL PROTECTED] wrote:
 
 do you have the persmissions set either for [EMAIL PROTECTED](which
 would only work from remotehost.com) or username@'%' (which would work for
 that username from any host)
 
 
 hth
 jeff
 
 
  
   
 Chase  
   
 chase@ck2000.   To: [EMAIL PROTECTED]
   
 biz cc: 
   
  Subject: [PHP-DB] Re: PHP/MySQL not 
available remotely...  
 12/04/2002   
   
 10:58 AM 
   
  
   
  
   
 
 
 
 
 Okay, it was suggested that I may not have my register_globals flagged to
 on but I do.  I still can't seem to make any remote connect to the
 server.
 Again, there are no errors, it just flat don't work.
 
 Chase
 
 
 Chase [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I seem to have a bit of an issue with my PHP/MySQL settings...
 
  A basic PHP bit like ?php echo $REMOTE_ADDR; ? works great on my
  webserver.  However, with any form of DB access the page just hangs... I
  don't get an error, but I don't get results either.  I also have
  phpMyAdmin-2.3.3 running.  I can access that from the server directly,
 but
  if I try to get to it via any other machine I get NO results.
 
  I am running IIS 5 with PHP4 and MySQL v3.23.53-max.
 
  Suggestions?
 
 
 
 
 
 --
 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] some data output formatting and grouping question...

2002-12-02 Thread David Smith
I don't see an easy way to do this in one SQL statement. But, the
following PHP does the trick for me (assuming MySQL):

// get the list of Y values
$r = mysql_query( SELECT * FROM table GROUP BY Y );
while( $y_val = mysql_fetch_array( $r ) )
$y_vals[] = $y_val['Y'];

// For each Y, fetch the Xs from the table
foreach( $y_vals as $y )
{
echo hr$ybr;
// get all the Xs for this Y
$r = mysql_query( SELECT * FROM table WHERE Y='$y' );
while( $row = mysql_fetch_array( $r ) )
echo $row['X'] . br;
}

Let us know if this works.

--Dave

On Mon, 2002-12-02 at 00:53, Victor wrote:

 Consider the following table:
 
 U | X | Y 
 --|---|--
 me|001|0a
 me|002|0a
 me|003|0a
 me|002|0b
 me|003|0b
 me|004|0b
 ..|...|..
 
 then the code says:
 
 SELECT * FROM Y WHERE U = me
 
 So now what?
 - remember I do not know the value of Y, so it has to be an automatic
 thing; I can't just say ... WHERE U = me AND Y = a.
 
 I want this output:
 
 0a
 001
 002
 003
 ___ (hr)
 
 0b
 002
 003
 004 
 
 How the hell do I do that? I can't think of the goddamn' syntax!
 
 __ 
 
 Post your free ad now! http://personals.yahoo.ca
 
 
 -- 
 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] HTTP Authentication with MySQL/PHP

2002-11-17 Thread David Smith
I have a directory 'admin' that has been .htaccess'ed off. Ie, If you
point your browser at that directory, you will be prompted with an HTTP
authentication dialog. Nothing special about PHP or MySQL there. I like
the security that .htaccess and Apache give me.

Now, I have users in a MySQL table with md5 passwords stored for each.
These users use an HTML form to log in to my site. Some of these users
are admin users. When these admin users log in, I'd like them to have
access to the 'admin' directory without being prompted with the HTTP
authentication dialog. Is there anyway to use PHP to tell Apache that a
user has been authenticated and that it need not throw up the HTTP
authentication dialog?

In case any of the foregoing is unclear, here's the process I want:

1. A non-authenticated user tries to access the directory 'admin', so
Apache tosses up the HTTP authentication dialog. If they enter their
user name and password, they will be admitted (done without PHP or
MySQL, .htaccess and a passwd file).

2. A non-admin user authenticates with my HTML form, then they try to
hit the 'admin' directory. The same thing happens as above.

3. An admin user authenticates with my HTML form, PHP tells Apache that
this user has been authenticated. Then the user goes to the 'admin'
directory, and is admitted without any other authentication.

So, another question: To solve this problem from a different angle, is
there a way to have Apache's .htaccess specify SQL to determine a user's
credentials? Ie, when they visit the 'admin' directory, Apache could
look up their record in the user table and determine if they are an
admin.

Sorry for the long explanation, but I wanted to make sure I was clear as
this is a little bit of a funky request.

Thanks,
Dave




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




Re: [PHP-DB] Select Fields

2002-11-06 Thread David Smith
Tyler,

You probably need one or two of the following:

1. Put single-quotes around case in your SQL (where type like 'case')
2. Use wild-cards in your where statement (where type like '%case%')

Good luck!

--Dave

On Wed, 2002-11-06 at 23:31, Tyler Whitesides wrote:
 Hi,
 Sorry if this is ametuer, but I have been staring at this code for so long, trying 
to find out why my selection fields are gathering values, and I cant find the problem.
 Thanks,
 Tyler
 --
 ?
 include './include/vars.php';
 include './include/dbconnect.php';
 ?
 html
 head
 title?= $title ?/title
 script languauge=javascript
 function totalCost()
 {
 var form = document.system;
 var casing = form.casing.value;
 var processor = form.processor.value;
 var ram = form.ram.value;
 var hdd = form.hdd.value;
 var video = form.video.value;
 var sound = form.sound.value;
 var nic = form.nic.value;
 var monitor = form.monitor.value;
 var speakers = form.speakers.value;
 var interfaces = form.interfaces.value;
 var total = casing + processor + ram + hdd + video + sound + nic + monitor + 
speakers + interfaces;
 form.price.value = total;
 }
 /script
 /head
 body bgcolor=#CBD5DA link=#405266 vlink=#3F593E alink=#3F593E
 div align=center
 center
 table border=0 cellspacing=0 cellpadding=0 width=780
 tr
 td width=15 height=15img border=0 src=images/corner_tl.gif width=15 
height=15/td
 td bgcolor=#FF height=15img border=0 src=images/clear.gif width=1 
height=1/td
 td width=15 height=15img border=0 src=images/corner_tr.gif width=15 
height=15/td
 /tr
 tr
 td bgcolor=#FF width=15img border=0 src=images/clear.gif width=1 
height=1/td
 td bgcolor=#FF
 table border=0 width=100% cellpadding=0 cellspacing=0
 /tr
 tr
 td valign=top rowspan=3 bgcolor=#C0C0C0img border=0 
src=images/clear.gif width=10 height=1
 /td
 td valign=topimg border=0 src=./images/main.png hspace=2 alt=Computer 
Service
 /td
 td valign=top align=right
 table name=login border=0 cellpadding=0 cellspacing=0
 tr
 td bgcolor=#cococo
 centerbServices/b/center
 /td/tr
 trtd
 center
 ? include './include/links.php'; ?
 /center
 /td/tr
 /table
 br
 
 /td
 /tr
 tr
 td valign=bottom colspan=2
 !---Main Body
 h2centerBuild Your Custom System/center/h2
 form name=system action=customSystems.php method=post
 ? $parts = mysql_query(select part,price from parts where type like case;); ?
 ul
 Case:
 select name=casing
 ? 
 while($item = mysql_fetch_array($parts))
 {
 echo option name='$item[part]' value=$item[price]$item[part]/option;
 }
 ?
 /select
 
 /ul
 div align=rightTotal Cost Of Parts: input type=text name=price 
size=6/div
 /form
 !-End Main Body--
 /td
 /tr
 tr
 td valign=top colspan=2 
 !-Empty Cell---
 table border=0 cellpadding=5 cellspacing=7
 tr
 td
 
 /td
 td
 
 /td
 
 td valign=top
 
 /td
 /tr
 /table
 
 /td
 /tr
 tr
 td valign=top bgcolor=#C0C0C0nbsp;
 /td
 td valign=top bgcolor=#C0C0C0 colspan=2
 
 /td
 /tr
 /table
 /td
 td bgcolor=#c0c0c0/td
 /tr
 tr
 td valign=top align=right width=15 height=15img border=0 
src=images/corner_bl.gif width=15 height=15/td
 td bgcolor=#FF height=15/td
 td valign=top align=left width=15 height=15img border=0 
src=images/corner_br.gif width=15 height=15/td
 /tr
 /table
 /div
 
 /body
 
 /html
 
 



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




Re: [PHP-DB] global vars

2002-10-30 Thread David Smith
When you redirect, you lose your variables. This means that you must
send them in some form to the other script. If you change your redirect
command to the following, you will see that $a gets transferred and
echoed in the second script as well as the first:

Header(Location: second.php?a=$a);

Note: this only works if you have register globals on which you seem
to have, so it should fix your problem.

Good luck!

--Dave


On Wed, 2002-10-30 at 23:05, Tomas Kubis wrote:
 Hello,
  I have big problem. I upgraded PHP from 4.1.2 to 4.2.3 and my scripts with
 doesn´t work. Please help me!
 in php.info register globals=On
 
 For example I have one script:
 first.php
 ?
 global $a;
 $a=150;
 Header(Location: second.php);
 ?
 
 second.php
 
 ?
 echo $a;
 echo $GLOBALS['a'];
 echo END;
 ?
 
 Where I have a bug?
 
 Thank you very much
 
 Tomas Kubis
 
 
 
 -- 
 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] Server Upgrade and DB Move(s)

2002-10-15 Thread David Smith

On Tue, 2002-10-15 at 15:31, [EMAIL PROTECTED] wrote:
 and the file copy method
 just seems to easy, it almost seems wrong  ;-),

This is a feature that is pretty nice about MySQL. You cannot do this
with Postgres, which caused my quite a few nice headaches over the
summer. You must dump the tables to an SQL file and read it into the new
database. MySQL is pretty cool.

--Dave


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