Re: [PHP-DB] in-line function?

2003-07-21 Thread Leif K-Brooks
Donny Lee wrote:

  Ohhh.. sorry for that. it's quite simple, i'm wondering if
  we can have something like those in-line functions in C++:

  class someCLASS {
  var $varLength;
  //  other stuff

  inline function length() {
  return $this-varLength;
  }
  }

  i expect it will make PHP script speed up a bit, coding
  easier, etc... but not sure it will do or not.   :)

What would be the difference (besides putting the word inline in front
of the function)?

-- 
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.



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



Re: [PHP-DB] Auto inc in MySQL

2003-07-09 Thread Leif K-Brooks
Stan Lemon wrote:

Also, I believe in addition to AUTO_INCREMENT it has to be UNIQUE as 
well.  Please correct me if I am wrong.
No, just INDEX.  UNIQUE will work fine, but I reccomend making it PRIMARY.

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] hmmm

2003-07-04 Thread Leif K-Brooks
Becoming Digital wrote:

We have found the only case when banning someone from the list for foul language
would be completely undesirable.
 

Making it so he really can't unsubscribe, on the other hand, would be 
very desirable.  Are you listening, admins? :-)

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] Altering a column in an existing table

2003-06-27 Thread Leif K-Brooks
Rick Dahl wrote:

I have a column (ID) that is currently not auto_incremental.  I need to change it so that it is auto_incremental.  There are already records in this column.  also, I need to change the field type from int(4) to int(8).

Rick

 

1) This has nothing to do with PHP.
2) This will most likely require an ALTER query.
3) Read your DB's manual.
--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] T_String?

2003-06-10 Thread Leif K-Brooks
The little detail is the lack of quotes around your query.

Jorge L. wrote:

I am getting the following error:
Parse error: parse error, unexpected T_STRING in C:\Program 
Files\Apache Group\Apache2\htdocs\view.php on line 4

On line:
$result = mysql_query(select * from guestbook) or die (mysql_error());
And I have no idea where the T_STRING is coming from. I know this is 
probably some little detail that I am over looking, but I would 
appreciate any help.

_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] strip

2003-06-04 Thread Leif K-Brooks
Don't.  addslashes() instead.

Chris Mach wrote:

does anyone know how to strip a ' from a string? It's causing errors for my
sql statements


 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] query string

2003-06-02 Thread Leif K-Brooks
To answer your question, you should urlencode() the team name.  However, 
I would store the user in a cookie or session, and fetch the team name 
on each page load.  Otherwise, they can easily change which team they're 
using.

Ian Fingold wrote:

Sorry I don't think I explained very well... heres my situation...

I have a mysql database set up... I have a user table with 2
fields...team_name and fant_week.
What I want to do is, depending on who is logged in, I want my link to
change the value of 'team' to the logged in members team name, like wise for
the week.
For example..
if gorno is logged in and his team is called fun team the link will
reflect his team and look like this...
fant_stnd3.php?week=1team=fun team
or if say... billbo is logged in and his team is called silly team the
link will look like this
fant_stnd3.php?week=1team=silly team
but again, my problem is that it's cutting off the team value when there is
a space in the string..


G|rhan Vzen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 

On Sun, 2003-06-01 at 22:26, Ian Fingold wrote:
   

I'm trying to build a query string for one of my links.. for example...
fant_stnd3.php?week=1team=fun%20team
I need to be able to grab the values of 'week' and 'team' from an array,
 

I
 

can do that no problem, but when the code runs it cuts off the value if
there is a space in the string. so instead of putting fun team in the
query string it cuts it off and just puts.. fun 
So my question, is there a function or any way to prevent this from
happening?
thanks.
 

  Hi Ian,
I have no idea what you are trying to do.. Well if you are getting
those values from a URL, $week and $team variables in your php script
should have the values in them.. In later versions of PHP, they will be
_POST['week'] and _POST['team'] or _GET['week'] or _GET['team']
depending on which method is used.. You don't need to parse the URL and
run them through an array.. :)
 Gurhan
   



 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] HELP HELP HELP SELECT not work

2003-04-05 Thread Leif K-Brooks
My psychic powers are a bit out of tune, but I think the problem is on 
line 35 of your code.

[EMAIL PROTECTED] wrote:

My PHP scripts don't execute the SELECT queries after execute the first.

My web execute PHP scripts for work with MYSQL, all on Apache webserver.

PHP version: 4.1.2

MySQL version: 3.22.32

The queries executed directly in MYSQL works.

Where is the problem?

These scripts run well for more times before this problem.

Antonio Gabrielli


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] Can't Insert more than 1 record

2003-04-03 Thread Leif K-Brooks
I haven't used my psychic powers for a while, but I think the problem is 
on line 35.

Keven Jones wrote:

Hello All,

I am having a problem inserting records
into my Database.  I am passing fields
from a FORM to my php program that adds
1 record to my DB. It will create the
first attempt just fine, however any
attempt after the 1st fails. I have
to delete the existing row in order
to add a new record.
Anyone know what I am doing incorrectl?

KJ





_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] Sharing variable values among PHP files

2003-04-01 Thread Leif K-Brooks
Please, please, PLEASE don't give advice!  If you don't know the answer, 
DON'T COMMENT!  The method you posted is for register_gkobals on, which 
it won'tr always (and shouldn't be)!

Ronan Chilvers wrote:

Coments inline...

snip
On 01 Apr,2003 at 10:04 Mustafa Ocak wrote:
 

You can store the value in a session variable 

session_start();
if (isset($_HTTP_SESSION_VARS['your_variable_name'])) {
   

/snip

Rather than using isset() you may need to use session_is_registered().  This is specifically for checking the existence of a session variable.  I would do something like

?php

// need this on all pages where you want to work with 
// the session var
session_start();

// Check for the existence of the session var and create
// it if it doesn't exist
if (!session_is_registered(ses_username)) {
session_register(ses_username);
}
// Are we getting a form var thru ?  if so pop it into the session var
if (isset($frm_username)) {
$ses_username = $frm_username;
}
// then in your scripts you can do
do_my_amazing_function($ses_username);
?

As long as you have session_start() at the beginning of each script, $ses_username is now available across scripts.

snip
 

$value=$_HTTP_SESSION_VARS['your_variable_name']; //get the value
}else{
$_HTTP_SESSION_VARS['your_variable_name']=new value;
}
   

