RE: [PHP-DB] password generator

2003-12-10 Thread Peter Lovatt
Hi

HTH

Peter


---
Excellence in internet and open source software
---
Sunmaia
Birmingham
UK
www.sunmaia.net
tel. 0121-242-1473
International +44-121-242-1473
---




function SM_pass_gen()
{

$consts = 'bcdgklmnprst';
$vowels = 'aeiou';
$symbols = '!%^_£123456789';
for ($x=0; $x < 6; $x++)
{
mt_srand ((double) microtime() * 100);
$const[$x] = substr($consts,mt_rand(0,strlen($consts)-1),1);
$vow[$x] = substr($vowels,mt_rand(0,strlen($vowels)-1),1);
$symb[$x] = substr($symbols,mt_rand(0,strlen($symbols)-1),1);
}
return $const[0] . $vow[0] .$const[2] . $const[1] . $vow[1] . $const[3]
. $vow[3] . $const[4] . $symb[2] . $symb[3];

}//end function





-Original Message-
From: Nikos Gatsis [mailto:[EMAIL PROTECTED]
Sent: 10 December 2003 13:42
To: PHP-mailist
Subject: [PHP-DB] password generator





Hello list

Is there any PHP script that generate password with digits from [a-zA-Z0-9]
to suggest me?
Thanx

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



RE: [PHP-DB] Remove all instances of a character....

2003-12-29 Thread Peter Lovatt
Does the ; need a backslash?

UPDATE risk_corpdatacapture email = REPLACE(email,'\;','')

Not sure but might be worth a try (back it up first!!)

Peter

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: 29 December 2003 10:17
To: CPT John W. Holmes
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Remove all instances of a character


Tried that but I got an error when using PHPMyAdmin...

UPDATE risk_corpdatacapture email = REPLACE(email,';','')
just don't work???

Wll confused now, cuase that's what I tried before I posted to the list... 
and you guys say it should work too...

Any other ideas?
=
Error
SQL-query :  
UPDATE risk_corpdatacapture email = REPLACE ( 
email,
';',
''
) 
MySQL said: 
You have an error in your SQL syntax.  Check the manual that corresponds 
to your MySQL server version for the right syntax to use near '=  REPLACE 
( email,
 ';',
 '' )' at line 1
==




"CPT John W. Holmes" <[EMAIL PROTECTED]> 
24/12/2003 13:27
Please respond to
"CPT John W. Holmes" <[EMAIL PROTECTED]>


To
<[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
cc

Subject
Re: [PHP-DB] Remove all instances of a character






From: <[EMAIL PROTECTED]>

> I have a MySQL database, with around 500 entries in one table...
> I've noticed that many entries have an erroneous ';' in the one of the 
> fields.
> 
> What I need to do, is tell MySQL to go through the ENTIRE table and find 

> any instances of '  ;  ' and them delete them... leaving the rest of the 

> data intact.

UPDATE TABLE SET column = REPLACE(column,' ; ','')

Reminder: This is a PHP list...

---John Holmes...

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




*
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] Checking for duplicate records before update?

2003-12-30 Thread Peter Lovatt
Hi

This is an alternate approach, and may be more elegant and efficient

Define hostname, mac, and ip fields as UNIQUE.

then INSERT IGNORE into the table. Check to see if a  row was inserted using
mysql_affected_rows()

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

if the row was inserted then all is well, otherwise ask to resubmit

I think this should still work with auto ids, but check.

HTH

Peter





-Original Message-
From: Jas [mailto:[EMAIL PROTECTED]
Sent: 30 December 2003 22:32
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Checking for duplicate records before update?


Problem. I have a database table that looks like this:
eg.
+--+--+---+---+-+
| id   | hostname | mac   | ip| vlan|
+--+--+---+---+-+
| 1014 | MTPC-01  | 00:02:B3:A2:9D:ED | 155.97.15.11  | Vlan-29 |
| 1015 | MTPC-02  | 00:02:B3:A2:B6:F4 | 155.97.15.12  | Vlan-29 |

This table will hold a very large number of entries, all unique.  I have
created a simple HTML form which updates the entries but before it does
it checks to see if records already exist that contain either the same
IP value, the same MAC value or the same Hostname value.  If any of
these items exist it currently discards the posted informaiton and
prompts the user to re-enter because I cannot have duplicate entries of
either the hostname, mac, ip fields.

Here is my function:
eg.
$x = mysql_query("SELECT * FROM $table WHERE hostname =
'$_POST[hostname]' OR ip = '$_POST[ip]' OR mac = '$_POST[mac]' NOT id =
'$_SESSION[id01]'")or die(mysql_error());
$num = mysql_num_rows($x);
   if($num == "0") {
 unset($_SESSION['search']);
 require 'dbase.inc.php';
 $table = "hosts";
 $sql = @mysql_query("UPDATE $table SET hostname =
\"$_POST[hostname]\", mac = \"$_POST[mac]\", ip = \"$_POST[ip]\", vlan =
\"$_POST[vlan]\" WHERE id = \"$_SESSION[id01]\"")or die(mysql_error());
 echo "Form worked!";
} elseif ($num != 0) {
   unset($_SESSION['search']);
   echo "Form didn't work because 1 of the 3 fields were present in
another record!!! Please try again.";
} else {
   echo "RTM again please!"; }

I think what I really need to know is if there is a quick way to sort
through the results of the current database records and do comparisons
against the form.  If any one has done something like this before could
you please show me an example or point me to a good resource.  Thanks in
advance.
Jas

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

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



RE: [PHP-DB] PHP Java problem

2004-01-13 Thread Peter Lovatt
Hi

php has very loose typing. This means that you can use a string as a number
and visa versa. You could for example do (substr("1 day",0,1) + 5) and get
the answer 1+5=6

php actually converts on the fly to do the above. The downside is that you
cannot always be sure what type a variable is. Form variable are always
strings, even if they are numbers.

I am not a java engineer either but "argument type mismatch" might be that
you are  passing a string when it expects a number or visa versa.

Try using settype() to force the type

http://uk2.php.net/manual/en/function.settype.php

and see if this fixes it.

Just a guess though, hope it helps

Peter





-Original Message-
From: Donovan Hutchinson [mailto:[EMAIL PROTECTED]
Sent: 13 January 2004 20:49
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP Java problem


Hi,

I've started putting together a site that uses PHP to access some custom
Java classes. While I'm not clear on what exactly the java classes are
doing, the programmer has given me an overview of the variables that I
should pass to them. However, I keep getting this error:

java.lang.IllegalArgumentException: argument type mismatch

The java programmer has no knowledge of PHP and so is unable to help locate
the source of the problem (tbh I'm don't have experience in large php
projects myself). The code I'm writing is in the following format:

$newobject = new Java('com.company.Class', $names, (String) $ssn, (int)
$time);

In the above example, $names is an object, $ssn a string and $time an
integer. The object $names is created in a similar way above this example.
Someone mentioned that I should be passing objects as arrays, but I'm not
clear on how this is done.

I've tested a very basic class to be sure it works, and had success, however
when I try to pass objects into classes, and multiple variables, it doesnt
work. I hope someone can shed some light on where I might be going wrong.

Many thanks,

Don

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

2004-01-20 Thread Peter Lovatt
you need quotes around the name

FirstName="$fname"

otherwise it takes the value of $fname to be  aa field name

HTH

Peter



-Original Message-
From: Kermit Short [mailto:[EMAIL PROTECTED]
Sent: 20 January 2004 22:28
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Update problems


I'm trying to update a record in a MSSQL database.  When I execute the
following code on an IIS5 webserver, I get an error message that says:

PHP Warning: odbc_do(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL
Server]Invalid column name 'Tom'., SQL state S0022 in SQLExecDirect in
E:\web\phptest\dbtest.php on line 31

This is after I've submitted the name Tom in the form.  Does anyone have any
ideas?!
Thanks very much in advance!
-Kermit

Could not Connect.");
 }
 else {
  echo"Connected to Database.";
  $sqlupdate="UPDATE UserInfo
 SET ZNum='112763', FirstName=$fname, LastName='Short', TA='00',
Building='1197', Room='112',  Div='FWO', Grp='IIM'
 WHERE ZNum='112763'";
  $sqlupdresults=odbc_do($odbccon, $sqlupdate);
  $query="SELECT * FROM UserInfo WHERE ZNum=112763";
  $qresults=odbc_do($odbccon, $query);
  odbc_result_all($qresults, "border=1");
  odbc_close($odbccon);
  echo "Connection Closed.";
 }
}
else {
 ?>
 
  First Name: 
  
 
 

--
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] Results with ledger stripes?

2004-01-25 Thread Peter Lovatt
";
$mongo = @mysql_query ("SELECT
substring_index(name,'.',-2),ROUND(AVG(speed),1) FROM `readings` GROUP BY
substring_index(name,'.',-2) ORDER BY substring_index(name,'.',-2) ASC");
echo "DomainAverage Speed\n";
while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM))
{
 if($bg=='#dd']) $bg='#ff' ;
 else $bg='#dd' ;

 echo "$mongorow[0]$mongorow[1]\n";
}
echo "";
?>

And I'd like it to spit out something along these lines:

domain1.com666.6 kbps
domain2.com3000.0 kbps
repeat until done



HTH

Peter

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 26 January 2004 01:43
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Results with ledger stripes?


Hello all,

I'm in the midst of creating an internet speed test system thingamabob for
my website.  It's basically finished...but ugly as sin.  What I'd like to do
is have the results (an average of each domain tested) listed in a nice
pretty table with alternating background colors, kinda like a ledger.  How
on earth do I do this?

Here's what I've got thus far:

";
$mongo = @mysql_query ("SELECT
substring_index(name,'.',-2),ROUND(AVG(speed),1) FROM `readings` GROUP BY
substring_index(name,'.',-2) ORDER BY substring_index(name,'.',-2) ASC");
echo "DomainAverage Speed\n";
while ($mongorow = mysql_fetch_array($mongo, MYSQL_NUM)) { echo
"$mongorow[0]$mongorow[1]\n";}
echo "";
?>

And I'd like it to spit out something along these lines:

domain1.com666.6 kbps
domain2.com3000.0 kbps
repeat until done


The gizmo is up and running at
http://www.dibcomputers.com/bandwidthmeter/index.php if you care to have a
gander.
Thanks a bunch,
Dan

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



RE: [PHP-DB] getting font size from browser

2004-01-30 Thread Peter Lovatt
php cannot read the sizes directly, but you can use javascript to pass
information to php and then use that

This is a routine I use to get screen size






this is on an opening  page - which redirects to another page, passing
parameters to php as it goes.


HTH

Peter






-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]
Sent: 30 January 2004 13:24
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] getting font size from browser


PHP is SERVER side, not browser side.
That's a Javascript question.
Miles
At 11:14 AM 1/30/2004 +0100, Roy G. Vervoort wrote:


>Is it possible to retreive the font size or view size from the browser.
>
>
>In the browser it is possible to change the screenview (make it larger or
>smaller for people with a visual aid). I would like to ineract my
stylesheet
>with these default settings.
>
>thans
>
>Roy
>
>--
>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] Question

2004-02-08 Thread Peter Lovatt
Hi

I think it may be the { and } which are used in php

if they are part of the data you are saving then try adding  a \ =>  \{ and
\} if not remove them.

Peter


---
Excellence in internet and open source software
---
Sunmaia
Birmingham
UK
www.sunmaia.net
tel. 0121-242-1473
International +44-121-242-1473
---







-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 07 February 2004 19:37
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Question


Dear friends,

On submitting form to mysql database I get a parse error,There is no problem
with connection code, Problem is some where around create the sql statement
Can any one figure out where is the precise error, please.
Following is the code from php file



-
Asif

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



RE: [PHP-DB] MySQL Multi-DB Join

2004-03-18 Thread Peter Lovatt
assuming the dtaabases are on the same server

$query = "
select db1.table1.field
from db1.table1, db2.table2
where
db1.table1.field1 = db2.table2.field2  
"

$result = mysql_query($query,$conection)

HTH

Peter


> -Original Message-
> From: Rod Strumbel [mailto:[EMAIL PROTECTED]
> Sent: 18 March 2004 14:48
> To: '[EMAIL PROTECTED]'
> Subject: [PHP-DB] MySQL Multi-DB Join
> 
> 
> Is there a way through the php mysql commands
> to join tables between databases?
> 
> Is simple enough at MySQL command line, but can't for the life
> of me figure out how to do it in PHP.
> 
> Thanks all,
> 
> R
> 

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



RE: [PHP-DB] MySQL Multi-DB Join

2004-03-18 Thread Peter Lovatt
I think as you are specifying the db in the query you dont need to select
it.

If you  do, mysql still uses DBs as specified in the query.

Peter

> -Original Message-
> From: Rod Strumbel [mailto:[EMAIL PROTECTED]
> Sent: 18 March 2004 15:14
> To: 'Peter Lovatt'; '[EMAIL PROTECTED]'
> Subject: RE: [PHP-DB] MySQL Multi-DB Join
>
>
> ?!?
>
> And just use the normal old db selection
> command for it?
>
> Which of the DBs would you select, or does it matter?
>
> mysql_select_db($databasename,$dbhandle);
>
> Think that is what has been confusing me.
> If you can select just one db, then what is that
> select_db command really doing?  Is it just
> establishing a mysql session, and once established
> you can issue pretty much any mysql command
> through the mysql_query command?
>
> If that IS the case, then why bother specifying the DB at
> all just issue the mysql_connect, and go straight
> to the mysql_query (although that doesn't work...tried it)?
> Just trying to figure out what that mysql_select_db
> is doing.
>
> Oh, and yes... the databases are on the same server
>
> Thanks again,
>
> R
>
> -Original Message-
> From: Peter Lovatt [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 18, 2004 9:02
> To: Rod Strumbel; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] MySQL Multi-DB Join
>
>
> assuming the dtaabases are on the same server
>
> $query = "
> select db1.table1.field
> from db1.table1, db2.table2
> where
> db1.table1.field1 = db2.table2.field2
> "
>
> $result = mysql_query($query,$conection)
>
> HTH
>
> Peter
>
>
> > -Original Message-
> > From: Rod Strumbel [mailto:[EMAIL PROTECTED]
> > Sent: 18 March 2004 14:48
> > To: '[EMAIL PROTECTED]'
> > Subject: [PHP-DB] MySQL Multi-DB Join
> >
> >
> > Is there a way through the php mysql commands
> > to join tables between databases?
> >
> > Is simple enough at MySQL command line, but can't for the life
> > of me figure out how to do it in PHP.
> >
> > Thanks all,
> >
> > R
> >
>

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



RE: [PHP-DB] Use of database

2004-03-27 Thread Peter Lovatt
Hi

only users with the privileges will be able to access those pages.

if you are using mysql 3.xx the link wont show for low privilege users (I
think !)

4.xx seems to show the links, but you can still only access them if you have
the right privileges

HTH

Peter




> -Original Message-
> From: Will [mailto:[EMAIL PROTECTED]
> Sent: 27 March 2004 15:21
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Use of database
>
>
> I have searched but I cannot find anything that will help me.
>
> I am using phpMyAdmin and I want to have a user not see the privilages,
> mysql info and such. How do you get rid of those links in the main page.
>
> Thank in adanvce.
> ~WILL~
>
> --
> 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] Double Submission into DB if Hit Refresh

2004-04-17 Thread Peter Lovatt
Hi

Add a hidden field into the form with a unique transaction ID.

When the data is submitted first time save the transaction ID to a table.

Before you do anything check to see if the transaction ID exists in the
table, if not then you are ok to save the transaction ID and then add/update
the data.

If the ID is already there, then do not add/update and send the user a
message to say they have submitted the same transaction twice.

HTH

Peter



> -Original Message-
> From: Craig Hoffman [mailto:[EMAIL PROTECTED]
> Sent: 18 April 2004 01:30
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Double Submission into DB if Hit Refresh
>
>
> What is the best way to avoid data being resubmitted (entered twice) to
> DB (mysql) if the user hits refresh after POSTING data via a form?
> __
> Craig Hoffman - eClimb Media
>
> v: (847) 644 - 8914
> f: (847) 866 - 1946
> e: [EMAIL PROTECTED]
> w: www.eclimb.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] Re: Using $_SESSION array for large number of variables. Any recommendations?

2004-04-25 Thread Peter Lovatt
Hi,

I would suggest a mysql table for the data. For large amounts it is probably
more efficient - not sure how much resource is needed to manage 100K pieces
of information using $_SESSION, but an indexed mysql table is probably much
quicker.

table

CREATE TABLE `session_data` (
`userID` VARCHAR( 20 ) NOT NULL ,
`var_name` VARCHAR( 100 ) NOT NULL ,
`var_data` VARCHAR( 250 ) NOT NULL ,
PRIMARY KEY ( `userID` , `var_name` )
);

you then retrieve the data at the beginning of each page request.

This is also persistent, so it will be there for as long as needed. If you
have a login system this also allows the user to switch machines or
browsers - $_SESSION is linked to the browser.

>From experience this works well.

hth

Peter


---
Excellence in internet and open source software
---
Sunmaia
Birmingham
UK
www.sunmaia.net
tel : 0121-242-1473
fax : 0870 7621758
International +44-121-242-1473
---









> -Original Message-
> From: Jimmy Brock [mailto:[EMAIL PROTECTED]
> Sent: 26 April 2004 00:48
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Re: Using $_SESSION array for large number of
> variables. Any recommendations?
>
>
> I would recommend cookies, not session.
>
> Cookies are stored on the users machine, whereas session data is stored on
> the server. If you have a power failure or have to reboot the
> server session
> data will be lost -- since session data is stored in memory.
>
> "Ross Honniball" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi all,
> >
> > System : Windows XP / Apache / MySql / PHP
> >
> > I'm considering using session variables to store a large amount of data.
> > How much is 'large'? To be honest, I have no idea at this point - very
> > early days.
> >
> > For arguments sake, lets say the system consisted of 100 users who will
> all
> > store between them say 1000 different variables and objects for a period
> of
> > 1 or 2 days.
> >
> > In a nutshell, reason for storing this info is to save the state of php
> > programs.
> >
> > Is this approach advisable, or are there limits / other considerations
> when
> > using session variables?
> >
> > I would greatly appreciate peoples comments on potential
> problems pursuing
> > this approach from anyone with extensive experience using session vars.
> >
> > Thanks ... Ross
> >
> > . Ross Honniball  JCU Bookshop Cairns Supervisor
> > . James Cook Uni, McGreggor Rd, Smithfield, Qld. 4878, Australia
> > . Ph:07.4042.1157  Fx:07.4042.1158   Em:[EMAIL PROTECTED]
> > . There are no problems. Only solutions.
>
> --
> 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] passing var array

2004-04-26 Thread Peter Lovatt
echo $_GET["some_var"]

> -Original Message-
> From: Sukanto Kho [mailto:[EMAIL PROTECTED]
> Sent: 26 April 2004 09:34
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] passing var array
> 
> 
> Hi, 
> 
> How to pass var array to other page?
> 
> I use $_GET but when I echo it, it appear "array"...
> 
> Thanx
> 
> Sk2 
> 
> -- 
> 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] converting scripts for register_globals=Off

2004-04-29 Thread Peter Lovatt
Hi

There are three main types of data passed by the browser - GET POST and
COOKIE.

php creates an array for each type, so what is $id now would also be
$_GET["id"] or $_POST["id"]

There is also $_REQUEST which is a combination of $_GET and $_POST so
$_REQUEST["id"] will also work.

If it were a cookie value it would be $_COOKIE["id"]

When register_globals is off $id will not be defined and only the above
arrays will be usable.

It is generally better practice to use the arrays anyway, so I would suggest
using them all the time.

HTH

Peter







> -Original Message-
> From: Kim Jacobs (Crooks) - Mweb [mailto:[EMAIL PROTECTED]
> Sent: 29 April 2004 10:40
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] converting scripts for register_globals=Off
>
>
> if any of you could help me out, I would greatly appreciate it...
> I am an absolute beginner to php (2 weeks now) and dont know what
> I dont know...
>
> I have written some scripts to access my online SQL db and I've
> tested the scripts on my machine with PHP 4.3.6 and register_globals = On
> Now where I host my site, uses PHP 4.3.5 and has register_globals
> = Off which means of course, that my scripts arent working, but I
> dont know why
>
> My question is, how do I convert my scripts so that they will
> work please? I know that $id and $submit are two of the 'inputs'
> that it doesnt like, but I dont know the rest
>
> Tx
> K
>
>  
> MWEB: S.A.'s most trusted and reliable Internet Service Provider.
> Just Like That.
>
> To join, go to: http://join.mweb.co.za or call 0860032000.
>
> --
> 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] The usual problem

2004-05-02 Thread Peter Lovatt
Looks OK to me

What error do you get ?

try


$sql = "
INSERT INTO underskrifter (
id
, type
, navn
, epost
, tid
, ip
, domain
, sted
)  VALUES (
''
, '$_POST[type]'
, '$_POST[navn]'
, '$_POST[epost]'
, '$tid'
, '$ip'
, '$host'
, '$_POST[sted]'
 );
  ";

mysql_query($sql) or die (mysql_error());

and see what you get

Peter

> -Original Message-
> From: Mathias Hunskår Furevik [mailto:[EMAIL PROTECTED]
> Sent: 03 May 2004 01:31
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] The usual problem
>
>
> Whats worng with this?
>
> $sql = "INSERT INTO underskrifter (id, type, navn, epost, tid,
> ip, domain,
> sted) "
>  . " VALUES ( '', '$_POST[type]', '$_POST[navn]',
> '$_POST[epost]',
> '$tid', '$ip', '$host', '$_POST[sted]' );"
>  . " ";
>
> mysql_query($sql);
>
> ???
>
> First I tryed the usual INSERT syntax, then the one that phpMyAdmin
> suggests. None of them works.
>
> -
> Mathias
> Norway
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



