[PHP-DB] Fatal Error - Undefined function mysqli_connect

2011-09-04 Thread Ben
Hi,

 

My server was upgraded to PHP 5.3.8 and MySQL 5.1.58 today and, since, I am
getting a 500 error on any script requiring a DB connection.

 

I've tried using the Procedural style example provided at
http://www.php.net/manual/en/mysqli.connect.php (as shown below), but get
the following line in my error logs:

 

PHP Fatal error: Call to undefined function mysqli_connect() in
DOC_ROOT/test2.php on line 2

 

-  Sample code

?php

$link = mysqli_connect('localhost', 'my_user', 'my_password', 'my_db');

 

if (!$link) {

die('Connect Error (' . mysqli_connect_errno() . ') '

. mysqli_connect_error());

}

 

echo 'Success... ' . mysqli_get_host_info($link) . \n;

 

mysqli_close($link);

?

 

If I run phpinfo(), I see the following:

Configure Command:  ..'-without-mysql'..

Additional .ini files parsed:  .. /etc/php.d/mysql.ini,
/etc/php.d/mysqli.ini.. /etc/php.d/pdo_mysql.ini

 

Is there something wrong with the installation of PHP/MySQL?

 

Any help would be greatly appreciated.  Thanks,

 

Ben Miller

 



RE: [PHP-DB] Fatal Error - Undefined function mysqli_connect

2011-09-04 Thread Ben
Lester wrote:
Upgraded from what?
 Sounds like the mysqli extension is no longer getting loaded. There will
either be an error saying why, or it is still commented out in the php.ini.

Upgraded from PHP 4.3 and MySQL 4.1.  Was using mysql_connect, but
understand that mysqli is better/supported extension for newer versions, so
am trying to rewrite the code to use mysqli_connect.  For what it's worth,
mysqli_init() also produces Call to undefined function mysqli_init() in my
error logs.

Thanks again,

Ben Miller 



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



[PHP-DB] Are join queries in phpMyAdmin a security hazard?

2010-02-27 Thread Ben Hubbell

Hello,

My web host does not have join queries in phpMyAdmin enabled. My web 
host is inexpensive, but their commitment to costumer service is 
inconsistent. They often dismiss bug reports as feature requests.


When pressed to enable join queries in phpMyAdmin several years ago, my 
web host stated that join queries in phpMyAdmin were a security hazard. 
Do you know if such a security hazard exists?


Regards,

Ben

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



Re: [PHP-DB] newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?

2009-08-05 Thread Ben Dunlap
 except that I just added the ORDER BY clause onto each SELECT segment,
 and now I get this error:
 query failed: Incorrect usage of UNION and ORDER BY
 
 How can I order the results while still doing the UNION ALLs?

You should only need one ORDER BY clause at the end of the whole query:

(SELECT...)
UNION ALL
(SELECT...)
UNION ALL
(SELECT...)
ORDER BY...

I'm not sure if this syntax is portable to other SQL-based DBMSes, though. I'm
certain that one system we use at work doesn't support it, but it's kind of a
dinosaur so I don't like to draw too many conclusions from what it doesn't 
support.

Ben

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



Re: [PHP-DB] newbie: how to return one iteration *per unique date(DAY!)* in a timestamp column?

2009-08-05 Thread Ben Dunlap
 Just one other tiny point of style here: having given the expression
 date(solarAWDateTime) the alias uniqueDate, you should probably use
 that alias to refer to the same thing elsewhere in your query, such as
 in the GROUP BY column.  So:
[8]
 That's a mysqlism :( It's not portable to other db's (apparently it's
 not part of the sql-spec).

I think I've even seen MySQL reject it in some cases.

Ben


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



Re: [PHP-DB] newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?

2009-08-04 Thread Ben Dunlap
 Can someone point me to understand why?  I thought that:
 SELECT COUNT(*) AS landing_count, date(solarLandingDateTime) AS
 solarLandingDate, 't7solar_landingALIAS' AS t7solar_landing FROM
 t7solar_landing GROUP BY DATE(solarLandingDateTime)
 would, among other thing, assign the number of records counted in that
 first table to the alias 'landing_count'.  No?

Yes, but when you UNION that query with others it gets a bit more complicated.
The UNION keyword adds more rows to the result-set, not more columns.

So, when you join queries with a UNION, corresponding columns in each of those
queries should all have the same aliases.

So you probably don't want to say:

SELECT nameABC AS `name1` FROM table1
UNION ALL
SELECT nameDEF AS `name2` FROM table2

Here you're asking the DBMS to give you a result-set with just one column, in
which the column is called `name1` some of the time, and `name2` the rest of
the time. Doesn't make much sense, and MySQL will silently ignore one or the
other of these aliases.

Instead, say:

SELECT nameABC AS `name` FROM table1
UNION ALL
SELECT nameDEF AS `name` FROM table2

This will produce a result-set with just one column, called `name`. The number
of rows in the result-set will equal the number of rows produced by the first
SELECT, plus the number of rows produced by the second SELECT.

Does that help make sense of why you need to add a second column to each query,
with the name of the table? Like so:

SELECT nameABC AS `name`, 'table1' AS `table_name` FROM table1
UNION ALL
SELECT nameDEF AS `name`, 'table2' AS `table_name` FROM table2

This query will produce a result-set with two columns. The first column will be
called `name` and the second will be called `table_name`; for example,
supposing that table1 contains only boys' names and table2 contains only girls'
names, you might get a result-set that includes these rows:


name| table_name

Robert  | table1
James   | table1
Lucy| table2
Teresa  | table2


Then for each row, you would need to examine the value of the `table_name`
column in PHP, to figure out which table the name is from. It looks like your
current code is operating as though each row contains results from all three of
your tables, which it doesn't. Each row only contains a result from one table.

BTW, mysql_fetch_assoc() returns an array, not an object, so you'd need to use
this syntax:

$row['column']

As opposed to:

$row-column

If you prefer the latter syntax, you can use mysql_fetch_object().

Ben

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



Re: [PHP-DB] newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?

2009-08-03 Thread Ben Dunlap
Govinda wrote:
 .. so my thought is to want to do nested query(ies),  where:
  *within* the while loop of the first recordset (which is now
 successfully returning just rows with unique dates), I do other
 query(ies) which will (in their own code block) find all rows of the
 date we are iterating.. so I can, for example, count  number of records
 for each unique date, do math/statistics, etc.

I had to do something similar in code of my own a little while ago, and got
some very good guidance on Stack Overflow. Here's the thread, you might find it
helpful:

http://stackoverflow.com/questions/946214/one-sql-query-or-many-in-a-loop

The user whose answer is marked as the correct one (Quassnoi) also writes a
helpful blog on SQL. You should be able to find the blog by clicking on the
username.

Ben



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



Re: [PHP-DB] newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?

2009-08-03 Thread Ben Dunlap
  ...which will echo:
  trtd#records in 't7solar_landing' matching the given (iterating)
 date  (in the 'solarLandingDateTime' column)/tdtd#records in
 'aw_7solar_confirm' matching the given (iterating) date (in the
 'solarAwConfDateTime' column)/tdtd#records in 'aw_7solar_aw'
 matching the given (iterating) date  (in the 'solarAWDateTime'
 column)/td/tr...

If you just need to count the records with a particular date you should be able
to use this construction:

SELECT COUNT(*) AS `record_count`,
   DATE(date_column) AS `date_field`
FROM table
GROUP BY `date_field`

You could probably write a generalized PHP function (called 'build_query()' or
something) that would construct this query given a table name and a date-column
name, and call it once for each table/column pair.

Then you could stitch the three query strings together, in PHP, into one large
query using SQL's UNION ALL, which concatenates the results of multiple
queries into one large result-set:

(query 1) UNION ALL (query 2) UNION ALL (query 3)

And then pass that one large query to the database.

 So I need to read/learn more MySQL.  Can you guys point me to where in the
 mysql docs I should be burying myself?

In my experience the MySQL manual isn't a great resource for learning SQL, at
the level you're looking for. It's a fine reference if you already have a solid
understanding of the basics. But to get that understanding, you might try the
O'Reilly book called Learning SQL:

http://oreilly.com/catalog/9780596520830/?CMP=AFC-ak_bookATT=Learning+SQL%2c+Second+Edition%2c

Someone else here might know of some good online resources. I've not seen any,
but then I haven't spent a whole lot of time looking. The parts of Learning
SQL that I've seen are excellent.

Ben

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



[PHP-DB] Single Quotes in Form Inputs

2009-07-27 Thread Ben Miller
Hi,

 

I have a form in which my sales reps can add new clients into the database,
but I'm running into a problem if the client's name includes a single quote,
such as O'Henry, when it comes time to input the form data into the database
table.  I'm guessing I need to use ereg_replace, or something similar, to
change the single quote, but I still can't seem to get the syntax right.
Any help would be appreciated.  For what it's worth, here is a shortened
version of what I have:

 

$ firstName = $_POST[form_firstName];

$ lastname = $_POST[form_lastName];

 

$query = mysql_query(INSERT INTO customers (`cust_first`,`cust_last`)
VALUES ('$firstName','$lastName'));

 

Ben Miller

 



[PHP-DB] Date Translation in MySQL

2008-08-05 Thread Ben Miller
I'm looking for a quick and simple way to query a MySQL database by date, or
more specifically, by day of the week.  My dates are stored in the DB in
-MM-DD HH:MM:SS format.  Question, is there a built-in for PHP or MySQL
that will take this column and return only Saturdays, for example, without
having to use PHP to find each of the last X number of Saturdays and then
for each Saturday, query the database?

In case it matters, I am running on PHP v 4.4.7 and MySQL version 4.1.22.

Thanks in advance.



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



RE: [PHP-DB] Date Translation in MySQL

2008-08-05 Thread Ben Miller
Figured there had to be an easier way.  Thank you so much.