/snip

Hope that helps.

 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.



Re: [PHP-DB] Sharing variable values among PHP files

2003-04-01 Thread Leif K-Brooks
The method posted, using isset().

Leston Drake wrote:

For us novices, can you please share how you would do this with 
register_globals off?

At 01:07 AM 4/1/2003, you wrote:

The method you posted is for register_gkobals on, which it won'tr 
always (and shouldn't be)!

Ronan Chilvers wrote:

Coments inline...

snip
On 01 Apr,2003 at 10:04 Mustafa Ocak wrote:


You can store the value in a session variable
session_start();
if (isset($_HTTP_SESSION_VARS['your_variable_name'])) {
/snip

Rather than using isset() you may need to use 
session_is_registered().  This is specifically for checking the 
existence of a session variable.  I would do something like

?php

// need this on all pages where you want to work with // the session 
var
session_start();

// Check for the existence of the session var and create
// it if it doesn't exist
if (!session_is_registered(ses_username)) {
session_register(ses_username);
}
// Are we getting a form var thru ?  if so pop it into the session var
if (isset($frm_username)) {
$ses_username = $frm_username;
}
// then in your scripts you can do
do_my_amazing_function($ses_username);
?

As long as you have session_start() at the beginning of each script, 
$ses_username is now available across scripts.

snip


$value=$_HTTP_SESSION_VARS['your_variable_name']; //get the value
}else{
$_HTTP_SESSION_VARS['your_variable_name']=new value;
}

/snip

Hope that helps.


--
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full 
extent of the law.




--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] Catch Errors

2003-03-30 Thread Leif K-Brooks
www.php.net/mysql-error

shaun wrote:

Hi,

Is it possible to catch the type of error message returned form a
mysql_query(); funtion
for example

if ($error == //duplicate row for table)
{
   echo This row already exists in the table;
}


 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


[PHP-DB] Generating view of tree?

2003-03-26 Thread Leif K-Brooks
I have a table with a tree.  Thing is, I need to generate a view of it like:
Category
   Sub-category
   Sub-sub-category
   Another sub-category
Another category
 Sub-category
Any way to do this, without using a huge number of queries?  Using MySQL.

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


Re: [PHP-DB] Creating MySQL Entry Forms

2003-02-28 Thread Leif K-Brooks
What's wrong with PhpMyAdmin?

Jeremy N.E. Proffitt wrote:

I need to create some simple web forms for entering, changing, deleteing information 
from a fairly simple MySQL database.  This is to be for internal use, so doesn't have 
to be really fancy or have alot of error checking.
 I could make a form for each table myself, but I would think their is an easier way...
Cheers
Jeremy
 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] selecting random rows

2003-02-27 Thread Leif K-Brooks
select * from table order by rand() limit 2

[EMAIL PROTECTED] wrote:

I'm sure this is pretty simple, but I'm having a hard time finding the answer:

How do you select two random rows in a mysql table?

Thanks,
Kent
 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] disable right-click in all frames.

2003-02-22 Thread Leif K-Brooks
1. Not a PHP question.
2. Definitley not a PHP database question.
3. No, I don't think so.
Matt wrote:

hey everyone.  i have a php script that opens up a new window with multiple
frames.  i am using javascript to disable the right-click mouse button on
the frames.  the problem is that on of the frames uses and external source,
which i can't change or modifiy at all.  is there a way for me to disable
the right-click mouse button in that frame?  is there just some way to
disable the right-click in all frames (no matter what the source) on a given
page?  please let me know if you have any ideas.  thanks.
matt



 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] Differences between php3 and php4

2003-02-22 Thread Leif K-Brooks


Y Al Hinai wrote:

include(mydata.txt);

Should be:
include('mydata.txt');
1. Is there any source (book or URL or whatever)  that shows what have been changed between php3 and php4 and what are the new functions or values are? Something like a table or differences in functions.

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

2. How do u get the mail() and include() to work?  
Also, who do u get header() to header() function to work in PHP4??  This is the code i am using for the header() followed by the error message:

There can't be ANY output before a call to header().  That includes 
spaces and new lines before ?php.

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] How to find the autoincremented number?

2003-02-21 Thread Leif K-Brooks
http://www.php.net/manual/en/function.mysql-insert-id.php

David Chamberlin wrote:

Hey,

Most of the tables I use identify things using an id which is 
auto-generated using autoincrement.  However I can't seem to figure 
out a good way to find what value was generated for the ID.

For example, let's say I generate a new entry and want to e-mail out a 
link to it and the link identifies the entry by ID.  Currently, the 
only way I can figure to do this is to first do the INSERT and then do 
a SELECT on some unique information that I just inserted (e.g., 
submitter's ID and last-modified date).  So for example, I would have:

function addNewEntry( $stuffToPutIn ){
  $sql = INSERT INTO myTable $stuffToPutIn;
  // I use pearDB with mysql
  $result = $this-db-query( $sql );
  checkDbResult( $result );
  $sql = SELECT id FROM myTable WHERE .
  (last_modified_by = $userId) AND .
  (last_modified_time = $currentTime);
  $result = $this-db-getAll( $sql );
  checkDbResult( $result );
  $entry = $result[0];

  $linkAddress = $baseEntryURL.'?entryId='.$entry-id;

  mailOutLink( $linkAddress );
}
What I'd really like to do is get rid of that SELECT or at least make 
it less hacky to find out what the id was that got autogenerated.

Any ideas?

Thanks,
Dave

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] Ordering...

2003-02-10 Thread Leif K-Brooks
order by col1 asc col2 desc

nikos wrote:


Hi list!
How can I Order By in MySQL a column asceding and an other column desceding?



