[PHP-DB] Job : Looking for a php / mysql programmer in or near Birmingham uk.

2007-10-23 Thread peter lovatt
Hi

I am a looking for a php / mysql programmer in, or within reach, of
Birmingham UK

I
have a variety of work including some very interesting and challenging
projects.

You can work here or from home, or a bit of both.

If you are interested email me [EMAIL PROTECTED] or call 0121 242 1473

I would consider a freelancer or full time employee, rates -
generous for the right person.

Peter


Re: [PHP-DB] Remote DB Connection: Pros and Cons?

2007-10-11 Thread peter lovatt
Hi

You would be better off with the database server and php on the same server
- both sites.

You will find there is significant lag if there is a poor
connection between the web and database server, but if you are just
accessing web pages
and updating data, even with large pages there is not much delay.

You could always try both permutations and see, but that has been my
experience.

Peter



On 12/10/2007, Chris [EMAIL PROTECTED] wrote:

 Tony Grimes wrote:
  Have any of you tried running a PHP website using a remote database
  connection?
 
  We currently have an in-house PHP website driven by a PostgreSQL
 database
  that is HEAVILY administered within the office with an administration
 sister
  site (also PHP).
 
  Problem: the office connection is having trouble keeping up with the
 website
  traffic. Our IT guys want to outsource the whole server to a co-location
  facility, but the administrators don't want the extra lag on the admin
 site.
 
  Is it feasible to host the database and admin site in the office, but
  outsource the website and connect to the office database remotely? Is
 there
  any other way to do this?

 Do the website and admin area reference the same database tables?

 If they don't, split the database up and keep the website db on the
 website server and the other internally.

 If they do, which one is the 'primary' set? ie which one gets updated?

 You could use replication to keep them in sync (http://www.slony.info/
 for example).

 --
 Postgresql  php tutorials
 http://www.designmagick.com/

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




[PHP-DB] spell checking and did you mean?

2006-03-23 Thread peter lovatt
Hi All

I am looking to check whether a keyword a user has entered already
exists in the database

I can find exact matches, but I am having trouble with typos.

I am looking for something like Google's did you mean if you type in
a close match.

SO if someone types in saet it returns did you mean  seat ?

Any suggestions which is best - SOUNDEX in MySql or  the php functions
 levenshtein(), soundex(),metaphone() or similar_text() on the
returned result.

Any other suggestions welcome.

Thanks

Peter

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

 ?php
 //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 ? phpinfo(); ? 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] 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] 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] 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 its 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] 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] 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 ' tdinput type=checkbox name=user[' . $j . ']
value=1/td' . \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


 form action=performaction.php method=post
 table
 ?php
 for ($j=0; $j$numRows; $j++) {
  echo 'tr' . \n;
  echo '   tdinput type=checkbox name=user' . $j . '
 value=1/td' . \n;
  echo '   td' . $dbid[$j] . '/td' . \n;
  echo '   td' . $firstName[$j] . '/td' . \n;
  echo '   td' . $lastName[$j] . '/td' . \n;
  echo '   td' . $uid[$j] . '/td' . \n;
  echo '   td' . $username[$j] . '/td' . \n;
  echo '   td' . $classification[$j] . '/td' . \n;
  echo '   /tr' . \n;
 }
 ?
 /table

 input type=submit name=removeuser value=Remove User /
 input type=submit name=modifyclass value=Modify Classification /
 input type=hidden name=beenSubmitted value=1 /
 /form


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

body onload=myform.my_text_box.focus()

form action=somescript.php method=post name=myform id=myform

input  type=text name=my_text_box id=my_text_boxvalue= size=30

/form

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

?php
// open the connection
$conn = mysql_connect(localhost, , );

// pick the database to use
mysql_select_db(testDB,$conn);

// create the SQL statement
$sql = INSERT INTO testtable values ('{$_POST[testField]}','
{$_POST[testFielda]}','{$_POST[testFieldb]}','{$_POST[testFieldd]}','
{$_POST[testFieldc]}','{$_POST[testFielde]}');



// execute the SQL statement
if (mysql_query($sql, $conn)) {
echo record added!;
} else {
echo something went wrong;
}
?

-
Asif

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


SCRIPT language=JavaScript
!--

var screensize = screen.width;

if (screensize = 640){
  window.location = 'index.php?screensize=640x480' ;
}

else if (screensize = 800){
  window.location = 'index.php?screensize=800x600' ;
}

else {
  window.location = 'index.php ;
}


// --
/SCRIPT

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

?php
$fname=$_POST['first'];
if (!(is_null($fname))) {
 if (!($odbccon = odbc_connect(**, **, **))) {
die(pCould not Connect./p);
 }
 else {
  echopConnected to Database./p;
  $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 pConnection Closed./p;
 }
}
else {
 ?
 form action=?php echo $_SERVER['PHP_SELF'] ? method=post
name=test
  First Name: input type=text name=first /br /
  input type=submit name=submit /
 /form
 ?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 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] 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] 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] 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] using code for multiple sites

2003-11-13 Thread Peter Lovatt
Hi

I do exactly this on servers running several hundred sites.

each site has a single file in the root, with any local config and a
variable $inc_root set.
eg
?php
$config_var1 = 'xyz';
$config_var2 = 'xyz';
$inc_root = '/home/sites/shared_stuff/';
//must be an absulute not relative address
?

all files are then referenced as

include($inc_root.'directory/sub_directory/file_i_want.php')

If you move things a lot you could link each site to a single file which
sets the $inc_root, so you only change one file.


HTH

Peter