-Original Message-
From: Simcha Younger [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2008 2:48 PM
To: php-db@lists.php.net
Subject: RE: [PHP-DB] Date Translation in MySQL


Select * FROM ... WHERE DAYOFWEEK(datecol)=7

-Original Message-
From: Ben Miller [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2008 8:10 PM
To: PHP. DB Mail List
Subject: [PHP-DB] Date Translation in MySQL

I'm looking for a quick and simple way to query a MySQL database by date, or
more specifically, by day of the week.  My dates are stored in the DB in
-MM-DD HH:MM:SS format.  Question, is there a built-in for PHP or MySQL
that will take this column and return only Saturdays, for example, without
having to use PHP to find each of the last X number of Saturdays and then
for each Saturday, query the database?

In case it matters, I am running on PHP v 4.4.7 and MySQL version 4.1.22.

Thanks in advance.



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

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.5.12/1592 - Release Date: 05/08/2008
06:03


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

2008-01-08 Thread Ben Stones
Hello,

I am having another problem with PHP, and I have tried rectifying the
problem with each try failing. The problem I have is, whenever I refresh the
page or visit the URL to where the login form is (which is index.php), it
automatically refreshes to the members page, even if I did not click the
'Submit' button (with or without the correct login details, for that matter,
even if I did click the 'Submit' button). I hope someone will be able to
help me in some way or another to rectify the issue; I have tried seeing all
possibilities of the problem. Once more, I am relatively knew to PHP, so I
appreciate help towards the right direction.

Cheers,
Ben Stones.

(PS: The PHP code is below)

$con = mysql_connect(localhost, ben_test, removed) or
die(mysql_error());
$db = mysql_select_db(ben_test) or die(mysql_error());
$user = $_POST['username'];
$pass = $_POST['password'];
$select_sql = sprintf(SELECT `username` FROM `users` WHERE `username` =
'$user' AND `password` = '$pass', mysql_real_escape_string($user),
mysql_real_escape_string($pass));
$select_sql_two = mysql_query($select_sql);

if($select_sql_two) {
echo 'Redirecting you to members page...';
echo '[meta http-equiv=refresh content=5;url=members.php /]';
}
else {
echo 'Error';
}

I've changed the HTML code, by the way, so it doesn't render the HTML code
in some mail boxes.


[PHP-DB] Another new PHP programmer question...

2008-01-03 Thread Ben Stones
Hello,

Thank you for your help previously everyone, I was able to fix that problem.
The thing now, is that I want to add smileys to the messages; i.e. :) would
equal to a smiley image when posting a message.

$con = mysql_connect(localhost,removed,removed) or die(con);
$db = mysql_select_db(ben_test) or die(db);

$post = $_POST['comment'];

if(empty($post)){
echo font color='red'bPost rejected, field left emptybr
//b/font;
}
else if(is_numeric($post)){
echo font color='red'bPost rejected, numeric data submittedbr
//b/font;
}
else if(preg_match(/www/, $post)) {
echo font color='red'bPost rejected. Advertising is prohibited!br
//b/font;
}

else {
mysql_query(INSERT INTO `comments`(`messages`) VALUES ('$post')) or
die(mysql_error());
}

$mysql_query_one = mysql_query(SELECT * FROM `comments`);
while($rows=mysql_fetch_array($mysql_query_one)) {
echo $rows['messages'] . hr;

I have grasped quite a lot so far, and added many complementry features,
however this is only my first script - so hence it is pretty much basic as
it is!

Thanks once again, hoping someone can assist me further.


[PHP-DB] PHP Beginners Help

2008-01-02 Thread Ben Stones
Hello, my name is Ben Stones. I am quite a beginner to PHP, and as a new
years resolution I am going to learn PHP (finally!)

Cut to the chase I have created a basic looping script that would display
anything submitted in a form, on seperate lines; here is the PHP code:

$con = mysql_connect(localhost,ben_test,--removed-) or
die(con);
$db = mysql_select_db(ben_test) or die(db);
mysql_query(CREATE TABLE `comments` (messages varchar(255)));
$comments = $_POST['comment'];
$sql1 = mysql_query(INSERT INTO `comments` (`messages`) VALUES
($comments));
$mysql_query_one = mysql_query(SELECT * FROM `comments`);
while($rows=mysql_fetch_array($mysql_query_one)) {
echo $rows['messages'] . [br /];
}

Everything went swell for the first half, and after I truncated the test
messages (or everything in the column, if you like), I tried doing one more
test run and upon clicking 'Submit', nothing would display except the
messages I added via phpMyAdmin.

Hope someone could help me.

PS: The password has been edited out of the preceding code as well as the
HTML code purposely for the mailing list.


Re: [PHP-DB] PHP Beginners Help

2008-01-02 Thread Ben Stones
Thanks all for your replies. Much appreciated. I have edited the code and
took points into account:


$con = mysql_connect(localhost,ben_test,removed) or die(con);
$db = mysql_select_db(ben_test) or die(db);
$sql1 = mysql_query(INSERT INTO `comments` (`messages`) VALUES
($comments)) or die(insert);
$mysql_query_one = mysql_query(SELECT * FROM `comments`);
while($rows=mysql_fetch_array($mysql_query_one)) {
echo $rows['messages'] . [br /];

Okay, the browser outputted insert so it has to be something to do with
the insert sql syntax I have added. Not sure if its over-riding the same
content added as before or something.

Any help once again is appreciated.

Thank you,
Ben Stones.

On Jan 3, 2008 3:16 AM, Benjamin Darwin [EMAIL PROTECTED] wrote:

 Ben:

 First, using a $_POST value directly into a MySQL query is EXTREMELY
 unsafe. Always filter data from any source to make sure it's what you
 expect. SQL injection is one of the easiest ways to cause real damage
 to a website. http://en.wikipedia.org/wiki/SQL_injection

 Check out this fuction for making the string safe:
 http://us2.php.net/manual/en/function.mysql-real-escape-string.php
 Also, try and strip out any characters that don't belong in the string
 anyway, just as added security.

 Good luck learning PHP.

 --Another person who happens to be named Ben

 I've also put a few edits in the code.
 On Jan 2, 2008 9:57 PM, Ben Stones [EMAIL PROTECTED] wrote:
  Hello, my name is Ben Stones. I am quite a beginner to PHP, and as a new
  years resolution I am going to learn PHP (finally!)
 
  Cut to the chase I have created a basic looping script that would
 display
  anything submitted in a form, on seperate lines; here is the PHP code:
 
  $con = mysql_connect(localhost,ben_test,--removed-) or
  die(con);
  $db = mysql_select_db(ben_test) or die(db);
  mysql_query(CREATE TABLE `comments` (messages varchar(255)));
  $comments = $_POST['comment'];
  $sql1 = mysql_query(INSERT INTO `comments` (`messages`) VALUES
  ($comments));
 
  $mysql_query_one = mysql_query(SELECT * FROM `comments`);
  while($rows=mysql_fetch_array($mysql_query_one)) {
  echo $rows['messages'] . [br /];
  }
 
  Everything went swell for the first half, and after I truncated the test
  messages (or everything in the column, if you like), I tried doing one
 more
  test run and upon clicking 'Submit', nothing would display except the
  messages I added via phpMyAdmin.
 
  Hope someone could help me.
 
  PS: The password has been edited out of the preceding code as well as
 the
  HTML code purposely for the mailing list.
 



Re: [PHP-DB] Column names into variables

2006-07-26 Thread Ben Hatfield

I believe this does exactly what you want.

http://us3.php.net/extract

Ben Hatfield
Programmer
[EMAIL PROTECTED]

Soapbox Studio, Inc.
469 N. Lake Street
Mundelein, IL 60060
P: +1.847.566.0666 x6#
www.soapboxstudio.com


On Jul 26, 2006, at 12:14 pm, z wrote:


Hi,

I have a table with about 50 columns in it. I'd like to query the
information for one record, and hold the data in variables that  
have the

same name as the column headings, along these lines:

$query = Select * from `postings` where `id` = $userid;
$result = mysql_query($query);
while($row=mysql_fetch_array($result)) {
  $id = $row[id];
  $location = $row[location];
  $employer = $row[employer];
  ...
}

I'd like to do this for all columns in the table, and feel like  
there's a
way to do this automatically, but haven't been able to find the  
function or

syntax to use. Any help is greatly appreciated.

Thanks,
Zeth


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



[PHP-DB] Broken pipe after long db process

2005-10-03 Thread Ben-Nes Yonatan
Hi all,

I wrote a php script which is running very long queries (hours) on a
postgresql database.
I seem to have a problem to run the code when there are single queries
which take long times (like 5 hours for an update query), from the log
of the database I received the following code:

2005-09-30 17:12:13 IDT postgres : LOG:  0: duration: 18730038.678
ms  statement: UPDATE product_temp SET nleft=(SELECT
2005-09-30 17:12:13 IDT postgres : LOCATION:  exec_simple_query,
postgres.c:1035
2005-09-30 17:12:13 IDT postgres : LOG:  08006: could not send data to
client: Broken pipe
2005-09-30 17:12:13 IDT postgres : LOCATION:  internal_flush, pqcomm.c:1050
2005-09-30 17:12:13 IDT postgres : LOG:  08P01: unexpected EOF on client
connection
2005-09-30 17:12:13 IDT postgres : LOCATION:  SocketBackend, postgres.c:287
2005-09-30 17:12:13 IDT postgres : LOG:  0: disconnection: session
time: 6:04:58.52
2005-09-30 17:12:13 IDT postgres : LOCATION:  log_disconnections,
postgres.c:3403

Now after the 5 hours update it need to echo into a log file a line
which say that it ended the current command (just for me to know the times), my
assumption is that PHP read the code into memory at start and opened the
connection to the file, after a time which he waited to any given life
sign he gave up and closed the connection to the file, and when the
code came back to the file it encountered no connection to the file
(broken pipe).

Or a newer assumption... though I did set max_execution_time to 0 (endlessly) 
it does close itself up after waiting to much time for the database response, 
and when the database do respond the php client is closed already and I receive 
the broken pipe error.

Am I correct at my assumption? if so how can I set the PHP to wait how
much I tell him?
Ofcourse if im wrong I would like to know the reason also :)


Thanks in advance,
  Ben-Nes Yonatan


Re: [PHP-DB] Re: writing foreign language chars from php5 to db (mysql4)

2005-08-15 Thread Ben Sytko

Louie,

Try reading through this guide on Unicode. Its going to take a lot more 
than what your doing to get it to work correctly.


http://www.phpwact.org/php/i18n/charsets?s=utf8

-Ben

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



Re: [PHP-DB] redirecting function

2005-03-14 Thread Ben Galin
On Mar 14, 2005, at 2:26 AM, Ken wrote:
On Mon, 14 Mar 2005 01:43:09 -0800 (PST), Yemi Obembe
[EMAIL PROTECTED] wrote:
hi folks,
who knows any function that can do this javascript trick
script
window.location='http://somewhere.com/'
/script
tried header(location:http://somewhere.com/) but it gave me an 
errorinclude() on the other hand only includes the url  doest 
redirect to it...

you forgot the quotation marks on header i believe
header('location: www.foobar.com');
and also make sure your browser supports header redirects, not all 
browsers do.
Also, from http://us4.php.net/header:
Remember that header() must be called before any actual output is 
sent, either by normal HTML tags, blank lines in a file, or from PHP. 
It is a very common error to read code with include(), or require(), 
functions, or another file access function, and have spaces or empty 
lines that are output before header() is called. The same problem 
exists when using a single PHP/HTML file.

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


[PHP-DB] Really Stuck!

2005-01-25 Thread Ben
Hello all,

As a beginner I have been trying to send two attachments from my HTML form.
Below is the code I have been using. The problem is, I seem to only be able
to send one or the other, when I send both, although they go through, the
text I want displayed tags 6110 etc, is also sent as an attachment. Any help
would be greatly appreciated as I have a huge headache!

?php

$to = [EMAIL PROTECTED];
$from = $_POST['from'];
$subject = $_POST['subject'];
$message = ;
if ($t6111 != )
$message .= stripslashes(6111=$t6111\n);
if ($t6110 != )
$message .= stripslashes(6110=$t6110\n);
if ($t6100 != )
$message .= stripslashes(6100=$t6100\n);
if ($t6112 != )
$message .= stripslashes(6112=$t6112\n);
if ($t6101 != )
$message .= stripslashes(6101=$t6101\n);



// Obtain file upload vars
$fileatt  = $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];


$headers = From: $from;

if (is_uploaded_file($fileatt)) {
  // Read the file to be attached ('rb' = read binary)
  $file = fopen($fileatt,'rb');
  $data = fread($file,filesize($fileatt));
  fclose($file);

  // Generate a boundary string
  $semi_rand = md5(time());
  $mime_boundary = ==Multipart_Boundary_x{$semi_rand}x;

  // Add the headers for a file attachment
  $headers .= \nMIME-Version: 1.0\n .
  Content-Type: multipart/mixed;\n .
   boundary=\{$mime_boundary}\;

  // Add a multipart boundary above the plain message
  $message = This is a multi-part message in MIME format.\n\n .
 --{$mime_boundary}\n .
 Content-Type: text/plain; charset=\iso-8859-1\\n .
 Content-Transfer-Encoding: 7bit\n\n .
 $message . \n\n;

  // Base64 encode the file data
  $data = chunk_split(base64_encode($data));

  // Add file attachment to the message
  $message .= --{$mime_boundary}\n .
  Content-Type: {$fileatt_type};\n .
   name=\{$fileatt_name}\\n .
  //Content-Disposition: attachment;\n .
  // filename=\{$fileatt_name}\\n .
  Content-Transfer-Encoding: base64\n\n .
  $data . nn;
}


$fileattt  = $_FILES['fileattt']['tmp_name'];
$fileattt_type = $_FILES['fileattt']['type'];
$fileattt_name = $_FILES['fileattt']['name'];

$headers = From: $from;

if (is_uploaded_file($fileattt)) {
  // Read the file to be attached ('rb' = read binary)
  $file = fopen($fileattt,'rb');
  $data = fread($file,filesize($fileattt));
  fclose($file);

  // Generate a boundary string
  $semi_rand = md5(time());
  $mime_boundary = ==Multipart_Boundary_x{$semi_rand}x;

  // Add the headers for a file attachment
  $headers .= \nMIME-Version: 1.0\n .
  Content-Type: multipart/mixed;\n .
   boundary=\{$mime_boundary}\;

  // Add a multipart boundary above the plain message
  $message = This is a multi-part message in MIME format.\n\n .
 --{$mime_boundary}\n .
 Content-Type: text/plain; charset=\iso-8859-1\\n .
 Content-Transfer-Encoding: 7bit\n\n .
 $message . \n\n;

  // Base64 encode the file data
  $data = chunk_split(base64_encode($data));

  // Add file attachment to the message
  $message .= --{$mime_boundary}\n .
  Content-Type: {$fileattt_type};\n .
   name=\{$fileattt_name}\\n .
  //Content-Disposition: attachment;\n .
  // filename=\{$fileatt_name}\\n .
  Content-Transfer-Encoding: base64\n\n .
  $data . nn;

}
// Send the message
$ok = @mail($to, $subject, $message, $headers);
if ($ok) {
  header (Location: http://www.tlwebsolutions.co.uk/form/;);
}
? 

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



RE: [PHP-DB] RE: php-db Digest 16 Jan 2005 13:41:28 -0000 Issue 2777

2005-01-17 Thread Ben
 All,

I am needing to send two attachments from my form. Both fields are called
'fileatt' and 'fileatt1'. Below is the script i wrote to attach 'fileatt'
but i am unsure on how to attach 'fileatt1'. Can I just add fileatt1 or do I
need to rethink how I do it?

Many thanks 


// Obtain file upload vars
$fileatt = $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];

$headers = From: $from;

if (is_uploaded_file($fileatt)) {
// Read the file to be attached ('rb' = read binary)
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);

// Generate a boundary string
$semi_rand = md5(time());
$mime_boundary = ==Multipart_Boundary_x{$semi_rand}x;

// Add the headers for a file attachment
$headers .= \nMIME-Version: 1.0\n .
Content-Type: multipart/mixed;\n .
 boundary=\{$mime_boundary}\;

// Add a multipart boundary above the plain message
$message = This is a multi-part message in MIME format.\n\n .
--{$mime_boundary}\n .
Content-Type: text/plain; charset=\iso-8859-1\\n .
Content-Transfer-Encoding: 7bit\n\n .
$message . \n\n;

// Base64 encode the file data
$data = chunk_split(base64_encode($data));

// Add file attachment to the message
$message .= --{$mime_boundary}\n .
Content-Type: {$fileatt_type};\n .
 name=\{$fileatt_name}\\n .
//Content-Disposition: attachment;\n .
// filename=\{$fileatt_name}\\n .
Content-Transfer-Encoding: base64\n\n .
$data . \n\n .
--{$mime_boundary}--\n;

}



// Send the message
$ok = @mail($to, $subject, $message, $headers);
if ($ok) {
header (Location: http://www.tlwebsolutions.co.uk/form/;);
}
?

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



[PHP-DB] '

2005-01-17 Thread Ben
Hi all,

When I submit my forms, if any textfield contains a ' the result comes back
with /'

Is there anyway of stopping this?

Thanks

Ben

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



[PHP-DB] Adding more than one attachement.

2005-01-10 Thread Ben
Hello all,

I am quite a beginner at all this, but I have got a form where I need two
attachments being sent. I have got one working but unsure how to add another
one. The form field names are fileatt and fileatt1. fileatt is attached my
the following code:

if (is_uploaded_file($fileatt)) {
  // Read the file to be attached ('rb' = read binary)
  $file = fopen($fileatt,'rb');
  $data = fread($file,filesize($fileatt));
  fclose($file);

  // Generate a boundary string
  $semi_rand = md5(time());
  $mime_boundary = ==Multipart_Boundary_x{$semi_rand}x;
  
  // Add the headers for a file attachment
  $headers .= \nMIME-Version: 1.0\n .
  Content-Type: multipart/mixed;\n .
   boundary=\{$mime_boundary}\;

  // Add a multipart boundary above the plain message
  $message = This is a multi-part message in MIME format.\n\n .
 --{$mime_boundary}\n .
 Content-Type: text/plain; charset=\iso-8859-1\\n .
 Content-Transfer-Encoding: 7bit\n\n .
 $message . \n\n;

  // Base64 encode the file data
  $data = chunk_split(base64_encode($data));

  // Add file attachment to the message
  $message .= --{$mime_boundary}\n .
  Content-Type: {$fileatt_type};\n .
   name=\{$fileatt_name}\\n .
  //Content-Disposition: attachment;\n .
  // filename=\{$fileatt_name}\\n .
  Content-Transfer-Encoding: base64\n\n .
  $data . \n\n .
  --{$mime_boundary}--\n;

Many thanks

Ben

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



[PHP-DB] New to the Mailing List

2004-12-23 Thread Ben
Morning all.

I attach a document, which is used to send an email with attachments. What I
need to do though, is if a form field is left blank, then that tag is not
included in the email. Any clues anybody?

It is vital that no information is sent for blank fields because it goes to
a system that would reject and email that has tags eg '1010: '

Many thanks in advance

Ben


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

RE: [PHP-DB] New to the Mailing List

2004-12-23 Thread Ben
Thanks Graeme, but I am only a real novice at this. This was te first real
PHP I have tried to do. If you could let me know in a little more detail,
that would be most appreciative.

Merry christmas ;-)

-Original Message-
From: graeme [mailto:[EMAIL PROTECTED] 
Sent: 23 December 2004 09:04
To: [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] New to the Mailing List


Try using the if statement.

Ben wrote:

Morning all.

I attach a document, which is used to send an email with attachments. 
What I need to do though, is if a form field is left blank, then that 
tag is not included in the email. Any clues anybody?

It is vital that no information is sent for blank fields because it 
goes to a system that would reject and email that has tags eg '1010: '

Many thanks in advance

Ben


  


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



[PHP-DB] PHP Oracle Authentication using UNIX user account

2004-10-04 Thread Ben Gill
Hi,

 

My DBA's preferred authentication method is to set up a UNIX user
account (i.e. userA) and let them login without using plaintext password
authentication, ie. The user has to be logged in, they can then run (for
example) sqlplus /  and that will log them into the correct database.

 

This is to prevent having to specify a username / password in a PHP
script (or a config file that gets loaded).  If the username / password
is visible in the script, then someone can login and start making manual
edits to the data using sql commands.

 

To implement this, I have ensured my apache instance is running as
'userA' and I have tried all sorts of combinations of things username =
 password = , username = / password = , username=/ password
=/ etc.. to get this working (It works fine from the command line) but
the OCILogon function requires a username and a password, so is not
happy.

 

One solution to this is that the DBA opens up the DB to plaintext
authentication, I store the username / password in a config file with
read only permissions (only for the owner, userA), and then only someone
who knows userA's password can login and view this config file.  But
that does not fit in with the way my DBA wants me to authenticate.

 

Has anyone got a solution for this?

 

Regards



RE: [PHP-DB] PHP Oracle Authentication using UNIX user account

2004-10-04 Thread Ben Gill
Hi Roy,

 

-  Yes the web server is on a different machine

-  I think remote OS auth is allowed as when I login to the DB
from another host using / it works fine.  (obviously logged in as userA
still)

 

 

My DBA suggested I might have to use SSH in some way but I have not
found any docs in setting up the authentication in this way...

 

I would not want to prompt the user for a username/password each time
the DB needs updating either..

 

It seems making the config file read only (by userA, the apache runtime
user) or encrypting the DB password within the config file is the best
option so far.

 

But as the problem has already been solved by Oracle and UNIX I was
hoping the solution would be at the O/S level (or at most exporting a
few ORA vars so the apache runtime picks it up), rather than at the
application software level. 

 

  _  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 04 October 2004 15:48
To: Ben Gill
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] PHP Oracle Authentication using UNIX user account

 


A couple notes / assumptions .. 

(1) The web server is on a different machine then database 
(2) The DB is not allowing remote OS authentication and only local OS
authentication 

If these are not true then some of my comments will be invalid 

(1) The above config will not work as the web-to-db conn is not
authenticated locally 
(2) If remote OS auth is allow that is more of a security risk .. (can
be mitigated) 
(3) If the php files are secured on the server that mitigates risk 
(4) Network traffic can be encrypted to prevent passwords being sent in
plain text 
But if network is compromised all non-secure traffic is
compromised (ftp/telnet/etc) 

My solution 
(1) No remote OS Auth 
(2) Trust network 
(3) I am only person that has access to web server (Web/DB/OS admin) 
(4) Use a 'generic' account for general web access that only has the
following privs 
- CREATE SESSION 
- SELECT on tables needed (via ROLE or direct as required) 
(5) If a user needs to modify data allow a method for them to be
prompted for username/password for database connection 

== 
If the web server  db server are the same box then local OS auth would
be fine.  I have not done this before since I like to separate my
resources for High Avail reasons.  I am now intrigued and will research
it.


Roy A. Jones 

  _  

US Pharma Database Administration 
GlaxoSmithKline Inc. US Pharma IT, Shared Services 

  _  

Email: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]  

  _  





Ben Gill [EMAIL PROTECTED] 

04-Oct-2004 10:30 



To

[EMAIL PROTECTED] 

cc

 

Subject

[PHP-DB] PHP Oracle Authentication using UNIX user account

 

 

 




Hi,



My DBA's preferred authentication method is to set up a UNIX user
account (i.e. userA) and let them login without using plaintext password
authentication, ie. The user has to be logged in, they can then run (for
example) sqlplus /  and that will log them into the correct database.



This is to prevent having to specify a username / password in a PHP
script (or a config file that gets loaded).  If the username / password
is visible in the script, then someone can login and start making manual
edits to the data using sql commands.



To implement this, I have ensured my apache instance is running as
'userA' and I have tried all sorts of combinations of things username =
 password = , username = / password = , username=/ password
=/ etc.. to get this working (It works fine from the command line) but
the OCILogon function requires a username and a password, so is not
happy.



One solution to this is that the DBA opens up the DB to plaintext
authentication, I store the username / password in a config file with
read only permissions (only for the owner, userA), and then only someone
who knows userA's password can login and view this config file.  But
that does not fit in with the way my DBA wants me to authenticate.



Has anyone got a solution for this?



Regards





Re: [PHP-DB] Re: Mass mail

2004-09-20 Thread Ben Galin
On Sep 20, 2004, at 7:13 AM, Manuel Lemos wrote:
Now, for the actual composing and sending of the newsletters, there 
are some optimizations that can be done depending on whether the 
newsletters  are going to be personalized (avoid it at all costs if 
you can) or not.
May I ask why?  Are you referring to the additional time it would take 
the script to run or to a security issue or something else?

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


[PHP-DB] letting a table name be a constant

2004-08-23 Thread Ben Galin
Hello,
Regarding this code:
[PHP code]
  // This works
  $name=name;
  $table=mytable;
  $mysql_connect(localhost,,) or die(Error: .mysql_error());
  $mysql_select_db(mydb) or die(Error: .mysql_error());
  $mysql_query(INSERT INTO $table (`id`,`name`) VALUES ('','$name'));
[/PHP code]
I want to define() TABLE as a constant instead of using the variable 
$table

[PHP code]
  // This runs without an error but does *not* insert a new row
  $name=name;
  define(TABLE, mytable);
  $mysql_connect(localhost,,) or die(Error: .mysql_error());
  $mysql_select_db(mydb) or die(Error: .mysql_error());
  $mysql_query(INSERT INTO TABLE (`id`,`name`) VALUES ('','$name'));
[/PHP code]
Changing the query line to
  $mysql_query(INSERT INTO `TABLE` (`id`,`name`) VALUES ('','$name'));
or
  $mysql_query(INSERT INTO 'TABLE' (`id`,`name`) VALUES ('','$name'));
has no effect.
I also tried to
  define(TABLE, `mytable`);
which, too, didn't work.
Would appreciate any advice,
 Ben
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] letting a table name be a constant

2004-08-23 Thread Ben Galin
On Aug 23, 2004, at 8:12 PM, John Holmes wrote:
You can't have a constant in a string. You'd do it like this:
mysql_query(INSERT INTO  . TABLE .  (`id`,`name`) VALUES 
('','$name'));
Thanks, John and Justin.  Wasn't thinking about that.
The other error you have, and I don't know how you think this code 
runs, are the dollar signs before mysql_connect(), mysql_select_db() 
and mysql_query() are not needed.
You're right.  It doesn't run.  I retyped instead of copy-and-paste'd; 
that's a typo.

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


[PHP-DB] retry, this time with code [was: [PHP-DB] [newbie] Form to email *and* insert row to MySQL]

2004-08-13 Thread Ben Galin
My last email shows on the archive but it also bounced back to me so I 
am reposting it.  Sorry of this is a double-post.

Also, I am adding this time the source code down below which I should 
have probably done last time around.

Any help is much appreciated, Ben.
repost
Hello guys,
I have an HTML form with the action attribute set to the famous
FormMail.pl and it works beautifully.  However, I also want to insert
the data into a MySQL database.
Initially, I thought that I would let FormMail validate the data, send
the email, and then redirect to a PHP script that would use the $_POST
array to INSERT it into my db [see source below].  Of course, it didn't 
work.  AFAICT, both
the FormMail script and the PHP script need to be called from the form's
action attribute.

1 - Is there a way to call them both?
 From lurking around and reading tutorials, I understand that it is
possible to send emails with PHP and that I don't need to use FormMail
at all.  However, I have been told that FormMail is a relatively safe
script that won't let hackers exploit either the server or myself.  I
am not quite sure what such exploits might be, but I trust that the
hackers are...
2 - If I am to drop FormMail, what PHP script should I use to protect
my, and the server's, security?
Which brings us to the next point: the PHP script that I currently use
is very straightforward ([see below]) and the subuser has
only INSERT privileges.
3 - Am I putting anything (db, server) in a danger with this script?
Cheers,
  Ben
/repost
source
  [HTML Form]
  form method=post action=http://site.com/cgi-bin/FormMail.pl; /
  input type=hidden name=redirect 
value=http://site.com/script.php; /
  input type=hidden name=required value=realname /
  pName: input type=text name=realname size=35 //p
  [...]

  [script.php]
  $name = $_POST['realname'];
  mysql_connect(localhost, subuser, password)or die(ERROR: 
.mysql_error());
  mysql_select_db(my_db)or die(ERROR: .mysql_error());
  mysql_query(INSERT INTO `my_table` (`id`, `name`) VALUES 
('','$realname'));
  header('Location: http://site.com/thankyou.html');
/source

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


[PHP-DB] [newbie] Form to email *and* insert row to MySQL

2004-08-12 Thread Ben Galin
Hello guys,
I have an HTML form with the action attribute set to the famous 
FormMail.pl and it works beautifully.  However, I also want to insert 
the data into a MySQL database.

Initially, I thought that I would let FormMail validate the data, send 
the email, and then redirect to a PHP script that would use the $_POST 
array to INSERT it into my db.  Of course, it didn't work.  AFAICT, both 
the FormMail script and the PHP script need to be called from the form's 
action attribute.

1 - Is there a way to call them both?
From lurking around and reading tutorials, I understand that it is 
possible to send emails with PHP and that I don't need to use FormMail 
at all.  However, I have been told that FormMail is a relatively safe 
script that won't let hackers exploit either the server or myself.  I 
am not quite sure what such exploits might be, but I trust that the 
hackers are...

2 - If I am to drop FormMail, what PHP script should I use to protect 
my, and the server's, security?

Which brings us to the next point: the PHP script that I currently use 
is very straightforward (connect, select_db, INSERT) and the subuser has 
only INSERT privileges.

3 - Am I putting anything (db, server) in a danger with this script?
Cheers,
 Ben
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] php-db@lists.php.net is currently protecting themselves from receiving junk mail using Spamcease Just this once, click the link below so I can receive your emails.