Qbit
  - Gatsis Nikos
Web developer
tel.: 2108256721 - 2108256722
fax: 2108256712
email: [EMAIL PROTECTED]
http://www.qbit.gr 

 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




Re: [PHP-DB] heredoc and coding standards

2003-02-03 Thread Leif K-Brooks
I usually do something like this:
function somefunction(){
   //Do whatever
   print
 END
Whatever
text
here
END
   ;
}

Rob Day wrote:


I try to write very clean code. However, there is one thing that always bugs
me - using heredoc syntax in a function. Code in the function really should
be indented (or 4 spaces for PEAR types), but, to quote the documentation,
the closing identifier must begin in the first column of the line. That
means no tabs, right? So is that just the way it is? Do I just need to not
worry about my tabs for heredoc? Is there some way to maintain consistency
without breaking my code?
-Rob

 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




Re: [PHP-DB] form field rejection

2003-02-02 Thread Leif K-Brooks
Try something like this (untested):

$phonenumber = '(123)-123-1234';
$phonenumber = preg_replace('/[^0-9]/','',$phonenumber);
if(!preg_match('/^([0-9]{3})([0-9]{3})([0-9]{4})$/',$phonenumber,$matches){
die('Invalid phone number.');
}
$full_number = $matches[0];
$areacode = $matches[1];
$exchange = $matches[2];
$number = $matches[3]
$banned_exchanges = array('321','654');
if(in_array($exchange,$banned_exchanges)){
die('Bad exchange.');
}

Addison Ellis wrote:


hello,
thank you for your time...
what is the best way for me to have a form field, phone reject 
certain phone prefixes?
for example: someone enters 321-1791 and 321 prefix can not be 
allowed as an entry...
thank you again, addison


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




[PHP-DB] Storing previous versions?

2003-01-26 Thread Leif K-Brooks
I'm planning to use a wiki-style help system for my website.  I've 
considered using existing open-source wiki systems, but it would be too 
much work to get them hooked up with my user system, etc.  Like most 
wikis, previous versions of articles will be stored.  I'm looking for 
ideas as to the best data structure for the previous versions (one table 
for articles, and another for each version of them?).  Also, any ideas 
for having it not take up huge ammounts of disk space?  Storing the 
difference between the next version and the old one, perhaps?

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



[PHP-DB] Getting all rows of a certain column when grouping?

2003-01-18 Thread Leif K-Brooks
I have a table that stores smileys users can use.  I'm trying to make a 
page that lists them in an HTML table something like:

||
| Smiley | Image |
||---|
|:), :-) | IMAGE |
|:(, :-( | IMAGE |
--

I could use a query something like:

select * from smileys group by image

But that would only return one of the possible things the user can type 
to make that smiley.  Is there another way?

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



[PHP-DB] Re: [PHP] Limit to size of autoindex in MySQL/PHPMyAdmin?

2003-01-03 Thread Leif K-Brooks
The limit to tinyint is 255... use int.

Jim MacCormaic wrote:


Hi all. I'm new here, currently implementing my first PHP/MySQL 
website on an iMac running Mac OS X v.10.2.3.

All has been going really well until just now while I was adding 
records to the MySQL database. I have a table which includes an 
auto-incremented field which is set as the Primary key. I was happily 
entering information and then suddenly got a warning of an error in my 
MySQL query, telling me that I had a 'duplicate entry 255 for key 1'.

I've checked the relevant table in PHPMyAdmin and, sure enough, under 
Row Statistic in the Structure option it gives a value of 255 for the 
Next Autoindex even though that value was already assigned in the 
previous record. I feel as if I've hit a brick wall on this one. I ran 
Check Table, Analyze Table and Optimize Table in PHPMyAdmin Operations 
and all reported 'OK'. I'm using a PHP form to insert the records and 
have code included to print out the MySQL query and to report errors 
(hence the warning which I received). The field in question is of type 
tinyint(4), unsigned, not NULL and, as stated, is the Primary key and 
set to auto-increment.

Have I hit some sort of limit by reaching an id of 255? If so, can I 
fix this? Any help would be appreciated, as my database has to all 
intents and purposes lost its functionality once I cannot add further 
records.

Jim MacCormaic
Dublin, Ireland
iChat/AIM : [EMAIL PROTECTED]



--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




Re: [PHP-DB] Mysql Passwprd validation

2003-01-03 Thread Leif K-Brooks
SELECT * from table where 
passwordfield=PASSWORD('$variablewithpassword') and 
username='$usernametocheck' limit 1

Sabina Alejandr Schneider wrote:

Hello to everybody!! I'm writing to know if somebody knows how can I 
validate a password that has been encrypted with the PASSWORD() mysql 
function. Thank you all for your time!!!

Sabina Alejandra Schneider
[EMAIL PROTECTED]






_

Tutopia - Acceso a Internet rápido, fácil y a los mejores precios.
http://www.tutopia.com


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




Re: [PHP-DB] Cannot add header information error

2002-12-26 Thread Leif K-Brooks
You can't add headers after you've outputted anything.  Without seeing 
the class page, I'd guess there's a space after the ?.  Either remove 
that or use output buffering.

Petre NICOARA wrote:

Hi guys
I have this error when I tried to use a sign-up form.
The thing is that I use some classes for database interaction, and I
respond by 
return Values; 
to the functions.
Also, in line 18 in  page.php I have this 
Header(Location: page1.php?string=value);
The Line 363 marks the class end ?

Warning: Cannot add header information - headers already sent by (output
started at classes/member_class.php:363) in F:\Web Applications\My
work\site\page.php on line 18

Could someone explain what is happening, the code is clear.

Thanks



 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




[PHP-DB] Checking if number is in bottom three?

2002-12-23 Thread Leif K-Brooks
I need a way to check if a number is in the bottom three of a column in 
my database.  For example, if I had a list of number in my table like this:
1
5
8
12
60
1
10001
I might need to know if 5 was in the bottom three, which it would be. 
But if I checked 60, it wouldn't be.  I could check the lowest number 
and add 3 to it, but it may have gaps.  Any ideas?

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



Re: [PHP-DB] Checking if number is in bottom three?

2002-12-23 Thread Leif K-Brooks
Thanks, but what I want to do is check if a number is in the first 3, 
not return the first three.  If returning the first three and seeing if 
any of them matches is the only way, I'll do that, but it doesn't seem 
that great for the server.

SELPH,JASON (HP-Richardson,ex1) wrote:

select myfield from table order by myfield DESC limit 3

That will return the last 3 records in your database where the highest
number is the last.  Think of it as sorting by that number in reverse and
only returning the first 3.

Cheers
Jason

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 23, 2002 10:14 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Checking if number is in bottom three?


I need a way to check if a number is in the bottom three of a column in 
my database.  For example, if I had a list of number in my table like this:
1
5
8
12
60
1
10001
I might need to know if 5 was in the bottom three, which it would be. 
But if I checked 60, it wouldn't be.  I could check the lowest number 
and add 3 to it, but it may have gaps.  Any ideas?

 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




Re: [PHP-DB] Set Logout Time for No Activity

2002-12-19 Thread Leif K-Brooks
Log out, meaning what?  Using sessions?  Cookies?

Allens wrote:


Hello,
  Is there a variable in php.ini that will allow you to log someone 
out if there is no activity of 30 minutes or greater from the logged 
in user? Thanks in advance. :)
:)
  Gale L. Allen Jr
  Macintosh Support Specialist