-Original Message-
From: mike [mailto:[EMAIL PROTECTED]
Sent: 13 November 2003 14:42
To: [EMAIL PROTECTED]
Subject: [PHP-DB] using code for multiple sites


I currently manage several websites that share the same code.
This code is included into many of the pages on every site.
I have duplicate copies of the code set up in each virtual host
directory.
Obviously this wastes space on my server and wastes my time having to
update them all.

I was looking for suggestions on the best way to be able to access these
php files through includes for each site.
A couple of the options that I have already looked into were-
I could put the code all into one directory for site A
and when I want to include these files I would have to include the full
path to the files
I really don't want to have to do this because I frequently move things
and I would have to change the path on each file.

either put these files into .:/usr/local/lib/php

or
create a directory called inc in /usr/local/apache
and then add the following line to php.ini
include_path = .:/usr/local/apache/inc 

I hope I made it clear what I want to accomplish.
If you could give your recommendations I would greatly appreciate it.

Thanks in advance,




Mike




Mike Calvelage

Webmaster / Sales Associate

Viper Systems

_.·´¯`·.¸¸-vipersystems.biz http://www.vipersystems.biz/ -¸¸.·´¯`·._

[EMAIL PROTECTED]

419-224-8344



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



RE: [PHP-DB] Dynamic sites, to appear static...?

2003-09-04 Thread Peter Lovatt
Hi

I think search engines follow dynamic links so long as they are there to
see.

http://www.google.com/search?q=sm_red+compsolbtnG=Google+Searchhl=enlr=i
e=UTF-8oe=utf-8

for an example of one of mine.

There was also an article on sitepoint about apache having aa address where
it is of the form site.com/somefile/dynamicStuffHere

where anything after somefile is dynamic parametrs. cant remember much
more, sorry... any Apche experts out there?

Peter


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: 04 September 2003 11:18
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Dynamic sites, to appear static...?


I've been building web sites that use a database backend for some time
now.
I typically use the format.
http://www.mysite.com/index.php?page=contact
http://www.mysite.com/index.php?page=home
http://www.mysite.com/index.php?page=aboutus
etc

My most recent job wants to use differnt pages, so the search engines will
pick up the url's as clearly defined, and not dynamic, as I normally do...

They way id do things is great (normally) as it allows the Admin person to
add as many pages as they like, without having to pay me to create it for
them.
But now if my most recent client wants to create a new page, I'll have to
do it for them...

Is there a way I can still admin the pages, and allow my client to
add/delete pages, but use static links , without '?page=home' etc...

I hope I've made sence...
I've discused this with my client, and he said a friend of his claimed
'that webserver software should have a module or plugin that will do this'
I've never heard of that, have I been living under a rock?

*
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] Browser-Trouble with Query

2003-09-03 Thread Peter Lovatt
Hi

Can we see the code + a few lines either side?

Peter