RE: [PHP-DB] RE: [tcphp] Hella fun project I'm about to throw at some tech college students

2004-05-02 Thread Peter Lovatt
Hi

If the reformating is complex - ABVDFR Co is in the middle of the field  -
then php

$bits = explode (" ", $FieldValue ) ;

then each element of $bits is a word, making reworking it easier

Just my 2p worth :)

Peter



> -Original Message-
> From: Rafi Sheikh [mailto:[EMAIL PROTECTED]
> Sent: 03 May 2004 02:17
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: [PHP-DB] RE: [tcphp] Hella fun project I'm about to throw at
> some tech college students
>
>
> Hi List.   A quick question.  I have some categories that are really long
> and I would like to re-word or re-format them when I am bring
> data in from a
> DB.  Now which would be better:
>
> Do it with PHP
> or
> Do it with MySQL
>
> Any suggestions as to how to?
>
> Example:
> A column name: Customer --> VARCHAR
> Values in Customer: "USA-North Upper ABVDFR Co. and Sons"
>
> I would like to re-word it for example: ABVDFR Co.
>
> I know I could use SUBSTRING or MID, or replace but the issue is since the
> column is a VARCHAR, the length of the value may change from row
> to row, for
> example: one row it maybe 20, in the next 13 and so on so forth.  I also
> thought that if I could use a length statement and come up with a
> formula...but so far no successany suggestions?
>
> Thx in Adv.
>
> RS
>
>
> This e-mail, including attachments, may include confidential and/or
> proprietary information, and may be used only by the person or entity to
> which it is addressed. If the reader of this e-mail is not the intended
> recipient or his or her authorized agent, the reader is hereby
> notified that
> any dissemination, distribution or copying of this e-mail is
> prohibited. If
> you have received this e-mail in error, please notify the sender
> by replying
> to this message and delete this e-mail immediately.
>
> --
> 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] Wrong table name - can it be fixed?

2004-05-17 Thread Peter Lovatt
Hi

using phpMyAdmin enter the following into a sql box

ALTER TABLE `16-05` RENAME `newname` ;


HTH

Peter

> -Original Message-
> From: Viorel Dragomir [mailto:[EMAIL PROTECTED]
> Sent: 17 May 2004 09:54
> To: Martin E. Koss; [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Wrong table name - can it be fixed?
>
>
> Use "tablename" from mysql command prompt.
> Try to use it from phpmyadmin, but I don't know if it works..
> And don't post emails with high priority anymore.
>
>   - Original Message -
>   From: Martin E. Koss
>   To: [EMAIL PROTECTED]
>   Sent: Monday, May 17, 2004 11:48
>   Subject: [PHP-DB] Wrong table name - can it be fixed?
>
>
>   I've made a big boo boo when exporting from MS Access to MySql database.
>   The table name was '16-05' which obviously is not a good name to have in
>   MySql.
>   I'm using PhpMyAdmin as I'm not very experienced with sorting out the
>   databases any other way. Problem is that I can't access the properties
>   of the table in order to rename it, whatever I try to do I get an error
>   (which is obviously due to the type of name the table has).
>
>   Is there any way I can fix this without getting too complicated?
>
>   Cheers.
>
>   Martin
>
>   ---
>   Outgoing mail is certified Virus Free.
>   Checked by AVG anti-virus system (http://www.grisoft.com).
>   Version: 6.0.684 / Virus Database: 446 - Release Date: 13/05/2004
>
>
>   --
>   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] require function detail with example

2004-06-26 Thread Peter Lovatt

Hi

assuming you want to check the variable in php you need gettype()

http://uk2.php.net/manual/en/function.gettype.php

the text box can only be done with javascript combined with an event

eg







If you need more on the javascript then a specialist javascript list would
be better :)

Peter



> -Original Message-
> From: Rinku [mailto:[EMAIL PROTECTED]
> Sent: 26 June 2004 08:13
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] require function detail with example
>
>
> 1)I need to check a variable weather it is numeric or
> character. Could any of you answer for the query ?
> 2)I want to set the focus of one particular textbox.
> So could you pls answer how to setfocus ?
>
>
>
> __
> Do you Yahoo!?
> Yahoo! Mail - 50x more storage than other providers!
> http://promotions.yahoo.com/new_mail
>
> --
> 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] How to forward a POSTed form to another server and catch the return for further processing

2004-08-15 Thread Peter Lovatt
hi

this should do the trick

Peter



// this is the script to pass the post onto
$server_to_post_to = 'http://www.test.com/somescript.php';

$url = parse_url($server_to_post_to);
unset($request_data) ;

//run through the data POSTed to this server and build a new POST request

foreach ($_POST as $name => $value)
{
   if (strlen($request_data) > 0)  $request_data .= '&';
   
   $request_data .= $name.'='.urlencode($value);
} 

//create a new post to the other sever
$request= "POST ".$url['path']." HTTP/1.1\r\n".
   "Host: ".$url['host']."\r\n".
   "Content-type: application/x-www-form-urlencoded\r\n".
   "Content-length: ".strlen($request_data)."\r\n\r\n".
   $request_data;
   


// Open the connection 
$fp = fsockopen($url['host'], 80, $err_num, $err_msg, 30); 

if ($fp) 
{
   // Submit form
   fputs($fp, $request);
   
   // Get the response 
   while (!feof($fp)) 
{
  $response .= fgets($fp,1024);
}

   fclose($fp);
   //do somthing with $response here
   
}
else
{
//could not connect to  server
print 'Error '.$err_num.' '.$err_msg;
}







> -Original Message-
> From: Yanglong Zhu [mailto:[EMAIL PROTECTED]
> Sent: 15 August 2004 01:41
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] How to forward a POSTed form to another server and
> catch the return for further processing
> 
> 
> How to forward a POSTed form to another server and
> catch the return for further processing.
> 
> I think I did this before. But now I have completely
> forgot how that was done. The posted form data is
> processed on the other server, the results should be
> returned or captured by the first server. Obviously my
> brain is not working.
> 
> Thanks for your help.
> 
> 
>   
> __
> Do you Yahoo!?
> Yahoo! Mail - 50x more storage than other providers!
> http://promotions.yahoo.com/new_mail
> 
> -- 
> 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] Help, i'm really desperated

2004-08-25 Thread Peter Lovatt
Hi

php runs as the same user as apache. Depending  on any other security/system
issues you could set apache to run as postgres.

Otherwise why not connect to postgres using the php functions and write the
text file using php?

You might also be able to su to postgres.

HTH

Peter