2004-08-05 Thread Ben Riddell
Spamcease is whitelist software for controlling Spam.  It maintains a list 
of people from whom the recipient wishes to receive email.  If you're not 
on the list, your email won't get through.

It's called a challenge/response system.
For each email sent to someone running spamcease, the server automatically 
issues a challenge email back to the sender to prove that s/he is a 
person and not a spambot.  The original sender clicks on the link in 
response (something a spambot can't do), and your email address is added 
to the list of people whose email gets through.

They are a pain in the tuchus for listservs and the like, unless the person 
running the program sets the parameters correctly to allow email addressed 
to the list to get through, otherwise, each person on the list has to go 
through the challenge and response procedure.

HTH,
-Ben
At 02:13 PM 8/5/2004, Mark wrote:
It is bogus. If you notice, your emails still go to the list. Someone
did this to php-general a bit ago. You can ignore it. There was
speculation that it was an email harvester, checking to verify that
return addresses are valid.
--- Colin Kettenacker [EMAIL PROTECTED] wrote:
 I got this for the PHP-General list. I think it's bogus but it
 would be nice
 to get a confirmation from the list admin.

 ck
 --
 Cheap Domain Registration | Web Hosting | Email Packages | + more
 Fantastic prices -- Even better service.
 http://www.hosttohost.net


 Pablo M. Rivas [EMAIL PROTECTED] on 8/4/04 9:57 AM wrote:

  Hello Josh,
 
  JAM What is this?
 
  JAM I received this E-Mail, and the link goes to something other
 than PHP.net
 
  JAM [EMAIL PROTECTED] is currently protecting themselves from
 receiving
  junk
  JAM mail using Spamcease Just this once, click the link below so
 I can
  receive
  JAM your emails.
  JAM You won't have to do this again.
 
 
  CLICK THE LINK SO HE CAN RECEIVE YOUR MAIL, and you won't have to
  do this again ;)
