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
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;
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
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
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
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)
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
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,
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
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
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
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
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
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:
?
~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
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
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
()) - 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
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
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
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
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.
--
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
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
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
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
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 =
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
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
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
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
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
- 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
});
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
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
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
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
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
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
, 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
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
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|
$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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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,
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
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.
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
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
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
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
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
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:
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
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
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
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.
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
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
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
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
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
75 matches
Mail list logo