-Original Message-
From: Sebastian Haag [mailto:[EMAIL PROTECTED]
Sent: 03 September 2003 21:12
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Browser-Trouble with Query


Hi everyone,

I have trouble with a PHP-script querying a MySQL-database. Actually my
Opera-Browser has trouble (version 7.11 on a Win2000 machine). It outputs
a parse error when i enter that page.

  Parse error: parse error in /var/www/mypage.php on line 156

After checking all parenthesis over and over, I decided to enter that page
with the InternetExplorer (version 5.50). And it worked.

What gives me a headache is that I tried commenting out that specific part
of the script. Still parse error on the same line. I inserted a bunch of
empty lines around line # 156 and I still got the same error at the same
line.

I don't have any more ideas. I hope you may have a hint.

Thank you very much. I appreciate your help!

Greetings, Sebastian

P.S. PHP version 4.1.2


-- 

Once a problem is defined - it is half way solved. (Henry Ford)

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

2003-08-19 Thread Peter Lovatt
Hi

I have had 40+ virused emails to the address I use for this list. Possible
they came from another source but this is the most likely.

Please check your virus scanners are up to date - 2 day old Norton virus
definitions did not pick it up.

Thanks

Peter



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



RE: [PHP-DB] mysql connect error

2003-08-14 Thread Peter Lovatt
Hi

Check the database name is exactly the same case as you are using - not
Soverign rather soverign for example.

After that try the raw php functions for connecting to the database


?php
//require_once 'DB.php';
$user = 'jbyrne';
$pass = '';
$host = 'localhost';
$db_name = 'sovereign';

if($dsn = mysql_connect($host,$user,$pass)) echo 'connected ok' ;
else echo 'Failed to connect to database'.mysql_error( $dsn) ;

if(mysql_select_db($db_name, $dsn )) echo 'selected db ok';
else echo 'Failed to select to database'.mysql_error( $dsn) ;


?

This will give the Mysql error messages which should give you more
information

HTH, if not comeback to me

Peter








-Original Message-
From: John Byrne [mailto:[EMAIL PROTECTED]
Sent: 12 August 2003 08:06
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql connect error


Hi,

I've just started playing with Linux/MySQL/PHP - I come from a
Windows/ASP/PowerBuilder background.

I have created a database in MySQL and now are trying to connect to it via
PHP. I keep getting the same error, no matter what I specify in DSN. I
always get:

DB Error: no such database

The following is the PHP code I am using:

?php
require_once 'DB.php';
$user = 'jbyrne';
$pass = '';
$host = 'localhost';
$db_name = 'sovereign';
$dsn = mysql://$user:[EMAIL PROTECTED]/$db_name;
$db = DB::connect($dsn);
if (DB::isError($db)) {
   die ($db-getMessage());
}

$db-disconnect();
?

This is straight out of the PHP documentation.

Any ideas why I get the same error all the time.

I am using RedHat 8.0, PHP 4.2.2, MySQL 3.2.53, Apache 2.0

thanks





--
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] un-encrypting passwords

2003-07-28 Thread Peter Lovatt
mysql has ENCRYPT() which will do the job

Peter

-Original Message-
From: Sam Folk-Williams [mailto:[EMAIL PROTECTED]
Sent: 28 July 2003 21:05
To: [EMAIL PROTECTED]
Subject: [PHP-DB] un-encrypting passwords


Hi,

I've got a PHP/MySQL site that uses a simple user table to check for a valid
username/password match when logging someone in. I encrypted the passwords
using mysql's PASSWORD() function. I now realize that was probably not the
best choice, because I don't think it's possible to un-encrypt them. I want
to add a feature that allows users to request to have their password emailed
to them.

Can anyone recommend a better method for encypting passwords and how to
unencrypt? (is there a function in PHP for this? Or a different MySQL
function?)

Thanks,

Sam

--
Sam Folk-Williams
Service Team Leader/Webmaster
Rise, Inc -- Creative Partnerships South
(952) 884 8330 (V);  (952) 884 8371 (F)
www.rise.org



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

2003-07-27 Thread Peter Lovatt
Hi

welcome to php :)

in general you can use an include at the beginning of each page

?php
include('database_conn.php' ) ;

$query = 'select * from table'
$result = ($query, $link)



?



-Original Message-
From: Morten Twellmann [mailto:[EMAIL PROTECTED]
Sent: 27 July 2003 13:01
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL Session


I have just recently entered the world of PHP and MySQL. I'm used to code in
ASP with Access databases and since I am not very familiar with PHP, I have
run into a problem, which is probably quite easy to solve:

Connecting to the database requires a couple lines of code, which I would
rather not have to write on every single page, which needs the database
connection.
($link = mysql_connect(host, username, password)
   or die(Could not connect :  . mysql_error());
  mysql_select_db(dbname) or die(Could not select database.);)

In ASP this is easy to solve, since I would just create a global.asa and
on the Application_OnStart procedure, I would create the global database
connection and then reference to that variable on each of the individual
pages.

Now, in PHP I do not seem to be able to create a global.asa or anything
similar. It does not even seem to have an Application object, which I can
refer to on any page.

Can anyone tell me how I can connect to the MySQL database from some kind of
a global page, being activated no matter which page the user starts on and
where I only need to write the different SQL statements in the individual
pages.
(In ASP I could do the following on the individual page:
Set RS = Application(conn).Execute(SELECT * FROM database)

Thank you.

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] write to word..

2003-07-23 Thread Peter Lovatt
Hi

I did it like this
?php
//create file here


//then output it

 header (Content-type: application/msword);
 header (Content-Disposition: attachment;
filename=letter.doc);
 include('letter.htm');

print('done it')
?

I wrote the letter to file and then included it, but you can probably just
print HTML as you would normally. Word will open HTML files and maintain the
format.

HTH

Peter





-Original Message-
From: Chris Mach [mailto:[EMAIL PROTECTED]
Sent: 23 July 2003 03:01
To: [EMAIL PROTECTED]
Subject: [PHP-DB] write to word..


hi,

I'm just wondering if it is possible to write to a word document or any
other file type that would allow for easy editing(besides txt) with out
having to copy and past everything in? I'm looking to have a template
perhaps in word and have the code insert variables from the database.

If it is possible, could some one point me in the right direction. Like
where to look in the manual.

Thanks,
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] Page Use

2003-06-23 Thread Peter Lovatt
use sessions and a database table

enter page name and timestamp it for each page request

Analyse from the timestamp order and the time difference.

Let me know if you want more details

HTH

Peter

-Original Message-
From: Tim Winters [mailto:[EMAIL PROTECTED]
Sent: 23 June 2003 13:06
To: 'PHP-DB'
Subject: [PHP-DB] Page Use


Hello,
 
I'm interested in setting up a system whereby I can track a users
movements through a site.
 
I particularly I am interested in recording both that the user actually
hit the page but also the time he spent on that page.
 
Is this possible using PHP and if so how?
 
Thx
 
 
Tim Winters
Creative Development Manager
Sampling Technologies Incorporated
 
1600 Bedford Highway, Suite 212
Bedford, Nova Scotia
B4A 1E8
www.samplingtechnologies.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Office: 902 450 5500
Cell: 902 430 8498
Fax:: 902 484 7115
 



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



RE: [PHP-DB] Select Statement with output in different colors.

2003-06-17 Thread Peter Lovatt
Try this

$query = 'SELECT * FROM table  
$mysql_result = mysql_query($query, $link);

while($row = mysql_fetch_array($mysql_result)) 
{


 switch ($row[event] )
 {
 case event_one:
$bg = 'blue'
 break;
 case event_one:
$bg = 'red'
 break;
 case event_one:
$bg = 'green'
 break;
 default:
$bg = 'white'

 }
 
 
 print 'tr bgcolor='.$bg.'
 tdda da da nbsp;/td
/tr';
 
 
 }// end while




HTH

Peter



-Original Message-
From: Christopher Lyon [mailto:[EMAIL PROTECTED]
Sent: 17 June 2003 22:35
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select Statement with output in different colors.


I have a php script that does some select statements, on mysql, and
outputs that to a table. I would like to change the color of the table
row depending upon one of the fields. The select statements are from a
syslog database that I have and I would like to highlight key events by
changing the colors for that row. Example would be MAJOR, yellow and
INFO, green. Does anybody have any examples of how to do this?


 

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

2003-03-30 Thread Peter Lovatt
Hi

Try running a grant query

 GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
   ON database_name.*
   TO [EMAIL PROTECTED]
   IDENTIFIED BY 'mypassword';


which will probably fix it

Peter

-Original Message-
From: Sparky Kopetzky [mailto:[EMAIL PROTECTED]
Sent: 30 March 2003 04:12
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySql Help needed


Greetings!

I am building an application in PHP and am creating a global $connect_id for
MySql. I have MySql on a separate machine and am using the connect like
this:

$server = development.myservermachine.net;
$username = myname;
$password = mypassword;
$connect_id = mysql_connect($server, $username, $password);

All I get is 'Access denied for user '[EMAIL PROTECTED]' (Using password:YES)

Now, I know I'm in the DNS server for my system, and the username and
password are correct as I checked the User table.

Any thoughts, ideas, etc. toward fixing this problem??

I'd appreciate any help provided.

Robin Kopetzky
Black Mesa Computer/Internet Services





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



RE: [PHP-DB] Related to WAR - 1

2003-03-29 Thread Peter Lovatt
Hi

There are many aspects to this complex political mess, most of us will have
views on it, and there are plenty of places to discuss it. This is the wrong
place.

I would echo David's comments

Keep it off php lists

Thanks

Peter



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



RE: [PHP-DB] INSERT Question

2003-03-29 Thread Peter Lovatt
Hi

you need to create 5 selects, all named investigator[] with index 1-5 (or
0-4), with the option set to empty for no selection.

this will return an array
investigator[1] = '1064618047'
investigator_yesno[1] = 'Y'

investigator[2] = '1649815377'
investigator_yesno[2] = 'N'

for example


form
table
tr
td
select name=investigator[1]
option value=Choose person/option
option value=1064618047Paul A/option
option value=1655387822Katrina A/option
option value=1649815377David A/option
/select
is a primary investigator?
input name=investigator_yesno[1] value=Y type=radio
checked=checked /Yes
input name=investigator_yesno[1] value=N type=radio /No
/td
/tr
tr
td
select name=investigator[2]
option value=Choose person/option
option value=1064618047Paul A/option
option value=1655387822Katrina A/option
option value=1649815377David A/option
/select
is a primary investigator?
input name=investigator_yesno[2] value=Y type=radio
checked=checked /Yes
input name=investigator_yesno[2] value=N type=radio /No
/td
/tr
...more here 
/table
/form



on the script receiving the data you  then need a for loop to insert the
records, one for each person


for ($i = 1; $i = 4; $i++)
{
//only do it if there is a value for $investigator[$i], ie there is a
selection
if($investigator[$i]) {
$query = 'INSERT INTO tbl_report_people
(record_id
, person_id
, investigator_yesno
)
VALUES
('.$record_id[$i].'
, '.$investigator[$i].'
, '.$investigator_yesno[$i].'
)
';
$mysql_result = mysql_query($query, $mysql_link);

}//end if

}//end for



hope this helps

Peter







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



RE: [PHP-DB] Parse Error

2003-02-26 Thread Peter Lovatt

if ($packages == 1){

if ($airporttransfer == car){
$airporttransfer2 = 12.00};
if ($airporttransfer == bus){
$airporttransfer2 = 10.00};
if ($airporttransfer == none){
$airporttransfer2 = 0.00};

};


() round brackets round the condition {} braces around the 'do it' bit :)

HTH

Peter

-Original Message-
From: Chris Payne [mailto:[EMAIL PROTECTED]
Sent: 27 February 2003 00:43
To: php
Subject: [PHP-DB] Parse Error


Hi there everyone,

I'm trying to run an if statement and inside that have other if's, but it
keeps telling me I have a parse error on the first if in the if statement
(The second if down).  Can anyone see what i'm doing wrong?

if ($packages == 1)(

if ($airporttransfer == car)(
$airporttransfer2 = 12.00);
if ($airporttransfer == bus)(
$airporttransfer2 = 10.00);
if ($airporttransfer == none)(
$airporttransfer2 = 0.00);

);

Thanks for your help :-)

Chris



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



RE: [PHP-DB] processing status page help

2003-02-15 Thread Peter Lovatt
htmlmeta http-equiv=refresh
content=10;URL=http://www.mysite.com/newpage.php;body bgcolor=#ff
please wait.
bodyhtml

should work - the 10 is the delay

Peter


-Original Message-
From: Brendon [mailto:[EMAIL PROTECTED]]
Sent: 15 February 2003 22:14
To: [EMAIL PROTECTED]
Subject: [PHP-DB] processing status page help


Hello,

How can I create a page that notifies the user their request is being
processed after they click a submit button?

For example, they type in some information, the page then says Your
request is processing...

Maybe a few animated ... 's for eyecandy, and then once the process is
completed, they get directed to a desired page.

Regards,
Brendon

--
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] processing status page help

2003-02-15 Thread Peter Lovatt
or perhaps more comprehensively


?php

print('
htmlmeta http-equiv=refresh
content=10;URL=http://www.mysite.com/newpage.php;body bgcolor=#ff
please wait.
bodyhtml
')

//start the processing here

do this;
do that;
do the other ;

?


should work but  I am not absolutly sure - try it and see...
Peter


-Original Message-
From: Brendon [mailto:[EMAIL PROTECTED]]
Sent: 15 February 2003 22:14
To: [EMAIL PROTECTED]
Subject: [PHP-DB] processing status page help


Hello,

How can I create a page that notifies the user their request is being
processed after they click a submit button?

For example, they type in some information, the page then says Your
request is processing...

Maybe a few animated ... 's for eyecandy, and then once the process is
completed, they get directed to a desired page.

Regards,
Brendon

--
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] first 10 or so words

2003-02-13 Thread Peter Lovatt
try SUBSTRING

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

Peter

-Original Message-
From: Bruce Levick [mailto:[EMAIL PROTECTED]]
Sent: 13 February 2003 22:23
To: [EMAIL PROTECTED]
Subject: [PHP-DB] first 10 or so words


Howdy,
I have a SELECT query displaying the results in repeated rows in a
table. I have a COMMENTS column coming out of the database table which
will likely contain a paragraph of information. I would like to display
only the first 10 or so words and then have a more link that people can
click on to display all the info. Is there a simple method for this??
 
Cheers
 



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




RE: [PHP-DB] Cutting strings

2003-01-26 Thread Peter Lovatt

Hi 

from the manual


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


LEFT(str,len)
Returns the leftmost len characters from the string str: 

mysql SELECT LEFT('foobarbar', 5);
- 'fooba'

HTH

Peter



-Original Message-
From: Chezney [mailto:[EMAIL PROTECTED]]
Sent: 26 January 2003 09:08
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Cutting strings


Hi

I have values in my table but for one of the fields I would only like to
display the first 5 chars instead of 15 how is this possiable?



--
Kind Regards,

Chezney




-- 
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-DB - ot browser compatibility

2003-01-23 Thread Peter Lovatt
Hi

I test on NS 4.75 and IE4 as a minimum browser spec.

I test on the following

IE 4, 5, 5.5, 6.0
NS 4.75, 7 (NS 6 has very low distribution and flaky table handling )
Opera 5.0 and 6.0
Mozilla 1.1

Presentation in IE5+ must be perfect. I tolerate minor layout problems in
the other browsers, but nothing serious/fatal in any browser.

I specialise in e-commerce so functionality and usability are more important
than the latest IE6 whizzbangs. Others needs may be different.

Peter




-Original Message-
From: Mignon Hunter [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2003 16:17
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP-DB - ot browser compatability


Hello List,

For those of you who on this list that have to monitor browser
compatibility, could you post your minimum requirements, ie Netscape
4.77 IE (whatever); either in general or specifically.  Realizing
different company's may have different requirements, of course.

I figured others might find this info useful.

Thanks.
--
Mignon Hunter
Web Developer
Toshiba International
713.466.0277 x 3461


--
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] need help spotting this php parse error

2003-01-23 Thread Peter Lovatt
Hi

Probably a missing ;

?
   option value=? echo $row[0]; ?? echo $row[1]; echo
 $row[2]; ?/option
   ?
   } ; - here
   ?
 /select
 /form




-Original Message-
From: Ignatius Reilly [mailto:[EMAIL PROTECTED]]
Sent: 23 January 2003 22:00
To: David Rice; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] need help spotting this php parse error


Dunno.

I also remember once having a parse error, but it was on line 35.

Cheers

Ignatius

- Original Message -
From: David Rice [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 23, 2003 8:53 PM
Subject: [PHP-DB] need help spotting this php parse error


 When i run this script it tells me that I have a parse error on line 34? I
 really can't see it anyhelp (please!) would be much appreciated Cheers,
Dave

 ?

 session_start();

 if(!$HTTP_COOKIE_VARS[username]) {

 /* The Cookie is not set, so load the page as if it is the first time
 */

 include(library/include/header.php);
 include(library/include/database.php);

 /* Include a header file and a database connections/functions file
 */

 ?

 form name=login method=post action=
select name=select

?

$query = SELECT * FROM Staff WHERE ResterauntId = 1;
$result = mysql_query($query) or die( mysql_error () );

While( $row = mysql_fetch_array($result) ) {

?
   option value=? echo $row[0]; ?? echo $row[1]; echo
 $row[2]; ?/option
   ?
   }
   ?
 /select
 /form

 _
 Stay in touch with MSN Messenger http://messenger.msn.co.uk


 --
 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] Users on line

2003-01-03 Thread Peter Lovatt
Hi

My bank uses two processes. If a user is inactive for more than about 5
minutes it forces you to log in again. This is done server side and just
does not allow you to do anything if your last activity was more than 5
minutes ago. It probably also marks the session as logged out.

It also uses JavaScript body onUnload='' to log you out when you close the
window. Not sure if this works when you just close the browser.

I do have a suggestion, which may or may not meet your needs.

When the user logs in, open a popup window  and set focus to the main window
body unload=self.focus()  so the popup becomes a popunder. Using a header
or meta tag refresh the popunder once a minute and log the session as
already discussed, but with a timeout of 2 minutes, so it will be up to
date. This will tell you that the user has a browser open.

This might be enough for your needs

If not you could use body onUnload='' to post a form to the popup window
when the main window closes. This logs out when the user closes the main
window. The only exception will be if the user navigates away from the site.
If you need to, you could prevent this by displaying site content in another
popup window with no navbar and no external links.

http is stateless, so you cannot do a true session like Messenger but the
above is reasonably close :)

HTH

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: Bernain, Fernando G. [mailto:[EMAIL PROTECTED]]
Sent: 03 January 2003 20:31
To: 'Peter Beckman'; Hutchins, Richard
Cc: Bernain, Fernando G.; '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Users on line


I'm thinking in something similar to ICQ or MSN. This is an app for a few
number of users (less than 50) but they need to know who are online when
they are working in the app too!!! Maybe I can use the table online and
insert then name of the user when he login the app... but I still have the
problem of the logout...

I was looking for something (like a function?) in apache or php who tells me
the open sessions at a moment...

Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]