---
 Ben Riddell --
--- Freelance Web Developer ---
- ben at thewhitebear dot com -
 www.thewhitebear.com -
 510/332.2979 -
---


Re: [PHP-DB] php-db@lists.php.net is currently protecting themselves from receiving junk mail using Spamcease Just this once, click the link below so I can receive your emails.

2004-08-05 Thread Ben Riddell
I'm going to revise this, because I just got the confirmation 
email.  People should not click on the link.

The link that it wants me to click on is 
http://www.tgpwizards.com/spamcease2/verify.php?id=3800307http://www.tgpwizards.com/spamcease2/verify.php?id=[xxx]

A quick check of the domain - http://www.tgpwizards.com - leads me to 
believe something else is happening that ain't so legit.

This should be forwarded to the list admin...
-Ben
At 02:39 PM 8/5/2004, Ben Riddell wrote:
Spamcease is whitelist software for controlling Spam.  It maintains a list 
of people from whom the recipient wishes to receive email.  If you're not 
on the list, your email won't get through.

It's called a challenge/response system.
For each email sent to someone running spamcease, the server automatically 
issues a challenge email back to the sender to prove that s/he is a 
person and not a spambot.  The original sender clicks on the link in 
response (something a spambot can't do), and your email address is added 
to the list of people whose email gets through.

They are a pain in the tuchus for listservs and the like, unless the 
person running the program sets the parameters correctly to allow email 
addressed to the list to get through, otherwise, each person on the list 
has to go through the challenge and response procedure.

HTH,
-Ben
At 02:13 PM 8/5/2004, Mark wrote:
It is bogus. If you notice, your emails still go to the list. Someone
did this to php-general a bit ago. You can ignore it. There was
speculation that it was an email harvester, checking to verify that
return addresses are valid.
--- Colin Kettenacker [EMAIL PROTECTED] wrote:
 I got this for the PHP-General list. I think it's bogus but it
 would be nice
 to get a confirmation from the list admin.

 ck
 --
 Cheap Domain Registration | Web Hosting | Email Packages | + more
 Fantastic prices -- Even better service.
 http://www.hosttohost.net


 Pablo M. Rivas [EMAIL PROTECTED] on 8/4/04 9:57 AM wrote:

  Hello Josh,
 
  JAM What is this?
 
  JAM I received this E-Mail, and the link goes to something other
 than PHP.net
 
  JAM [EMAIL PROTECTED] is currently protecting themselves from
 receiving
  junk
  JAM mail using Spamcease Just this once, click the link below so
 I can
  receive
  JAM your emails.
  JAM You won't have to do this again.
 
 
  CLICK THE LINK SO HE CAN RECEIVE YOUR MAIL, and you won't have to
  do this again ;)
---
 Ben Riddell --
--- Freelance Web Developer ---
- ben at thewhitebear dot com -
 www.thewhitebear.com -
 510/332.2979 -
---
---
 Ben Riddell --
--- Freelance Web Developer ---
- ben at thewhitebear dot com -
 www.thewhitebear.com -
 510/332.2979 -
---


Re: [PHP-DB] mysql_error() (was Re: Getting last insert id?)

2003-10-10 Thread Ben Edwards
On Thu, 2003-10-09 at 17:35, pete M wrote:
 http://www.php.net/manual/en/function.mysql-error.php
 
 Ben Edwards wrote:
 
  On Thu, 2003-10-09 at 16:33, pete M wrote:
  
 $new_id = mysql_query('select last_insert_id()');
 
 your can also user it within a query - eg
 
 $sql = ' insert into related table parent_id, data , data2) values 
 (last_insert_id(), 23, 45);
 
  
  
  Is there also a similar way of getting the last error message, i.e.
  
  $new_id = mysql_query('select error()');
  
  I currently am trying to solve the problem or mysql_error() returning
  nothing after an error.  It may be something to do with globals and
  something like the above may help.
  
  Ben

This I know, its just that the function always returns nothing so I was
looking for an alternative way of getting the error.
-- 

* Ben Edwards   Tel +44 (0)1179 553 551  ICQ 42000477  *
* Homepage - nothing of interest here   http://gurtlush.org.uk *
* Webhosting for the masses http://www.serverone.co.uk *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Fun corporate graphics http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *


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



Re: [PHP-DB] mysql_error() (was Re: Getting last insert id?)

2003-10-09 Thread Ben Edwards
On Thu, 2003-10-09 at 16:33, pete M wrote:
 $new_id = mysql_query('select last_insert_id()');
 
 your can also user it within a query - eg
 
 $sql = ' insert into related table parent_id, data , data2) values 
 (last_insert_id(), 23, 45);
 

Is there also a similar way of getting the last error message, i.e.

$new_id = mysql_query('select error()');

I currently am trying to solve the problem or mysql_error() returning
nothing after an error.  It may be something to do with globals and
something like the above may help.

Ben
-- 

* Ben Edwards   Tel +44 (0)1179 553 551  ICQ 42000477  *
* Homepage - nothing of interest here   http://gurtlush.org.uk *
* Webhosting for the masses http://www.serverone.co.uk *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Fun corporate graphics http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *


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



[PHP-DB] mysql_error() returning nothing

2003-10-08 Thread Ben Edwards
I have been having this problem for a long time.  A while ago I wrote
the below functions to handle database errors.  They used to display the
message and email it to me.  Now mysql_error() returns nothing!

Any help would be greatly appreciated, as you can imagine this is
causing a lot of problems.

Are they any other ways of getting the error?

Ben

  function query_db( $sql, $db ) {
$result = mysql_query( $sql, $db ) or
  error_db( $sql, $db );
return $result;
  }

  function error_db( $sql, $db ) {

  global $SERVER_NAME, $SCRIPT_NAME;

  table_top( Database Error );

  table_middle();

  $sqlerr = mysql_error( $db );

  echo bSQL:/b:BR$sqlbrbError:/bBR$sqlerr;

  table_bottom();

  // Clost of table/html from calling script
  table_bottom();
  html_footer();

  // Send error via email

  $msg  =
Application error has accured on CriticalDistribution
instalation .
on '$SERVER_NAME'. The error message is :-\n\n.
SQL:$sql\n\nError:$sqlerr\n\n.
This message was .
generated by '$SERVER_NAME/$SCRIPT_NAME';

  $subj = CritDist App error from $SERVER_NAME;

  // Hard coded to minimize chance of this module erroring
  $to   = CriticalDistribution [EMAIL PROTECTED];
  $from = From: .$to;

  mail($to, $subj, $msg, $from);

  die();
  }


-- 

* Ben Edwards   Tel +44 (0)1179 553 551  ICQ 42000477  *
* Homepage - nothing of interest here   http://gurtlush.org.uk *
* Webhosting for the masses http://www.serverone.co.uk *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Fun corporate graphics http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *


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



Re: [PHP-DB] mysql_error() returning nothing

2003-10-08 Thread Ben Edwards
Don't think globals are off on our server, not having to use $_GET etc.

If they were turned of how would I access the MySQL error message?

Ben

On Wed, 2003-10-08 at 15:59, mike karthauser wrote:
 on 8/10/03 3:04 pm, Ben Edwards at [EMAIL PROTECTED] wrote:
 
  Any help would be greatly appreciated, as you can imagine this is
  causing a lot of problems.
 
 Hi ben,
 What version of php are you running? I notice you are using globals. Its
 likely that globals have been turned off on your server.
-- 

* Ben Edwards   Tel +44 (0)1179 553 551  ICQ 42000477  *
* Homepage - nothing of interest here   http://gurtlush.org.uk *
* Webhosting for the masses http://www.serverone.co.uk *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Fun corporate graphics http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *


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



RE: [PHP-DB] SELECT FROM 2 or more tables

2003-08-20 Thread Ben Lake
Hehe, ok, that was bad there for a second :)

Ben

-Original Message-
From: Brian Dailey [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 20, 2003 3:24 PM
To: Ben Lake; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] SELECT FROM 2 or more tables


No, he meant rarely want to join entire tables without a cross
referencing ID column.

That's definitely something you wouldn't want to do very often. It's
impractical and 
extremely inefficient.

Ben Lake wrote:

 Rarely want to do joins? That's a new one.
 
 Ben
 
 -Original Message-
 From: Brent Baisley [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 20, 2003 3:04 PM
 To: John Ryan
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] SELECT FROM 2 or more tables
 
 
 A join merges every record in one table with every record in another
 table, which is something you rarely want to do. So you want to set a 
 filter on the merged records, which can be anything, but is usually a 
 match between a field in one table and a field in another table.
 
 That's a join in two sentences or less.
 
 On Wednesday, August 20, 2003, at 03:41 PM, John Ryan wrote:
 
 
I cant grasp JOIN for the life of me


-- 
- Brian Dailey


- HyperSoft Support
- http://www.hypersoft.net



-- 
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] PHP5.0, MySQL4.1, Apache2 on WinXP

2003-07-22 Thread Ben Lake
PHP 5.0 doesn't come with mysql support... You have to get the libraries
yourself... I think u can get them from mysql.com

Might have to pay? I haven't totally figure out the implications of the
no mysql in PHP 5.0 yet, but I know its not there.

Ben