865/947-5740

  Remember, Love wins over all
(:


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




Re: [PHP-DB] Assign a variable with another variables value

2002-12-01 Thread Leif K-Brooks
$foo = BAR;
$varname = new$foo;
$$varname = some string;

Martin Allan Jensen wrote:


Hi folks,

I probably need a little help the next couble of days, but well here is the first question.

How can i assign a variable with the value of another variable ??

Example:
$foo = BAR;

$newBAR = some string;

The BAR is supposed to be taken from the value of $foo.

THANKS A LOT!!!

Regards,
Martin Allan Jensen

 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




[PHP-DB] Making field concat of autoincrement column and other values?

2002-12-01 Thread Leif K-Brooks
I'm trying to make a field in my database table a concat of an 
autoincrement value and some other values.  I'm trying:
insert into table set 
val1='val1',val2='val2',concatfield=concat('whatever',id,'whatever'), 
but it doesn't work.  Is there another way, or will I have to update the 
row directly after inserting?

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



Re: [PHP-DB] Making field concat of autoincrement column and othervalues?

2002-12-01 Thread Leif K-Brooks
I could concat when selecting, but it will be used in the where clause 
(it is neccesary to do it like this, I'm also md5ing it but forgot to 
mention that), and I'm guessing it would be bad for the server to have 
to concat and md5 in the where clause.

John W. Holmes wrote:

I'm trying to make a field in my database table a concat of an
autoincrement value and some other values.  I'm trying:
insert into table set
val1='val1',val2='val2',concatfield=concat('whatever',id,'whatever'),
but it doesn't work.  Is there another way, or will I have to update
   

the
 

row directly after inserting?
   


You'll have to do it after. Id probably doesn't even have a value since
you're just creating the row.

But, why do it this way? Why not add two more columns where you put in
'whatever' and 'whatever', then do the CONCAT when you actually SELECT
out the data. Then nothing is repeated. With your method, what if the ID
ever changes, then you'll have two columns to update. 

---John Holmes...



 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.





Re: [PHP-DB] Making field concat of autoincrement column and othervalues?

2002-12-01 Thread Leif K-Brooks
I'm trying to make a customised session system (I could use PHP's 
built-in one, but I need a lot more control than it offers).  I could 
use the autoincremented id in a cookie, but it would be easy for a 
hacker to change the cookie to gain access to others' data.

John W. Holmes wrote:

I could concat when selecting, but it will be used in the where clause
(it is neccesary to do it like this, I'm also md5ing it but forgot to
mention that), and I'm guessing it would be bad for the server to have
to concat and md5 in the where clause.
   


Yeah, I guess so. This all begs the questions though of why you're doing
all of this in the first place...

---John Holmes... 



 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.





[PHP-DB] Deleting topics older than 2 hours?

2002-11-24 Thread Leif K-Brooks
I'm trying to run a cron job to delete forum topics more than 2 hours 
old.  I know how to do that, but the problem is also deleting the posts 
in the topic at the same time.  Can someone shed some light on this, please?

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



Re: [PHP-DB] Deleting topics older than 2 hours?

2002-11-24 Thread Leif K-Brooks
Sounds to me like you didn't understand the question.  The table 
structure is something like:
topics_
| id | forum | author | subject | posttime |
-

_posts
| id | topic | author | message | posttime|
-