> -Original Message-
> From: Mário Gamito [mailto:[EMAIL PROTECTED]
> Sent: 25 August 2004 11:09
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Help, i'm really desperated
>
>
> Hi,
>
> I need to run this command inside a PHP (web) script, in order to
> produce an acl list (url_negados.txt) for squid:
>
> /usr/bin/psql -t knet -c "SELECT url_negado from urls_negados" >
> /tmp/urls_negados.txt
>
> I'm using shell_exec to run it.
>
> Well, so far, so good.
> The problem is that i must run this command as user postgres, otherwise
> it won't work and i can't find a way to do it in PHP :(
>
> Any ideas would be appreciated.
> I'm realy desperated.
>
> Warm Regards,
> Mário Gamito
>
> --
> 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] Webpage response to selection & $_POST

2004-08-29 Thread Peter Lovatt
Hi

you need to check for $_POST["user1"], $_POST["user2"] etc - is that what
you are doing?

Your other variables are done as an array - $firstName[$j] etc, should your
check box be

 echo ' ' . "\n";

(note the [])


Otherwise try vardump($_POST) to see exactly what is being returned.

If this does not fix it try posting the code that handles the response and
we will try and help.

Peter





> -Original Message-
> From: Philip Thompson [mailto:[EMAIL PROTECTED]
> Sent: 30 August 2004 00:12
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Webpage response to selection & $_POST
>
>
> Hi all.
>
> I have a list of users in a database that I would like to show on a
> dynamic webpage. With each of these users that shows up on the page,
> there is going to be a checkbox next to their name so that I can
> perform multiple tasks, such as 'Remove User' or 'Modify Information'.
> I have all of the appropriate information showing up on the page,
> including the checkboxes.
>
> My question is... if I select a checkbox for a user, the other pages do
> not even recognize that I have selected that checkbox and I am using
> the $_POST method - why is that? I have even attempted to use the
> import_request_variables function - no luck. So, I cannot verify which
> users I want to perform an action on.
>
> Anyone have any ideas? Snippets of code to follow...
>
> Thanks in advance,
> ~Philip
>
>
> 
> 
>  for ($j=0; $j<$numRows; $j++) {
>  echo '' . "\n";
>  echo 'value="1">' . "\n";
>  echo '   ' . $dbid[$j] . '' . "\n";
>  echo '   ' . $firstName[$j] . '' . "\n";
>  echo '   ' . $lastName[$j] . '' . "\n";
>  echo '   ' . $uid[$j] . '' . "\n";
>  echo '   ' . $username[$j] . '' . "\n";
>  echo '   ' . $classification[$j] . '' . "\n";
>  echo '   ' . "\n";
> }
> ?>
> 
>
> 
> 
> 
> 
>

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



RE: [PHP-DB] Please help

2004-09-08 Thread Peter Lovatt
HI

try 

 $result = mysql_query($sql . " " . $sql_ext . " limit 0,1")
 or die("Invalid query".mysql_error());

which will give more detail on the error.

HTH

Peter

> -Original Message-
> From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
> Sent: 08 September 2004 20:29
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Please help
> 
> 
> I'm using a product called dbqwiksite pro.  PHP
> generator for PHP - MySQL 
> 
> The code seems to be working fine except in my search
> page where I receive an "invalid query"
> 
> $result = mysql_query($sql . " " . $sql_ext . " limit
> 0,1")
> or die("Invalid query");
> 
> This is the place I where the code is taking the die
> path.
> I'm guessing something belongs between the quotation
> marks , just not sure.
> 
> Anyone ?
> 
> Thank you
> Stuart
> 
> -- 
> 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] Newbie Question - mysql_select_db fails with access denied.

2004-09-24 Thread Peter Lovatt
Hi

try $db = mysql_connect("localhost", "myuser","mypassword") - without it  you are not  
submitting a password 

Peter

> -Original Message-
> From: Christian Schlaefcke [mailto:[EMAIL PROTECTED]
> Sent: 24 September 2004 13:31
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Newbie Question - mysql_select_db fails with access
> denied.
> 
> 
> Hi Folks,
> 
> I want to do something like the following:
> $db = mysql_connect("localhost", "myuser") or die("Connect failed : " .
> mysql_error());
> 
> mysql_select_db("mydb",$db) or die("SELECT_DB failed : " . mysql_error
> ());
> 
> $result = mysql_query("SELECT * FROM mytable", $db) or die("Query
> failed : " . mysql_error());
> 
> The script does not proceed beyond the "mysql_select_db" line. I get
> this error:
> SELECT_DB failed: Access denied for user ''@'localhost' to database
> 'mydb'
> 
> What happened to the user information. I have granted all neccessary
> rights to "myuser". But it seems that itÂs even not caring about the
> user.
> 
> I have MySQL 4.1.4 and PHP 4.3.8-2.1 on a Fedore Core 2 System  running.
> 
> Thanks & 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



RE: [PHP-DB] Problem with script

2004-11-02 Thread Peter Lovatt

Try echoing the actual query being run. It will give you more info to work
with.

Peter




> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: 02 November 2004 16:42
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Problem with script
>
>
> Hi all, greetings from Phoenix, Arizona!
> I'm having a problem with a PHP script and the database it manages.
> I'm having his error message:
>
> Query failed: You have an error in your SQL syntax. Check the manual that
> corresponds to your MySQL server version for the right syntax to use near
> 't read card','1099413551')' at line 1
>
> I don't know what is happening, usually the database works well but
> sometimes this strange error appears. I'm sending you the scripts in where
> I think the error could be.
>
> Any suggestion or comment will be very appreciated.
>
> Thanks
>
> Renato

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



RE: [PHP-DB] save as you type

2004-12-12 Thread Peter Lovatt
You could use JavaScript






onblur executes when the user leaves the box, and will submit the form

HTH

Peter


> -Original Message-
> From: Matthew Perry [mailto:[EMAIL PROTECTED]
> Sent: 12 December 2004 05:12
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] save as you type
>
>
> Is there a way to make an input box save data into a database as users
> type?  My users keep forgetting to press my "apply changes" buttons.
> Matthew
>
> --
> 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] forgetting to close db connection

2004-12-12 Thread Peter Lovatt
Hi

If you have a large number of users updating the same database there are a
wide range of issues that come into play.

I am assuming you have a web interface, if not the following  does not
apply.

The web is stateless. By that I mean that there is no persistent connection
between your page and the server, unlike a desktop database like Access.

Your browser requests a page, your webserver generates the page, in
co-operation with php and MySql. The whole page is then returned and your
browser displays it. Although your php script may not  explicitly disconnect
from MySql, once the request has been fulfilled it will do it automatically.

This is a simplified overview, and there are tricks that allow slightly
different behaviour, but this is how it generally  works.

Unlike a desktop database, MySql does not lock the data while you update it,
so you need to manage the case where two users might edit the same data and
overwrite each others changes. Like web pages, MySql does its job in
transactions. You send the instruction to MySql, it completes the
transaction and then disconnects. So, from a data point of view, your user
requests a copy of the record, MySql sends the data, with no idea what your
user will do with it. When the editing is complete your user's browser sends
the edited data back, and php tells MySql to execute an update of some sort
using the data the browser sent back. MySql does not check to see if the
data has changed since you requested it in the first place.

There have been a few discussions about record locking over the last month
or so, which would be worth reading.

700 users constantly updating data is quite a lot. If you get to that stage
you may need a hosting solution to match, 20 users should not present any
problems for most web hosts.

Hope this gives a clearer picture.

Peter






















> -Original Message-
> From: Matthew Perry [mailto:[EMAIL PROTECTED]
> Sent: 12 December 2004 15:23
> Cc: [EMAIL PROTECTED]
> Subject: [PHP-DB] forgetting to close db connection
>
>
> On my forms I connect to my database each page that I need to update the
> data.
> I do not disconnect at the end of the page.
> Very soon I will have about 20-700 entering data simultaneously.  I
> might use this javascript code sent by Peter.  This will probably lead
> to a pretty huge overhead.
> Is not disconnecting on every page going to cause any problems?  Are
> there any other concerns I should consider?
>
> Matthew
>
>
> Peter Lovatt wrote:
>
> >You could use JavaScript
> >
> >
> > >onBlur="dataform.submit()">
> >
> >
> >
> >onblur executes when the user leaves the box, and will submit the form
> >
> >HTH
> >
> >Peter
> >
> >
> >
> >
> >>-Original Message-
> >>From: Matthew Perry [mailto:[EMAIL PROTECTED]
> >>Sent: 12 December 2004 05:12
> >>To: [EMAIL PROTECTED]
> >>Subject: [PHP-DB] save as you type
> >>
> >>
> >>Is there a way to make an input box save data into a database as users
> >>type?  My users keep forgetting to press my "apply changes" buttons.
> >>Matthew
> >>
> >>--
> >>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] Re: HTTP Auth for PHPMyAdmin

2004-12-22 Thread Peter Lovatt
set auth type to cookies

Peter

> -Original Message-
> From: Mark Benson [mailto:[EMAIL PROTECTED]
> Sent: 22 December 2004 10:55
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Re: HTTP Auth for PHPMyAdmin
> 
> 
> Martin Norland wrote:
> 
> >What do you mean proper HTTP authorization for PHPMyAdmin - do you want
> >it to log you in automatically, or do you want to use .htaccess to
> >protect your PHPMyAdmin scripts?
> >
> >By your statement of config file, and talking about PHPMyAdmin - I'm
> >assuming that you've configured it to automatically log you in - in
> >which case I would suggest you verify you can login with the same exact
> >paramters on its normal login, as well as confirming that the parameters
> >are indeed set when it attempts to check them.
> 
> Sorry I was being chased out of the building at the end of the 
> day when I was writing that e-mail :)
> 
> What I meant was I want to setup phpMyAdmin so that a login is 
> required when you access the pages (i.e. you must enter a u/n and 
> pwd in a dialog).
> Currently my config.inc.php is set so that the 
> '$cfg['Servers'][$i]['auth_type'] = 'config'; and I supply 
> the MySQL user and pwd in the config.inc.php and it connects 
> automatically. This is not ideal as I'd like to prevent others 
> accessing it, for security and integrity reasons.
> 
> If I set the config.inc.php value to 
> '$cfg['Servers'][$i]['auth_type'] = 'http';' then it will 
> show a login dialog on connection but any u/n and pwd I try 
> (based on the MySQL grant tables) is rejected.
> 
> What I need to know is what is the best way to limit access to 
> the pages, do I ignore the config.inc.php and setup some other 
> system or can i use the grant tables from my MySQL server?
> 
> Ideally I would want to log into the MySQL server as either my 
> normal 'dbadmin' user OR 'root' as only 'root' has alteration 
> rights on the grant tables so stuff that is outside the auspices 
> of normal admin is easier to carry out (i.e. doesn't involve me 
> hacking the config.inc.php all the time).
> 
> -- 
> Mark Benson
> 
> http://homepage.mac.com/markbenson
> 
> -- 
> 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] Help in learning PHP and MySQL

2004-12-31 Thread Peter Lovatt
Hi

from php 5 onwards mysql is not enabled by default

http://www.php.net/manual/en/ref.mysql.php


Note: Windows users will need to enable php_mysql.dll inside of php.ini and
either copy libmysql.dll into the Windows system directory, or make it
available to the PATH.

from memory...
(To enable it, edit php.ini - find the reference to php_mysql.dll and remove
the ; which comments it out )

Peter




> -Original Message-
> From: Novice Learner [mailto:[EMAIL PROTECTED]
> Sent: 31 December 2004 03:35
> To: php-db@lists.php.net
> Subject: [PHP-DB] Help in learning PHP and MySQL
>
>
> I apologize if this is a very basic question.
>
> I just started learing PHP and MySQL, I am reading "PHP and
> MySQL" by Larry Ullman, I also have access to PHP 5 by Julie
> Meloni. I reached Chapter 6 of Ullman's book and got stuck.
>
> I have the following code:
>
>  //This file contains the database access information. This file
> also establishes a connection
> //to MYSQL and selects the database.
> //Set the database access information as constants
> define ('DB_USER', 'masud');
> define ('DB_PASSWORD', 'masud');
> define ('DB_HOST', 'localhost');
> define ('DB_NAME', 'masud');
> //Make the connection and then select the database
> $dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD);
> mysql_select_db(DB_NAME);
> ?>
>
> I have a normal MySQL user as "masud", whose password is also
> "masud" and a database also called "masud". All this for learning purpose.
>
> I get the following error message:
>
> Fatal error: Call to undefined function mysql_connect() in
> C:\Program Files\Apache
> Group\Apache2\htdocs\CTA\mysql_connect.php on line 13
>
> The books says:
> If you receive an error that claims mysql_connect() is an
> undefined function, it means that PHP has not been compiled with
> MySQL support.
>
> I have been running a test script with  and I get
> the results successfully.
>
> I am running Windows XP with Apache 2 server and PHP5 5.0.3
>
> I would appreciate if you could help me in any way, including
> pointing me to resources that can help get going.
>
> Thank you,
>
> Masud
>
>
>
> -
> Do you Yahoo!?
>  Read only the mail you want - Yahoo! Mail SpamGuard.

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



RE: [PHP-DB] Security Question

2005-01-16 Thread Peter Lovatt
Hi

It is better from a security point of view to have a secure login. The secure 
server encrypts the data between the browser and the server, making it 
impossible to read on its journey from you to the server.

However whether it is a major security  problem is another question. To view 
the traffic somebody must have access to the servers that route your request, 
which isn't easy. They then have to spot your traffic amongst all the other web 
traffic.

If it is the login for your Swiss bank account where you hid the million you 
made without declaring tax then it should be secure - no question. On the other 
hand if it is just to login to see when your books will be delivered, with no 
sensitive financial information then the risk is smaller and it is unlikely 
that anyone is trying too hard to get your login, so an insecure login carries 
less risk. 

You could always host the login page on a non secure server but post the form 
to a secure server.

Peter








> -Original Message-
> From: Micah Stevens [mailto:[EMAIL PROTECTED]
> Sent: 17 January 2005 02:46
> To: php-db@lists.php.net
> Subject: Re: [PHP-DB] Security Question
> 
> 
> 
> If it submits to a secure server the form data will be encrypted before 
> transmission I believe. At least that's my understanding, and 
> that seems to 
> be how ebay does it for example. Once you log-in, it submits to a secure 
> page. 
> 
> -Micah 
> 
> 
> On Sunday 16 January 2005 06:38 pm, Chris Payne wrote:
> > Hi everyone,
> >
> >
> >
> > I have a security question, I want to see if I am right or 
> wrong.  I have
> > programmed a system with PHP and MySQL, the main system resides 
> on a secure
> > server, but the client wants the login page on a NON-Secure server for
> > marketing purposes.  Am I the only one who thinks this is a 
> major security
> > concern?
> >
> >
> >
> > 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



RE: [PHP-DB] Security Question

2005-01-17 Thread Peter Lovatt
Hi

The page/form will be requested over a non secure connection. When the form is 
submitted the browser establishes a secure connection to the server and then 
sends the data, so the data is sent securely.

Peter




> -Original Message-
> From: Micah Stevens [mailto:[EMAIL PROTECTED]
> Sent: 17 January 2005 03:47
> To: php-db@lists.php.net
> Subject: Re: [PHP-DB] Security Question
> 
> 
> But what I'm saying is that if you're submitting a form from an unsecured 
> page, to a script on a secure server, the data will still be encrypted. 
> Anyone know this for sure to be correct? It sure makes sense this way. 
> 
> 
> On Sunday 16 January 2005 07:27 pm, Peter Lovatt wrote:
> > Hi
> >
> > It is better from a security point of view to have a secure login. The
> > secure server encrypts the data between the browser and the 
> server, making
> > it impossible to read on its journey from you to the server.
> >
> > However whether it is a major security  problem is another question. To
> > view the traffic somebody must have access to the servers that 
> route your
> > request, which isn't easy. They then have to spot your traffic 
> amongst all
> > the other web traffic.
> >
> > If it is the login for your Swiss bank account where you hid the million
> > you made without declaring tax then it should be secure - no 
> question. On
> > the other hand if it is just to login to see when your books will be
> > delivered, with no sensitive financial information then the 
> risk is smaller
> > and it is unlikely that anyone is trying too hard to get your 
> login, so an
> > insecure login carries less risk.
> >
> > You could always host the login page on a non secure server but post the
> > form to a secure server.
> >
> > Peter
> >
> > > -Original Message-
> > > From: Micah Stevens [mailto:[EMAIL PROTECTED]
> > > Sent: 17 January 2005 02:46
> > > To: php-db@lists.php.net
> > > Subject: Re: [PHP-DB] Security Question
> > >
> > >
> > >
> > > If it submits to a secure server the form data will be 
> encrypted before
> > > transmission I believe. At least that's my understanding, and
> > > that seems to
> > > be how ebay does it for example. Once you log-in, it submits 
> to a secure
> > > page.
> > >
> > > -Micah
> > >
> > > On Sunday 16 January 2005 06:38 pm, Chris Payne wrote:
> > > > Hi everyone,
> > > >
> > > >
> > > >
> > > > I have a security question, I want to see if I am right or
> > >
> > > wrong.  I have
> > >
> > > > programmed a system with PHP and MySQL, the main system resides
> > >
> > > on a secure
> > >
> > > > server, but the client wants the login page on a NON-Secure 
> server for
> > > > marketing purposes.  Am I the only one who thinks this is a
> > >
> > > major security
> > >
> > > > concern?
> > > >
> > > >
> > > >
> > > > 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



RE: [PHP-DB] i am lost (php warning)

2005-01-18 Thread Peter Lovatt
Hi


it means that the query did not  produce a result - usually this is because
of a problem with the query.

$sql_query = mysql_query("SELECT * FROM cm_customer WHERE emial='$user'");

I am guessing you misspelt email and this should be

$sql_query = mysql_query("SELECT * FROM cm_customer WHERE email='$user'");


if you add an error trap it makes this knd of thing easier to spot

$sql_query = mysql_query("SELECT * FROM cm_customer WHERE email='$user'") or
die(mysql_error());


HTH

Peter











> -Original Message-
> From: Earl Clare [mailto:[EMAIL PROTECTED]
> Sent: 18 January 2005 06:59
> To: php-db@lists.php.net
> Subject: [PHP-DB] i am lost (php warning)
> Importance: High
>
>
> Hi ya'll,
>
>
>
> I am lost as to why I am getting this error in my script. Can
> anyone kindly
> explain why this is so.
>
>
>
> Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
> resource in /home/cm/public_html/cell/login.php
>
>
>
> --
> --
> ---
>
>   My script
>
> --
> --
> ---
>
>
>
>
>
> if($_POST['submit'] == '>Log In')
>
> {
>
> $user=$_POST["email"];
>
> $pass=$_POST["pass"];
>
> $sql_query = mysql_query("SELECT * FROM cm_customer WHERE
> emial='$user'");
>
> $sql_query = mysql_num_rows($sql_query);
>
>
>
> if (($sql_query) >0)
>
> {
>
> $valid = $user;
>
> session_start();
>
> session_register("valid");
>
> }
>
> }
>
>
>
>   if (session_is_registered("reg"))
>
>   {
>
>   echo "ok";
>
>   }
>
>
>
>   else
>
>   {
>
>  echo "sorry";
>
>   }
>
>
>
>

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



RE: [PHP-DB] last record

2005-01-24 Thread Peter Lovatt
hi

using mysql as you describe is probably the most elegant and efficient way
to do it

is there a reason for asking php to do it?

Peter


> -Original Message-
> From: neil [mailto:[EMAIL PROTECTED]
> Sent: 25 January 2005 03:12
> To: php-db@lists.php.net
> Subject: [PHP-DB] last record
>
>
> Apart from the obvious of reversing the sort order in a select
> statement and
> then picking off the first record
>
> eg. select * from blah where somefield like '%something%' order by
> someotherfield desc limit 0,1
>
> is there any way in php rather than sql to pick the last record
> in a record
> set?
>
> Thanks
>
> Neil
>
> --
> 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] Ensuring users don't overwrite each other (NOT a newbie question)

2002-02-01 Thread Peter Lovatt


Hi

Interesting problem! Systems would be so much easier to build if we didn't
have to allow for users :)

Two suggestions, depending on how you want the data dealt with.

A table of rows in use, with a time stamp and an owner. When user1 opens the
record, stamp it with owner and time. If user2 wants to use the record,
check when it was 'locked' and apply a timeout based on how long it takes to
edit. For example if the record was opened 3 mins ago, and the timeout is 5,
the user2 gets a message saying 'Record in use try again in 2 minutes' If it
was opened 6 minutes ago set the owner of the locked record to user2, and
reset the timestamp.

If / when user1 submits, refuse the update, and inform user1, and whatever
handing you need after that.

If no user2 has tried to open the record, then user1 can still submit,
because they still own it, even if there is a timeout.

If you are feeling flash maybe a JavaScript timer that pops up 1 minute
before timeout and warns user1 to save (update record and reload for more
editing)?

Probably more hassle than its worth, but you could also take a snapshot of
the data, when user1 starts, and if more than one user tries to edit the
record, save the updates in a temp table, compare the updated record with
the original snapshot, and do some sort of intelligent amalgamation.

HTH

Peter


> -Original Message-
> From: Oliver Cronk [mailto:[EMAIL PROTECTED]]
> Sent: 31 January 2002 23:09
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Ensuring users don't overwrite each other (NOT a
> newbie question)
>
>
>
> Hi there, currently writing an e-CRM system for an intranet using PHP on
> Win32 and MS-SQL.  This system needs to be scalable but more importantly
> there will be anything up to 400 users (unlikely, but the max
> amount) using
> the same records (updating information about customers etc) and I
> worry that
> whilst one user has a form open (via one of my PHP scripts) that another
> user could also be making changes to the same record and if they post it
> before the other one they could overwite each others changes.  For info:
> database is normalised to 3NF so that side of things should be okay.
>
> I have thought of a couple of solutions:
>
> Row Locking when a user has a record - and if another user wants
> to use that
> record PHP tells them its in use.  But if the forst user doesn't make any
> changes how will the db know to unlock the row and there might be
> potential
> deadlock issues.  Also I'm not sure of the SQL for row locking
> (do you use a
> SELECT with a ROWLOCK hint?).
>
> Another idea was to have a log or temp table - that would get written into
> when ever some opens a record but this has the same issues as the first
> solution I think.
>
> An another idea is T-SQL and transactions but I'm not sure if that will
> solve the problem (and I've never used T-SQL before - therefore
> I'm not sure
> of its capabilities)
> eg:
> When the script is started by the first user (to bring up the existing
> record) perhaps a transaction is started (if they can persist between
> batches?):
>
> $tranname = "@tran".$id;
> $sqlstr = "TRANSACTION $tranname
>
> SELECT rows from CASES
> WHERE id = $id
> GO
>
> /* maybe find the date / time from a system table sp_something of the last
> time the row was modified?? */
>
> START TRANSACTION $tranname
> GO
> ";
>
> But that probably won't work thinking about it (and looking at the stupid
> senseless code I have written above) The transcation probably
> need to be
> around the update SQL doesn't it?  And then do a rollback if it finds
> another user has updated lately?  And then reload the data and
> send it back
> to the form for the user to check (then they can update - after
> checking the
> other users data?)
>
> Anybody have a solution /views on this?  Anybody had to fix a similar
> problem?  Or is all this paranoia (will the DB handle this problem on it
> own? - I very much doubt that last comment!)
>
> Any help would be most appreciated, I don't need all of the PHP code just
> the concepts will do (I have been using PHP/MS-SQL for a while) or some
> example T-SQL if you think thats the solution I should go for.
>
> Thanks very much in advance...
>
> Oliver Cronk
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> 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] Ensuring users don't overwrite each other (NOT a newbie question)

2002-02-01 Thread Peter Lovatt

Hi

I don't think there can be a perfect solution, because you don't have a true
persistent session between the user and the system.

For the timeout watch a real user (or time yourself) and see how long it
takes to do the update. If locking user2 out for any length of time causes
problems go for a timeout close to the time it takes, and risk upsetting
user1 sometimes. If user2 can easily go and do something else for five
minutes set the timeout at 2 or 3 times the measured update time to allow
for the slowest one finger typist!

You could also log the system in use to see how many times user1's update
gets refused, and adjust the timeout accordingly.

I use a timeout system for restricted access user sessions, so I have most
of the code you need, if you would like it. email me off list if you would
like it.

HTH

Peter

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








> -Original Message-
> From: Oliver Cronk [mailto:[EMAIL PROTECTED]]
> Sent: 01 February 2002 08:30
> To: Peter Lovatt; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Ensuring users don't overwrite each other (NOT a
> newbie question)
>
>
> Thanks for that answer, you filled in some of the blanks for the table /
> logging solution, but I am now looking at row locking instead of
> a seperate
> table (and then doing things similar to what you outlined).
>
> The main problem is the darn timeout - how long should it be etc? And if I
> use row locking and don't unset the locks / use a timeout then the db will
> get completely locked up if the user doesn't update I would imagine!
>
> Darn users!!  This script is complicated enough without this!!
>
> Cheers
>
> Ollie
>
> -Original Message-
> From: Peter Lovatt [mailto:[EMAIL PROTECTED]]
> Sent: 01 February 2002 08:10
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Ensuring users don't overwrite each other (NOT a
> newbie question)
>
>
>
> Hi
>
> Interesting problem! Systems would be so much easier to build if we didn't
> have to allow for users :)
>
> Two suggestions, depending on how you want the data dealt with.
>
> A table of rows in use, with a time stamp and an owner. When
> user1 opens the
> record, stamp it with owner and time. If user2 wants to use the record,
> check when it was 'locked' and apply a timeout based on how long
> it takes to
> edit. For example if the record was opened 3 mins ago, and the
> timeout is 5,
> the user2 gets a message saying 'Record in use try again in 2
> minutes' If it
> was opened 6 minutes ago set the owner of the locked record to user2, and
> reset the timestamp.
>
> If / when user1 submits, refuse the update, and inform user1, and whatever
> handing you need after that.
>
> If no user2 has tried to open the record, then user1 can still submit,
> because they still own it, even if there is a timeout.
>
> If you are feeling flash maybe a JavaScript timer that pops up 1 minute
> before timeout and warns user1 to save (update record and reload for more
> editing)?
>
> Probably more hassle than its worth, but you could also take a snapshot of
> the data, when user1 starts, and if more than one user tries to edit the
> record, save the updates in a temp table, compare the updated record with
> the original snapshot, and do some sort of intelligent amalgamation.
>
> HTH
>
> Peter
>
>
> > -Original Message-
> > From: Oliver Cronk [mailto:[EMAIL PROTECTED]]
> > Sent: 31 January 2002 23:09
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] Ensuring users don't overwrite each other (NOT a
> > newbie question)
> >
> >
> >
> > Hi there, currently writing an e-CRM system for an intranet using PHP on
> > Win32 and MS-SQL.  This system needs to be scalable but more importantly
> > there will be anything up to 400 users (unlikely, but the max
> > amount) using
> > the same records (updating information about customers etc) and I
> > worry that
> > whilst one user has a form open (via one of my PHP scripts) that another
> > user could also be making changes to the same record and if they post it
> > before the other one they could overwite each others changes.  For info:
> > database is normalised to 3NF so that side of things should be okay.
> >
> > I have thought of a couple of solutions:
> >
> > Row Locking when a user has a record - and if another user wants
> > to use that
> > record PHP tells them its in use.  But if th

RE: [PHP-DB] MySQL

2002-02-04 Thread Peter Lovatt



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

> -Original Message-
> From: Peter Lovatt [mailto:[EMAIL PROTECTED]]
> Sent: 04 February 2002 16:30
> To: Morten Nielsen
> Subject: RE: [PHP-DB] MySQL
> 
> 
> phpMyAdmin!
> 
> 
> http://phpwizard.net/projects/phpMyAdmin/
> 
> 
> HTH
> 
> Peter
> 
> ---
> Excellence in internet and open source software
> ---
> Sunmaia
> www.sunmaia.net
> [EMAIL PROTECTED]
> tel. 0121-242-1473
> --- 
> 
> > -Original Message-
> > From: Morten Nielsen [mailto:[EMAIL PROTECTED]]
> > Sent: 04 February 2002 16:34
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] MySQL
> > 
> > 
> > Hi,
> > Is there an easy way to see the data in a table?
> > I made a table that contains information about people. How do I 
> see/change
> > the contenst of the table?
> > 
> > Thanks,
> > Morten
> > 
> > 
> > 
> > -- 
> > 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] If Statement that makes me cry