-Original Message-
From: Kai [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 22, 2003 4:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP5.0, MySQL4.1, Apache2 on WinXP


I am having the hardest time getting PHP to install it's MySQL dll
handlers, even tho it's supposed to be embedded, it refuses to do
anything with MySQL.

(Constant PHP Fatal error:  Call to undefined function:
mysql_connect() in C:\apache\Apache2\htdocs\example\index.php3 on line
8 killing the test
script)

I am kinda new to the php language, but I know I have it coded right in
the file I am using, any clues on where/how I can get the MySQL PHP dlls
to work right in this situation?

oh, PHP works fine otherwise, as does apache and mysql in any other
respects.

the by-hand-install directions in the install.txt that came with php5
have been followed and double checked multiple times.

Thanks for any help I can get,
-Kai



-- 
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] Re: problem with starting a session

2003-07-15 Thread Ben Tauler
You cannot write anything out before the session_start() call.
The error tells you that you have written something at:

output started at c:\inetpub\wwwroot\ads4u\data_valid_fns.php:25

Check for any echo, print or html output before session_start()

Hope that helps,

Ben


Ahmed Abdelaliem [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 hi,
 i have a problem with starting a session in the page that validates the
user
 input and sends it tothe database,
 when the user clicks register he gets this error

 Warning: session_start(): Cannot send session cookie - headers already
sent
 by (output started at c:\inetpub\wwwroot\ads4u\data_valid_fns.php:25) in
 c:\inetpub\wwwroot\ads4u\register_new.php on line 89

 Warning: session_start(): Cannot send session cache limiter - headers
 already sent (output started at
 c:\inetpub\wwwroot\ads4u\data_valid_fns.php:25) in
 c:\inetpub\wwwroot\ads4u\register_new.php on line 89


 and here is the code i wrote :

 ?
  $email=$HTTP_POST_VARS['email'];
  $passwd=$HTTP_POST_VARS['passwd'];
  $passwd2=$HTTP_POST_VARS['passwd2'];
  $title=$HTTP_POST_VARS['title'];
  $name1=$HTTP_POST_VARS['name1'];
  $name2=$HTTP_POST_VARS['name2'];
  $phone=$HTTP_POST_VARS['phone'];
  $mobile=$HTTP_POST_VARS['mobile'];
  $address1=$HTTP_POST_VARS['address1'];
  $address2=$HTTP_POST_VARS['address2'];
  $town=$HTTP_POST_VARS['town'];
  $pb=$HTTP_POST_VARS['pb'];
  $country=$HTTP_POST_VARS['country'];
  $occupation=$HTTP_POST_VARS['occupation'];

 session_start();


 if (!filled_out($HTTP_POST_VARS)){
 echo You Haven't filled your registeration details correctly, Please
go
 back and try again;
 exit;
 }

 if (!valid_email($email)){
 echo That is not a valid email address. Please go back and try
again.;
 exit;
 }
 if ($passwd != $passwd2){
 echo The passwords you entered do not match - please go back and try
 again.;
 exit;
 }

 if (strlen($passwd)6 || strlen($passwd) 16){
 echo Your password must be between 6 and 16 characters Please go back
 and try again.;
 exit;
 }




 can anyone tell me please where is the problem and how to solve it,

 i test those scripts on my local server IIS, i use windows XP and last
 version of PHP and MYSQL,




 thanks

 _
 MSN 8 with e-mail virus protection service: 2 months FREE*
 http://join.msn.com/?page=features/virus




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



RE: [PHP-DB] Backing up entire database...

2003-07-04 Thread Ben Lake
http://www.mysql.com/doc/en/mysqldump.html

www.mysql.com - Documentation - search = answers

Ben

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Friday, July 04, 2003 4:02 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Backing up entire database...


I wanna back up my MySQL database in preperation for this:

==
http://www.securityfocus.com/news/6219
http://www.counterpane.com/alert-t20030702-001.html
http://news.ists.dartmouth.edu/todaysnews.html#internal10656

SANS (http://isc.incidents.org/) says on site
http://isc.sans.org/diary.html =

I use phpmyadmin, and have about 15 databases, with multiple tables in 
each...
I wanna be able to back up everything, as I can do individually when in 
the specific database view...
But just do the whole thing in one go...
I know by the tme I get an answer, I could've just done each one anyway,

but I'm curious... ;-)

Is this possible?

*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***



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



RE: [PHP-DB] hmmm

2003-07-01 Thread Ben Lake
WTF does To unsubscribe, visit: http://www.php.net/unsub.php; at the
bottom of every e-mail mean to you idgit?

Ben

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 01, 2003 4:38 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] hmmm




YOU FUCKING SHIT!!! UNSUBSCRIBE MY EMAIL PLEASE !!! GOD VERDOMME !!! 

UNSUBSCRIBE IT NOW,MOTHER FUCKER 


BABI LOE BANGSAT LOE KONTOL LOE !!! SIKTIR GIT!!! YALLA!!! 

HOER !!! GO AWAY FROM MY MAIL BOX WILL YA!!! FUCK SHIT U BASTARD MOTHER
FUCKER 
ASSHOLE !!! 

PECUN LOE BABI LOE JANCUK !!!

--

-- 
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] No MySQL Support in PHP5 - Uh oh!

2003-06-29 Thread Ben Lake
Howdy All,

Anyone have an input on the recent announcement that about MySQL
libraries not being present in PHP 5. What other means might be
available to connect to MySQL?

I took a look at the MySQL license, and I am assuming it was the change
to the MySQL drivers needing a commercial license to be used that is
causing all of the fuss?

Correct me if I'm wrong, just trying to figure out what's going to
happen to some legacy stuff when 5 hits the fan!

Thanks,

Ben Lake


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



[PHP-DB] mysql_error problem

2003-06-24 Thread Ben Edwards
I am using the below function (error_db) witch is called thus:-

  function query_db( $sql, $db ) {
$result = mysql_query( $sql, $db ) or
  error_db( $sql, $db );
return $result;
  }
But $sqlerr is always blank (it is set with  '$sqlerr = mysql_error( $db 
);').  Any idea why?

Ben

  function error_db( $sql, $db ) {

global $SERVER_NAME;
global $SCRIPT_NAME;
table_top( Database Error );

table_middle();

$sqlerr = mysql_error( $db );

echo bSQL:/b:BR$sqlbrbError:/bBR$sqlerr;

table_bottom();

// Clost of table/html from calling script
table_bottom();
html_footer();
// Send error via email

$msg  =
  Database error has accured on $SERVER_NAME\n\n..
  The error message is :-\n\n.
  SQL:$sql\n\nError:$sqlerr\n\n.
  This message was .
  generated by '$SERVER_NAME$SCRIPT_NAME';
$subj = Database error from $SERVER_NAME;

// Hard coded to minimize chance of this module erroring
$to   = [EMAIL PROTECTED];
$from = From: .$to;
mail( $to, $subj, $msg, $from );

die();
  }

* Ben Edwards   Tel +44 (0)1179 553 551  ICQ 42000477  *
* Homepage - nothing of interest here   http://gurtlush.org.uk *
* Webhosting for the masses http://www.serverone.co.uk *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Fun corporate graphics http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *

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

[PHP-DB] MySQL or Postgres

2003-03-24 Thread Ben Edwards
Could someone please point me in the correct direction for a decent 
comparison of the two in respect of:-

  Reliability
  Scalability
  Speed
  Functionality
These are actually in order or importance to me (I know both are fairly fast).

I am also interested in how easy it would be to migrate from MySQL to 
Postgress.

Proples general experiences/comments also welcome.

Beb


* Ben Edwards  +44 (0)117 968 2602 *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Smashing the Corporate image   http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8 *


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003

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

RE: [PHP-DB] MySQL or Postgres

2003-03-24 Thread Ben Edwards
Where MySQL loses points in the daemon robustness department, it makes up 
for it by apparently never corrupting its data files. The last thing you 
want is your precious data files fouled randomly, and MySQL does well here. 
In over a year of running MySQL, I haven't ever seen a single case of 
database or index corruption. In the same timeframe, I have done 2 or 3 
recoveries of a couple different Postgres databases. (irregardless, backups 
are always your best friend, as shown by the database fiasco here on 
PHPBuilder) 

This clinched it.  Although I was keen to use postages due to its better 
functionality, the issue with it corrupting data files means I will be 
going for MySQL.

At 12:04 24/03/2003 +0100, Snijders, Mark wrote:

sorry the url I gave was of a weird language..

this one is better:

http://www.phpbuilder.com/columns/tim2705.php3