-Original Message-
From: Peter Beckman [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 03, 2003 4:49 PM
To: Hutchins, Richard
Cc: Bernain, Fernando G.; '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Users on line


I agree; it'd be nice if there was some sort of code that'd be executed
when someone closed their browser.  There is the javascript on_exit() or
something where the user, when they leave a domain, is executed.  However,
this only works if they click off the site, not if they close their
browser.  Plus if they go to another site and come back within 5/10/15
minutes, are they still considered logged in?

It's fairly impossible to keep track of when users are or are not using the
site that is not really complex.  What if they are reading an article, run
to the restroom, finish reading the article and then click on another page?
I figure they are idle after 15 minutes.  If they continue to surf the
site in an hour or two, their session will be updated (if your sessions
last long enough, or if not they'll probably be automatically re-logged in
which case they'd be updated/re-inserted in the online table), and will
once again be counted as a person online.

One example is forcing people to be logged out after 10 minutes of
inactivity.  Bank of America does this, most likely using javascript.
However, if yahoo! did this when I was reading my mail and I stepped away,
I'd be annoyed.  Most sites allow you to be logged in forever (Remember
me) so forcing people to log out just to be able to count who is online
seems silly.

If you just want to keep track of how many people are logged in, I'd just
say that logged in is defined as having an active logged in session that
was active in the last 5/10/15 minutes.  I'm almost positive that method is
how most web sites determine time online.

Peter

On Fri, 3 Jan 2003, Hutchins, Richard wrote:

 How would the online table be maintained if a user simply closes out the
 browser without actually logging out properly? I'm not at all experienced
 with sessions, but closing the browser should terminate the session,
 correct? Bernain may want to delete from his online table every hour or so
 to catch those people who have not properly logged out (assuming the
delete
 from online... query is only fired when they click on a log out
button).

 I'm not slagging Peter's recommendation. I was thinking this solution
 through as well, but was a bit stuck when it came to users just closing
 their browsers without logging out.

  -Original Message-
  From: Peter Beckman [mailto:[EMAIL 

RE: [PHP-DB] Users on line

2003-01-03 Thread Peter Lovatt
Hi

Better still :)

I know more now than I did ten minutes ago - Its not nitpicking its useful

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: Matthew Moldvan [mailto:[EMAIL PROTECTED]]
Sent: 03 January 2003 22:24
To: 'Peter Lovatt'; Bernain, Fernando G.; 'Peter Beckman'; Hutchins,
Richard
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Users on line


Don't mean to nitpick, but from what I read onUnload works both when
navigating away and when closing ...

:)

Regards,
Matthew Moldvan

---
 System Administrator
 Trilogy International, Inc
 http://www.trilogyintl.com/ecommerce/
---

-Original Message-
From: Peter Lovatt [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 03, 2003 5:10 PM
To: Bernain, Fernando G.; 'Peter Beckman'; Hutchins, Richard
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Users on line


-- snip --

The only exception will be if the user navigates away from the site.
If you need to, you could prevent this by displaying site content in another
popup window with no navbar and no external links.

http is stateless, so you cannot do a true session like Messenger but the
above is reasonably close :)

HTH

Peter

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





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




RE: [PHP-DB] Special URL Verification String...

2002-12-04 Thread Peter Lovatt
The %7 and similar are used in URL encoding to represent illegal characters
such as spaces and others - these are translated when the user clicks to
open the URL, giving the string you get back. I think

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: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: 04 December 2002 22:07
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] Special URL Verification String...