2002-02-10 Thread Peter Lovatt

hi

A few thoughts

Firstly wouldn't it be easier to store the resumes in the database?

then 'SELECT * from table where cand_resume_text LIKE "%keyword[1]%" or
cand_resume_text LIKE "%keyword[2]%"

bit inefficient but it works, and opening lots of files is also inefficient.

or


SELECT * from table



while ($row = mysql_fetch_array($result))
{
$found_it=0;

 for keywords
  {
   if(eregi($kw, $row["resume_text"]))
 {
  $found_it=1;
  $found_one=1;
 }
  }//end for

if($found_it==1) print(.)

}//end while

if(!$found_one) print "failed"


(I always mark the end of a bracket set, makes debugging easier...)

For your code..

you are printing the result after every keyword check, which will be
serveral times per record, if you have more than one keyword.

Mark success or not by setting a variable and print only when $found_it==1,
resetting $found_it after each loop ;






 while ($row = mysql_fetch_array($result))
 {
$found_it=0;

 $id = $row['id'];

 $FirstName = $row['FirstName'];

 $LastName = $row['LastName'];

 $filename = "/home/sites/madden.williamsen.net/web/recruiter/resumes/"
 .$row['ResumeUp'];

 $fd = fopen($filename,"r");

 $contents = fread($fd, filesize($filename));

 $keywords = explode( $delimiter, $words );

 for ($i=0; $i < count($keywords); $i++) {

 $kw = $keywords[$i];

 if( eregi($kw, $contents) )
 {
   $found_it=1;
//set var to show a success - don't reset
$found_at_least_one=1;
 }//end if

 }//end for

if($found_it==1)
{
 echo "The Words $kw has been found in the resume of
 $LastName, $FirstName
 ";
}//end if

 }//end while

if(!$found_at_least_one)  echo "Your Search Returned Zero Records";


hth

Peter


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

> -Original Message-
> From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
> Sent: 10 February 2002 16:54
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] If Statement that makes me cry
>
>
> This script is confusing the hell out of me...
>
> What its suppose to do is do a search on documents, and then is it finds
> something say who and where it is, but it repeats the message for
> every hit.
>
> Same goes with the message when there is no results, it repeats
> it for every
> record. All I want it do is say "The results for $kw"
>
> the list here
>
> then when no results are returned, just say the message once..
>
> the results for "$kw" returned zero results.
>
> here is the script
>
>  include "variables.php";
> $delimiter = ",";
>
> $connection = @mysql_connect($databaseserver, $databaseuser,
> $databasepass)
> or die ("could not connect to database");
> $db = @mysql_select_db($databasename, $connection) or die("Could
> not select
> database");
> $sql = "SELECT id, FirstName, LastName, ResumeUp FROM $canidatetable";
> $result = mysql_query($sql, $connection) or die("Couldn't execute query");
>
> while ($row = mysql_fetch_array($result))
> {
> $id = $row['id'];
>
> $FirstName = $row['FirstName'];
>
> $LastName = $row['LastName'];
>
> $filename = "/home/sites/madden.williamsen.net/web/recruiter/resumes/"
> .$row['ResumeUp'];
>
> $fd = fopen($filename,"r");
>
> $contents = fread($fd, filesize($filename));
>
> $keywords = explode( $delimiter, $words );
>
> for ($i=0; $i < count($keywords); $i++) {
>
> $kw = $keywords[$i];
> =
> THE TROUBLE SPOT
> =
> if( eregi($kw, $contents) )
> {
> echo "The Words $kw has been found in the resume of
> $LastName, $FirstName
> ";
> }
> else {
>
> echo "Your Search Returned Zero Records";
> }
> }
> }
> ===
> ==
> fclose($fd);
>
> ?>
>
>
>
> --
> 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] How is NULL stored?

2002-02-11 Thread Peter Lovatt

Hi

When I use phpMyAdmin to view data, where values are NULL it displays the
word 'NULL'. Does this mean that the word 'NULL' is actually stored in the
table, or is it defined by some other character? Is this any different from
an empty value?

I am using it to check to see whether a value has been entered into a field,
and if so what is the value. Will MySql return an empty string or do I need
to trap for 'NULL' as well?

Ta

Peter



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


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




RE: [PHP-DB] Drop Down Menus

2002-02-12 Thread Peter Lovatt

Hi

the row index starts at 0 not 1 so you need $row[0], as you have only one
field $row[1] will be empty.

HTH

Peter

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

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 12 February 2002 16:10
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Drop Down Menus
>
>
> Hi wonder if anyone knows what I am doing wrong here.
>
> I have a drop down selection menu that is generated from a mysql
> database. In the database we have over 15 fields one of them
> contains text for the catergory that the entry belongs to. I have
> used the following code to generate my drop down menu but when i
> view it in the browser the drop down menu has not listed the
> categories instead we have blank entries for each selection.
>
>  mysql_select_db("database");
> $sql = "select distinct category from books ORDER BY category ASC";
> $makes_result = mysql_query($sql);
> print ("\n");
> print("Please select a
> Category\n");
> while($row = mysql_fetch_row($makes_result))
> {
> print("$row[1]\n");
> }
> print(""); ?>
>
> Thanks for the help.
>
> Barry
>
> --
> 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] Logging visits using a database

2002-02-13 Thread Peter Lovatt

Hi

Excuse the cross post

I am thinking about building a logging tool to do visit analysis using SQL,
rather than doing log file analysis.

The aim is to analyse requests for dynamic pages called via php as well as
static pages. Static pages will use an include for logging. Php calls may
have two or three extra parameters which relate to products that are
displayed (this is for ecommerce) which I also want to log. I am looking
particularly at HTTP_REFERER, paths through the site, and most viewed
products.

Questions

1. Am I reinventing the wheel? and would it be better to buy a package
(Spending money brings me out in a nasty rash, and leaves me feeling a
little unsteady on my feet, but is sometimes the best option), or use a free
one. The intended audience is non technical managerial type bods so nothing
too difficult to understand :)

2. If I do use an existing package, are there any that are good with dynamic
sites and the parameters passed to scripts, rather than just logging static
pages?

3. Writing a database driven stats package on a medium traffic site (3-500
visits a day, Average 8-12 pages per visit=6000 inserts a day, peaking at
2-3 per second ) will mean lots of inserts, and a few reads when the
analysis is run. Running MySql on a 1.5GHz 512MB machine, is it better to
leave the table unindexed and put up with slow analysis, or will the machine
cope with indexes? The data could be aggregated periodically, but if
possible left intact for up to a year to follow trends.

4. Is a (MySql?) database driven system a good answer, or just the wrong way
to go??

Any thoughts and experience much appreciated before I commit to hours of
work and gallons of coffee

Thanx

Peter


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


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




[PHP-DB] RE: Logging visits using a database

2002-02-14 Thread Peter Lovatt

Thanks.

Analog only does basic 'what files have people viewed?' type reports, which
offers some of the insight I am looking for, but not the path through the
site etc. Also the output confuses non techies. Any other thouhts?

TIA
Peter

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

> -Original Message-
> From: Gurhan Ozen [mailto:[EMAIL PROTECTED]]
> Sent: 14 February 2002 03:09
> To: Peter Lovatt; [EMAIL PROTECTED]
> Subject: RE: Logging visits using a database
>
>
> Hi
> I have never used it but sounds like analog would fit your needs pretty
> well. Check them out at:
> http://analog.sourceforge.net/
>
> Hope this helps..
>
> Gurhan
>
>
> -Original Message-
> From: Peter Lovatt [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 13, 2002 6:29 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Logging visits using a database
>
>
> Hi
>
> Excuse the cross post
>
> I am thinking about building a logging tool to do visit analysis
> using SQL,
> rather than doing log file analysis.
>
> The aim is to analyse requests for dynamic pages called via php as well as
> static pages. Static pages will use an include for logging. Php calls may
> have two or three extra parameters which relate to products that are
> displayed (this is for ecommerce) which I also want to log. I am looking
> particularly at HTTP_REFERER, paths through the site, and most viewed
> products.
>
> Questions
>
> 1. Am I reinventing the wheel? and would it be better to buy a package
> (Spending money brings me out in a nasty rash, and leaves me feeling a
> little unsteady on my feet, but is sometimes the best option), or
> use a free
> one. The intended audience is non technical managerial type bods
> so nothing
> too difficult to understand :)
>
> 2. If I do use an existing package, are there any that are good
> with dynamic
> sites and the parameters passed to scripts, rather than just
> logging static
> pages?
>
> 3. Writing a database driven stats package on a medium traffic site (3-500
> visits a day, Average 8-12 pages per visit=6000 inserts a day, peaking at
> 2-3 per second ) will mean lots of inserts, and a few reads when the
> analysis is run. Running MySql on a 1.5GHz 512MB machine, is it better to
> leave the table unindexed and put up with slow analysis, or will
> the machine
> cope with indexes? The data could be aggregated periodically, but if
> possible left intact for up to a year to follow trends.
>
> 4. Is a (MySql?) database driven system a good answer, or just
> the wrong way
> to go??
>
> Any thoughts and experience much appreciated before I commit to hours of
> work and gallons of coffee
>
> Thanx
>
> Peter
>
>
> ---
> Excellence in internet and open source software
> ---
> Sunmaia
> www.sunmaia.net
> [EMAIL PROTECTED]
> tel. 0121-242-1473
> ---
>
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


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




RE: [PHP-DB] Logging visits using a database

2002-02-14 Thread Peter Lovatt


> On Thursday 14 February 2002 07:29, Peter Lovatt wrote:
> > Hi
> >
> > Excuse the cross post
> >
> > I am thinking about building a logging tool to do visit
> analysis using SQL,
> > rather than doing log file analysis.
> >
> > The aim is to analyse requests for dynamic pages called via php
> as well as
> > static pages. Static pages will use an include for logging. Php
> calls may
> > have two or three extra parameters which relate to products that are
> > displayed (this is for ecommerce) which I also want to log. I am looking
> > particularly at HTTP_REFERER, paths through the site, and most viewed
> > products.
> >
> > Questions
> >
> > 1. Am I reinventing the wheel? and would it be better to buy a package
> > (Spending money brings me out in a nasty rash, and leaves me feeling a
> > little unsteady on my feet, but is sometimes the best option), or use a
> > free one. The intended audience is non technical managerial type bods so
> > nothing too difficult to understand :)
>
> I would say you are :) Something like Analog would probably do
> all you need
> to do and more. But it doesn't use a database.

As far as I can see, it does not track referrers and paths through the site,
and a simple pages visited (it includes all the requests for graphics etc )

It is also a bit overwhelming for non techies, even with the nicer
interfaces.

>
> I've done something similar. In apache I pipe the logs through a
> little perl
> program which writes the info directly into an MySQL database. On
> one setup,
> a PII 300/448MB machine *easily* handles 10K requests a day. The table
> (indexed) is nearly up to 1 million rows and shows no
> (noticeable) signs of
> slowing down.

Great, that was one of my bigger concerns

>
> > 4. Is a (MySql?) database driven system a good answer, or just the wrong
> > way to go??
>
> Depends on how dynamic you want your analysis to be. And whether
> you can put
> up with long query times. In the above system some analysis can
> take up to 30
> secs to perform.
>
> My reason for using a db was complete flexibility in analysing
> the data in
> any which way I want.

Me too

>
> Getting the info into the db is the easy part -- I could send you
> the perl
> script that I use. The hard bit is coming up with the necessary
> queries to
> extract the info from the db.


That would be much appreciated, please send it to [EMAIL PROTECTED]



>
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
>
> /*
> There's so much to say but your eyes keep interrupting me.
> */
>
> --
> 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] Disable Right click w/ php?

2002-02-14 Thread Peter Lovatt

Hi

I don't think it is possible without javascript, and it does not always work
with javascript.

Anybody with any real knowledge can bypass it anyway simply by saving the
page and opening it in a text editor. So Javascript will stop casual right
clickers, and the others will do it anyway, if they want to.

Just my 2p worth

HTH

Peter

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

> -Original Message-
> From: jas [mailto:[EMAIL PROTECTED]]
> Sent: 14 February 2002 06:18
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Disable Right click w/ php?
>
>
> I have been looking on php.net for a function to disallow people to right
> click to view source... anyone have a good idea of how to accomplish this
> without using java-script?
> Thanks in advance,
> Jas
>
>
>
> --
> 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] Passing form values with quotes, to itself

2002-02-14 Thread Peter Lovatt

Hi

I spent ages trying to get  it to work. Echoing the " always closes the text
area in an input box, so any data after the quotes isn't displayed. Its
fundamental to the HTML, so adding slashes is irrelevant.

What I did in the end was to swap double quotes " for two single quotes ''
using ereg_replace. It looks a little odd sometimes, but it works. You swap
it back again when you insert or update the data and addslashes to make sure
it inserts safely.

Not sure if there are more elegant answers

email me offlist if you would like the code

HTH

Peter

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

> -Original Message-
> From: Jim Lucas [php] [mailto:[EMAIL PROTECTED]]
> Sent: 14 February 2002 18:34
> To: William Fong; [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Passing form values with quotes, to itself
>
>
> it is called magic quotes and it can be enabled through the php.ini file.
>
> Jim Lucas
> - Original Message -
> From: "William Fong" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, February 13, 2002 10:36 AM
> Subject: Re: [PHP-DB] Passing form values with quotes, to itself
>
>
> > Doesn't PHP have something that will automatically do this?  I can't
> > remember, but I think you had to enable it in php.ini or when
> you compile.
> >
> > (just like to know for future reference).
> >
> > thx.
> >
> > -w
> >
> > --
> > William Fong - [EMAIL PROTECTED]
> > Phone: 626.968.6424 x210  |  Fax: 626.968.6877
> > Wireless #: 805.490.7732|  Wireless E-mail:
> [EMAIL PROTECTED]
> >
> >
> >
> >
> > - Original Message -
> > From: "David Fudge" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, February 13, 2002 10:12 AM
> > Subject: Re: [PHP-DB] Passing form values with quotes, to itself
> >
> >
> > : before you submit to the db, you have to escape the quotes like this:
> > :
> > : $Body = addslashes($Body);
> > : all " " will show up as \" \"
> > : and ' ' will be \' \'
> > :
> > : when you pull the info from the db, you'll have to use
> "stripslashes()"
> to
> > : remove those you put in.
> > : $Body = stripslashes($Body_from_db);
> > :
> > : - Original Message -
> > : From: "Faye Keesic" <[EMAIL PROTECTED]>
> > : To: <[EMAIL PROTECTED]>
> > : Sent: Wednesday, February 13, 2002 1:02 PM
> > : Subject: [PHP-DB] Passing form values with quotes, to itself
> > :
> > :
> > : > Hi there.
> > : >
> > : > I have a form that contains several fields w/ text info
> (which may or
> > may
> > : > not contain single and double quotes).
> > : >
> > : > When the user clicks Preview, the form's action is set to
> call itself
> > : > ($PHP_SELF), and the info is displayed nicely so they can read it
> over,
> > : and
> > : > verify it before saving to the db.
> > : >
> > : > What I'm having problems with is that when the data has quotes, the
> text
> > : > data cuts off.
> > : >
> > : > If I use: 
> > : > then double quotes are cut off.
> > : >
> > : > If I use: 
> > : > then single quotes are cut off.
> > : >
> > : > I want nothing cut off!  I've tried addslashes()..still cuts off.
> > : >
> > : > I hope that all made sense...
> > : > --
> > : > Faye
> > : >
> > : >
> > : > --
> > : > 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 Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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




RE: [PHP-DB] PHP IDE

2002-02-24 Thread Peter Lovatt

Not an IDE as such but a good text editor

Homesite has good php syntax colouring, which picks up missing quote marks.
Its commercial, but good.

http://www.macromedia.com/software/homesite/

HTH


Peter

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

> -Original Message-
> From: Aron Pilhofer [mailto:[EMAIL PROTECTED]]
> Sent: 23 February 2002 17:54
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] PHP IDE
>
>
> After spending two frustrating hours tracking down a bug
> yesterday - only to
> discover it was a misplaced quote mark. I've had it.
>
> I am looking for suggestions out there for a good IDE for PHP development,
> preferably one that doesn't cost an arm and a leg. I tried PHP4EE studio,
> but it is buggy as hell and kept crashing on me.
>
> Thanks in advance.
>
>
>
> --
> 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] "The" Debacle

2002-02-24 Thread Peter Lovatt

When you add the data

//does it begin with 'The '?
$name_start = substr($band_name, 0, 2)

if ($name_start=="The")
  {
  //remove the word 'The' and following space from the beginning of the
string
  str_replace('The ', '', $band_name) ;

  //add ', The 'to the end of the name
  $band_name=$band_name.', The';
  }

You might want something more sophisticated if The with a capital is found
in the middle of names, but hope this is a start


Peter
---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
---

> -Original Message-
> From: Jonathan Underfoot [mailto:[EMAIL PROTECTED]]
> Sent: 24 February 2002 18:36
> To: [PHP-DB]
> Subject: [PHP-DB] "The" Debacle
>
>
> I'm putting together a table with bands, and I have a slight
> problem.  Well it not really a problem as much as I'd like some
> input from more seasoned professionals.  Certain band names begin
> with "The" but when listing them it would be of great advantge to
> me to remove the "the."  Has anyone else faced this dilemma?  I
> was thinking that when inputting and editing band names that I
> could just scripot a new column with the comma in place.  I
> suppose librarys have this difficulty as well.  So what is it?
>
> Column 1 - "The Distillers"
> Column 2 - "Distillers, The"
>
> Or a bit of PHP programming every time I list them (seems more difficult.)
>
> Either way, does anyone have the propper PHP function I should use?
>
> Thanks much...
>
> -Jonathan
>
>


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




RE: [PHP-DB] If else trouble

2002-02-24 Thread Peter Lovatt

Hi




> -Original Message-
> From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
> Sent: 24 February 2002 22:28
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] If else trouble
>
>
> Hi all,
>
> I have worked and re-worked this if else statement. I can't get
> it to work.
>
> It's suppose to work like this.
>
> If there are no points in the bank then echo but it always echo's
> you don't
> have enough points. It also wont keep me from withdrawing more than I have
> in the bank.
>
> What am I doing wrong and how do I keep the script from letting
> me withdraw
> more than I have, and keep it from echoing "you don't have enough points!"
> all the time?
>
> $sql_result = mysql_query("SELECT * FROM bank_points WHERE
> uid={$session["uid"]}");
> if ($sql_result <= "0") {
>  echo "you don't have enough points!";
>
> }else{
>echo "Your withdraw has been made!";
> }
>


$sql_result is the result ID,

you need

$row = mysql_fetch_array($sql_result)

which loads the returned row into an array  $row

Guessing your field is called bank_points_total

if ($row["bank_points_total"] <= "0")
  {
  echo "you don't have enough points!";
  }
else
  {
 echo "Your withdraw has been made!";}
  }