-Original Message-
From: Ben Edwards [mailto:[EMAIL PROTECTED]
Sent: maandag 24 maart 2003 12:03
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL or Postgres
Could someone please point me in the correct direction for a decent
comparison of the two in respect of:-
   Reliability
   Scalability
   Speed
   Functionality
These are actually in order or importance to me (I know both are fairly
fast).
I am also interested in how easy it would be to migrate from MySQL to
Postgress.
Proples general experiences/comments also welcome.

Beb


* Ben Edwards  +44 (0)117 968 2602 *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Smashing the Corporate image   http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8 *

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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003

* Ben Edwards  +44 (0)117 968 2602 *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Smashing the Corporate image   http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8 *


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003

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

[PHP-DB] RE: Stumped again...

2003-03-11 Thread Ben Walling
Your code:
while($name = mysql_fetch_row($groups_tmp)) {
  $grp_list .= option$name[0]/option\n;
}

should be changed to:
while($name = mysql_fetch_row($groups_tmp)) {
  $grp_list .= option value=.$name[0].$name[0]/option\n;
}

The value property of the option tag is actually what gets submitted to the next page. 
 The text that immediately follows option value=x is what is displayed to the user.

So, for this (HTML) code:
SELECT NAME=Test
OPTION VALUE=1Thing One
OPTION VALUE=2Thing Two
/SELECT

The user would see a list with:
Thing One
Thing Two

The next page would get either 1 or 2 as the value for Test.

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 11, 2003 2:43 PM
To: Ben Walling; '[EMAIL PROTECTED]'
Subject: RE: Stumped again...


I don't really understand this suggestion.  Could someone possibly
expound on this further?  Maybe an example?  Thanks.

-Original Message-
From: Ben Walling [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 11, 2003 12:19 PM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: Stumped again...


You need the value parameter for the option tags:

OPTION VALUE=1First
OPTION VALUE=2Second

Scott V Nipp [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
   OK...  I have once again thought of something cool to do, and can't
 quite figure out how to make it happen.  I am developing a user account
 request system for work.  Things are coming along nicely.  The user logs
 into the system, kind of, selects the systems that he wants to have
accounts
 added on, and then the next page is where the problems begin.  Once the
user
 selects the systems, the next page lists the systems selected along with a
 dropdown for Default Shell and another dropdown for Primary Group and
a
 small text box for Other Group.  The dropdowns are populating fine, and
 everything is displaying on the screen as expected.  The problem I am
having
 is that the selections don't seem to work.  I have this page feed a final
 page that also displays the selections as a result test.  I am seeing the
 system names, but no shell or group information.  
   Here are some pertinent portions of the code with comments:
 
   Above code snipped  
 $shell_list = getEnumOptions('accounts','shell');
 $shell_tmp = select size=\1\ name=\shell\\n;
 $shell_tmp .= optionDefault Shell/option\n;
 foreach ($shell_list as $item) {
   $shell_tmp .= option$item/option\n;
 }
 $shell_tmp .= /select\n;
 
 mysql_select_db($database, $Prod);
 $query_groups = SELECT name FROM grps;
 $groups_tmp = mysql_query($query_groups, $Prod) or die(mysql_error());
 $grp_list = select size=\1\ name=\grp\\n;
 $grp_list .= optionPrimary Group/option\n;
 $grp_list .= option---/option\n;
 while($name = mysql_fetch_row($groups_tmp)) {
   $grp_list .= option$name[0]/option\n;
 }
 $grp_list .= /select\n;
   Code snipped  
 
   This section of code creates the Default Shell dropdown list and
 the Primary Group dropdown list.  One of these lists is derived from the
 ENUM values of the field, the other is derived from the values of a
seperate
 table.
 
   Code snipped  
 form name=form1 method=post action=account_final.php
 
 ?php
   while (isset($_POST['system'][$a])) { 
   echo td width=\20%\div
 align=\center\.$_POST['system'][$a]./div/td;
   echo td width=\20%\div
 align=\center\.$shell_tmp./div/td;
   echo td width=\20%\div
 align=\center\.$grp_list./div/td;
   echo td width=\20%\div align=\center\input type=\text\
 name=\other\ value=\\ size=\15\/div/td/tr;
   $tmp = $sbcuid.-.$_POST['system'][$a];
   $a++;
   array_push( $accnts, $tmp );
 array_push( $shells, $shell );
 array_push( $grps, $grp );
 array_push( $others, $other );
  }
 ?
   Code snipped  
 
   This section of code actually displays one line for each system
 previously selected with additional input items for Default Shell,
 Primary Group, and Other Group.  This code also creates arrays of the
 systems, shells, groups, and others which are passed onto the next page.
 This system array is used to display the results as well as populate the
 database, and the system array data is the only data actually being
 displayed.  I do not think that the data for the other arrays is actually
 getting populated.
 
   Code snipped  
 ?php
   session_register(accnts, shells, grps, others);
 ?
 
 div align=center
 input type=submit name=Submit value=Submit
 /div
 /form
   Code snipped  
 
   This section of code simply registers the arrays for use on the next
 page.
 
   Thanks in advance for any help.  Please let me know if you need any
 other information to help figure out what is wrong with this.
 
 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.com
 
 

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



RE: [PHP-DB] Re: Undefined index and variables

2003-01-15 Thread Ben Joyce
Couldn't you use the 'for each' method on $_POST instead?

 .b

 -Original Message-
 From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] 
 Sent: 15 January 2003 16:44
 To: 'Fred Wright'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Re: Undefined index and variables
 
 
 Fred,
 
 I don't have much time today, but here is my initial 
 assessment of what might be going wrong with your page:
 
 You display add.php which draws a form for data.
 You submit that form to add.php (itself).
 The form redraws inside the page.
 You get errors when add.php looks for data in the 
 $HTTP_POST_VARS array because the page is fresh and that 
 array is empty.
 
 Problem is that there is no code to handle the data that was 
 entered in the first place. Once you hit submit, the add.php 
 page is (re)drawn in its original state - with no values in 
 the fields. Therefore, when the $_POST['varname'] statement 
 looks in $HTTP_POST_VARS, there's nothing to display so you 
 get the Undefined Index errors. It's almost like refreshing the page.
 
 My advice would be to separate the code for the data entry 
 and data handling parts of your project into independent 
 scripts. Use add.php to collect the data then send the data 
 to a php script called handleAdd.php that gets the name/value 
 pairs and submits them to the database. After submitting the 
 data to the database in handleAdd.php, forward the user back 
 to another page (add.php again, if you want) where they can 
 get some kind of confirmation the data was entered.
 
 A further recommendation would be to provide the list with 
 the code you gave to me so maybe somebody else with a little 
 more free time might be able to assist you further. Sorry I 
 couldn't provide any more help.
 
 Rich
 
  -Original Message-
  From: Fred Wright [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, January 15, 2003 12:21 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Re: Undefined index and variables
  
  
  ?
  //This is lines 22 and 23 of Add.php
  require(common.php) ;
  GenerateHTMLForm();
  $smt2= $_POST['Ref'];  //line 22
  $smt3=$_POST['Chassis']; //line 23
  
  The form below is in common.php
  
  function GenerateHTMLForm() {
  
  printf(FORM action=\add.php\ METHOD=post);
  
  printf(TABLE border=\0\ width=\100%%\);
  
  printf(TRTDReference:/TD);
  printf(TDINPUT TYPE=text SIZE=5 NAME=Ref/TD/TR);
  
  printf(TRTDChassis:/TD);
  printf(TDINPUT TYPE=text SIZE=25 NAME=Chassis /TD/TR);  
  printf(/TABLE);  printf(INPUT TYPE=submit name=\submit\);
   printf(/FORM );
  }
  
  Fred Wright [EMAIL PROTECTED] wrote in message 
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Hi to all
   Being new to PHP I am naturally experiencing some minor problems.
  
   I have a form which processes Ref and Chassis data, when I
  load Add.php
   which does work but on loading get errors
  
   Notice: Undefined index: Ref in C:\Xitami\webpages\add.php
  on line 22
   Notice: Undefined index: Chassis in
  C:\Xitami\webpages\add.php on line 23
   How do I get rid of these undefined errors? Could anyone
  advise please.
   Regards
   Fred
  
   printf(FORM action=\add.php\ METHOD=post);
  
   printf(TABLE border=\0\ width=\100%%\);
  
   printf(TRTDReference:/TD);
  
   printf(TDINPUT TYPE=text SIZE=5 NAME=Ref /TD/TR);
  
   printf(TRTDChassis:/TD);
   printf(TDINPUT TYPE=text SIZE=25 NAME=Chassis /TD/TR);
  
   printf(/TABLE);
  
   printf(INPUT TYPE=submit name=\submit\);
  
   printf(/FORM );
  
  
  
  
  
  --
  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] small database

2002-11-12 Thread Hatem Ben
Check the PHP-DB archives ;-)
http://news.php.net/article.php?group=php.dbarticle=22433

Hatem

- Original Message -
From: Rich Hutchins [EMAIL PROTECTED]
To: Seabird [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, November 13, 2002 12:24 AM
Subject: RE: [PHP-DB] small database


 As you'll probably see in a lot of responses, it might be better to store
 the pictures in a folder on the server and store only the path to the
 pictures in the db.  That keeps the size of the db smaller.

 If you choose to do that, use an HTML form with
 enctype=multipart/form-data and an input type=file element, send it to
a
 PHP script to upload the file, move it to a specified directory and put
the
 path and the filname in a table in your db. Then, when you need to display
 an image, just grab the path and insert it in an img src= tag.

 I don't know how to store an image directly in a database since I always
 store just the path. Sorry.

 HTH,
 Rich
 -Original Message-
 From: Seabird [mailto:jacco;vliegt.nl]
 Sent: Tuesday, November 12, 2002 11:56 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] small database


 Hi everyone,

 I'm creating a sample site for a company that does aircraft sales. I use a
 MySQL DB to store all the info of the available aircraft. Now, I would
like
 to store pictures directly inside that same table, so that on the
details
 page, it would provide a picture out of (for example) Field5. Is this
 possible and if so how? (I tried blob etc., but can't get it to work).

 Thanx,
 Jacco
 --
 http://seabird.jmtech.ca

 Attitude is Everything!
 But Remember, Attitudes are Contagious!
 Is Yours worth Catching



 --
 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] displaying flash from db

2002-10-21 Thread Yonatan Ben-Nes
Hi all!

Does anyone know where can i find some information about displaying flash from a db? 

I'm breaking my head over it, searching at newsgroups, searching at the net, 
addressing newsgroups but still nothing!
Help b4 im cutting my hands off!!!


With hopes to be saved :P
Yonatan Ben-Nes



[PHP-DB] welp! having problems with flash display

2002-10-18 Thread Yonatan Ben-Nes
Hi all,

im trying to retrieve data from my db (postgresql) and display it (an ad).
now when i don't try to enter it to a display code of flash (embed src=... and so 
on) it display the flash fine just in the biggest proportion it can get and it 
overwrite on the rest of the html.
when i tried to take the data and insert it into the embed src (at the flash code with 
the right porporties) as a file (swf extension) it display the swf file but only as a 
white squre with the right measures as i gave it at the code (it also doesnt overwrite 
the rest of the html) but it wont display the clip itself!

can anyone help me with this or just give me a link to related info?

Thanks in advance,
Ben-Nes Yonatan


p.s

first time that i use newsgroups for such things... so.. if i did something wrong just 
notify me :P



Re: [PHP-DB] images

2002-10-15 Thread Hatem Ben

hello,

you can do it this way (using mysql):

?php
/*
create table images(
img_id int(4) NOT NULL auto_increment,
img_name varchar(60),
img_file_type varchar(10),
img_content blob,
PRIMARY KEY (img_id)
) TYPE=MyISAM;
*/
if (empty($imgfile) or $go!==uploadimg)
{
// Generate the form to upload the image
$form = form method=\post\ action=\\ enctype=\multipart/form-data\
Specify a name for your image : input type=\text\ name=\imgname\br/
Select your image file : input name=\imgfile\ type=\file\br/
input type=\submit\ value=\Submit\
input type=\hiddent\ name=\go\ value=\uploadimg\
/form;
echo $form;
} else {
// You have an image that you can insert it in database
/* Connecting, selecting database */
$link = @mysql_connect(mysql_host, mysql_user, mysql_password)
or die(Could not connect);
@mysql_select_db(my_database) or die(Could not select database);
// if the file uploaded ?
if (is_uploaded_file($imgfile))
{
// Open the uploaded file
$file = fopen($imgfile, r);
// you can get the $imgtype also here ;)
// Read in the uploaded file
$image = fread($file, filesize($imgfile));
// Escape special characters in the file
$image = AddSlashes($image);
}
else
$image = NULL;
$query = INSERT INTO images VALUES (NULL, '$imgname', '$imgtype',
'$image');
$result = mysql_query( $query ) or die(Query failed);
echo Hope this will help ;);
}
?


Regards,
Hatem

- Original Message -
From: Edward Peloke [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 15, 2002 9:23 PM
Subject: [PHP-DB] images


 How can I allow the user to upload images to a php website and have the
 image stored in the mysql db?

 Thanks,
 Eddie


 --
 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] images [Oops]

2002-10-15 Thread Hatem Ben

Oops sorry for never testing before sending :P the script works fine
but there is a little change, there is a hiddent should be changed to hidden
in the form ;)

that's all,
enjoy

- Original Message -
From: Hatem Ben [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 15, 2002 9:46 PM
Subject: Re: [PHP-DB] images


 hello,

 you can do it this way (using mysql):

 ?php
 /*
 create table images(
 img_id int(4) NOT NULL auto_increment,
 img_name varchar(60),
 img_file_type varchar(10),
 img_content blob,
 PRIMARY KEY (img_id)
 ) TYPE=MyISAM;
 */
 if (empty($imgfile) or $go!==uploadimg)
 {
 // Generate the form to upload the image
 $form = form method=\post\ action=\\
enctype=\multipart/form-data\
 Specify a name for your image : input type=\text\
name=\imgname\br/
 Select your image file : input name=\imgfile\ type=\file\br/
 input type=\submit\ value=\Submit\
 input type=\hiddent\ name=\go\ value=\uploadimg\
 /form;
 echo $form;
 } else {
 // You have an image that you can insert it in database
 /* Connecting, selecting database */
 $link = @mysql_connect(mysql_host, mysql_user, mysql_password)
 or die(Could not connect);
 @mysql_select_db(my_database) or die(Could not select database);
 // if the file uploaded ?
 if (is_uploaded_file($imgfile))
 {
 // Open the uploaded file
 $file = fopen($imgfile, r);
 // you can get the $imgtype also here ;)
 // Read in the uploaded file
 $image = fread($file, filesize($imgfile));
 // Escape special characters in the file
 $image = AddSlashes($image);
 }
 else
 $image = NULL;
 $query = INSERT INTO images VALUES (NULL, '$imgname', '$imgtype',
 '$image');
 $result = mysql_query( $query ) or die(Query failed);
 echo Hope this will help ;);
 }
 ?


 Regards,
 Hatem

 - Original Message -
 From: Edward Peloke [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, October 15, 2002 9:23 PM
 Subject: [PHP-DB] images


  How can I allow the user to upload images to a php website and have the
  image stored in the mysql db?
 
  Thanks,
  Eddie
 
 
  --
  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 manipulation

2002-10-06 Thread Hatem Ben

i was trying to do it with preg_replace, but this is much better

thanks a lot,
Hatem

- Original Message -
From: Rasmus Lerdorf [EMAIL PROTECTED]
To: Hatem Ben [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Sunday, October 06, 2002 3:09 AM
Subject: Re: [PHP-DB] Some data manipulation


 So loop through and check the last char.  Am I missing something that
 makes this harder than the obvious:

   foreach($arr as $key=$val) {
 $end = $val[strlen($val)-1];
 switch($end) {
case '1':  $arr[$key] = substr($val,0,-1); break;
case '2':
case '3':  $arr[$key] = substr($val,0,-1) . ((int)$end + 4); break;
 }
   }

 Not sure if you always want to add 4 to the last char when it ends in 2 or
 3, but that was the only info you gave.

 -Rasmus

 On Sun, 6 Oct 2002, Hatem Ben wrote:

  hey all
 
  i have a database of arrays like this :
  Array
  (
  [0] = 2-
  [1] = 8b2
  [2] = 8#c3
  [3] = 8b2
  [4] = 8#f2
  [5] = 4a2
  [6] = 8a1
  [7] = 8a2
  [8] = 4a2
  [9] = 4a2
  [10] = 4a2
  
  )
 
  i just need to change in every string the last value when it is equal to
1,2
  or 3
  ex ::
   [0] = 2-won't be changed  [0] = 2-
   [1] = 8b2  will be changed to [1] = 8b6
   [2] = 8#c3 will be changed to[2] = 8#c7
   [6] = 8a1   will be changed to[6] = 8a
 
  and so on
 
  Thanks for any help
  Hatem
 
 
  --
  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] Some data manipulation

2002-10-05 Thread Hatem Ben

hey all

i have a database of arrays like this :
Array
(
[0] = 2-
[1] = 8b2
[2] = 8#c3
[3] = 8b2
[4] = 8#f2
[5] = 4a2
[6] = 8a1
[7] = 8a2
[8] = 4a2
[9] = 4a2
[10] = 4a2

)

i just need to change in every string the last value when it is equal to 1,2
or 3
ex ::
 [0] = 2-won't be changed  [0] = 2-
 [1] = 8b2  will be changed to [1] = 8b6
 [2] = 8#c3 will be changed to[2] = 8#c7
 [6] = 8a1   will be changed to[6] = 8a

and so on

Thanks for any help
Hatem


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




Re: [PHP-DB] $_POST And $_REQUEST

2002-10-05 Thread Hatem Ben

$_REQUEST is an associative array consisting of the contents of $_GET,
$_POST, $_COOKIE, and $_FILES

http://www.php.net/manual/en/reserved.variables.php


- Original Message -
From: Shoulder to Shoulder Farm [EMAIL PROTECTED]
To: PHP Database List [EMAIL PROTECTED]
Sent: Sunday, October 06, 2002 1:50 AM
Subject: [PHP-DB] $_POST And $_REQUEST


 Hi all,
 What is the difference between the $_POST and $_REQUEST functions (I
 can't find it in the docs)?
 Thanks, Taj


 --
 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] Very cool -= Code Generator =- !!!

2002-09-29 Thread Hatem Ben

i've check it, and also try it, code generated for a sample database won't
run okay, most pages return errors !

if it will support others database, it will be a great tool

Best regards,
Hatem


- Original Message - 
From: John W. Holmes [EMAIL PROTECTED]
To: 'johnny1b1g' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, September 29, 2002 4:19 PM
Subject: RE: [PHP-DB] Very cool -= Code Generator =- !!!


  Use Codejay as your web assistant.
  Create ASP , PHP, COLDFUSION , ASP.NET
  web applications
  Save time and money.
  
  Visit  www.codejay.com
 
 Interesting program, did anyone else check it out?? All it really does
 is generate reports and create admin interfaces to add/edit data in a
 database. The reports are pretty good, you can open your database,
 choose what columns you want, create relationships, add to the SQL Where
 clause, make the results links (and pass values in them) or images, etc.
 
 It would be useful to someone with no programming experience at all,
 which is always the case with these code generators. 
 
 There are some issues with the PHP code creation, of course. For some
 reason, it uses $HTTP_GET_FILES, instead of $HTTP_GET_VARS. This, of
 course, causes the Prev/Next and other links to fail. There may be
 others, that's the obvious one I found right away. 
 
 It also requires the user to turn on output buffering in php.ini. Why?
 The code for some reason contains a ob_start() and session_start() call,
 but it never uses a session or does anything with the buffer. If output
 buffering is required to be on in php.ini, then why call ob_start()?? I
 think it's a bad idea to require changes to php.ini, anyhow. 
 
 And, the most blaring oversight, IMO, is that it only generates code for
 Access and MSSQL. ?? Come on...if you're going to take the time to write
 this, why not include MySQL? 
 
 Plus, they need to run a spell and grammar check on the help files... :)
 
 Not worth 80 Euro / 82 dollars in my opinion...
 
 ---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] Very cool -= Code Generator =- !!!