The problem is, if I run a query like (I know the query is probably 
wrong, I'm just writing it now):
delete from topics where posttime + interval 2 hours  now()
I would leave orphan posts inside of that topic.  I'm not sure how (or 
if it's even possible) to delete the posts as the topic is deleted.

DL Neil wrote:

Sorry Leif, but CrystalBall v2.6 is currently unable to help.
The word WHERE features.
Show us the money - or second choice: the (erroneous) code...
=dn


 

I'm trying to run a cron job to delete forum topics more than 2 hours
old.  I know how to do that, but the problem is also deleting the posts
in the topic at the same time.  Can someone shed some light on this,
   

please?
 

--
The above message is encrypted with double rot13 encoding.  Any
   

unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
 


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


   



 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.





[PHP-DB] Really dumb question... deleting everything but newest 100 rows?

2002-11-23 Thread Leif K-Brooks
I know this is a dumb question, but how would I delete everything but 
the first 100 results returned from a query?  I know I'd use limit, but 
my mind's going blank as to the exact syntax.

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



Re: [PHP-DB] Really dumb question... deleting everything but newest100 rows?

2002-11-23 Thread Leif K-Brooks
I was thinking something along those lines, but phpmyadmin gives an 
error.  The table currently has way too many rows (32362), could this 
have to do with it?

Warning: Unable to jump to row 0 on MySQL result index 4 in 
/home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php on line 223

Warning: Cannot add header information - headers already sent by (output 
started at /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php:223) 
in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/libraries/ob.lib.php 
on line 53

Warning: Cannot add header information - headers already sent by (output 
started at /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php:223) 
in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/header.inc.php on line 23

Warning: Cannot add header information - headers already sent by (output 
started at /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php:223) 
in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/header.inc.php on line 24

Warning: Cannot add header information - headers already sent by (output 
started at /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php:223) 
in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/header.inc.php on line 25

Warning: Cannot add header information - headers already sent by (output 
started at /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php:223) 
in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/header.inc.php on line 26

Warning: Cannot add header information - headers already sent by (output 
started at /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php:223) 
in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/header.inc.php on line 27

Warning: Cannot add header information - headers already sent by (output 
started at /home/virtual/site1/fst/var/www/html/PhpMyAdmin/sql.php:223) 
in /home/virtual/site1/fst/var/www/html/PhpMyAdmin/header.inc.php on line 29


 Database mydb running on localhost

Error

SQL-query : 

delete from `mytable` order by col desc limit 100, -1

MySQL said:

You have an error in your SQL syntax near 'order by col desc limit 100, -1' at line 1

Back 
http://www.ecritters.biz/PhpMyAdmin/db_details.php?lang=enserver=1db=chizzy_co_ukshow_query=ysql_query=delete+from+%60topics%60+order+by+id+desc+limit+100%2C+-1

Marco Tabini wrote:

If you have a column that gives you the newness of each row--I'm
assuming a date here:

delete from my_table order by date_inserted desc limit 100, -1


This should work... I recommend a db backup first :-)


Marco


php|architect - The magazine for PHP Professionals
The monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com

On Sat, 2002-11-23 at 17:38, Leif K-Brooks wrote:
 

I know this is a dumb question, but how would I delete everything but 
the first 100 results returned from a query?  I know I'd use limit, but 
my mind's going blank as to the exact syntax.

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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

   




 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.





Re: [PHP-DB] session in php 4.2.3

2002-11-12 Thread Leif K-Brooks
My guess is a register_globals problem, but it's hard to tell without 
seeing your scripts.

dn wrote:

Hi!

I have to support a PHP-Database-solution which someone else
has developed. In addition I'm quite new to php ...

It uses Oracle 8 to display values out of the database.
Everything is running fine with php 4.1.1.
Due to security reasons I wanted to update to php 4.2.3.
I use the same values within both configure-runs:

./configure \
--with-oci8=/oracle/product/8.1.7 \
--with-apxs=/usr/sbin/apxs \
--enable-sigchild \
--with-zlib-dir=shared \
--with-gd=/usr/ \
--with-png-dir=/usr/lib \
--without-mysql

The php-scripts do the following when a user logs in:

   session_register(user,password,db);

I assume that other scripts can use this values when they
query the database. A session-file is created in /tmp/.
As I mentioned above everything runs fine with php 4.1.1.

With php 4.2.3 the login-script is ok! When another script
is called it seems like it is not able to read the sess-file
which exists (!) in /tmp/sess

Could you please give me a hint what I'm doing wrong!

Thanks in advance!

Daniel




--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




[PHP-DB] Pgsql Vs. Mysql

2002-11-11 Thread Leif K-Brooks
Sorry for the off-topic post, but it would be highly annoying to have to 
subscribe to a new mailing list for just one topic.

I'm currently using mysql, but I'm considering switching to pgsql.  I'm
wondering which is better.  Also, how hard would Pgsql be to install?
 Php seems to have pgsql support, but there's currently no pgsql server.

--
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full extent 
of the law.




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



[PHP-DB] Performance for how many columns to update?

2002-11-10 Thread Leif K-Brooks
I'm wondering how significant the performance differences between:
mysql_query(update table set col1='val1' where whatever='whatever');
and
mysql_query(update table set col1='val1',col2='val2',col3='val3'... 
where whatever='whatever');

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



Re: [PHP-DB] Performance for how many columns to update?

2002-11-10 Thread Leif K-Brooks
Yes, I know that one query is more efficient than 3, but I'm trying to 
do a mysql_fetch_array that automatically changes the row at the end of 
the script if it has changed.  I'm trying to decide whether to make it 
only update the changed rows or be lazy and make it update them all if 
only 1 has changed.

Peter Beckman wrote:

Straight from the MySQL Documentation, which is where you should look first
always:

http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Optimisation.html#Update_speed

   5.2.10 Speed of UPDATE Queries

   Update queries are optimised as a SELECT query with the additional
   overhead of a write. The speed of the write is dependent on the size of
   the data that is being updated and the number of indexes that are
   updated. Indexes that are not changed will not be updated.

   Also, another way to get fast updates is to delay updates and then do
   many updates in a row later. Doing many updates in a row is much
   quicker than doing one at a time if you lock the table.

   Note that, with dynamic record format, updating a record to a longer
   total length may split the record. So if you do this often, it is very
   important to OPTIMIZE TABLE sometimes. See section 4.5.1 OPTIMIZE TABLE
   Syntax.

If you aren't doing an update of 50K per row, updating 3 columns instead of
1 will be much quicker (quoted from the manual).  If you are doing 10,000
updates, read more of the manual on the syntax of UPDATE because you can
delay your updates which allows MYSQL to update the table at its leisure
which offers better performance.

Peter, who reminds you to always read the manual (or less kindly RTFM!).


On Sun, 10 Nov 2002, Leif K-Brooks wrote:

 

I'm wondering how significant the performance differences between:
mysql_query(update table set col1='val1' where whatever='whatever');
and
mysql_query(update table set col1='val1',col2='val2',col3='val3'...
where whatever='whatever');

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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

   


---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.





Re: [PHP-DB] Polls?

2002-11-08 Thread Leif K-Brooks
The problem is, I need to make a page that shows all of the polls, and 
one query per poll would kill the server.