HTH


Peter


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

> Thanks in advance
> Jennifer Downey
>
>
>
> --
> 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] any php/Linux gurus out there?

2002-03-04 Thread Peter Lovatt

Hi

I am running the security upgrade and am getting the following error when I
run the RPM
The install is RH 7.0 and was pre-installed. I had assumed that the RPMs
from Redhat would match the pre installed version, as it was standard.

I am a humble programmer (and part time sys admin!), rather than a Linux/RH
guru, so would appreciate some advice. What is the best way to deal with
this ?


error: failed dependencies:
libcrypto.so.1 is needed by php-4.0.6-9.7.0
libmm.so.11 is needed by php-4.0.6-9.7.0
libssl.so.1 is needed by php-4.0.6-9.7.0
libcrypto.so.1 is needed by php-imap-4.0.6-9.7.0



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

sql table


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




RE: [PHP-DB] Best way to store/retrieve content??

2002-03-07 Thread Peter Lovatt

Hi

I have done a similar thing, and found that you can store just the text in
the database.

I added  'Short_content' which was a leader, and some other fields for
management.

I designed a few templates in Dreamweaver and embeded a function to display
the content in the page

eg 

The function basically pulls the content from the database and prints it.
You can just print the text, or you can add HTML in the function to give a
particular layout. You can use the same principal to link images, or you can
hard code them into the page.

If you want to be more sophisticated you can use a number of templates and
store the one to use in the record, giving.

display.php?contentID=1234

->query db to get template for 'Article 1234'

->output 'template_1.htm' which has the correct layout, and the function for
this article embedded in it


CREATE TABLE S_content (
  ContentID int(11) NOT NULL auto_increment,
  Title varchar(100) NOT NULL default '',
  Description varchar(250) default NULL,
  Short_content text,
  Full_content text,
  UserID int(11) default NULL,
  Start_date date default NULL,
  End_date date default NULL,
  End_actionID int(11) NOT NULL default '0',
  Template_file varchar(50) ,

PRIMARY KEY (ContentID),
  KEY ContentID(ContentID),
)

   HTH

Peter

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

> -Original Message-
> From: Monty [mailto:[EMAIL PROTECTED]]
> Sent: 07 March 2002 19:31
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Best way to store/retrieve content??
>
>
> I'm writing some content management scripts for an online magazine. Many
> articles are formatted in a similar way, but some have a unique
> page layout
> that includes grids of photos, tables, etc.
>
> I'm not sure if the best way to store content is in a database so
> it can be
> flowed into an article template, or to simply lay out the page as HTML,
> surrounding it with a simple include("header.php") and
> include("footer.php")
> for header/footer HTML and graphics. For articles that require things like
> tables, it would be a pain to have to write this HTML by hand or
> lay it out
> in Dreamweaver then copy and past the code into the database
> field (using an
> Admin web form).
>
> Or, is it prudent to set up a custom table in the databse for each type of
> content so that a matching template can be used to format the
> pages properly
> without having to include all the HTML in the database with the content
> itself?
>
> Hope this makes some sense. Just trying to figure out the best
> way to tackle
> this. All input is appreciated!
>
> Monty
>
>
>
> --
> 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] Best way to store/retrieve content??

2002-03-07 Thread Peter Lovatt

Hi

I am not an expert but could XML be an answer?

The author(s) gets a screen designed by you, looking like the screen you
will publish, with type in text boxes (name="short_text1",
name="short_text2" etc )where the text will be. When you store the input
from the form you end up with


 pic1.jpg
 Short paragraph of text under pic1 
 pic2.jpg
 Short paragraph of text under pic2
 lots of stuff, lots of stuff, lots of stuff, lots of stuff, lots
of stuff,  


which allows you to add any structure to the data, but store all the article
in a single searchable text field.

Otherwise maybe you could use two tables.

 CREATE TABLE Article
(

  ArticleID int(11),
  Title char(50),
  Start_date date default NULL,
  End_date date default NULL,
  End_actionID int(11) NOT NULL default '0',
  Template_file varchar(50) ,
)

 CREATE TABLE Article_components
(

  ArticleID int(11),
  Component_name char(50),
  Content text

)

Article_components might contain :-

+--+++
|ArticleID | Component_name | Content|
+--+++
|123   | pic1   | pic1.jpg   |
+--+++
|123   | short_text1| Short text etc etc |
+--+++
|123   | pic2   | pic2.jpg   |
+--+++
|123   | short_text2| Short text etc etc |
+--+++

Which you could search and return the articleID, which you could then use to
retive the article in full.

To display, loop thro the result

$row["pic1"]$row["pic2"]$row["pic3"]
$row["short_text1"]$row["short_text2"]$row["short_
text3"]

Just a few thoughts

Be interested to know how you do this in the end.

Peter

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

> -Original Message-
> From: Monty [mailto:[EMAIL PROTECTED]]
> Sent: 07 March 2002 20:51
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Best way to store/retrieve content??
>
>
> Hi Peter, thanks a lot for your advice. I think where I'm stuck is how to
> best store certain types of articles in a data table. Interviews would be
> easy, because it's just paragraphs of text with an inline photo here and
> there. The more structured articles are trickier and I can't
> figure out how
> to use the same Article table for all articles. Using the example
> I gave in
> a previous message, here's a rough page layout of one of these structured
> articles:
>
> +---+  +---+  +---+
> |  image 1  |  |  image 2  |  |  image 3  |
> +---+  +---+  +---+
>
> Short paragraphShort paragraphShort paragraph
> of text under  of text under  of text under
> the image. the image. the image.
>
> +---+  +---+  +---+
> |  image 4  |  |  image 5  |  |  image 6  |
> +---+  +---+  +---+
>
> Short paragraphShort paragraphShort paragraph
> of text under  of text under  of text under
> the image. the image. the image.
>
>
> If I have one field in the Article table for full_content (which
> works just
> fine for interviews), how could I enter the above type of article
> into this
> table so that the template will know to separate each element
> text block and
> match it up with the associated image? Is this a matter of
> writing a special
> parsing function that would take the following from the full_content
> field...
>
>
> 
>
> Short paragraph of text under the image.
>
> 
>
> Short paragraph of text under the image.
>
> ...and format break it down into an array so it can then be
> formatted on the
> page as illustrated above?
>
> My real block is how the set up the database more than the templates. As I
> mentioned, I'm trying to keep all articles in one data table so
> searches can
> be easily done on all articles.
>
> Thanks!
>
> Monty
>
>
>
>
> > From: [EMAIL PROTECTED] (Peter Lovatt)
> > Newsgroups: php.db
> > Date: Thu, 7 Mar 2002 20:11:00 -
> > To: "Monty" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
> > Subject: RE: [PHP-DB] Best way to store/retrieve content?

RE: [PHP-DB] Storing sesssions in a db bad for the performance?

2002-03-11 Thread Peter Lovatt

Hi

I do this and have no problems.

I don't have two similar sites to compare , but performance seems fine.

HTH

Peter

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

> -Original Message-
> From: Andy [mailto:[EMAIL PROTECTED]]
> Sent: 11 March 2002 16:49
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Storing sesssions in a db bad for the performance?
>
>
> Hi there,
>
> I am wondering if it is producing a lot of extra load if I would store the
> sessions inside a mysql db. I use phbb as a discussion board as
> well, and I
> saw that those guys are doing that. Does anybody have some experiance on
> that? Or knows a good article?
>
> Thanx for any help,
>
> ANdy
>
>
>
> --
> 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] A text file include ?

2002-03-25 Thread Peter Lovatt

hi

try nl2br 

hth

Peter

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

> -Original Message-
> From: Dave Carrera [mailto:[EMAIL PROTECTED]]
> Sent: 25 March 2002 08:35
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] A text file include ?
> 
> 
> Hi All,
> 
>  
> 
> I know how to include the contents of a test file into my app.
> 
>  
> 
> But at the moment I have to type in  tags to make in render
> properly.
> 
>  
> 
> Is there a way of reading the contents and dynamically creating
> paragraph breaks or line breaks?
> 
>  
> 
>  
> 
>  
> 
> Dave Carrera
> 
> Php Developer
> 
> http://davecarrera.freelancers.net
> 
> http://www.davecarrera.com
> 
>  
> 
>  
> 
> 

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




RE: [PHP-DB] Re - Direct a User after a completed Form

2002-03-31 Thread Peter Lovatt




should do the trick

HTH

Peter
---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
--- 

> -Original Message-
> From: Ethan J. Mings [mailto:[EMAIL PROTECTED]]
> Sent: 01 April 2002 01:08
> To: PHP Mailing List
> Subject: [PHP-DB] Re - Direct a User after a completed Form
> Importance: Low
> 
> 
> PHP-DB Mailing List
> --
> 
> I've created a form which loads data to my data table.  Works great.
> 
> Is there a way to allow the user to go to a thank you after the form
> is completed. Where could I find this is the manual.
> 
> Tried Location() with little success.
> 
> Suggestions.
> 
> 
> 
> 
> 
> --
> Ethan J. Mings
> mailto:[EMAIL PROTECTED]
> 
> 
> -- 
> 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




FW: [PHP-DB] need some help...

2002-04-02 Thread Peter Lovatt





hi Alex

basically you load a variable with the contents of the page, and then write
the contents of the variable to the file

hope this helps

Peter





  

  ';

$db = mysql_connect( "db",  "**",  "**");
mysql_select_db( "net3dual_reviews",$db);
$r = mysql_query("SELECT * FROM hwureviews ORDER BY num DESC LIMIT 7");
$max = mysql_query("select max(num) from hwureviews",$db);

while($a=mysql_fetch_array($r))
{
$retval.="  - %s",$a["url"],$a["picurl"],$a["picurl"],$a["title"])
";
}

$retval.='

  

  ';


//open file for writing
$myfile=fopen("review.shtml","w+");

//write $retval to file
fputs($myfile,$retval);




?>



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

> -Original Message-
> From: Alex Behrens [mailto:[EMAIL PROTECTED]]
> Sent: 03 April 2002 01:25
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] need some help...
>
>
> Hey Guys,
>
> I'm new to this list and I need some help outputing some code to
> a .shtml file instead of using a dynamic php file. Can someoneh
> elp me get this working?
>
> I have a script that outputs headlines for
> reviews and I need to output it to a file for inserting into my page,
> because I can't use php on this specific page so I want to output it to
> html. how do I do this? I know you use the fopen, fputs and fclose php
> commands but dont know how to format it, below is my syntax:
>
>   
> 
>   
> 
>src="/images/menu-reviews.gif" width="137" height="20"> $db = mysql_connect( "db",  "**",  "**");
> mysql_select_db( "net3dual_reviews",$db);
> $r = mysql_query("SELECT * FROM hwureviews ORDER BY num DESC LIMIT 7");
> $max = mysql_query("select max(num) from hwureviews",$db);
> while($a=mysql_fetch_array($r)) {
> printf (" border=\"0\">  -  href=\"%s\">%s",$a["url"],$a["picurl"],$a["picurl"],$a
> ["title"])
> ;
> }
> ?>
> 
> 
>   
> 
>   
>
>
> Thanks!
> 
> -Alex "Big Al" Behrens
> E-mail: [EMAIL PROTECTED]
> Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
> Phone: 651-482-8779
> Cell: 651-329-4187
> Fax: 651-482-1391
> ICQ: 3969599
> Owner of the 3D-Unlimited Network:
> http://www.3d-unlimited.com
> Send News:
> [EMAIL PROTECTED]
>


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




RE: [PHP-DB] Re: Making a txt file from db data, is it possible?

2002-04-08 Thread Peter Lovatt

a little lateral thinking.

there are a number of email to fax services out there (www.j2.com is one).
Last time I looked it was as cheap to use as a normal fax, and it saves much
hassle. just email the order to their servers and it gets faxed.

Might be worth a look

Peter

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

> -Original Message-
> From: Frank Flynn [mailto:[EMAIL PROTECTED]]
> Sent: 08 April 2002 18:59
> To: Rick Emery; 'Raymond'; [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Re: Making a txt file from db data, is it
> possible?
>
>
> Yes, I'd say this is the  way to go.  As the  customer submits the  order
> simply write out the file as you'd like it.  It doesn't  take
> long and you
> have all the  data in the cart (I'm not sure how you're dealing with the
> cart - saving it in the DB,  cookies, session variables - but it  doesn't
> really matter).
>
> Otherwise  you  could  save this in the DB and have a demon type thing
> continuously poll the  DB for orders not yet  sent - but that's more of a
> pain and  more likely to break as the demon fails but customers  don't
> notice and think their orders are being  processed.
>
> Even so you'd still have to write it the same way.  The export or dump
> features will only give you the rows of data in a tab delimited
> format not a
> formatted document as you probably want.
>
> Good Luck,
> Frank
>
> On 4/8/02 10:40 AM, "Rick Emery" <[EMAIL PROTECTED]> wrote:
>
> > fopen()
> > fwrite()
> > fclose()
> >
> > -Original Message-
> > From: Raymond [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, April 08, 2002 12:05 PM
> > To: Frank Flynn; [EMAIL PROTECTED]
> > Subject: [PHP-DB] Re: Making a txt file from db data, is it possible?
> >
> >
> > Hi!
> >
> > Ok, I think I maybe have to explain this a little better : )
> >
> > I have this website that have a webshop that is driven by mysql and php.
> > This is working fine, but when a customer puts something into
> his cart and
> > he is sending his order, I would like to send this order by fax
> to the store
> > nearest the customer.
> >
> > And I have this faxprogram that scan a directory for files and
> send them as
> > a fax. So I was thinking  I'm not sure if it is possible,
> but if it is
> > possible to write all products in the customers cart into a
> txtfile. Iwould
> > make to send fax, or?
> >
> > Thankfull for all advices or help : )
> >
> > Best regards Raymond
> > - Original Message -
> > From: "Frank Flynn" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Sunday, April 07, 2002 6:02 AM
> > Subject: Re: Making a txt file from db data, is it possible?
> >
> >
> >> On 4/6/02 4:12 PM, "[EMAIL PROTECTED]"
> >> <[EMAIL PROTECTED]> wrote:
> >>
> >>> From: "Raymond Lilleodegard" <[EMAIL PROTECTED]>
> >>> Date: Sat, 6 Apr 2002 17:18:07 +0200
> >>> To: [EMAIL PROTECTED]
> >>> Subject: Re: Making a txt file from db data, is it possible?
> >>>
> >>> May I use this dump method with a query too? Or is this only
> for making
> > a
> >>> hole table into a txt file?
> >>
> >> By  the time I caught this thread there was no mention of the DBMS you
> > were
> >> using and they are different.  Still one trick that usually works is to
> >> create a view with the query you want and to dump that view.
> >>
> >>> Because I'm trying to get a website into a txt file and save it into a
> >>> directory on the server to get a order sendt by fax. Or is
> this a "long
> > way"
> >>> to go?
> >>
> >> Sounds like the long way to me.  But like I said I just saw this am I'm
> > not
> >> sure what you're trying to do.  I'd be happy to comment further if you
> > like
> >> just send more details of what you're trying to do.
> >>
> >> Good Luck,
> >> Frank
> >>
> >>> Regards Raymond
> >>>
> >>
> >>
> >
>
>
> --
> Frank Flynn
> Poet, Artist & Mystic
>
>
>
> --
> 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] How to avoid: Warning: Page has Expired

2002-04-09 Thread Peter Lovatt

If you change the form action  to 'get' instead of 'post' this avoids the
message.



'Get' data is displayed on the address line

eg http://domain.com/script.php3?photoID=123&viewtype=full

so it should be avoided for sensistive data like passwords or credit card
numbers. This kind of data should always use 'post'



HTH

Peter
---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
---

> -Original Message-
> From: John Hughes [mailto:[EMAIL PROTECTED]]
> Sent: 09 April 2002 08:30
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] How to avoid: Warning: Page has Expired
>
>
> I have the first part of the kids' soccer photo database site up that I
> mentioned in an earlier post.
>
> The site displays nine image thumbnails. You click on the
> thumbnails and are
> taken to a full size photo.  Everything works as expected for the
> first nine
> images but when you go to the next page of thumbnails, you start getting:
>
> Warning: Page has Expired The page you requested was created using
> information
> you submitted in a form. This page is no longer available. As a
> security precaution,
> Internet Explorer does not automatically resubmit your information
> for you.
>
> To resubmit your information and view this Web page, click the
> Refresh button.
>
> What causes this and how can I fix it so this doesn't happen?
>
> The URL for this site is http://fuzzheads.org/barcelona
>
> TIA
>
> John Hughes
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




RE: [PHP-DB] Re: security/setup question: php3 script contains db password, but scriptmust be readable by nobody: any solution?

2002-04-11 Thread Peter Lovatt

The only answer I know is in the php config, which you may not have acces
to. php can be configured to run as the owner of the script that calls it.
This means only your scripts can read your files. This is not the default
option, and most ISPs just run the default, so your password is available to
anybody skilled enough to find it.

http://www.php.net/manual/en/features.safe-mode.php

should help

HTH

Peter

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

> -Original Message-
> From: Michael Andersson [mailto:[EMAIL PROTECTED]]
> Sent: 04 April 2002 11:55
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Re: security/setup question: php3 script contains db
> password, but scriptmust be readable by nobody: any solution?
>
>
> you could always use a sepeate file and and then use include
> ("path/to/whateverfile.php"); with all your dc connection prefererences in
> it...
>
> "Dries Verachtert" <[EMAIL PROTECTED]> skrev i meddelandet
> news:[EMAIL PROTECTED].
> kuleuven.a
> c.be...
> >
> > Hello,
> >
> > I use apache with php3 and mysql to get some data out of the mysql
> database
> > like probably lotsa people do. The php3 file contains the password,
> because
> > it must be able to connect to the database with a valid password. This
> file
> > also needs to be readable because nobody (the user of the apache
> webserver)
> > must be able to read the file. At least i think this is the
> reason because
> > without a chmod o+r it doesn't work. There are ca. 200 users on this
> > machine.. so i would like to avoid the possibility that other users get
> this
> > password. Are there any solutions? I already checked the faq and i
> couldn't
> > find it.
> >
> > Thanx in advance,
> > Dries Verachtert
> >
>
>
>
> --
> 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] Definitive answer for large scale registration/authentication

2002-04-16 Thread Peter Lovatt

hi

Depends a little on what you are doing next.

I am not an htaccess expert so this is written as a 'sessions' user, but if
you use a database/session system you have a lot of flexibility, and can log
what users are up to.

If it is well programmed, with security in mind you can make it very secure
too. Things like lockout after 3 failed logins, site admins without any
authority on the system itself , users with different authorities within the
software etc etc.

On the other hand if you just want a simple restricted area perhaps htaccess
is best