I am trying to implement an approval system that sends an e-mail to
a user for approval linking them back to a special URL that matches database
entries for a verification string.  The verification string sent via the
e-mail does not match that in the database and I am looking for help in
figuring out why.  Here is what generates the verification string:

$verify_string = $sbcuid;
for ($i = 0 ; $i  14; $i++) {
  $verify_string .= chr(mt_rand(32,126));
}

Here is what this results in inside the database table:

sn4265e~zD|W(XTMxO+

Here is what is sent in the e-mail:

sn4265e%7EzD%7CW%28XTMxO%22%2B

I know that I am doing something wrong here, but what.  Thanks in
advance.


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] Special URL Verification String... PS

2002-12-04 Thread Peter Lovatt
Hi

PS

I would use

$verify_string = md5(uniqid(rand()));

to generate a random identifier of the sort you are looking for

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: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: 04 December 2002 22:07
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] Special URL Verification String...


I am trying to implement an approval system that sends an e-mail to
a user for approval linking them back to a special URL that matches database
entries for a verification string.  The verification string sent via the
e-mail does not match that in the database and I am looking for help in
figuring out why.  Here is what generates the verification string:

$verify_string = $sbcuid;
for ($i = 0 ; $i  14; $i++) {
  $verify_string .= chr(mt_rand(32,126));
}