Peter Beckman wrote:

Use the dual table questions and answers suggestion before.

Then just use a loop:

$question = mysql_query(select * from questions where id={$this_question});
while ($r = mysql_fetch_array($question)) {
  $answers = mysql_query(select * from answers where qid={$r[id]});
  while ($s = mysql_fetch_array($answers)) {
  print question input and labels;
  }
}

On Fri, 8 Nov 2002, Leif K-Brooks wrote:

 

I'm working on a polling system, and I'm having a bit of a problem.  I'm
not sure how to store the questions.  Storing them in a seperate table
would require a query for each poll displayed - not good.  I've also
thought of storing them as a serialized array.  Any thoughts on this?

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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

   


---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.





[PHP-DB] Polls?

2002-11-07 Thread Leif K-Brooks
I'm working on a polling system, and I'm having a bit of a problem.  I'm 
not sure how to store the questions.  Storing them in a seperate table 
would require a query for each poll displayed - not good.  I've also 
thought of storing them as a serialized array.  Any thoughts on this?

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



Re: [PHP-DB] Polls?

2002-11-07 Thread Leif K-Brooks
Thanks, but my problem is how to efficiently display a page with all of 
the polls with results.  Also, I need a variable number of questions, 
which that tutorial doesn't provide.  Thanks, though.

Ignatius Reilly wrote:

One possibility:

table questions( questionID, question_text, ...) PRIMARY KEY( questionID)

table answers( FK_questionID, individualID, answer_code, ...) PRIMARY KEY(
FK_questionID, individualID)

For very simple online polls, there is a nice tutorial in Devshed:
http://www.devshed.com/Server_Side/PHP/PHPDemocracy

HTH
Ignatius