just my 2p worth

Peter

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

> -Original Message-
> From: Brad Hubbard [mailto:[EMAIL PROTECTED]]
> Sent: 16 April 2002 02:48
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: [PHP-DB] Definitive answer for large scale
> registration/authentication
>
>
> Can I get some feedback on the conventional wisdom as to the best
> solution
> for high volume registration and authentication of users
> accessing a secure
> site? I have worked before with database/session based methods as well as
> htaccess. Which is preferred? Are there alternatives?
>
> Thanks for the feedback,
> Brad
>
> --
> 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] Import/Export data

2002-04-18 Thread Peter Lovatt

Hi

The most universal way would be to export the table to CSV format. You can
then use
LOAD DATA INFILE phpMyAdmin to load it into the database.

http://www.mysql.com/doc/L/O/LOAD_DATA.html

HTH

Peter

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

> -Original Message-
> From: Rosen Marinov [mailto:[EMAIL PROTECTED]]
> Sent: 18 April 2002 17:28
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Import/Export data
>
>
> Hi,
> How can I import/Export data to MySQL database using PHP
> following formats:
> EDI, Access, Excel ?
>
> Where can I find information about this ?
>
> Thanks,
> Rosen Marinov
>
>
>
>
> --
> 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] page expires

2002-04-18 Thread Peter Lovatt

Add




to your header, which will tell the browser not to cache the page, and use
the POST method



HTH

Peter

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

> -Original Message-
> From: Natividad Castro [mailto:[EMAIL PROTECTED]]
> Sent: 18 April 2002 12:56
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] page expires
>
>
> Hi to all,
>
> I have form that users fill out and submit. What I'm trying to do
> is not to
> let users to go back to the form after they have submmited, or if they go
> bak, make the page expires.
> Can someone please tell me or give an idea on how to do it?
>
> Thanks in advanced
> Nato
>
>
> --
> 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] Updating Many Records

2002-04-18 Thread Peter Lovatt

IF there is a formula for the value of quantity eg Quantity = Quantity -1
(UPDATE table SET Quantity = Quantity-1 ) you need to do an update statement
for each row

EG UPDATE table SET Quantity = "9" WHERE Field = Book3

HTH

Peter

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

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 18 April 2002 14:21
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Updating Many Records
>
>
> I am not sure if this is possible.
>
> I have a database, and we fetch all the records and then list them.
>
> What we need is the one field in the database to be able to be updated.
>
> Now  the field will have different values for each record. Is it
> possible to update the table with lots of different values?
>
> So for example we have:
>
> Field Qantity
> Book 1 5
> Book2 6
> Book3 9
>
> Now when we are shown all these records the quantity is a form
> field and we want to change this but for each record?
>
> Hope the above is enough to go on.
>
> Barry
>
> --
> 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] Updating Many Records oops

2002-04-18 Thread Peter Lovatt


Dont think it made sense last time (too little coffee, too much work!)

try again

 IF there is a formula for the value of quantity eg Quantity = Quantity -1
 (UPDATE table SET Quantity = Quantity-1 ) 
IF there is no formual you need to do an  update statement
 for each row
 
 EG 
 UPDATE table SET Quantity = "2" WHERE Field = Book1
 UPDATE table SET Quantity = "4" WHERE Field = Book2
 UPDATE table SET Quantity = "9" WHERE Field = Book3
 
HTH

Peter
---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
--- 

> -----Original Message-
> From: Peter Lovatt [mailto:[EMAIL PROTECTED]]
> Sent: 18 April 2002 23:30
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Updating Many Records
> 
> 
> IF there is a formula for the value of quantity eg Quantity = Quantity -1
> (UPDATE table SET Quantity = Quantity-1 ) you need to do an 
> update statement
> for each row
> 
> EG UPDATE table SET Quantity = "9" WHERE Field = Book3
> 
> HTH
> 
> Peter
> 
> ---
> Excellence in internet and open source software
> ---
> Sunmaia
> www.sunmaia.net
> [EMAIL PROTECTED]
> tel. 0121-242-1473
> ---
> 
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: 18 April 2002 14:21
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] Updating Many Records
> >
> >
> > I am not sure if this is possible.
> >
> > I have a database, and we fetch all the records and then list them.
> >
> > What we need is the one field in the database to be able to be updated.
> >
> > Now  the field will have different values for each record. Is it
> > possible to update the table with lots of different values?
> >
> > So for example we have:
> >
> > Field Qantity
> > Book 1 5
> > Book2 6
> > Book3 9
> >
> > Now when we are shown all these records the quantity is a form
> > field and we want to change this but for each record?
> >
> > Hope the above is enough to go on.
> >
> > Barry
> >
> > --
> > 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] Passwords

2002-04-23 Thread Peter Lovatt

Basically you need first to authorise the user. Check the username and
password against an entry in a user table in the database.

If you are using sessions set a variable that makes the session authorised,
you are not using sessions then you need some sort of session management. (I
have the code, contact me off list if you want it )

if(login ok) $authorised = 1;

At the beginning of any page you want protected

if(!$authorised) die ('you are not authorised to view this page etc etc');

will do the trick

regards

Peter
---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
---

> -Original Message-
> From: Achilles Maroulis [mailto:[EMAIL PROTECTED]]
> Sent: 08 December 2001 08:10
> To: PHP mailing list
> Subject: [PHP-DB] Passwords
>
>
> Hi folks.
>
> I have a quetion for you which maybe a little silly as I'm still
> new here..
> I want to build a database in which access will have only
> registered memebers, so I need to protect it. The database will
> have over 10 records and hopefully over 1000 users-visitors.
> Everyone of them is going to have his own password. I suppose I
> will have to build a table with usernames and encrypted passwords
> but what I don't know is how to protect the pages not to be seen
> without authorization. At first I thought about the .htaccess and
> .htpasswd files but I'm not sure yet...
> Can anyone suggest the best way to protect my database? If it is
> to complicated to be explained in an email please suggest just
> the functions names and I'll try to find the way...
>
> Thanx
> Achilles
>


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




RE: [PHP-DB] Weird Windows SQL

2002-04-24 Thread Peter Lovatt

have you set up permissions for the user you are connecting as?
see  GRANT in the MySql manual. The test bit is a default setting for users
with no privileges (from my slightly rusty memory)

HTH

Peter

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

> -Original Message-
> From: Michael K. Dolan Jr. [mailto:[EMAIL PROTECTED]]
> Sent: 25 April 2002 00:40
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Weird Windows SQL
>
>
> Hi, I just installed MySQL on Windows XP.
>
> The winmysqladmin GUI only allows me to create databases that
> start with "test". So, I can create a database called
> "testmydata" but I cannot create a database named "mydata". This
> is driving me nuts. Any ideas?
>
> Thanks,
>
> Mike
>


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




[PHP-DB] UK based php/mysql programmers

2002-04-29 Thread Peter Lovatt

Hi

I am bidding for a big project scheduled for the end of May. If it comes off
I will need an extra pair of hands, or perhaps two.

Some UK specific knowledge/content which is why UK based matters, no offence
to anyone else :)

Anybody interested in working for/with me? Rates and URLs to
pjl_at_sunmaia.net please

Peter

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


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




FW: [PHP-DB] Using functions in SELECT statements

2002-05-02 Thread Peter Lovatt




Could it be the second $ in the lower('%$SearchBox$%') ?

Peter



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

> -Original Message-
> From: Robin S McKenzie [mailto:[EMAIL PROTECTED]]
> Sent: 02 May 2002 14:34
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Using functions in SELECT statements
> 
> 
> 
> I'm trying perform a case-insensitive test for a name.  These are stored
> like "Association of ...", and I want to convert both the filter and the
> test data to lower- (or upper-) case.  Why doesn't this work:   ?
> 
> SELECT *
> FROM [Organisation Membership]
> WHERE lower(organisation) LIKE lower('%$SearchBox$%')
> 
> Robin McKenzie
> Department of Mechanical Engineering
> University of Bristol
> e:[EMAIL PROTECTED]
> e:[EMAIL PROTECTED]
> m:+44(0)7970 058712
> 
> 
> 
> 
> -- 
> 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] Easy one for you guru's :-)

2002-05-11 Thread Peter Lovatt

I have one that uses a database, is that any use, or do you specifically
want a php session based bit of coding??


Peter
---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
---

> -Original Message-
> From: Dave Carrera [mailto:[EMAIL PROTECTED]]
> Sent: 11 May 2002 19:03
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Easy one for you guru's :-)
>
>
> Hi All
>
>
>
> Can someone breakdown the logic of adding and subtracting products to a
> shopping cart using sessions.
>
>
>
> I can't quite get the logic so something in plain English would help
> very much.
>
>
>
> Any helpful advice, pointers or even code examples are very much
> appreciated.
>
>
>
> Thank you fully in advance for any help you may give.
>
>
>
> Dave C
>
>


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




RE: [PHP-DB] Open file dialog box to save static file

2002-05-12 Thread Peter Lovatt

Hi

you can use php to write the html to a file, rather than having to do it all
manually.

Look at

fopen()

Not sure if this is exactly what's needed, but it might be.


HTH

Peter

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

> -Original Message-
> From: Howard Picken [mailto:[EMAIL PROTECTED]]
> Sent: 12 May 2002 10:05
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Open file dialog box to save static file
>
>
> I'm looking for a way to do the following
>
> I've created a php/mysql site for my wife for various
> database lists she has.
>
> She uses PHP locally on our on web server to add/manage
> entries but a lot of the pages need to be static and uploaded
> to a specific site (no PHP/MySQL).
>
> So I've give her a link that calls another php page to "generate"
> and view the static page in the format she requires.  She then has to
> view the source of that page hilight and copy it over the top
> of the old page on her PC, then upload it to the site.
>
> Now... what I would to be able to do is instead of her having to
> view source etc. I would like to be able to call up a Windows
> file save dialog box (maybe even going staright to the correct folder)
> so that the file can just be saved.
>
> I can't find anything in the PHP manual about this.  Anyone done it
> or have any ideas?
>
> Howard
>
>
>
> --
> 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] mssql_fetch_array not working?

2002-05-13 Thread Peter Lovatt

hi

The code looks OK

Try something like

  while ($row = mssql_fetch_array($rs));
  {
   echo "another row";
   echo $row["ItemClassKey"];
   echo "";
  }
 }

to see if it is looping thro the results, if so then the array
$row["ItemClassKey"] is empty - check the obvious - index case and that
there is data in the field in the record.

If it is not looping thro then could the if($rs) be moving the pointer to
the end of he result set, so there is nothing left to loop thro?

hth

Peter

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

> -Original Message-
> From: Benjamin Walling [mailto:[EMAIL PROTECTED]]
> Sent: 13 May 2002 22:16
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] mssql_fetch_array not working?
>
>
> I apologize if the answer to this is incredibly simple.  I'm
> trying to learn
> PHP, and evaluate whether to change our site away from ASP.
>
> I have the following php code, and I can't get any results.
>
> I have add the line  echo mssql_num_rows($rs); to see how many rows are
> returned, and I get 11 (there are 11 rows in this table).
>
> The page outputs only "11Done".  Why am I not getting any thing into
> $row?  Why do I only get 1  (I would expect 11)?
>
> --Begin Code
>
> $db = mssql_connect("domino","uid","pwd");
> if ($db)
> {
>  $dbs = mssql_select_db("acuity_edd_app",$db)
>   or die("Couldn't set DB");
>  $sql = "SELECT * FROM timItemClass ORDER BY ItemClassID";
>  $rs = mssql_query($sql);
>  echo mssql_num_rows($rs);
>  if ($rs)
>  {
>   while ($row = mssql_fetch_array($rs));
>   {
>echo $row["ItemClassKey"];
>echo "";
>   }
>  }else{
>   echo "No results\n";
>  }
>  echo "Done\n";
> }else{
>  echo "Unable to connect to database.\n";
> }
>
> --End Code
>
>
>
>
> --
> 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] mssql_fetch_array not working?

2002-05-13 Thread Peter Lovatt


well spotted :)


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

> -Original Message-
> From: Terry Romine [mailto:[EMAIL PROTECTED]]
> Sent: 13 May 2002 22:41
> To: Gurhan Ozen
> Cc: Benjamin Walling; [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] mssql_fetch_array not working?
> 
> 
> Do I see a semicolon at the end of the while? that won't work...
> 
> On Monday, May 13, 2002, at 04:35  PM, Gurhan Ozen wrote:
> 
> >   while ($row = mssql_fetch_array($rs)) _;_
> >
> should be
>   while ($row = mssql_fetch_array($rs))
>   {
>   ...
>   }
> 
> Terry Romine
> Web Developer
> JumpInteractive.com
> 

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




RE: [PHP-DB] Fames Included?

2002-05-25 Thread Peter Lovatt

Hi

just use a frameset with php pages in


   

   
   



if I  understood what you were trying to achieve :)

hth

Peter


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

> -Original Message-
> From: César L. Aracena [mailto:[EMAIL PROTECTED]]
> Sent: 25 May 2002 17:34
> To: PHP DB List
> Subject: [PHP-DB] Fames Included?
>
>
> Hi all,
>
> I have a problem in a site I am developing, which is generated by
> the use of too many tables inside tables. I can avoid using that
> many tables by using frames instead and I would like to make
> every page of the site, using the following schema:
>
> include("framed_header.php");
> include("framed_left_menu.php");
> //main body of every page;
> include("framed_footer.php");
>
> Is it posible to make a site or page by including framed-pages within PHP?
>
> Thanx a lot.
>
> Cesar Aracena
> [EMAIL PROTECTED]
> Neuquen, Argentina
>


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




RE: [PHP-DB] HUGE problem here

2002-06-08 Thread Peter Lovatt

"DELETE FROM auth WHERE name=$deletename LIMIT 1";

needs quotes

"DELETE FROM auth WHERE name='$deletename' LIMIT 1";

This may be the problem.


HTH

Peter


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

> -Original Message-
> From: César L. Aracena [mailto:[EMAIL PROTECTED]]
> Sent: 08 June 2002 10:04
> To: PHP DB List
> Subject: [PHP-DB] HUGE problem here
> Importance: High
>
>
> Hi all,
>
> I have a deadline for tomorrow morning (4 more hours) and have one small
> problem I’ve been working on for 3 hours now. I want the Administrators
> of a site to be able to delete or create new Admin users from within one
> admin’s page.
>
> >From the “Aministrators page” they will see a list of available
> administrators with a “DELETE” link aside each one. This works just
> fine, and the link I made looks like this:
>
> [snip]
> echo “ href=\"manageusers.php?mode=deleteuser&deletename=$row[name]\">DELETE
> USER”;
> [snip]
>
> I also made a FORM to insert new ADMINS from the same page which
> displays the list of ADMINS which looks like this:
>
> [snip]
> 
> 
>
>   
>   SIZE=20 MAXLENGTH=10>
>   
>  
>   SIZE=20 MAXLENGTH=30>
>   
>   
>  
>   
>
> 
>
>  
> [snip]
>
> When the page manageusers.php is called, it looks like this:
>
> [snip]
>if ($mode)
>   {
> if ($mode == 'deleteuser')
> {
> $query = "DELETE FROM auth WHERE
> name=$deletename LIMIT 1";
>$result = mysql_query($query);
>
>if ($result);
>{
>echo "User deleted";
>}
> }
> else if ($mode == 'adduser')
> {
> $query = "INSERT INTO auth VALUES ('
> ".$newuser." ', password(' ".$newpass." '))";
>$result = mysql_query($query);
>
>if ($result)
>{
>echo User Added";
>}
> }
>   }
> ?>
> [snip]
>
> It works just fine for adding new ADMINS but when I want to delete one,
> despite the fact it does tell me that it was deleted, the ADMIN is still
> there… What the heck is going on???
>
> Thanks so much in advance… did I mentioned I have to get it fized in 4
> hours ;-) ???
>
> Cesar   Aracena
> CE / MCSE+I
> Neuquen, Argentina
> +54.299.6356688
> +54.299.4466621
>
>


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




RE: [PHP-DB] Re: password()... is it possible?

2002-06-22 Thread Peter Lovatt

Hi

PASSWORD() is not reversible, but ENCRYPT() might be worth a look. Are you
sure you want unencrypted passwords on view? If you have a security breach,
which can include a sacked or unhappy sys admin, who wants to hit back, then
you could have a very uncomfortable situation!

Better to go with Seth's idea and send them a fresh password, unless there
is a very good reason not to.

Just my 2p worth :)

HTH

Peter

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

> -Original Message-
> From: Seth Yount [mailto:[EMAIL PROTECTED]]
> Sent: 22 June 2002 22:12
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Re: password()... is it possible?
>
>
>   I am not sure of the decrypting procedure for password(),
> but if your
> admin needs to view the passwords for the purpose of changing or
> notifying forgotten passwords to the custormer you could use this
> approach:
>
>   Generate a random password (numbers and letters) that is
> emailed to the
> user.  The user then logs on with their USERNAME and the new password.
> Of course, the user then should be influenced to change the generated
> password to something of their choice.
>
>   This works well in that you can increase your security by
> letting the
> user know that 'nobody' will know their password, thus limiting access
> to the users account/session to them alone.
>
>   If this isn't the case that you are dealing with, then I am
> just babbling
> away... hope it helps ;)
>
>
> César aracena wrote:
>
> > Hi all,
> >
> > I need the administrators of one site to actually see the user's
> > passwords. I like using password() for encrypting but doesn't know if it
> > can be retrieved in common English.
> >
> > Thanks,
> >
> > Cesar Aracena 
> > CE / MCSE+I
> > Neuquen, Argentina
> > +54.299.6356688
> > +54.299.4466621
> >
> >
> >
>
>
> --
> 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] Question

2002-06-23 Thread Peter Lovatt

Hi

The correct way, IMHO, would be to consider the situation. The hard drives
are a sub component of the computer. In which case the hard drive table
should be a 'child' of the computer table.

However the hard drives could be an item in their own right too.

So if you want to consider the hard drive as an item, but to know which
computer it is in then make HardDriveID the primary key of the hard drive
table, and include ComputerID as a link field.

If it is basically a component of the computer then make
(ComputerID,HardDriveID) the primary key.

In practice either will work as will

Computer table
{
ComputerID(primary)
Hard_drive_1
Hard_drive_2
Hard_drive_3
..
Hard_drive_n

}

 which is simpler, not good design, but probably OK if you are sure you will
never have more than 'n' drives

just my 2p worth

Peter
---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
---

> -Original Message-
> From: Mike Tuller [mailto:[EMAIL PROTECTED]]
> Sent: 23 June 2002 21:07
> To: Chris Barnes; Php-Db (E-mail)
> Subject: Re: [PHP-DB] Question
>
>
> That would probably work, but only for what I want right now. If I ever
> wanted to create a report of all the hard drives I have, it would become
> more difficult.
>
> I know I need to have a separate table in the database for the drives, but
> am not sure if the foreign key should be drives in the computer table, or
> computer in the drive table. I could just go ahead and work with it, but I
> am the type that wants to learn the right way in the beginning, not figure
> out later that I was doing it wrong. As far as normalization,