Here is what this results in inside the database table:

sn4265e~zD|W(XTMxO+

Here is what is sent in the e-mail:

sn4265e%7EzD%7CW%28XTMxO%22%2B

I know that I am doing something wrong here, but what.  Thanks in
advance.


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

2002-11-28 Thread Peter Lovatt
Hi

you need quotes around the values

mysql_query(insert into tblquotehits
(qoption,referer,browser,remoteaddr,dt) values
('$quotetype','$referer','$browser','$remoteaddress','$currentdtstring'),$d
b);

HTH

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: Bill Arbuckle, Jr. [mailto:[EMAIL PROTECTED]]
Sent: 28 November 2002 22:56
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql problem


Hello all!  I am new to php and I am trying to update a mySQL table using
php v4.2.3 for Windows.  I am using the command:

mysql_query(insert into tblquotehits
(qoption,referer,browser,remoteaddr,dt) values
($quotetype,$referer,$browser,$remoteaddress,$currentdtstring),$db);

I have read the documentation and found some notes on the topic but none
seemed to solve my problem.  I have tried other variations of the command
such as inserting a semicolon at the end of the insert statement before the
closing double quotes.  All variables are defined and all columns are
actually columns in the table ... I have checked all of this.  I have also
returned the result to a variable and echoed it to the screen ... the result
printed is Resource id #2.

This is driving me crazy as I know it must be something quite simple that I
am overlooking.  Any help is greatly appreciated!  TIA

Bill


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

2002-11-22 Thread Peter Lovatt
A little more detail

Install MyODBC - you will need it on all machines

In Access

File - Get external data - Link tables -ODBC data sources - MyODBC data
source

You now have a direct link from Access to MySql and can run an Access query
to load the data straight into MySql.

I did this a while ago and can't remember more detail, but I hope this will
point you in the right direction.


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: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: 22 November 2002 14:30
To: Edward Peloke; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] autoupload


 I am currently creating a php/mysql site for a client.  Many of the
 customers who will be using this site also use a vb/access program to