- Original Message -
From: Leif K-Brooks [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 08, 2002 8:15 AM
Subject: [PHP-DB] Polls?


 

I'm working on a polling system, and I'm having a bit of a problem.  I'm
not sure how to store the questions.  Storing them in a seperate table
would require a query for each poll displayed - not good.  I've also
thought of storing them as a serialized array.  Any thoughts on this?

--
The above message is encrypted with double rot13 encoding.  Any
   

unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
 


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


   



 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.





[PHP-DB] Abstraction layer or not?

2002-11-05 Thread Leif K-Brooks
I'm working on a new site, and I'm wondering whether to use an 
abstraction layer or not.  I don't have any plans to switch DB system, 
but you never know what the future holds.  I figure that there's no 
reason not to, but are there any down sides?  Which abstraction layers 
are good?

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



Re: [PHP-DB] Abstraction layer or not?

2002-11-05 Thread Leif K-Brooks
True, but a DB wrapper can do the error reporting as well.

John W. Holmes wrote:


I'm working on a new site, and I'm wondering whether to use an
abstraction layer or not.  I don't have any plans to switch DB system,
but you never know what the future holds.  I figure that there's no
reason not to, but are there any down sides?  Which abstraction layers
are good?
   


ADOdb is a good one. PEAR also has an abstraction class. Once you get
used to using them, they make things easier over all. I've never
actually switched databases with them, so I don't know how much easier
it makes that. I find them ideal for error catching and reporting.

---John Holmes...



 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.





[PHP-DB] Getting affected rows before executing query?

2002-11-03 Thread Leif K-Brooks
I keep forgetting where clauses.  It's my dumbest mistake, and I always 
make it.  I just lost the password of everyone on my site trying to 
change my own - not good.  Anyway, I'm trying to edit PhpMyAdmin to warn 
if there's more than a certain number of affected rows for a query.  Is 
there a way to tell number of affected rows before executing the query?

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



[PHP-DB] Performance problems?

2002-11-01 Thread Leif K-Brooks
I've been optimizing scripts in an attempt to speed my friend's site up, 
and I believe I've found the source of the performance problems.  When I 
comment the following page load time changes from around 6 seconds to 
less than .5 of a second.

   if($loggedin){
   $events = mysql_query(select * from events where 
whofor='{$userinfo['id']}' order by id desc limit 1);
   if(mysql_num_rows($events) == 1){
   $events = mysql_fetch_array($events);
   print  END
   p align=centera 
href={$basepath}doevent.php?id={$events['id']}{$events['message']}/a/p
   END;
   }
   }

This code checks for events (new mail, etc.) that the user may have and 
dispays them.  Any idea on what makes it perform this badly?
--

The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



Re: [PHP-DB] Re: Performance problems?

2002-11-01 Thread Leif K-Brooks
Aha - thanks.  The problem is, I also need to retrieve other data 
asscociated with it.  I'll alter the table to order by id, but is there 
anything long-term I can do?

Manuel Lemos wrote:

Hello,

On 11/02/2002 03:21 AM, Leif K-Brooks wrote:


I've been optimizing scripts in an attempt to speed my friend's site 
up, and I believe I've found the source of the performance problems.  
When I comment the following page load time changes from around 6 
seconds to less than .5 of a second.

   if($loggedin){
   $events = mysql_query(select * from events where 
whofor='{$userinfo['id']}' order by id desc limit 1);
   if(mysql_num_rows($events) == 1){
   $events = mysql_fetch_array($events);
   print  END
   p align=centera 
href={$basepath}doevent.php?id={$events['id']}{$events['message']}/a/p 

   END;
   }
   }

This code checks for events (new mail, etc.) that the user may have 
and dispays them.  Any idea on what makes it perform this badly?


The order by clause is the killer. It forces the server to rebuild the 
whole table in memory just to returned the results sorted. If you just 
want the highest id, use MAX(id) .



--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




[PHP-DB] Multiple table select, but still returning row if no record existsin second table?

2002-10-30 Thread Leif K-Brooks
I'm using mysql.  Is there any way to do a multiple-table select, but 
still return the results from table 1 if there are no matching rows in 
table 2?  Something like select table1.something,table2.something as 
something2 from table1,table2 where table1.table2id = table2.id will 
only return the data from table1 if a row with the id in table1.table2id 
exists in table2.

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



[PHP-DB] Mysql too many connections?

2002-10-28 Thread Leif K-Brooks
Is there any way to change how many connections mysql allows?  I keep 
getting the too many connections error... (not using pconnect)

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



Re: [PHP-DB] The Ethics and Access of Login

2002-10-28 Thread Leif K-Brooks
That's a HUGE security flaw!  Anyone could send that in a GPC value and 
get unauthorized access!  USE $_SESSION['login'] INSTEAD!!!

Daevid Vincent wrote

Then at the top of each page, just check if they're logged in or not. 
 if( !$login ) { Header(Location: .$LOGINPAGE.\n\n); exit; }
 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




[PHP-DB] Getting rows where column has changed?

2002-10-27 Thread Leif K-Brooks
I'm trying to make a page to help in detecting people using automatic 
refresher programs.  In the table that stores user info, there is a 
column called lastseen which says when the user was last seen.  I'm 
trying to:
1. Select all lastseen colmns that are less than 5 minutes old
2. Wait 2 seconds
3. Select lastseen columns that have changed since step 1, and display 
that info
Any ideas on how to do this?  Is it even possible?  Thanks...

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



[PHP-DB] Adding 1 day to date/datetime/timestamp?

2002-10-23 Thread Leif K-Brooks
I need to add one day to a datetime/date/timestamp field.  How would I 
do this?  (sorry for the n00b-ish question...)  I'm using mysql.

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



[PHP-DB] Accessing data from next row? (mysql)

2002-10-14 Thread Leif K-Brooks

Using mysql, how do I access the data of the next row using code
something like this:
$result = mysql_query(select column from table where whatever='whatever');
while($array = mysql_fetch_array($result)){
//Whatever
}

-- 
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full extent 
of the law.




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




[PHP-DB] Random numbers with range in mysql?

2002-09-28 Thread Leif K-Brooks

I'm trying to make shops that sell virtual objects.  They restock once 
every 15 minutes.  This is all set up.  The problem is, I would like to 
have objects in these shops with a random chance of being restocked.  My 
idea is to store two numbers in the restock list: chance, and outof. 
 (For a 1/5 chance on each restock, those values would be 1 for chance, 
5 for outof).  The problem is, I need a way of generating a random 
number within a certain range.  I thought of going through php and 
mt_rand(), but that would make for a very inefficient script.  Any ideas?


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




[PHP-DB] Caculating minutes since DATETIME column?

2002-09-26 Thread Leif K-Brooks

I need a way to calculate the number of minutes since the value of a 
DATETIME column in mysql.  Any ideas?  Thanks.


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




Re: [PHP-DB] Caculating minutes since DATETIME column?

2002-09-26 Thread Leif K-Brooks

Thanks a lot for your help, but just a not to anuyone else who tries 
this.  Since there's no ()s around

UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(your_column)

, it thinks that you're trying to get:

UNIX_TIMESTAMP(NOW()) - (UNIX_TIMESTAMP(your_column) /60)


Instead of:

(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(your_column)) / 60



John Holmes wrote:

SELECT UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(your_column) / 60 AS
Minutes FROM your_table

---John Holmes...

  

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 12:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Caculating minutes since DATETIME column?

I need a way to calculate the number of minutes since the value of a
DATETIME column in mysql.  Any ideas?  Thanks.


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





  





[PHP-DB] Categorized list?

2002-09-26 Thread Leif K-Brooks

I'm trying to create a system to store virtual objects.  Each object 
will be in a category, and the categories may be in other categories. 
 The categorie list might look something like:
Food
Candy
Healthy Food
Vegeterian food
Organic food
Gross food

I'm thinking of a datbase structure for the categorys something like:
id (int, auto_inc, primary)
name (text)
insideof(int, id of other catrgory which this one is inside of)

The problem is, I need to generate an indented list such as I showed 
before.  I know how to do this with a lot of colors (selecting what each 
category contains, etc.), but is there a more effieient way?  I use 
mysql.  Thanks for any ideas.
   


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




[PHP-DB] Script to control mysql users?

2002-08-29 Thread Leif K-Brooks

I need to add mysql users to some databases, but my dumb control panel 
(ensim) doesn't seem to have a feature to do that, and I'm nothing in 
the mysql database.  Does anyone have a script to let me add them 
automaticly if I supply it with the root password?


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




[PHP-DB] Database abstraction layer needed?

2002-08-17 Thread Leif K-Brooks

I'm redoing my web site, and I'm considering using a db abstraction 
layer.  Would I need one, and should it be db-type specific (like, can 
just do one db type)?  I don't plan to change database types.


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




Re: [PHP-DB] Database abstraction layer needed?

2002-08-17 Thread Leif K-Brooks

My current website is www.ecritters.biz.  I think I need one mostly for 
counting how many queries a page uses, for changing stuff about how 
queries are executed (like doing something with the errors on every 
query), etc.

MET wrote:

What's your current website?  Why do you think you need one?

~MET

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, August 17, 2002 3:28 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Database abstraction layer needed?


I'm redoing my web site, and I'm considering using a db abstraction 
layer.  Would I need one, and should it be db-type specific (like, can 
just do one db type)?  I don't plan to change database types.


  




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




[PHP-DB] Good mysql abstraction layer class?

2002-08-15 Thread Leif K-Brooks

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-DB] Best way to have virtual objects do something?

2002-07-18 Thread Leif K-Brooks

First of all, I'm sorry if the php general list would be a better place 
to do this.  Anyway, I  am making a game website with a friend.  Among 
other things, it will have virtual objects that can be used to do 
things.  My database structure idea is something like:
item_actions(id int,displaycode text,code text)
item_types(id int,actions text,name text)
items(id int,type int,owner int)

The action display code will control how the action text is displayed, 
it's code will be run when it gets used. The actions field in item_types 
will have the ids of what this type of item can do.  The thing is, I 
want to be able to pass  values to the actions so that I won't need to 
add a new action for every small difference.   I have considered using 
funcctions for each action, but I want to store them in the database so 
artists can add items without knowing php.  Any ideas?  Thanks.


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