> In reply to
> Duncan's post) I have been reading up on that, and so far it
> hasn't given me
> the answer on this type of problem. Maybe what I am reading doesn't cover
> that, so if you are talking about a particular document, let me know and I
> will look at that.
>
> > From: "Chris Barnes" <[EMAIL PROTECTED]>
> > Date: Mon, 24 Jun 2002 05:03:53 +1000
> > To: "Php-Db \(E-mail\)" <[EMAIL PROTECTED]>
> > Subject: RE: [PHP-DB] Question
> >
> > i dont know how will this will work, but you could try storing
> the multiple
> > hard disk details for each computer in an "array" in 1 field.
> > then when you want to get the information from the db, use explode() to
> > store the value in the field into an array again.
> >
> > e.g.
> > the field in the DB might look like this...
> > HardDriveSize = "1.2Gb,25Gb,25Gb"
> >
> > so get the field from the db and then use explode() to store it
> in an array
> > in php.
> > e.g.
> > $disk_size = explode("," , $field);
> >
> > i dont know how well this will work for you...i'm only a newbie.
> >
> >
> > -Original Message-
> > From: Mike Tuller [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, 24 June 2002 3:43 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] Question
> >
> >
> > I am wanting to create a PHP frontend to a database that holds
> information
> > about the computers that I take care of. I have a problem though when it
> > comes to storing hard drive information. In most cases, the
> computers have
> > one drive, but some have 2 or more, so I can't create the main
> database with
> > fields like this.
> >
> > ComputerID
> > HardDriveType
> > HardDriveSize
> >
> > I know I will need to create a separate table to hold
> information about the
> > drives, and connect them to the computer by attaching the
> primary key of the
> > drives table to the Computer table.
> >
> > Computer Table
> >
> > ComputerID
> > DriveID
> > 
> > Drive Table
> >
> > DriveID
> > HardDriveType
> > HardDriveSize
> >
> > This is where I am unsure. If there is more than one drive,
> then this would
> > be incomplete because it would only show one drive. What is the
> best way to
> > make it so that all drives show for the computer, or am I doing this
> > backwards? Should I tie the computer to the drive instead?
> >
> > Thanks,
> > Mike
> >
> >
> > --
> > 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] PHP and msql Error

2002-06-26 Thread Peter Lovatt

Hi

With MySql that means that there is no result returned. Usually SQL error,
but could be a setup problem if you have not run any queries succesfuly.

Not sure if the same applies to MSql, but try echoing the error, echo
msql_error($conn) (if it is the same as MySql)

HTH

Peter

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

> -Original Message-
> From: comp boy [mailto:[EMAIL PROTECTED]]
> Sent: 26 June 2002 20:09
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: [PHP-DB] PHP and msql Error
>
>
>  I am getting the following error:
>
>  Warning: Supplied argument is not a valid mSQL result resource in
>  /usr/local/apache/htdocs/inc/listings.inc on line 24
>
>  listings.inc: 24
>  $numRows = msql_numrows( $result );
>
>  The manual on php.net says that it takes no variables msql_numrows(void)
>  however it says it is another version of msql_num_rows(int msql);
>
>  The code I am trying to run, runs perfectly fine on another one of our
> systems.  I was just setting up a development server and now I am getting
> this problem.  The specs are the same except for the version of Apache
> production is 1.3.9 and development is 1.3.26
>
>  PHP vesrion 4.1.2
>
>  ./msqladmin version
>  Version Details :-
>  msqladmin version   2.0.11
>  mSQL server version 2.0.11
>  mSQL protocol version   23
>  mSQL connection Localhost via UNIX socket
>  Target platform Linux-2.2.14-5.0-i686
>
> PHP was configured:
> ./configure --with-apxs=/usr/local/apache/bin/apxs --with-msql
>
> msql was a default install.
>
> Does anyone know what I did wrong?  Do I need to recompile with some
> different options?
>
> TIA
> Jason
>
>
> --
> 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] XML

2002-06-27 Thread Peter Lovatt

Hi

I am looking at a project using XML to import and export data into MySql
directly or using php. The datasets are quite large (40-50 million records)

I haven't used XML before.

Does it take long to work out how to use php/XML? Are there any problems
working with large datasets?

Thanks

Peter



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

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 27 June 2002 17:43
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: [PHP-DB] Re: PHP and msql Error
>
>
> The error is in your MySql statement.  Sounds like you are calling the
> wrong data field / column.  Check you spelling and syntax to make sure
> all of that is in order.  If you can't find it, copy it and post it.
> We'll help you out
>
> gl -- Seth
>
> Comp Boy wrote:
>
> >  I am getting the following error:
> >
> >  Warning: Supplied argument is not a valid mSQL result resource in
> >  /usr/local/apache/htdocs/inc/listings.inc on line 24
> >
> >  listings.inc: 24
> >  $numRows = msql_numrows( $result );
> >
> >  The manual on php.net says that it takes no variables
> msql_numrows(void)
> >  however it says it is another version of msql_num_rows(int msql);
> >
> >  The code I am trying to run, runs perfectly fine on another one of our
> > systems.  I was just setting up a development server and now I
> am getting
> > this problem.  The specs are the same except for the version of Apache
> > production is 1.3.9 and development is 1.3.26
> >
> >  PHP vesrion 4.1.2
> >
> >  ./msqladmin version
> >  Version Details :-
> >  msqladmin version   2.0.11
> >  mSQL server version 2.0.11
> >  mSQL protocol version   23
> >  mSQL connection Localhost via UNIX socket
> >  Target platform Linux-2.2.14-5.0-i686
> >
> > PHP was configured:
> > ./configure --with-apxs=/usr/local/apache/bin/apxs --with-msql
> >
> > msql was a default install.
> >
> > Does anyone know what I did wrong?  Do I need to recompile with some
> > different options?
> >
> > TIA
> > Jason
> >
> >
>
>
> --
> 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] encryption of critical data

2002-06-27 Thread Peter Lovatt

HI

If you are using MySql look at ENCODE() on mysql.com

http://www.mysql.com/doc/M/i/Miscellaneous_functions.html


Most databases support some sort of encryption. Encrypting by php is
probably more secure - somebody might be able to sniff data going to the
database if it still plain text, but that is a small risk IMHO, and getting
the database to do it is easy .

HTH

Peter

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

> -Original Message-
> From: youx [mailto:[EMAIL PROTECTED]]
> Sent: 27 June 2002 14:12
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] encryption of critical data
>
>
> Hi,
> Can someone provide me some information about encryption and
> decryption of critical data such as credit number card in order
> to stock them on a mysql database in a secure way.
>
> What I want to do is making a web interface secured via SSL in
> order to be able to consult some people information. As I don't
> want the critical information to be plaintext on the db, I'm
> searching for a way to get it encrypted and then decrypted when
> I'm consulting via the interface.
>
>  I've read the php.net documentation and many articles about data
> encryption/decryption but both of them stand theorical about the
> various algorithms.
>
> Do you know the more secures of them and the way to use them ?
> Do you know people working in the same way or do they prefer
> another kind of more secure solution ?
>
> Thank you for your advice,
> R.
>


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




RE: [PHP-DB] Excel to MySQL??

2002-06-29 Thread Peter Lovatt

Hi

from Excel export to csv

use phpMyAdmin to load it into mysql (recent versions of phpMyAdmin has an
Excel import function)

HTH

Peter

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

> -Original Message-
> From: Chase [mailto:[EMAIL PROTECTED]]
> Sent: 29 June 2002 22:22
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Excel to MySQL??
>
>
> Does anyone know of a way that I can export an Excel spreadsheet to a
> file that I can import to MySQL?  I found a program that will do this
> for Access, but I would rather leave Access out of this if possible.
> Thanks!!
>
> Chase
>
>
> --
> 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] Storing passwords in a database

2002-06-30 Thread Peter Lovatt

Hi

Retrieving lost passwords is a lot less hassle than a setting up a new one,
for the user. IMHO a job site would be better with more convenience and less
security.

So I would go for option 1 - encrypt / decrypt

If you were storing very sensitive information then go for option 2.

Peter


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

> -Original Message-
> From: Lisi [mailto:[EMAIL PROTECTED]]
> Sent: 30 June 2002 10:25
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Storing passwords in a database
>
>
> I know there's been discussion on the list before on this topic,
> but I'm a
> little fuzzy on the details.
>
> I want to create a site where users can create an account online,
> and then
> log in to search job postings.  I want to store their user info and
> password in a database. I need a way for them to retrieve their passwords
> if forgotten. I know there are two basic approaches:
>
> 1) Storing the passwords using some form of encryption, which can be
> reversed and the password can be emailed to the user.
>
> This seems to me to be preferable, since they don't have to change their
> password whenever they forget it. However, are there security issues with
> this? I know many people recommend the second method:
>
> 2) Generating a new random password which the user can then use to log in
> and change to whatever they want.
>
> What are the advantages of this, since someone would need access to the
> person's email address with either method 1 or 2 in order to steal the
> password?
>
> What functions should I be looking at for encryption, for either method?
> What are advantages and disadvantages of each method?
>
> The site will not take credit card information, all accounts are free. So
> the security issues are much less, but of course you do not want a site
> where people's accounts are stolen even if there is not money involved.
>
> I hope this is clear,
>
> -Lisi
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




RE: [PHP-DB] MySQL test database creation...

2002-07-05 Thread Peter Lovatt

hi

If the database is not too much data you can export using phpMyAdmin and
select 'complete inserts' which generates complete queries.

you could also do

INSERT  INTO db_2.tablename
SELECT *
FROM db_1.tablename

if both databases are on the same server.

There may be better answers, but these two are simple :)

Peter

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

> -Original Message-
> From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
> Sent: 05 July 2002 18:26
> To: '[EMAIL PROTECTED]'
> Subject: [PHP-DB] MySQL test database creation...
>
>
>   Hey guys...  I know that this is not specifically on topic for this
> group, but I promise this is an easy one.
>
>   I am developing a web app, and need to create a development copy of
> the production database.  I have created the new database, now I just need
> to  export and import the schema and data from the production database.  I
> am running MySQL 3.23.49, and I am using phpMyAdmin for the bulk of my
> database administration.  I can get the data and schema dumped to a file
> easily enough with phpMyAdmin, but it does not seem to offer an import.  I
> know that mysqlimport should be the tool to handle this, but I
> want to make
> this as easy as possible for myself and I am pretty sure there is a way to
> have it create the tables and everything from the schema data.  I
> have check
> the mysql documentation, but I am not finding what I need.  I am
> sure it is
> in there, but I have had a pretty long night with little sleep.
>   Thanks in advance for the help.
>
> 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
>


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




RE: [PHP-DB] template problem!!!

2002-07-06 Thread Peter Lovatt

Hi

Just enclose it in 

You can do this in either templates or html pages

If you want it to work you can either save as .php, include it in a php
script or set your server to parse htm pages with php.

HTH

Peter

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

> -Original Message-
> From: its me [mailto:[EMAIL PROTECTED]]
> Sent: 06 July 2002 06:32
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] template problem!!!
>
>
> i have asimple problem:
> can i put php code in the site template??-i'm using dreamweaver.
> and if yes will i save it as php or as .dwt??
> thanks guys
>
>
> Rehab M.Shouman
>
> 
> 
>
>
> -
> Express yourself with a super cool email address from BigMailBox.com.
> Hundreds of choices. It's free!
> http://www.bigmailbox.com
> -
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




RE: [PHP-DB] Having more problems

2002-07-07 Thread Peter Lovatt

You are missing a  tag to mark the start of the body, so all your
content will be part of the header, I think!

HTH

Peter

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

> -Original Message-
> From: Shiloh Madsen [mailto:[EMAIL PROTECTED]]
> Sent: 07 July 2002 06:07
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Having more problems
>
>
> The newbie is still having troubles heh. Maybe some kind soul can tell
> me what im doing wrong this time. This is the code for a page I am
> working on. When I try to bring up the page in a browser, I just
> get a white page, instead of having the HTML display. Anyone able
> to tell me why?
>
>
>
> 
>
> 
> 
> Login Page
> 
>  $dbhost = "127.0.0.1";
> $dbuser = "root";
> $db = "LoginInfo";
>
> $LoginDB=@mysql_connect($dbhost, $dbuser, $dbpass);
> if (! $LoginDB) {
> print "Unable to connect to the database server at this time.";
> exit();
> } else {
> mysql_select_db("GameDB",$LoginDB);
> if (! @mysql_select_db("GameDB") )
> print "Unable to locate the Game Database.";
> exit();
> }
> ?>
> 
> body { color: white; background: black; }
> 
>  alt="D&D Resource Page" border="0">"
> 
> 
> 
> Login: 
> Password: 
>  
>
> 
>
>  }
> ?>
>
> 
>
>
>
> --
> 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] Newbie Reminder on HTML Variable Passing - quick fix

2002-07-07 Thread Peter Lovatt

hi

The enclosed will read all incoming variables and convert them, effectively
turning on 'register_globals'

It is a quick fix for broken scripts but does remove the security provided
by turning register_globals off !

use it as an include at the beginning of scripts.

Peter

http://www.sunmaia.net for full licence terms  #
#supporthttp://www.sunmaia.net/support/ #
#   #
#   You can do whatever you like with this so long  #
#   as this header remains in place #
#   #
#   It worked last time I used it, but it is not#
#   guaranteed in any way!  #
#   #
#   #
/

while(list($key, $val) = each($HTTP_POST_VARS))
{
$$key = stripslashes($val);
}


while(list($key, $val) = each($HTTP_GET_VARS))
{
$$key = stripslashes($val);
}


while(list($key, $val) = each($HTTP_COOKIE_VARS))
{
$$key = stripslashes($val);
}



?>



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

> -Original Message-
> From: Allens [mailto:[EMAIL PROTECTED]]
> Sent: 07 July 2002 16:53
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Newbie Reminder on HTML Variable Passing
>
>
> I just recently got back to work on my db's and found that html variable
> passing isn't working anymore. I did some research and fould that the
> core setting in PHP for register_globals is off by default now since
> 4.1.x. As a newbie, this stumped me. There are some new variables
> created by the PHP team to address this, but we need to change our code
> some. The url below helps explain some of this. Hope this helps some of
> the other newbies entering this environment that have been confused by
> this as I had been. :)
>
> http://www.php.net/release_4_1_0.php
> :)
>Gale L. Allen Jr
>Macintosh Support Specialist
> 865/947-5740
>
>"Remember, Love wins over all"
> (:
>
>
> --
> 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] disable backbutton

2002-07-07 Thread Peter Lovatt

Hi

if you add




to your header that should stop the browser caching and if you do all your
links using a form with the method set to 'post' that should stop people
using the back button

HTH

Peter

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

> -Original Message-
> From: Sander Peters [mailto:[EMAIL PROTECTED]]
> Sent: 07 July 2002 21:28
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] disable backbutton
>
>
> Hello,
>
> I would like to make a page expire or disable the backbutton (clear the
> history).
> Why? I'm developping a database-related programm in php/mysql and
> people can
> log in and out, but nobody should be able to use the backbutton to be in
> the system again as the user that just logged of.
>
> Can somebody help me?
> Thanks in advance!
>
> Sander Peters
>
>
>
> --
> 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] catch warnings?

2002-07-10 Thread Peter Lovatt


look at

http://www.php.net/manual/en/function.mssql-get-last-message.php


Peter
---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
--- 

> -Original Message-
> From: Gabor Niederlaender [mailto:[EMAIL PROTECTED]]
> Sent: 10 July 2002 12:37
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] catch warnings?
> 
> 
> Hi all!
> 
> This is not a typical DB-Question, but I hope you give me some hints
> either...
> 
> If I insert a String instead of a date(f.Ex) into the DB, I get a
> Warning:
> 
> MS SQL message: Syntax error converting datetime from character
> string. (severity 16) 
> 
> How can I catch these warnings in PHP?
> 
> Best regards,
> Gabor 
> 
> -- 
> 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] Good mysql abstraction layer class?

2002-08-16 Thread Peter Lovatt

Hi

If you want power take a look at Metabase, it covers most major DBs with a
single interface.

If you want simple, but functional, contact me offlist and I will send you
mine, which works well.

Peter

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

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: 16 August 2002 06:10
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Good mysql abstraction layer class?


I'm completley reprogramming my site, and I'm looking for a good mysql
abstraction layer.  I want something that basicly works just like the
normal mysql functions (something like $classvar->function(), rather
than mysql_function()).  Any ideas?


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




FW: [PHP-DB] how to hide source code??

2002-08-29 Thread Peter Lovatt

hi

Basically the answer is no.

However Zend (www.zend.com) produce commercial software which compiles the
php, making it run faster and the source unreadable, but it is not cheap so
you need a good enough reason to spend the money.

On the other hand it is the commercial arm of php so you are supporting php
in the process.

Not sure if there are any other options

Peter

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

-Original Message-
From: Smita Manohar [mailto:[EMAIL PROTECTED]]
Sent: 29 August 2002 18:59
To: [EMAIL PROTECTED]
Subject: [PHP-DB] how to hide source code??


hii
im using php script with mysql. i want to hide the script from the admin or
from the person who has privileges to access all the data. bcos i use ftp to
upload the files. and i don't want anyone should be able to view the source.

is it possible to do so?

thnx and regds,
smita.



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


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



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




RE: [PHP-DB] how to hide source code??

2002-08-29 Thread Peter Lovatt

Hi

Reading a few of the answers which I missed (mail filters!) before I wrote
the last email I thought I might add a little depth.

If you are on a shared hosting machine then the answer fundamentally is no.
The machine admin has absolute control over the machine and can see anything
you put on there. Php also has a number of security settings and the default
(which most shared hosters will use because it is easy) makes your code
accessible to anybody else with access to the machine, though they need to
know enough about php and Linux file systems to find their way around.

So it comes down to how much security matters. You can make your code
difficult to read or even have different bits on different servers. In the
end anybody determined enough will be able to access it, but, unless it is
very valuable or sensitive data, they probably won't bother :)

You could get your own server - in the UK prices start at £75 (about US$100)
per month, or you could host your own if you have a connection. These are
both genuinely secure options.

HTH

Peter

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



-Original Message-
From: Smita Manohar [mailto:[EMAIL PROTECTED]]
Sent: 29 August 2002 18:59
To: [EMAIL PROTECTED]
Subject: [PHP-DB] how to hide source code??


hii
im using php script with mysql. i want to hide the script from the admin or
from the person who has privileges to access all the data. bcos i use ftp to
upload the files. and i don't want anyone should be able to view the source.

is it possible to do so?

thnx and regds,
smita.



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


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



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



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




RE: [PHP-DB] Help with code

2002-08-29 Thread Peter Lovatt

Hi