store
 a lot of the same data.  The client asked me last night if we could write
an
 app that would run on the customers machine that would routinely take data
 from the access db on their machine and automatically upload it to our
mysql
 site.  Any ideas on how this can be accomplished?

You'd have to write a little vB or C program to do it, unless you're going
to install PHP on every computer.

---John Holmes...


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



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




RE: [PHP-DB] Fastest, easiest Flatfile DB with PHP

2002-11-18 Thread Peter Lovatt
Hi

If you have a lot of queries then use a database. 

If 'the frequency and number of queries are really
massive so ' is a typo I am still not sure it's worth the hassle

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: Teemu Pentinsaari [mailto:[EMAIL PROTECTED]]
Sent: 18 November 2002 14:16
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Fastest, easiest Flatfile DB with PHP


hi,

Maybe someone here can point me the way ...
I'm looking for a fast and easy to use flatfile database working with PHP.
The amount of stored data, the frequency and number of queries are really
massive so I'm hoping to be able to skip MySql and build this service with
some alternative technique. Anyone ?

thanks

Teemu



-- 
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] Pull Word Docs

2002-11-13 Thread Peter Lovatt
Hi

If the webserver is delivering the doc you need the path relative to the
document, not the server file system.

If the word doc is off the web root I think

a href=get_doc.php?doc=proc1.docProcedure/a

and get_doc.php is

(assuming linux file system)

?php

include ('/ebmnw01/vol1/docs/proc1.doc')

?

If I have understood what you are doing

HTH

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: Steve Dodkins [mailto:Steve.Dodkins;ebm-ziehl.co.uk]
Sent: 13 November 2002 16:53
To: Php-Db (E-mail)
Subject: [PHP-DB] Pull Word Docs


Hi

I'm trying to use the following

echo a href=\.$myrow[parts_proc].\Procedure/a;

where parts_proc contains the document path //ebmnw01/vol1/docs/proc1.doc

In Internet Explorer it pulls the document correctly but in Mozilla it tries
http:\\192.168.10.50\works\//ebmnw01/vol1/docs/proc1.doc is there another
way to represent the document path?

Regards

Steve Dodkins

IMPORTANT NOTICE The information in this e-mail is confidential and should
only be read by those persons to whom it is addressed and is not intended to
be relied upon by any person without subsequent written confirmation of its
contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the
accuracy or completeness of this message as it has been transmitted over a
public network.   Furthermore, the content of this e-mail is the personal
view of the sender and does not represent the advice, views or opinion of
our company. Accordingly, our company disclaim all responsibility and accept
no liability (including in negligence) for the consequences of any person
acting, or refraining from acting, on such information prior to the receipt
by those persons of subsequent written confirmation. In particular (but not
by way of limitation) our company disclaims all responsibility and accepts
no liability for any e-mails which are defamatory, offensive, racist or in
any other way are in breach of any third party's rights, including breach of
confidence, privacy or other rights. If you have received this e-mail
message in error, please notify me immediately by telephone. Please also
destroy and delete the message from your computer. Any form of reproduction,
dissemination, copying, disclosure, modification, distribution and/or
publication of this e-mail message is strictly prohibited.  If you have
received this E-mail in error, or suspect that the message may have been
intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245
468555.
ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ




--
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] MySql limits - WAS [PHP-DB] ROugh idea of speed

2002-11-11 Thread Peter Lovatt
Hi

I am interested in the limits of MySql.

I have a site which is growing. The biggest tables are currently about 750K
but this will grow to the 3-10M record mark over the next 6 months. The
databases are well designed and are currently running smoothly on 2x1GHz
PIII and 512MB RAM.

I am planning and specifying hardware for the next phase of growth and had
assumed MySql would handle this size of table comfortably. What are the
problems to look out for?

Is it tables that have heavy write use that are prone to problems or are
read only tables a problem too?

The site has an abstraction layer so moving databases is not out of the
question, but would involve work and expense not currently budgeted for.

I am a moderately skilled DBA and we have the budget for hardware. I don't
anticipate going beyond 10M records and would rather stick with MySql unless
we are heading for big trouble.

Thoughts and advice appreciated


Peter

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



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




[PHP-DB] FW: php J2EE .NET

2002-11-06 Thread Peter Lovatt
Hi

There is an article on sitepoint.com about benchmarking J2EE and  .NET and
some controversy over the result
http://www.sitepoint.com/newsletters/viewissue.php?fid=3id=3issue=52

Does anybody have experience of php/MySql in comparison with either of the
above in terms of efficiency or ultimate performance?

Is anybody interested in putting a php/MySql setup through the same
benchmarks?

Mostly for fun, but might be useful for the 'but Open Source is not up to
Enterprise Applications' augment.

Peter

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





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




RE: [PHP-DB] Connecting to DB on separate server?

2002-11-04 Thread Peter Lovatt
Hi

You need to pinpoint where the break in communication is.

Does php connect ok to a database on the local machine?
no - php or local MySql config problem?
yes - can you ping the database server from the php server?
   no - network problem
   yes -MySql problem
-is MySql running
   no - start it :)
   yes - have you run a GRANT statement that allows access to the
database from the php server?

If none of the above gives any answers contact me offlist and I will run
through some diagnostics with you

HTH

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: Cassy M Rowe [mailto:cassy;cassyrowe.com]
Sent: 04 November 2002 04:27
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Connecting to DB on separate server?