Re: [PHP-DB] vBulletin board

2002-06-15 Thread Leif K-Brooks

That's illegal.

John StoneCold wrote:

Hi,

Dose any one who has a copy of vBulletin board for sale?

Thanks



  




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




[PHP-DB] Mutiple inserts with one query?

2002-05-31 Thread Leif K-Brooks

Is there a way to insert multiple identical rows in one mysql query? 
 I'm using a looped query right now, which uses more server load than it 
should...  Thanks!


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




[PHP-DB] Multi-table query slower than using array?

2002-05-30 Thread Leif K-Brooks

I have a website where users can adopt virtual pets.  On this page, 
there is a page with some statistics.  One of the statistics listed on 
that page is most popular pet species.  It was taking over 3 seconds to 
load, so I'm trying to optimize it.  I store the pet species in a 
seperate table from pets, an id from the species table is stored in the 
species table.  I used to be putting all of the species in an array by 
looping through the species table, then I would use that array to 
process the id numbers.  In my attempts to optimize, I changed it to a 
multi-table query that looked something like select count(*) as 
cnt,species.name,pets.species from pets,species where 
species.id=pets.species group by pets.species order by cnt desc limit 
1.  Now, the speed of the page loading is up to 10 seconds!  Was the 
array method the better way?


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




[PHP-DB] Searching everything?

2002-05-24 Thread Leif K-Brooks

Is there any way to search *every*thing in my database (using mysql)?  I 
am thinking of a query somethng like select * from * where * LIKE 
'%putsearchhere%'.  This would help a lot when searching for 
inappropriate language.


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




[PHP-DB] Any idea what's wrog with this query?

2002-04-18 Thread Leif K-Brooks

I have a field in one of my tables called when, which is type timestamp.
I'm trying to use some of the date functions to get data from it, but it's
not working.  The return from mysql_error() is not helpful.  Any ideas?
Here's my query:
$query = mysql_query(select month(when) as month,year(when) as
year,dayofmonth(when) as day,hour(when) as hour,minute(when) as
minute,second(when) as second from table) or print Error: .mysql_error(); 

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




Re: [PHP-DB] Any idea what's wrog with this query?

2002-04-18 Thread Leif K-Brooks

It worked, thanks alot!
on 4/18/02 1:43 PM, Paul Edmondson at [EMAIL PROTECTED] wrote:


see http://www.mysql.com/doc/R/e/Reserved_words.html

Your column called 'when' is a reserved word.
Thats my first guess at your problem. I've come across this before with
MySQL accepting column names that are reserved words. Try changing the
column name to something else and try again.


On Thu, 2002-04-18 at 18:34, Leif K-Brooks wrote:
 I have a field in one of my tables called when, which is type timestamp.
 I'm trying to use some of the date functions to get data from it, but it's
 not working.  The return from mysql_error() is not helpful.  Any ideas?
 Here's my query:
 $query = mysql_query(select month(when) as month,year(when) as
 year,dayofmonth(when) as day,hour(when) as hour,minute(when) as
 minute,second(when) as second from table) or print Error: .mysql_error();
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php






[PHP-DB] What is mysql error 28?

2002-04-17 Thread Leif K-Brooks

I have a website which has, among other things, virtual items.  The items
are stored in table items, the different types of items in item_types.  I
use the following query to get a user's items:
SELECT DISTINCT t1.id,t1.itemtype,t2.name FROM items as t1,item_types as t2
WHERE (t1.itemtype = t2.id AND t1.owner = '$theirrealinfo[username]' AND
t1.placein='inventory')


A few minutes ago, items mysteriosly started getting then followowing error
from mysql_error(): Got error 28 in table handler.  Thanks to anyone who
can help!
P.S. They just started working again.  I'm still sending this because I want
to know what was wrong.  Thanks again! 



[PHP-DB] Best way to not display frozen users?

2002-04-11 Thread Leif K-Brooks

I run a gaming website.  Sometimes, I have to freeze users for one thing or
another.  But, since there are lots of tables involving users that get
displayed to other users, they still get seen.  One solution to this seems
to be to have an array of frozen users in the header, which I check when
displaying user-related things.  Is this the best solution, and if it is,
what is the best way to do it?  Thanks!


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




Re: [PHP-DB] Best way to not display frozen users?

2002-04-11 Thread Leif K-Brooks

on 4/11/02 11:14 AM, Leif K-Brooks at [EMAIL PROTECTED] wrote:

I run a gaming website.  Sometimes, I have to freeze users for one thing or
another.  But, since there are lots of tables involving users that get
displayed to other users, they still get seen.  One solution to this seems
to be to have an array of frozen users in the header, which I check when
displaying user-related things.  Is this the best solution, and if it is,
what is the best way to do it?  Thanks!


I forgot to say, I use a myaql database if that helps.




[PHP-DB] Please help me! :(

2002-03-23 Thread Leif K-Brooks

I have a site where things in the database have ids.  When something new is
added, it gets an id one higher than the highest existing id.  I use code
something like this:

$gethighestid = mysql_fetch_array(mysql_query(select id from table order by
id desc limit 1));
$tobeid = $gethighestid[id]+1;
mysql_query(insert into table(id,othercolumn,othercolumn2)
values('$tobeid','something','something'));

The thing is, I just got two rows with duplicate ids.  Aparantley, two
people must of added two things at just the right times to make the same id.
Is there any way that will reduce, or eliminate, the time gap between
getting id and inserting? 

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




[PHP-DB] Is there a better way to do this?

2002-03-15 Thread Leif K-Brooks

I operate a small game site for kids.  On this site, the players  can, among
other things, buy virtual items.  I have each item stored in a table called
items in a mysql database.  The type is one column in that table, but it
is a number, not a name.  When I want to display items with the item name, I
have to send a query to the item_types table to get the type name.  The
problem is, if a user has 50 items, it takes 50 queries to get the types.
Is there any better way? 

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