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

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

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

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


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



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

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

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

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

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

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


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



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

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

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

Ben

On Wed, 2003-10-08 at 15:59, mike karthauser wrote:
> on 8/10/03 3:04 pm, Ben Edwards at [EMAIL PROTECTED] wrote:
> 
> > Any help would be greatly appreciated, as you can imagine this is
> > causing a lot of problems.
> 
> Hi ben,
> What version of php are you running? I notice you are using globals. Its
> likely that globals have been turned off on your server.
-- 
********
* Ben Edwards   Tel +44 (0)1179 553 551  ICQ 42000477  *
* Homepage - nothing of interest here   http://gurtlush.org.uk *
* Webhosting for the masses http://www.serverone.co.uk *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Fun corporate graphics http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *


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



[PHP-DB] mysql_error() returning nothing

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

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

Are they any other ways of getting the error?

Ben

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

  function error_db( $sql, $db ) {

  global $SERVER_NAME, $SCRIPT_NAME;

  table_top( "Database Error" );

  table_middle();

  $sqlerr = mysql_error( $db );

  echo "SQL::$sqlError:$sqlerr";

  table_bottom();

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

  // Send error via email

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

  $subj = "CritDist App error from $SERVER_NAME";

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

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

  die();
  }


-- 

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


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



[PHP-DB] mysql_error problem

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

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

Ben

  function error_db( $sql, $db ) {

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

table_middle();

$sqlerr = mysql_error( $db );

echo "SQL::$sqlError:$sqlerr";

table_bottom();

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

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

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

die();
  }

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

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

RE: [PHP-DB] MySQL or Postgres

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

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

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

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

this one is better:

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



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

Beb

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

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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003
************
* Ben Edwards  +44 (0)117 968 2602 *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Smashing the Corporate image   http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8 *


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

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

[PHP-DB] MySQL or Postgres

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

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

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

Proples general experiences/comments also welcome.

Beb


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


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

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

Re: [PHP-DB] Add Record to DB and Return Auto_Increment ID?

2001-10-21 Thread Ben Edwards

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

$key = mysql_insert_id();

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

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

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

Ben

At 07:15 P 21/10/01, Brett Conrad wrote:
>Hi.
>
>I'm creating a class mapped to the functions of a guestbook.  Each guestbook
>submission becomes an entry in a db table.  I am using the DB Pear class.
>
>I'm new to PHP and my question is this:
>
>What is the best way to create a method that adds a new guestbook entry and
>returns its auto_increment id.  I could use an "Insert" statement and then a
>"Select" statement to find out what id was added for the record, but that
>seems a little inefficient.  Any ideas?
>
>Thanks for any help.  Much appreciated,
>
>Brett
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

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


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: fulltext not for me/alternatives

2001-10-21 Thread Ben Edwards


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

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

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

Ben



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


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: fulltext not for me/alternatives

2001-10-21 Thread Ben Edwards


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

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

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

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

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



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


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] fulltext not for me/alternatives

2001-10-21 Thread Ben Edwards

I have a bit of a problem with using freetext indexes because there are a 
LOT of important 3 letter words in my database and as I am using shared 
hosting so do not have the option to recompile MySql.  Can't quite figure 
why 3 is not the default (car, dog, cat war, man, bed, ).  Maybe so you 
would have to recompile to be able to find s_e_x ;).

The other thing I cant figure out is how much data you need for it to 
actually work well.  There is a reference in the manual saying it works 
better on bigger data sets but no indication as to what it means by big.

Anyway, this means I am looking for an alternative which can be implemented 
on php4.  Has anyone any suggestions?

Ben

3.23.41-log

Also in the manual it mentions freetext search

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


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]