I have a php page on server #1 trying to access a database on server 
#2.  What do I put in the following blanks:

$hostname: ___ (have tried IP, http, localhost, nothing works)
$username: blah
$password: blah
$database: _

$link=mysql_connect($hostname, $user, $pass) or die(Failure to 
communicate with database);

$close=mysql_select_db($database, $link);



All I get is the Failure to communicate.  message.

Server #1: ellerweb.eller.arizona.edu
Server #2: datamonster.sbs.arizona.edu
$database is cassy, but do I need to add anything to that?

I've tried asking two people who are really good at this and they have 
no answers.

THANK YOU IN ADVANCE!

Cassy Rowe


-- 
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] Connecting to DB on separate server?

2002-11-04 Thread Peter Lovatt
Also the following might give a more useful error message


$link=mysql_connect($hostname, $user, $pass)
echo mysql_errno() . :  . mysql_error(). \n;

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: Cassy M Rowe [mailto:cassy;cassyrowe.com]
Sent: 04 November 2002 04:27
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Connecting to DB on separate server?


I have a php page on server #1 trying to access a database on server 
#2.  What do I put in the following blanks:

$hostname: ___ (have tried IP, http, localhost, nothing works)
$username: blah
$password: blah
$database: _

$link=mysql_connect($hostname, $user, $pass) or die(Failure to 
communicate with database);

$close=mysql_select_db($database, $link);



All I get is the Failure to communicate.  message.

Server #1: ellerweb.eller.arizona.edu
Server #2: datamonster.sbs.arizona.edu
$database is cassy, but do I need to add anything to that?

I've tried asking two people who are really good at this and they have 
no answers.

THANK YOU IN ADVANCE!

Cassy Rowe


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




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] 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] 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:
form method=get action=var.php
  input type=text name=var size=20 value=test
  input type=submit value=Submit
/form

and have the var.php like this:
?php
print($var);
phpinfo();
?

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

2002-09-21 Thread Peter Lovatt

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

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

just a thought

Peter

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

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


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

---John Holmes...

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


 John,

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

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

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

 No again, just using the browser in Linux.

 John Holmes...


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

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

 Netscape gave the same result.

 Thanks,
 Warren

 
 Regards
 Conni












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

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



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


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



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



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




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

?php

require(../common/main_page_generator.php);

//Create an instance of the class
$colecciones = new Page();

$content = tr
td bgcolor=\#00\ class=\font-
small\a href=\index.php\nbsp;nbsp;Página principal/a/td
/tr
tr
td
table width=\100%\ border=\0\
cellpadding=\0\ cellspacing=\0\
tr
td align=\center\
background=\../images/layout/background_left_column.gif\br;

//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./td/tr/table/td/tr;

} else


for ($i=0; $i  $num_results; $i++)
{
if ($i==$num_results/2){
$content .= /td
td
img
src=\../images/colecciones/central_image.gif\ width=\250\ height=\2\
/td
td align=\center\
background=\../images/layout/background_right_column.gif\
br;
}
$row = mysql_fetch_array($result);
$content .= a href=.$PHP_SELF.?code=.$row
[cat_code]..htmlspecialchars(stripslashes($row
[cat_name]))./abrbr;
}

$content .= /td/tr/table/td/tr;
}

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


*

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 'br'.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] 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




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] 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 (tr align=center valign=top\n);

print (td align=left valign=topselect name=itemchoiceoptionChoose
Item/o
ption\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 (option
value=$itemarray[description]$itemarray[description]/option\n);
}

print (/select\n);

print (/td\n);


Some example items from which they choose areapple 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] 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




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

?php
#
#   #
#SunMaia.net RED#
#   e-development at the speed of thought   #
#   #
#   #
#This module copyright SunMaia.net 1999-2002#
# author Peter Lovatt [EMAIL PROTECTED]   #
#   #
#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

META HTTP-EQUIV=expires CONTENT=0
META HTTP-EQUIV=Pragma CONTENT=no-cache

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




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




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] 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 mailto:[EMAIL PROTECTED]
  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] 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 “a
 href=\manageusers.php?mode=deleteuserdeletename=$row[name]\DELETE
 USER/a”;
 [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]
 FORM ACTION=manageusers.php?mode=adduser METHOD=POST
 PTABLE BORDER=0 CELLSPACING=0 CELLPADDING=5 WIDTH=100%
TR
   TD
  PINPUT TYPE=text NAME=newuser VALUE=USER
 SIZE=20 MAXLENGTH=10/P
   /TD
  TD
  PINPUT TYPE=text NAME=newpass VALUE=PASSWORD
 SIZE=20 MAXLENGTH=30/P
   /TD
   TD
  PINPUT TYPE=submit NAME=Submit VALUE=ADD
 ADMIN/P
   /TD
/TR
 /TABLE

  /FORM
 [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 mailto:[EMAIL PROTECTED]  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] Fames Included?

2002-05-25 Thread Peter Lovatt

Hi

just use a frameset with php pages in

FRAMESET ROWS=210,* FRAMESPACING=0 FRAMEBORDER=0 border=0
   FRAME SRC=top.php3 NORESIZE=NORESIZE NAME=top scrolling=no
FRAMESET COLS=130,* FRAMESPACING=0 FRAMEBORDER=0 BORDER=0
   FRAME SRC=left.php3 NORESIZE=NORESIZE NAME=s_main 
   FRAME SRC=main.php3  NORESIZE=NORESIZE NAME=order
/FRAMESET
NOFRAMES

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




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




[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




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




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

META HTTP-EQUIV=expires CONTENT=0
META HTTP-EQUIV=Pragma CONTENT=no-cache

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

form action=script.php name=entryform method=post

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




  1   2   >