2002-09-29 Thread Hatem Ben

a php/mysql already exist : http://www.bigprof.com/appgini/

- Original Message - 
From: John W. Holmes [EMAIL PROTECTED]
To: 'johnny1b1g' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, September 29, 2002 4:19 PM
Subject: RE: [PHP-DB] Very cool -= Code Generator =- !!!


  Use Codejay as your web assistant.
  Create ASP , PHP, COLDFUSION , ASP.NET
  web applications
  Save time and money.
  
  Visit  www.codejay.com
 
 Interesting program, did anyone else check it out?? All it really does
 is generate reports and create admin interfaces to add/edit data in a
 database. The reports are pretty good, you can open your database,
 choose what columns you want, create relationships, add to the SQL Where
 clause, make the results links (and pass values in them) or images, etc.
 
 It would be useful to someone with no programming experience at all,
 which is always the case with these code generators. 
 
 There are some issues with the PHP code creation, of course. For some
 reason, it uses $HTTP_GET_FILES, instead of $HTTP_GET_VARS. This, of
 course, causes the Prev/Next and other links to fail. There may be
 others, that's the obvious one I found right away. 
 
 It also requires the user to turn on output buffering in php.ini. Why?
 The code for some reason contains a ob_start() and session_start() call,
 but it never uses a session or does anything with the buffer. If output
 buffering is required to be on in php.ini, then why call ob_start()?? I
 think it's a bad idea to require changes to php.ini, anyhow. 
 
 And, the most blaring oversight, IMO, is that it only generates code for
 Access and MSSQL. ?? Come on...if you're going to take the time to write
 this, why not include MySQL? 
 
 Plus, they need to run a spell and grammar check on the help files... :)
 
 Not worth 80 Euro / 82 dollars in my opinion...
 
 ---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] Conversion from access to mysql

2002-09-10 Thread Hatem Ben


both tools don't work okay for me, i'm just using the export tool in
MsAccess then convert database to xml, and thanks to PHP, i convert that to
mysql queries.
Just one problem when i want to convert binary data (pict or others), still
haven't find a suitable solution for that.

Best regards,
Hatem

- Original Message -
From: Steven Dowd [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, September 10, 2002 12:54 PM
Subject: Re: [PHP-DB] Conversion from access to mysql


 also  http://www.dbtools.com.br  this will work both ways accessmysql
also
 supports excel , dbf, csv etc etc

 Steven



 - Original Message -
 From: Chris Grigor [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, September 10, 2002 10:47 AM
 Subject: [PHP-DB] Conversion from access to mysql


  Hey there all
 
  This is more than likely a common question, anyone have any guidelines,
 do's
  or dont's
  about converting an access db to mysql db...
 
  Regards
 
  Chris
 
 
  --
  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] login won't work for Internet Explorer

2002-08-27 Thread Ben . Westgarth



Hi there,

I am experiencing a peculiar problem. I have recently moved a PHP / MySQL driven
website I have been developing from my linux box on to a live host. Everything
seemed to go smoothly apart from one peculiar problem. When I access the site
using Internet Explorer (so far I have tried 5.0 and 5.5), I am unable to log
into the members' section of the site. Instead I receive the following error:

Warning: Unable to jump to row 0 on MySQL result index 2 in
[pathdir]/member_login_check.php on line 12

Warning: Unable to jump to row 0 on MySQL result index 2 in
[pathdir]/member_login_check.php on line 13

Warning: Unable to jump to row 0 on MySQL result index 2 in
[pathdir]/member_login_check.php on line 14

The peculiarity is that when I log in using Mozilla, I have no problem. Why
should the choice of browser have any effect on a set of processes which are all
server-side? Or am I completely wrong about that? All suggestions and help
appreciated.

Thanks, Ben




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




[PHP-DB] Date calculation

2001-11-12 Thread Ben S.
How do you get the date that is 14 days from today's date.
I am using PHP4 and MySQL. I can get that date with MySQL monitor but php. I
have tried many things but nothing works.
Does anyone give me a help?

Thank you.
Ben



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

2001-11-12 Thread Ben S.
How do you get the date that is 14 days from today's date?
I can get that date with mysql monitor but PHP. I am using PHP4 and MySQL. I
have tried many things but nothing works.
Does anyone give me a help?

Thank you.
Ben



-- 
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] Add Record to DB and Return Auto_Increment ID?

2001-10-21 Thread Ben Edwards

Do the insert missing out auto_increment column and then get it afterwoods 
with.

$key = mysql_insert_id();

This actually is cleared on next database access, there is another function 
that is not (cant remember other function and I may of got them the wrong 
way round).

If you are new to PHP you should look things up in the manual, there is a 
PDF and web searchable version for both MySQL and PHP.  Search for 
AUTO_INCREMENT.

Although I am impressed you are using db list not general one ;)

Ben

At 07:15 P 21/10/01, Brett Conrad wrote:
Hi.

I'm creating a class mapped to the functions of a guestbook.  Each guestbook
submission becomes an entry in a db table.  I am using the DB Pear class.

I'm new to PHP and my question is this:

What is the best way to create a method that adds a new guestbook entry and
returns its auto_increment id.  I could use an Insert statement and then a
Select statement to find out what id was added for the record, but that
seems a little inefficient.  Any ideas?

Thanks for any help.  Much appreciated,

Brett



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

**
* Ben Edwards+352 091 429995 *
* Homepagehttp://www.gifford.co.uk/~bedwards *
* i-Contact Progressive Videohttp://www.videonetwork.org *
* Smashing the Corporate image http://www.subvertise.org *
* Bristol's radical newshttp://www.bristle.co.uk *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8   *
**


-- 
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] Re: fulltext not for me/alternatives

2001-10-21 Thread Ben Edwards


Is there a way to get mysql to change the default from 3 to 2 letter words (or
less) that are ignored in fulltext indexes?
I'm running version 4 alpha. I checked the TODO and it's not listed. Is it
possible to make this a config.h option?

As I said I am on a shared host and don't have the option to recompile 
MySQL.  The answer is yes, it is in an .h file (or something like that).

  A minimum of 4 letters for a word to be
included in a fulltext index seems a bit restrictive.

My point exactly ;)  But this is what it is (4 letters).  Penelizes us non 
hardcore commercial users who can't afford our own box.

The latest documentation categorically states there is no other way of 
changing this.



**
* Ben Edwards+352 091 429995 *
* Homepagehttp://www.gifford.co.uk/~bedwards *
* i-Contact Progressive Videohttp://www.videonetwork.org *
* Smashing the Corporate image http://www.subvertise.org *
* Bristol's radical newshttp://www.bristle.co.uk *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8   *
**


-- 
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] Re: fulltext not for me/alternatives

2001-10-21 Thread Ben Edwards


See the manual, and SHOW VARIABLES LIKE 'ft_%'

Looks like this is something new to 4.  My ISP has 20+ db servers so reckon 
it will be a while before they roll 4 out.  Will email them.  Thanks for 
the info.

However this douse not help me in the immediate future and I still need to 
find a alternative fullsearch method.

Ben



**
* Ben Edwards+352 091 429995 *
* Homepagehttp://www.gifford.co.uk/~bedwards *
* i-Contact Progressive Videohttp://www.videonetwork.org *
* Smashing the Corporate image http://www.subvertise.org *
* Bristol's radical newshttp://www.bristle.co.uk *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8   *
**


-- 
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] DB Compaction Algorithm

2001-08-08 Thread Ben Bleything

Hello all... I'm going to propose an algorithm to compact a MySQL database
containing information that I'll talk about shortly.  I'm curious what you
all think about it.  Nevermind the various reasons why I should/should not
do this, as I have weighed them in my head and decided that it's something
I want to do.

So, anyway, on with the show.

---

My database is used by a radio station to keep track of their music assets
and playlists.  It contains the following tables:

-albums -- Contains album data and references to other tables
-artists -- Contains name and ID
-genres -- Contains name and ID
-labels -- Contains name and ID
-media -- Contains name and ID
-names -- Contains only one row... info about the radio station.
-playlist -- contains a timestamp and references to users and tracks
-tracks -- contains track info and references to albums and artists
-users -- contains user information

The names table is there so that I can easily pull the data from
somewhere, but just as easily alter it from the interface... I didn't want
to deal with using a file, though it wouldn't be hard... I may change that
later.

Anyway, because of repeated add's, delete's, etc on the name/ID tables,
they are becoming fragmented.  I have set the datatypes on the ID fields
large enough to handle anything that they throw at it for now, but over
the course of 5 years, they may begin to reach their capacity, and I will
no longer be around to support it (it's a college radio station).

Therefore, I have decided that I need an algorithm to compact the
auto_increment fields.

Here's what I'm thinking.  On a table-by-table basis, create a temporary
table that contains the old ID and the new ID.  Then, once that table is
populated, convert references in other tables from the old to new.

Like this (in PHP pseudocode)

result = SELECT * FROM labels;
delete from labels;
create temporary table labeltemp( oldid, newid );

loop through result
insert into labeltemp (oldid) value (result[id])

update sometable set id=newid where id=oldid;

So, that was brief and messy... but I think it will work.  I'm hesitant to
try it, because I can't create a new database, and I don't want to try it
on live data.

So, can anyone see a problem with this, aside from the old why do you
want to do that? crap?

Thanks,
Ben


-- 
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] cleaning up auto_increment fields

2001-08-05 Thread Ben Bleything

Hello all!

Is it worth my time (both real and processor) to make my application
find gaps in the auto_increment sequence (in MySQL) and fill them when I
add new data?  I'm concerned about overloading the capacities of my
datatypes (although they are very liberal).