try echoing the actual query, after the variables have been converted to
values

   $qtrans = "insert into $tbltrans
values('0', 'daily', '$building',
'$itemchoice',
 '0', '$count', '0', '$ddate', '$cat')";

echo $qtrans ;

and see if a comma or quote mark is in the wrong place.

HTH


Peter

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

-Original Message-
From: Michael Cortes [mailto:[EMAIL PROTECTED]]
Sent: 29 August 2002 20:33
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Help with code


I don't know if this is the place for a new programmer to get help.  But
here goes..


// list items and get input for today's item uses/receipts

print ("\n");

print ("Choose
Item\n");


I am using the following code to let my users choose from a list of
inventory items:


$userarray = mysql_fetch_array($resultuser);
while ($itemarray = mysql_fetch_array($resultitem)) {

print ("$itemarray[description]\n");
}

print ("\n");

print ("\n");


Some example items from which they choose are"apple sauce, case, 12/8oz" and
"Beef, Patties Lean,
A627, 40#, gov".

My problem is such.  When they choose and item and submit the
transaction.


   $qtrans = "insert into $tbltrans
values('0', 'daily', '$building',
'$itemchoice',
 '0', '$count', '0', '$ddate', '$cat')";


I am loosing all of item description after the first comma.  "Beef, Patties
Lean, A627, 40", gov"
turns into "Beef,".

Can anyone help?




Michael Cortes
Fort LeBoeuf School District
34 East 9th Street
PO Box 810
Waterford PA 16411-0810
814.796.4795
Fax1 814.796.3358
Fax2 978-389-1258


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

2002-08-30 Thread Peter Lovatt

Hi

I will second that and add MySql to the list. I love the power and stability
and the confidence these two give. I started building sites at a time when
the costs of M$ software were beyond my means and perl was beyond my
abilities :)

Now I feed my kids and keep a roof over our heads using them. Without the
time and dedication of those who built and shared php and MySql this would
not have been possible so kudos a big thank you from me too.

Peter

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

-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]]
Sent: 30 August 2002 14:25
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Kudos


I know we'd all agree, but for everyone who has taken it for granted, like I
have, I just wanted to mention what a privilege it is that PHP exists. I've
recently been involved on a .NET project and with every buggy, broken, and
just plain bad module I come across I wish more that I could just use PHP. I
am very grateful for the minimal pay and minimal glory volunteers that
created such an excellent product. So three cheers for PHP!

<>< Ryan

--
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] not a valid MySQL result

2002-09-06 Thread Peter Lovatt

Hi

Couple of points, you probably have an SQL error,

I use

echo $query;
echo ''.mysql_error();

which shows the query and the error

you use 'author-cat' in the table name
and 'author_cat' and 'author-cat' in the where clause which will throw an
error.

HTH

Peter



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

-Original Message-
From: Wilmar Perez [mailto:[EMAIL PROTECTED]]
Sent: 06 September 2002 16:51
To: php-db mailing list
Subject: [PHP-DB] not a valid MySQL result


Hello guys

This is my first posting to the list, even though I've had some experience
with C++, these are my first steps with php and mysql.

Well, the thing is that I'm getting the following message:

Warning: Supplied argument is not a valid MySQL result resource
in /var/www/bva/new/main/colecciones.php on line 35

The code is shown below:

$query_cat = "select author_names || ' ' || author_surnames
  from author, author-cat
  where author_cat.cat_code = $code
  and author.author_code = author-cat.author_code";


$result_cat = mysql_query($query_cat);

$num_results_cat = mysql_num_rows($result_cat);  //This is line 35


I did the same with a simpler select sentence and it worked alright, so I
guess there's a problem with the select sentence but haven't been able to
find it.

Does anyone have an idea?

Thanks a lot for your help.

***
 Wilmar Pérez
 Network Administrator
   Library System
  Tel: ++57(4)2105145
University of Antioquia
   Medellín - Colombia
  2002
***



--
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] Can't see the results

2002-09-07 Thread Peter Lovatt

Hi

you are using mysql_fetch_array which returns an array indexed by field name
eg

$row = mysql_fetch_array($result)

$row["Author"] will be 'fred bloggs'



you are indexing using a number which needs mysql_fetch_row

suggested simplified code is

I have named the resulting field as 'author_full_name' for clarity
If $code is not a number then it shold be quoted.

$query_cat =  "select author.author_names || ' ' || author.author_surnames
AS author_full_name
from author, authorxcat
where authorxcat.cat_code = $code
and author.author_code = authorxcat.author_code"
   ;

$result_cat = mysql_query($query_cat) or die($mysql_error());


while($row = mysql_fetch_array($resultID))
{
$content .='html code..'
$content .= $row["author_full_name"]
$content .='html code..'
}// end while


**you could also do as Jim suggested


$result_cat = mysql_query($query_cat) or die($mysql_error());
while($row = mysql_fetch_row($resultID))
{
$content .='html code..'
$content .= $row["0"]
$content .='html code..'
}// end while



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

-Original Message-
From: Wilmar Perez [mailto:[EMAIL PROTECTED]]
Sent: 07 September 2002 00:38
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Can't see the results


Hello again

Well I followed Jim recomendation but it didn't work either, I think I'd
better send the full code to you (don't worry is very short), so you can
have
a broader idea of what I'm intending to do, which is actually quite a simple
thing, just to retrieve results from a database according to a selection
made
by the user.  Any help will be highly appreciated.

Well here is the code:

Note:  If you have a look to the part where the main IF condition is false
(when the $code variable doesn't exist) you'll see that I'm doing something
pretty simmilar but with a different mysql query.  That part works alright.
So, what am I missing in the second part? (when the $code variable exists)


  Página principal





";

//Operations
$query = "select * from categories order by cat_name";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);

if($code){

$query_cat = "select author.author_names || ' ' || author.author_surnames
from author, authorxcat
where authorxcat.cat_code = $code
and author.author_code = authorxcat.author_code"
or die($mysql_error());

$result_cat = mysql_query($query_cat) or die($mysql_error());

$num_results_cat = mysql_num_rows($result_cat) or die($mysql_error());

for ($i=0; $i < $num_results_cat; $i++)
{
$row = mysql_fetch_array($result_cat) or die($mysql_error());

   $num_cols = count($row); //As suggested by Jim

for($j=0; $j < $num_cols; $j++){
$content .= $row[$j];
}
}

$content .= $num_results_cat."";

} else


for ($i=0; $i < $num_results; $i++)
{
if ($i==$num_results/2){
$content .= "




";
}
$row = mysql_fetch_array($result);
$content .= "".htmlspecialchars(stripslashes($row
["cat_name"]))."";
}

$content .= "";
}

//Send values
$colecciones -> SetTitle("Colecciones");
$colecciones -> SetContent($content);
$colecciones -> Display();
?>


*
Jim wrote:

Your problem seems to stem from the $content .= $row; $row is an Array and
you must use an index to get at any given value it holds. If you need all of
the values in $row, use the count() function to get the number of elements
(columns in this case), then loop through them adding them to $content along
with any separators (IE: commas or semi colons or spaces) etc. the code
might
look like this:

$content = ""; // I like to make sure that the variable is always
initialized
to something before I use it.

$num_results_cat = mysql_num_rows($result_cat);

for ($i=0; $i 

RE: [PHP-DB] Problem with SQL

2002-09-08 Thread Peter Lovatt

hi

It is trying to insert the value '127' into a key field (or indexed field)
when it already has a record with '127' in that field. You may know it as a
key violation

It means you are trying to insert a record with a duplicate primary key

HTH

Peter

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

-Original Message-
From: Brtosz Matosiuk [mailto:[EMAIL PROTECTED]]
Sent: 08 September 2002 10:22
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Problem with SQL


Hi all
SQL gives me a strange error and I can't find any info about it. Mayby
someone of you could give me a clue what is wrong.

The error is : 'Duplicate entry '127' for key 1'
Thanks for any help
--
-= MAdSiuK ([EMAIL PROTECTED]) =-
"(...) jestesmy nihilistami, w nic nie wierzymy, doslownie w nic(...)"



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

2002-09-21 Thread Peter Lovatt

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

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

just a thought

Peter

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

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


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

---John Holmes...

> -Original Message-
> From: Warren Massengill [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 20, 2002 1:08 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Form response
>
>
> John,
>
> If you're seeing PHP source code when you pull up a page, your server
is
> not
> configured correctly. What if you try a basic .php page like echo
"Hello
> World";, does that work?
>
> No. Just prints the source code. What is really strange (to me) is
that
> the
> simple form and a more complex form (not shown here) works pefectly.
The
> forms open, accept input, and when you press submit ... the next
script
> reverts to source code, just like hello world, phpinfo(), and
everything
> else. ;--(
>
> You are running a web server right, not just using File->Open?? ---
>
> No again, just using the browser in Linux.
>
> John Holmes...
>
>
> >From: "Cornelia Boenigk" <[EMAIL PROTECTED]>
> >Reply-To: "Cornelia Boenigk" <[EMAIL PROTECTED]>
> >To: "Warren Massengill" <[EMAIL PROTECTED]>
> >Subject: Re:  [PHP-DB] Form response
> >Date: Fri, 20 Sep 2002 13:31:46 +0200
> >
> >Hi Warren
> >
> >Did you change the php.ini? There must be the line
> >
> >default_mimetype = "text/html"
>
> I checked. The line already exists as default_mimetype = "text/html"
> . I did find the mod_mime_magic module in Apache (see below for the
gory
> details) and installed it - to no effect as you might imagine (both
Apache
> and PHP are configured to accept html,php,etc...)
> >
> >It seems that the browser doesn't recognize the correct type and
> >displays the source. Did you try to display the forms in another
> >browser.
>
> Netscape gave the same result.
>
> Thanks,
> Warren
>
> >
> >Regards
> >Conni
>
>
>
>
>
>
>
>
>
>
>
>
> LoadModule mime_magic_module  modules/mod_mime_magic.so
> ---
> AddModule mod_mime_magic.c
> 
> #
> # TypesConfig describes where the mime.types file (or equivalent) is
> # to be found.
> #
> 
> TypesConfig /etc/mime.types
> 
> ---
> #
> # The mod_mime_magic module allows the server to use various hints
from
> the
> # contents of the file itself to determine its type.  The
MIMEMagicFile
>
> 
>MIMEMagicFile /usr/share/magic.mime
> MIMEMagicFile conf/magic
> 
>
>
>
> _
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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



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




RE: [PHP-DB] Variables coming from forms

2002-09-22 Thread Peter Lovatt

could be a register globals issue?

Peter

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

-Original Message-
From: Achilles Maroulis [mailto:[EMAIL PROTECTED]]
Sent: 22 September 2002 07:04
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Variables coming from forms


Hi. I have posted this thread before but didn't come to a solution so I try
again.

I've installed Apache 2.0 and PHP 4.2.3 (both with the msi installers) on
Windows 2000 Pro.
The problem I have is that I get the message

Notice: Undefined variable: var_name in 

every time I pass a new variable into another page whether this happens
using the URL or a form or even sessions.

The strange thing is that if I run phpinfo() in the same page (where the
variable is considered to be undefined) I see that my variables do exist in
the variables section of phpinfo.


For example. If I use a form to pass a variable in a php file like this:

  
  


and have the var.php like this:


I'll get the message:
Notice: Undefined variable: var in C:\Progr.\htdocs\var.php on line 2

while I'll also get a line like this in the variables section of phpinfo():
Variable  Value
_GET["var"] the value I typed before

I think this is really strange. Has anyone something to suggest?

Thanx in advance!!
Achilles


-- 
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] export to csv file

2002-09-28 Thread Peter Lovatt

If you are using *nix set the file, or directory permissions recursively, to
777.

If you want to let the users download the file it may be simpler to generate
the content and send it directly to them when they click on a link.

http://www.phpbuilder.com/mail/phplib-list/2001062/0017.php

explains but basically set the header using

header("Content-Type: application/force-download");

and then output the file.

Peter





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

-Original Message-
From: Patrick Latour [mailto:[EMAIL PROTECTED]]
Sent: 28 September 2002 20:42
To: Diana Castillo; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] export to csv file



- Original Message -
From: "Diana Castillo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 28, 2002 10:02 AM
Subject: [PHP-DB] export to csv file


> Hi, I want to export some fields on a regular basis from a table to a text
> file, preferable to the users local computer. I tried writing to a file
with
> fopen but I get "permission denied" when I try to open it for writing.
> What is the best solution?
> Thanks,
> Diana
>
> --
> See my web page:
> http://www.netrox.net/%7Ecastillo/hghindex.htm
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.391 / Virus Database: 222 - Release Date: 9/19/2002


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

2002-10-23 Thread Peter Lovatt
check

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

it covers a number of options 

Peter

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

-Original Message-
From: Doaldo Navai Junior [mailto:doaldo@;triunfo-bsb.com.br]
Sent: 22 October 2002 05:46
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Security


I need RSA cryptography (or another assymetric method) to crypt the data in
my db. How can I do it?

Doaldo
[EMAIL PROTECTED]



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

2002-10-29 Thread Peter Lovatt
Hi

Take a look at replication

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

HTH

Peter

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

-Original Message-
From: Martin Hudec [mailto:corwin@;corwin.sk]
Sent: 29 October 2002 08:18
To: [EMAIL PROTECTED]
Subject: [PHP-DB] database synchronization


Hello,

  maybe this is not to be posted here but I am working on this
  using PHP and MySQL (one application for travel agencies)

  Does someone know how to synchronize automatically two
  databasesi have one database running on my server with
  static IP and another, from which we are taking updated records,
  on another computer with static or dynamic IP.has someone
  tried to solve this?

-- 
Best regards,
 Martin  mailto:corwin@;corwin.sk


-- 
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: Re[2]: [PHP-DB] database synchronization

2002-10-29 Thread Peter Lovatt
Hi

Replication works continuously when the two databases are in contact with
each other, unless you specify otherwise. Likewise, if you connect
periodically, MySql will synchronise the two databases itself.

With replication, MySql logs everything the master does. When a slave logs
in (you can have any number of slaves) it checks the master logs to see how
up to date it is, and 'catches up' with the master.

Once it is set up correctly you don't need to do anything yourself.

HTH

Peter

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

-Original Message-
From: Martin Hudec [mailto:corwin@;corwin.sk]
Sent: 29 October 2002 08:44
To: Peter Lovatt
Cc: [EMAIL PROTECTED]
Subject: Re[2]: [PHP-DB] database synchronization


Hello Peter,

nice readinglooks like i need to get binary log with queries that
modified some data...okayand use queries from this log on our
slave databaseokay

mysqlbinlog log-file | mysql -h server_name

i suppose server_name is hostname but what if this hostname
changes (or IP)

looks like all i have to do is setup to create binary log on master
(other server with various IPs)then on our machine i will set up
script which will check for new log files in example each 4 hours and
use themfirst question...how will i use queries from logfile to
update mine database? and what if other (master) server is not online
(dialup)? Should i make that master server connect to our
server?...Because i think it will be better to send those log files
directly to slave server with stable and well known IP...and make
remote updatethan to try to find changing ip of master
serverthat puts me to another problem...what if master is running
windows? I can create these scripts on linux..but what on windows?


--
Best regards,
 Martinmailto:corwin@;corwin.sk

Tuesday, October 29, 2002, 9:29:43 AM, you wrote:

PL> Hi

PL> Take a look at replication

PL> http://www.mysql.com/doc/en/Replication.html

PL> HTH

PL> Peter

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

PL> -Original Message-
PL> From: Martin Hudec [mailto:corwin@;corwin.sk]
PL> Sent: 29 October 2002 08:18
PL> To: [EMAIL PROTECTED]
PL> Subject: [PHP-DB] database synchronization


PL> Hello,

PL>   maybe this is not to be posted here but I am working on this
PL>   using PHP and MySQL (one application for travel agencies)

PL>   Does someone know how to synchronize automatically two
PL>   databasesi have one database running on my server with
PL>   static IP and another, from which we are taking updated records,
PL>   on another computer with static or dynamic IP.has someone
PL>   tried to solve this?

PL> --
PL> Best regards,
PL>  Martin  mailto:corwin@;corwin.sk


PL> --
PL> PHP Database Mailing List (http://www.php.net/)
PL> 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: Re[4]: [PHP-DB] database synchronization

2002-10-29 Thread Peter Lovatt
Hi

If the records are all independant - ie travel agent (TA) A has their own
records and so does TA B then REPLACE INTO MainDB SELECT * FROM
Travel_agent_A_DB so the main database is just receiveing updated records
from the TAs.

Travel agent logs in to master php driven site .
master php driven site logs TA IP
master php driven site makes connection to TA mysql using IP
master php driven site gets new/updated records
master php driven site writes new/updated records to master DB

If more than one travel agent can update the same record then you risk
corrupting the data. If they do not have a live connection to the master
then the record they update may itself be out of date. The only way I can
see of doing this is soem system that locks a record for the period that TA
might take updating it.

Perhaps

TA A login
TA grab record, mark as locked
TA B gets 'locked record' message
TA A updates record and writes back to master
record marked as not locked

HTH

Peter

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

-Original Message-
From: Martin Hudec [mailto:corwin@;corwin.sk]
Sent: 29 October 2002 09:18
To: Peter Lovatt
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re[4]: [PHP-DB] database synchronization


Hello Peter,

okay :)))so far I understand...buthmmm let me explain

I have server of travel agencies records (we need to update this, so
it is slave) with stable IPand then bunch of other computers (from
these we are updating...so they are all masters) in various travel
agencies...but not all of them have stable IP (some joins using
dialup...some have stable line)...some girl there updates
database...and they may not be on net:).
So in this case i have one slave and many masters.

solution one:

My server (slave) has to periodically check for updateswhen
masters have stable IP I can make list of IPs and then connect to each
server and take binary update log...and use itbut what can i do
when master has dynamic IP? So i discard this solution

solution two...better...from my point of view ;):

Masters with stable IP will update in period of for example 4
hoursmasters with dynamic IP will update when they are online
(girl browsing on chatting sites ;)))that puts the question if
there is possible to make remote update (sending binlog from master to
slave and automatically updating slave)(but if i understood your
previous mail...synchronization (replication) is done automaticaly
the question two is what if this master is running Windows 98 with
MySQL-win for example? Is that possible to make also in windows?

I will try to post this also to mysql list

--
Best regards,
 Martinmailto:corwin@;corwin.sk

Tuesday, October 29, 2002, 10:05:00 AM, you wrote:

PL> Hi

PL> Replication works continuously when the two databases are in contact
with
PL> each other, unless you specify otherwise. Likewise, if you connect
PL> periodically, MySql will synchronise the two databases itself.

PL> With replication, MySql logs everything the master does. When a slave
logs
PL> in (you can have any number of slaves) it checks the master logs to see
how
PL> up to date it is, and 'catches up' with the master.

PL> Once it is set up correctly you don't need to do anything yourself.

PL> HTH

PL> Peter

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


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



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




  1   2   >