I think it wouldn't be that difficult... but would probably slow the
application down... I fear that, because of the relationships I have, if
I ever decide to compact the database later, it will be an extremely
trying task.

Thanks,
Ben


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

2001-07-19 Thread Ben Bleything

?php
$date = 2001-07-19; // as if it just came from the db

$date_array = explode('-',$date);

$date = $date_array[1] . - . $date_array[2] . - .
$date_array[0];
?

That should do it =

Good luck!
Ben

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf
Of system
Sent: Friday, July 13, 2001 8:17 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Date Format

Friends,
I have a design, up and running scripts connected to MySQL.
How do I retrieve date formats and have it displayed as dd-mm- ?
I store them as DATE.
CK Raju



-- 
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] Question about strlen .. I think

2001-07-16 Thread Ben Bleything

You could split the string on the slashes with explode('/',$string) and
then manipulate the array elements you get back.

Good luck,
Ben

-Original Message-
From: Dennis Kaandorp [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, July 15, 2001 9:21 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Question about strlen .. I think

Hello,
On my site users can submit ftp's.
Is there a way to replace the spaces between the paths?
This is what I mean:
/uploads//by/   /dennis/
must become
/uploads/4sp/by/3spdennis/

Thnx,
Dennis


-- 
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] Dynamic SQL + result resource error

2001-07-08 Thread Ben Bleything

Sure he is.  Right here:

$queryResult = mysql_query($sql);

what exact error is occurring?

-Original Message-
From: Matthew Loff [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, July 08, 2001 5:00 PM
To: 'Mark Gordon'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Dynamic SQL + result resource error


You aren't calling mysql_query() to execute the query.

//$find is text box input
$wordsarray = explode( ,$find); 
$sql = SELECT bandname FROM bands WHERE (bandname
LIKE ;
$i = 0;
while ($i  count($wordsarray)) 
{ 
$word = current($wordsarray); 
next($wordsarray);
$sql=$sql.$word);
$i++; 
}
print $sqlhr;

$queryResult = mysql_query($sql);

while ($myrow=mysql_fetch_row($queryResult))
{
print $myrow[0],p;
}


-Original Message-
From: Mark Gordon [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, July 08, 2001 7:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Dynamic SQL + result resource error


Why is this code generating an error when it outputs a
valid SQL statement?  (there are no parse errors)

//$find is text box input
$wordsarray = explode( ,$find); 
$sql = SELECT bandname FROM bands WHERE (bandname
LIKE ;
$i = 0;
while ($i  count($wordsarray)) 
{ 
$word = current($wordsarray); 
next($wordsarray);
$sql=$sql.$word);
$i++; 
}
print $sqlhr;
while ($myrow=mysql_fetch_row($sql))
{
print $myrow[0],p;
}

=
Mark
[EMAIL PROTECTED]

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.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 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] Dynamic SQL + result resource error

2001-07-08 Thread Ben Bleything

Guess I'm just a big dumbass then, aren't I =P

Oops.

I suppose that would cause it to fail then, wouldn't it?

=  Ben

-Original Message-
From: Matthew Loff [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, July 08, 2001 5:10 PM
To: 'Ben Bleything'; 'Mark Gordon'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Dynamic SQL + result resource error


The code you're referencing is my modification of his original post. :)


-Original Message-
From: Ben Bleything [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, July 08, 2001 8:04 PM
To: 'Matthew Loff'; 'Mark Gordon'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Dynamic SQL + result resource error


Sure he is.  Right here:

$queryResult = mysql_query($sql);

what exact error is occurring?

-Original Message-
From: Matthew Loff [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, July 08, 2001 5:00 PM
To: 'Mark Gordon'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Dynamic SQL + result resource error


You aren't calling mysql_query() to execute the query.

//$find is text box input
$wordsarray = explode( ,$find); 
$sql = SELECT bandname FROM bands WHERE (bandname
LIKE ;
$i = 0;
while ($i  count($wordsarray)) 
{ 
$word = current($wordsarray); 
next($wordsarray);
$sql=$sql.$word);
$i++; 
}
print $sqlhr;

$queryResult = mysql_query($sql);

while ($myrow=mysql_fetch_row($queryResult))
{
print $myrow[0],p;
}


-Original Message-
From: Mark Gordon [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, July 08, 2001 7:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Dynamic SQL + result resource error


Why is this code generating an error when it outputs a
valid SQL statement?  (there are no parse errors)

//$find is text box input
$wordsarray = explode( ,$find); 
$sql = SELECT bandname FROM bands WHERE (bandname
LIKE ;
$i = 0;
while ($i  count($wordsarray)) 
{ 
$word = current($wordsarray); 
next($wordsarray);
$sql=$sql.$word);
$i++; 
}
print $sqlhr;
while ($myrow=mysql_fetch_row($sql))
{
print $myrow[0],p;
}

=
Mark
[EMAIL PROTECTED]

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.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 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] Control Structure Error

2001-07-08 Thread Ben Bleything

It works for me... except that you need a semi-colon after 'return
$returned_string' and it sticks the word OR at the end of the whole
string, which you may not want.

Does that help, or did I miss the point?

Ben

-Original Message-
From: Brad Lipovsky [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, July 08, 2001 5:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Control Structure Error

Here is the code that I am trying to use:

//code start
function search_terms($title) {
 $array = explode ( , $title);
  for($i=0,$n=count($array); $i$n; $i++) {
   $returned_string = $returned_string . $array[$i] .  OR ;
}
 return $returned_string
}
//code end

I want it to turn the string of words stored in $title into an array
($array), then use the for structure to insert the string  OR  in
between
each word, and then finally return the string ($returned_string) for DB
purposes.



-- 
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] Update Multiple records

2001-05-17 Thread Ben Cairns

I want to update a MySQL db table, but I want to update multiple records,

Like this:

I want to run a statement like this:
update weld_details set parent = '1' where db_uid = '1','2'

Now, it dont work, and I cant see why, I think it has something to do with the 
numbers at the end of the statement. But I cant see what...

Pls help.

Thanks in advance.

-- Ben Cairns - Head Of Technical Operations
intasept.COM
Tel: 01332 365333
Fax: 01332 346010
E-Mail: [EMAIL PROTECTED]
Web: http://www.intasept.com

MAKING sense of
the INFORMATION
TECHNOLOGY age
@ WORK..


-- 
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] PHP On Linux

2001-04-19 Thread Ben Cairns

I have nearly 18 Months devel on Windows, but we are now moving to Linux,

I have never installed PHP On Linux before, so could someone pls give me an 
'Installation Guide' to follow for PHP With MySQL Support, on Linux,

Also, I would like to know what I have to do with MySQL: You know, what files 
go where etc...

Thanks.


-- Ben Cairns - Head Of Technical Operations
intasept.COM
Tel: 01332 365333
Fax: 01332 346010
E-Mail: [EMAIL PROTECTED]
Web: http://www.intasept.com

"MAKING sense of
the INFORMATION
TECHNOLOGY age
@ WORK.."


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

2001-04-09 Thread Ben Cairns

Closing a MySQL connection is a good habit to get into,

However, what you describe, doesn't sound like a PHP error, it may just be one 
of the many errors with msie rearing its head.


-- Ben Cairns - Head Of Technical Operations
intasept.COM
Tel: 01332 365333
Fax: 01332 346010
E-Mail: [EMAIL PROTECTED]
Web: http://www.intasept.com

"MAKING sense of
the INFORMATION
TECHNOLOGY age
@ WORK.."


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

2001-03-29 Thread Ben Cairns

What is the best field type to use for an Auto_Increment field?

i am using int at the moment, is there a better one?

-- Ben Cairns - Head Of Technical Operations
intasept.COM
Tel: 01332 365333
Fax: 01332 346010
E-Mail: [EMAIL PROTECTED]
Web: http://www.intasept.com

"MAKING sense of
the INFORMATION
TECHNOLOGY age
@ WORK.."


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

2001-03-20 Thread ben

On Wed, 21 Mar 2001, boclair wrote:

 This is simple but  I cannot see where I am going wrong
 
 I have a table members with one of the fields
 status, varchar(10)
 
 The values may be active or retired or deceased or null
 
 If I run the select
 
 SELECT * FROM members WHERE status = 'deceased';
 
 I getMySQL said: You have an error in your SQL syntax near
 '\'deceased\';' at line 1
 
 Will somebody show me the correct syntax
 
 Tim Morris
 
 
 

you need to pass the quotes to mysql, hence you have to backslash them in
the php code. Try :

$query="SELECT * FROM members WHERE status = \"deceased\"";

--
Ben
History is curious stuff You'd think by now we had enough Yet the fact
remains I fear They make more of it every year.


-- 
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] Resolution detect and redirect

2001-02-27 Thread Ben - FCP

Would be a feat indeed if you could get PHP to do this! It does need
Javascript to do (although having returned the result, you could then carry
this forward by setting a variable server side (in php!) that identified the
user and continued to display appropriate page versions).

If you were feeling really clever, you could even go the whole hog and store
these as variables using the session functions of PHP4 (would then mean that
the variable as well as any others you choose to set for the user don't have
to be laboriously carried over each time). Just a thought.

Seriously though,  definitely worth trying http://www.irt.org I would be
very supprised if there wasn't an FAQ specifically about this (its actually
very easy to do in Javascript).

Have fun,

Ben Stoneham
Technical Director - FCP Internet LTD

___

FCP Internet LTD - 'Making the Web Work for You'

70 Smithbrook Kilns, Cranleigh, Surrey, GU6 8JJ, UK.

Tel. 01483 272 303 Fax. 01483 272 303 mail: [EMAIL PROTECTED]

http://www.fcpl.com

___

-Original Message-
From: Joe Brown [mailto:[EMAIL PROTECTED]]
Sent: 27 February 2001 20:46
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Resolution detect and redirect


This feat will require a java script (not appropriate for php/db).

I saw something on a javascript site, perhaps www.webreference.com

gl

""Matthew Cothier"" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Why not just create a table that will resize to any resolution?

 Because I am using different sized images for the different resolutions as
 well as other page thingys.

 And I need the script for other things too.

 So can anyone help?
 _
 Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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 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] PHP security

2001-02-20 Thread Ben - FCP

Absolutely correct!

Having said all of this, it is still a bad idea (certainly on UNIX systems,
I can't speak for Micro$oft) to keep passwords embedded in scripts in this
way, particularly if you are running PHP as a CGI process, it is a better
idea to have the appropriate passwords stored as variables inside a separate
script that is then called via and 'include' statement (which should then be
read-only to 'root' if memory server me right -its been a long time since I
ran PHP this way!).

Ben Stoneham
Technical Director - FCP Internet LTD.

___

FCP Internet LTD - 'Making the Web Work for You'

70 Smithbrook Kilns, Cranleigh, Surrey, GU6 8JJ, UK.

Tel. 01483 272 303 Fax. 01483 272 303 mail: [EMAIL PROTECTED]

http://www.fcpl.com

___

This message is confidential; Any unauthorised disclosure, use or
dissemination,

either whole or partial, is prohibited. If you are not the intended
recipient of the message, please notify the sender immediately.

-Original Message-
From: Doug Schasteen [mailto:[EMAIL PROTECTED]]
Sent: 20 February 2001 19:51
To: Don; php-db list
Subject: Re: [PHP-DB] PHP security


As far as I know, you can not download PHP programs without access to
download them. Meaning you need an account on the webserver, so they would
need your account user and pass before they could steal your mysql user and
pass. I don't know how frontpage works, but it would probably have to call
on the server to parse the php script before downloading it. There is no way
to download a PHP script as a "nobody" user without it being parsed by PHP
first.


- Original Message -
From: "Don" [EMAIL PROTECTED]
To: "php-db list" [EMAIL PROTECTED]
Sent: Tuesday, February 20, 2001 1:24 PM
Subject: [PHP-DB] PHP security


 I am writing aome PHP scripts to connect to a MySQL database.  In order
 to connect, I have found the following documented code:

 $dbLink = mysql_connect("localhost", "my_user", "my_password")

 Here, the password is plain text.  This does not seem very secure to
 me.  What is to prevent someone using a program like Frontpage to
 download my web and discover my password?



 --
 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] MySQL Database Design

2001-02-14 Thread Ben Cairns

If was to create a table in a database with 19 Fields, and define them all 
as a BLOB, even though some of them may only hold a max of 10 characters.

What would be the implications of this?

-- Ben Cairns - Head Of Technical Operations
intasept.COM
Tel: 01332 365333
Fax: 01332 346010
E-Mail: [EMAIL PROTECTED]
Web: http://www.intasept.com

"MAKING sense of
the INFORMATION
TECHNOLOGY age
@ WORK.."


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