Re: [PHP-DB] Best way to remove slashes?

2005-02-02 Thread Brent Baisley
It looks like you might be running addslashes multiple times, which 
means you would need to run stripslashes multiple times. This usually 
happens when you run addslashes on the data before entering into the 
database, but also have magic quotes enabled (which does the same 
thing). Use get_magic_quotes_gpc to test if magic quotes if enabled 
before running your own addslashes, or just turn off magic quotes.

Otherwise run stripslashes a few times (kind of messy).
On Feb 1, 2005, at 6:28 PM, Chris Payne wrote:
Hi there everyone,

What’s the best way to remove slashes to stop the following from being
output from a string:

City = HYPERLINK "file:///\\'Alliance\\"\\\'Alliance\\\'

Say the string is called $city, I tried the following:

Stripslashes($city); but it  didn’t seem to work?

Chris
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.4 - Release Date: 2/1/2005

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Best way to remove slashes?

2005-02-01 Thread Chris Payne
Hi there everyone,

 

What’s the best way to remove slashes to stop the following from being
output from a string:

 

City = HYPERLINK "file:///\\'Alliance\\"\\\'Alliance\\\'

 

Say the string is called $city, I tried the following:

 

Stripslashes($city); but it  didn’t seem to work?

 

Chris


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.4 - Release Date: 2/1/2005
 


Re: [PHP-DB] Best way to show multiple pages reports from database

2003-10-20 Thread Peter Beckman
On Thu, 16 Oct 2003, Dejan Milenkovic wrote:

> I'm not fammiliar with internal MySQL architecture and exactly how things
> work but I was wondering what is the most effcient way of spliting reports
> over multiple pages. Is there a preformance difference between these two
> codes, specialy if there are some complex conditions and joins that should
> be done to get result.
>
> $page=1; // this is set via GET or POST
> $items_per_page=10;
> $sql="SELECT COUNT(*) FROM table";
> $result=mysql_query($sql)
> $number_of_items=mysql_numrows($result);
> $start=($page-1)*$items_per_page;
> $sql="SELECT * FROM table LIMIT $start, $items_per_page";
> $result=mysql_query($sql)
> while ($row=mysql_fetch_assoc($result)) {
>  // here goes output
> }

 The above is better.  MySQL doesn't return 4,000 pages to PHP, just the 10
 you ask for.  Faster, cleaner, better.  Select count(*) from table is
 super-fast, so almost no overhead there.

> $page=1; // this is set via GET or POST
> $items_per_page=10;
> $sql="SELECT * FROM table";
> $result=mysql_query($sql)
> $number_of_items=mysql_numrows($result);
> $start=($page-1)*$items_per_page;
> mysql_data_seek($result, $start);
> for ($i=0; $i<$items_per_page; $i++) {
>  $row=mysql_fetch_assoc($result)
>  // here goes output
> }

---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---

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



[PHP-DB] Best way to show multiple pages reports from database

2003-10-17 Thread Dejan Milenkovic
I'm not fammiliar with internal MySQL architecture and exactly how things
work but I was wondering what is the most effcient way of spliting reports
over multiple pages. Is there a preformance difference between these two
codes, specialy if there are some complex conditions and joins that should
be done to get result.

$page=1; // this is set via GET or POST
$items_per_page=10;
$sql="SELECT COUNT(*) FROM table";
$result=mysql_query($sql)
$number_of_items=mysql_numrows($result);
$start=($page-1)*$items_per_page;
$sql="SELECT * FROM table LIMIT $start, $items_per_page";
$result=mysql_query($sql)
while ($row=mysql_fetch_assoc($result)) {
 // here goes output
}

$page=1; // this is set via GET or POST
$items_per_page=10;
$sql="SELECT * FROM table";
$result=mysql_query($sql)
$number_of_items=mysql_numrows($result);
$start=($page-1)*$items_per_page;
mysql_data_seek($result, $start);
for ($i=0; $i<$items_per_page; $i++) {
 $row=mysql_fetch_assoc($result)
 // here goes output
}

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



Re: [PHP-DB] Best way to multi-thread (Kind of)?

2003-08-18 Thread Chris Payne

Hi there,

Ahhh you're a life saver, thanks for that that really helps out alot - and
makes sense when I think about it :-)

Regards

Chris

> For each message have a autoincrement message ID, an INT field is
sufficient I
> would guess.
>
> Also in each message record, have a parentID field as INT, default this to
0,
> and if the message is a reply to another message, make the parentID = to
the
> first message's  ID field.
>
> When you're displaying titles, query for all messages that have parentID
of 0,
> then for each one of those, do a second query for a parentID of that
message
> ID.
>
> I hope that explanation isn't too convoluted. I'm sure there's other
possibly
> better ways to do it, but that's how I've done it in the past.
>
>
> -Micah
>
>
> On Monday 18 August 2003 6:21 pm, Chris Payne wrote:
> > Hi there everyone,
> >
> > I have almost finished my forums system (Thanks for the feedback BTW on
> > optimizing the basic query code).
> >
> > Now that works fine on all 6 forums (Though i've programmed the 6th
forum
> > differently to allow image uploading and resizing).  My question is
this, I
> > want people to be able to reply to a message and for any messages that
have
> > replies to have them indented UNDER the original for selection, how can
I
> > do this?
> >
> > I know I need a reference to the original message, but i'm not sure how
to
> > do the indenting etc  and getting it to display under the original
> > posters message.
> >
> > Any help would be VERY welcome.
> >
> > Regards
> >
> > Chris Payne
>
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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



Re: [PHP-DB] Best way to multi-thread (Kind of)?

2003-08-18 Thread Micah Stevens


For each message have a autoincrement message ID, an INT field is sufficient I 
would guess. 

Also in each message record, have a parentID field as INT, default this to 0, 
and if the message is a reply to another message, make the parentID = to the 
first message's  ID field. 

When you're displaying titles, query for all messages that have parentID of 0, 
then for each one of those, do a second query for a parentID of that message 
ID.

I hope that explanation isn't too convoluted. I'm sure there's other possibly 
better ways to do it, but that's how I've done it in the past. 


-Micah


On Monday 18 August 2003 6:21 pm, Chris Payne wrote:
> Hi there everyone,
>
> I have almost finished my forums system (Thanks for the feedback BTW on
> optimizing the basic query code).
>
> Now that works fine on all 6 forums (Though i've programmed the 6th forum
> differently to allow image uploading and resizing).  My question is this, I
> want people to be able to reply to a message and for any messages that have
> replies to have them indented UNDER the original for selection, how can I
> do this?
>
> I know I need a reference to the original message, but i'm not sure how to
> do the indenting etc  and getting it to display under the original
> posters message.
>
> Any help would be VERY welcome.
>
> Regards
>
> Chris Payne


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



[PHP-DB] Best way to multi-thread (Kind of)?

2003-08-18 Thread Chris Payne
Hi there everyone,

I have almost finished my forums system (Thanks for the feedback BTW on optimizing the 
basic query code).

Now that works fine on all 6 forums (Though i've programmed the 6th forum differently 
to allow image uploading and resizing).  My question is this, I want people to be able 
to reply to a message and for any messages that have replies to have them indented 
UNDER the original for selection, how can I do this?

I know I need a reference to the original message, but i'm not sure how to do the 
indenting etc  and getting it to display under the original posters message.

Any help would be VERY welcome.

Regards

Chris Payne

RE: [PHP-DB] Best way to pass multiple selections to a DB

2003-06-17 Thread Creative Solutions New Media
Thanks Richard and Edward,

The naming of the list box as an array works great for passing the data
around. Thanks.

As for exactly what I need to do with the data I'm not exactly sure myself.
PHP and mySQL is a bit new to me.

I may be back for more help but for now thanks for the unbelievably quick
and helpful replies

Have a DAY

Respectfully,

Tim Winters
Manager, Creative Development
Sampling Technologies Incorporated (STI)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
W: 902 450 5500
C:  902 430 8498

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
Sent: June 17, 2003 3:57 PM
To: '[EMAIL PROTECTED]'; PHP-DB
Subject: RE: [PHP-DB] Best way to pass multiple selections to a DB

Tim,

You need to name your multiple select box as an array (e.g. selectThis[]).
The values will be passed as an array to the next page. You then need to
iterate over that array and pass the values into the database.

There's plenty of info on how to pull this off in the archives on PHP.NET
just search for select box or multiple select or the like and you should get
plenty of hits with code and summaries and the whole smash.

Rich

> -Original Message-
> From: Creative Solutions New Media [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 17, 2003 2:53 PM
> To: PHP-DB
> Subject: [PHP-DB] Best way to pass multiple selections to a DB
>
>
> Hello,
>
> Can anyone enlighten me as to some techniques for
> transferring information
> from a multiple select list box to mySQL.
>
> Someone recommended something about using join tables for
> this (which I have
> no idea how to set up).
>
> Thanks
>
> Tim Winters
> Manager, Creative Development
> Sampling Technologies Incorporated (STI)
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> W: 902 450 5500
> C:  902 430 8498
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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



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



Re: [PHP-DB] Best way to pass multiple selections to a DB

2003-06-17 Thread Becoming Digital
> Can anyone enlighten me as to some techniques for transferring information
> from a multiple select list box to mySQL.

Not knowing how you need to insert the values (multiple entries, values in
multiple fields), I would generate an array of the selections and loop through,
either running individual queries or building your multi-value query string.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: "Creative Solutions New Media" <[EMAIL PROTECTED]>
To: "PHP-DB" <[EMAIL PROTECTED]>
Sent: Tuesday, 17 June, 2003 14:52
Subject: [PHP-DB] Best way to pass multiple selections to a DB


Hello,

Can anyone enlighten me as to some techniques for transferring information
from a multiple select list box to mySQL.

Someone recommended something about using join tables for this (which I have
no idea how to set up).

Thanks

Tim Winters
Manager, Creative Development
Sampling Technologies Incorporated (STI)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
W: 902 450 5500
C:  902 430 8498




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





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



RE: [PHP-DB] Best way to pass multiple selections to a DB

2003-06-17 Thread Hutchins, Richard
Tim,

You need to name your multiple select box as an array (e.g. selectThis[]).
The values will be passed as an array to the next page. You then need to
iterate over that array and pass the values into the database.

There's plenty of info on how to pull this off in the archives on PHP.NET
just search for select box or multiple select or the like and you should get
plenty of hits with code and summaries and the whole smash.

Rich

> -Original Message-
> From: Creative Solutions New Media [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 17, 2003 2:53 PM
> To: PHP-DB
> Subject: [PHP-DB] Best way to pass multiple selections to a DB
> 
> 
> Hello,
> 
> Can anyone enlighten me as to some techniques for 
> transferring information
> from a multiple select list box to mySQL.
> 
> Someone recommended something about using join tables for 
> this (which I have
> no idea how to set up).
> 
> Thanks
> 
> Tim Winters
> Manager, Creative Development
> Sampling Technologies Incorporated (STI)
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> W: 902 450 5500
> C:  902 430 8498
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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



[PHP-DB] Best way to pass multiple selections to a DB

2003-06-17 Thread Creative Solutions New Media
Hello,

Can anyone enlighten me as to some techniques for transferring information
from a multiple select list box to mySQL.

Someone recommended something about using join tables for this (which I have
no idea how to set up).

Thanks

Tim Winters
Manager, Creative Development
Sampling Technologies Incorporated (STI)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
W: 902 450 5500
C:  902 430 8498




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



RE: [PHP-DB] best way to iterate through DB_Result the second time around?

2003-02-02 Thread John W. Holmes
> Iterating over a result set is eaasy the first time;
> 
>   while( $group_data = $result->fetchRow( DB_FETCHMODE_ASSOC ) )
>   {
>   blah...
>   }
> 
> 
> How come DB_Result doesn't have a reset() function so you can iterate
over
> the result set a second time without having to resort to this sort of
> thing?
> 
> for( $i = 0; $i < $result->numRows(); $i++ ) // Have to iterate
through
> 
>   // result set on the
second
> pass
> {
> $group_data = $result->fetchRow( DB_FETCHMODE_ASSOC, $i );
>   blah..
> }

It depends on your database... If you're using MySQL, see if whatever
class you're using has a wrapper for mysql_data_seek(). It will do what
you want rather easily. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




[PHP-DB] best way to iterate through DB_Result the second time around?

2003-02-02 Thread Brad Hubbard
Iterating over a result set is eaasy the first time;

  while( $group_data = $result->fetchRow( DB_FETCHMODE_ASSOC ) ) 
  {
blah...
  }


How come DB_Result doesn't have a reset() function so you can iterate over 
the result set a second time without having to resort to this sort of thing?

for( $i = 0; $i < $result->numRows(); $i++ ) // Have to iterate through
  
  // result set on the second pass
{
$group_data = $result->fetchRow( DB_FETCHMODE_ASSOC, $i );
blah..
}

Brad


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




Re: [PHP-DB] best way to stare true, false

2002-08-12 Thread leo g. divinagracia iii

if you are storing a bunch of T/F, you can store 8 of them into a single
byte...  each bit position will represent one "question"...

you just have to do some BIT manipulation on your end...

andy wrote:

> Hi there,
>
> I am searching for the best way to store true or false inside a MySQL DB.
> With best I mean the most data efficient way and in the same time the best
> for fast searching later on the table to find all which are false, or true.
> I think I did read something about a way to do this with ENUM, but cant
> remember where and how, all tryes did not succeeed so far.
>
>

--
Leo G. Divinagracia III
[EMAIL PROTECTED]



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




Re: [PHP-DB] best way to stare true, false

2002-08-11 Thread Jim Hunter

The smallest amount of database storage is going to be with a TinyInt and if
you set up two constants to represent TRUE and FALSE then all your code will
read correctly and will store correctly. EG:

define("TRUE", 1);
define("FALSE", 0);

now you can use TRUE and FALSE in your program where you would use any
variable (just don't use a dollar sign in front of them). This will make
your code much easier to read in the long run. Plus, if you create a 'master
global' file with all of your custom routines that you use in all programs,
you could have these globals there as well avaialable to all your programs
without thinking about it again.

Remember, keep your code readable, runable and reusable!

Jim Hunter
Diamond Computing




---Original Message---

From: andy
Date: Saturday, August 10, 2002 07:40:19 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] best way to stare true, false

Hi there,

I am searching for the best way to store true or false inside a MySQL DB.
With best I mean the most data efficient way and in the same time the best
for fast searching later on the table to find all which are false, or true.
I think I did read something about a way to do this with ENUM, but cant
remember where and how, all tryes did not succeeed so far.

Thanx for any help on that.

Andy



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

.


RE: [PHP-DB] best way to stare true, false

2002-08-11 Thread Mark Middleton

Andy,

I do use the "ENUM" technique quite a bit, with good results.

it's even easier if you set the ENUM values to 1 and 0, then when you do a
database query, you don't have to read the string, you can simply check for
it's presence.

Here's a fictitious example:

In user_table, make a field for "is_admin" ENUM('0','1')

then when you do a SQL query:

SELECT
*
FROM
user_table
WHERE
username = '$username'

do a query, and mysql_fetch_object (or however you get your DB query
results)

if ($row->is_admin) {
// This code will only be executed
// if the is_admin field is set to "1"
... code ...
}

I use phpMyAdmin to adminster the DB.  To setup an ENUM field in phpMyAdmin,
you select ENUM from the dropdown box in the column "TYPE", and place the
possible values in the "Length/Values" - for the above example, you would
simply type '0','1' in the values text box.  (I'm sorry if I'm being
redundant with info you already know, I just remember it being confusing for
me when I set up my first enum field)

I hope this helps,
Mark


> in this direction, but .. hey does nobody do this like that??
>

> > > > > I am searching for the best way to store true or false inside
> > > > > a MySQL DB. With best I mean the most data efficient way and
> > > > > in the same time the best for fast searching later on the
> > > > > table to find all which are false, or true. I think I did read
> > > > > something about a way to do this with ENUM, but cant remember
> > > > > where and how, all tryes did not succeeed so far.
> > > > >
> > > > > Thanx for any help on that.
> > > > >

>


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




Re: [PHP-DB] best way to stare true, false

2002-08-11 Thread Andy

oh... no I ment it in a different way..

somehow.. declare 1 enum value and then set it or not. Search for NULL or
not NULL values instead of false /true.

in this direction, but .. hey does nobody do this like that??

Andy

--

http://www.globosapiens.net
Global Travellers Network!



"Raquel Rice" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Sat, 10 Aug 2002 17:41:56 +0200
> "andy" <[EMAIL PROTECTED]> wrote:
>
> > > > Hi there,
> > > >
> > > > I am searching for the best way to store true or false inside
> > > > a MySQL DB. With best I mean the most data efficient way and
> > > > in the same time the best for fast searching later on the
> > > > table to find all which are false, or true. I think I did read
> > > > something about a way to do this with ENUM, but cant remember
> > > > where and how, all tryes did not succeeed so far.
> > > >
> > > > Thanx for any help on that.
> > > >
> > > > Andy
> > >
> > > How about as a "tinyint" ... 0/1
> > >
> > > --
> > > Raquel
> >
> > hmm.. thats how I am doing it right now. There might be a better
> > way?!
>
> I've never used ENUM, so take what I say with a grain of salt.  It
> appears to me that if you use "true" or "false" as your ENUM values,
> those values are stored as strings.  In PHP you would then have to
> do string comparisons rather that
> "if ($a) {
> do this;
> }"
>
> Perhaps it depends upon how you use it ... what you do with it?
>
> --
> Raquel
> 
> The world is not good enough - we must make it better.
>   --Alice Walker
>



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




Re: [PHP-DB] best way to stare true, false

2002-08-10 Thread Raquel Rice

On Sat, 10 Aug 2002 17:41:56 +0200
"andy" <[EMAIL PROTECTED]> wrote:

> > > Hi there,
> > >
> > > I am searching for the best way to store true or false inside
> > > a MySQL DB. With best I mean the most data efficient way and
> > > in the same time the best for fast searching later on the
> > > table to find all which are false, or true. I think I did read
> > > something about a way to do this with ENUM, but cant remember
> > > where and how, all tryes did not succeeed so far.
> > >
> > > Thanx for any help on that.
> > >
> > > Andy
> >
> > How about as a "tinyint" ... 0/1
> >
> > --
> > Raquel
> 
> hmm.. thats how I am doing it right now. There might be a better
> way?!

I've never used ENUM, so take what I say with a grain of salt.  It
appears to me that if you use "true" or "false" as your ENUM values,
those values are stored as strings.  In PHP you would then have to
do string comparisons rather that 
"if ($a) {
do this;
}"

Perhaps it depends upon how you use it ... what you do with it?

-- 
Raquel

The world is not good enough - we must make it better.
  --Alice Walker


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




Re: [PHP-DB] best way to stare true, false

2002-08-10 Thread andy

hmm.. thats how I am doing it right now. There might be a better way?!





"Raquel Rice" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Sat, 10 Aug 2002 16:46:54 +0200
> "andy" <[EMAIL PROTECTED]> wrote:
>
> > Hi there,
> >
> > I am searching for the best way to store true or false inside a
> > MySQL DB. With best I mean the most data efficient way and in the
> > same time the best for fast searching later on the table to find
> > all which are false, or true. I think I did read something about a
> > way to do this with ENUM, but cant remember where and how, all
> > tryes did not succeeed so far.
> >
> > Thanx for any help on that.
> >
> > Andy
>
> How about as a "tinyint" ... 0/1
>
> --
> Raquel
> 
> The world is not good enough - we must make it better.
>   --Alice Walker
>



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




Re: [PHP-DB] best way to stare true, false

2002-08-10 Thread Raquel Rice

On Sat, 10 Aug 2002 16:46:54 +0200
"andy" <[EMAIL PROTECTED]> wrote:

> Hi there,
> 
> I am searching for the best way to store true or false inside a
> MySQL DB. With best I mean the most data efficient way and in the
> same time the best for fast searching later on the table to find
> all which are false, or true. I think I did read something about a
> way to do this with ENUM, but cant remember where and how, all
> tryes did not succeeed so far.
> 
> Thanx for any help on that.
> 
> Andy

How about as a "tinyint" ... 0/1

-- 
Raquel

The world is not good enough - we must make it better.
  --Alice Walker


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




[PHP-DB] best way to stare true, false

2002-08-10 Thread andy

Hi there,

I am searching for the best way to store true or false inside a MySQL DB.
With best I mean the most data efficient way and in the same time the best
for fast searching later on the table to find all which are false, or true.
I think I did read something about a way to do this with ENUM, but cant
remember where and how, all tryes did not succeeed so far.

Thanx for any help on that.

Andy



-- 
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] 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] 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 store/retrieve content??

2002-03-07 Thread Peter Lovatt

Hi

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

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


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


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

Otherwise maybe you could use two tables.

 CREATE TABLE Article
(

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

 CREATE TABLE Article_components
(

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

)

Article_components might contain :-

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

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

To display, loop thro the result

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

Just a few thoughts

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

Peter

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

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

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

2002-03-07 Thread Shrock, Court

> I like your idea about the [start-stop block].  To maybe 
> merge what Paul
> said with your idea, you could store the name of the function handler
> (generates the appropriate content) inside the "[]".

I meant Peter :)

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




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

2002-03-07 Thread Shrock, Court

Valid point--I was thinking that in a news article or such, the content is
mostly already created and edited, just needed to be posted by someone not
familar with HTML.

I like your idea about the [start-stop block].  To maybe merge what Paul
said with your idea, you could store the name of the function handler
(generates the appropriate content) inside the "[]".

[renderProducts]
[renderImage]
/photos/image1.jpg
[/renderImage]
[renderDescription]
This product will make your skin feel silky smooth.
[/renderDescription]
[renderImage]
/photos/image2.jpg
[/renderImage]
[renderDescription]
New from Nivea, a lotion that moisturizes and protects from the sun.
[/renderDescription]

that way, the main handler (renderProducts) is always at the top.  The main
handler would then strip out the data/sub-routine calls (renderImage,
renderDescription) and pass that data to the function along with a context
variable like $op or something so that the same functions could be used to
display to the screen and to edit the results thanks to $op
(add/modify/view, etc...).  The function renderImage could contain an
internal counter to when to display the next row.  Creating this source data
would require something similar to my last post, except replacing the html
with the appropriate "[]".  Of course, what we are really doing is xml.
Maybe should just do xml:


  

  /photos/image1.jpg


  This product will make your skin feel silky smooth.

  
  

  /photos/image2.jpg


  New from Nivea, a lotion that moisturizes and protects from the sun.

  


In parsing the first example, I would probably use preg_match and regular
expressions.  In parsing the xml, I would use php's xml parser.

Hope this helps a little more--
Court

> -Original Message-
> From: Monty [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 07, 2002 1:04 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Best way to store/retrieve content??
> 
> 
> Hi Court, thanks a lot for your advice.
> 
> I am fairly new to PHP, so, I'm a little slow in 
> understanding some of the
> suggestions in your detailed post. From what I gather, you 
> suggested that an
> Admin script be created to basically build each portion of an 
> article piece
> by piece, which would then be combined and stored in a single 
> field in the
> Articles data table. Is that right?
> 
> The only thing I can see being a problem with this method is 
> if the writer
> needs to go back and edit the article. Unless I strip out all 
> HTML and parse
> the sections out into individual fields, they would have to 
> contend with all
> the HTML code written into the article content field. I'd 
> like to reduce the
> amount of HTML stored with the article content in the 
> database as much as
> possible so that writers don't have to worry about anything 
> but the most
> basic codes.
> 
> Here's one idea I have. In the database field, the article 
> content may look
> something like this:
> 
> [START-BLOCK]
> [IMG="photos/image1.jpg"]
> This product will make your skin feel silky smooth.
> [END-BLOCK]
> 
> [START-BLOCK]
> [IMG="photos/image2.jpg"]
> New from Nivea, a lotion that moisturizes and protects from the sun.
> [END-BLOCK]
> 
> 
> ...which I can then parse to lay the article out like this...
> 
> 
> +---+  +---+  +---+
> |  image 1  |  |  image 2  |  |  image 3  |
> +---+  +---+  +---+
> 
> Short paragraphShort paragraphShort paragraph
> of text under  of text under  of text under
> the image. the image. the image.
> 
> +---+  +---+  +---+
> |  image 4  |  |  image 5  |  |  image 6  |
> +---+  +---+  +---+
> 
> Short paragraphShort paragraphShort paragraph
> of text under  of text under  of text under
> the image. the image. the image.
> 
> 
> If this is a doable and good way to go, then my next question 
> is, which PHP
> string function would be the best to use for parsing custom 
> codes (like
> [IMG=) into actual HTML codes?
> 
> Thanks!
> 
> Monty
> 
> 
> > From: [EMAIL PROTECTED] (Court Shrock)
> > Newsgroups: php.db
> > Date: Thu, 7 Mar 2002 12:16:07 -0800
> > To: 'Monty' <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> > Subject: RE: [PHP-DB] Best way to store/retrieve content??
> > 
> > Actually, CSS is very powerful--way more than simple html.  
> One drawback is
> > that CSS1 did not include any support for tables directly, 
> but the generic
> > controls work

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

2002-03-07 Thread Monty

Hi Court, thanks a lot for your advice.

I am fairly new to PHP, so, I'm a little slow in understanding some of the
suggestions in your detailed post. From what I gather, you suggested that an
Admin script be created to basically build each portion of an article piece
by piece, which would then be combined and stored in a single field in the
Articles data table. Is that right?

The only thing I can see being a problem with this method is if the writer
needs to go back and edit the article. Unless I strip out all HTML and parse
the sections out into individual fields, they would have to contend with all
the HTML code written into the article content field. I'd like to reduce the
amount of HTML stored with the article content in the database as much as
possible so that writers don't have to worry about anything but the most
basic codes.

Here's one idea I have. In the database field, the article content may look
something like this:

[START-BLOCK]
[IMG="photos/image1.jpg"]
This product will make your skin feel silky smooth.
[END-BLOCK]

[START-BLOCK]
[IMG="photos/image2.jpg"]
New from Nivea, a lotion that moisturizes and protects from the sun.
[END-BLOCK]


...which I can then parse to lay the article out like this...


+---+  +---+  +---+
|  image 1  |  |  image 2  |  |  image 3  |
+---+  +---+  +---+

Short paragraphShort paragraphShort paragraph
of text under  of text under  of text under
the image. the image. the image.

+---+  +---+  +---+
|  image 4  |  |  image 5  |  |  image 6  |
+---+  +---+  +---+

Short paragraphShort paragraphShort paragraph
of text under  of text under  of text under
the image. the image. the image.


If this is a doable and good way to go, then my next question is, which PHP
string function would be the best to use for parsing custom codes (like
[IMG=) into actual HTML codes?

Thanks!

Monty


> From: [EMAIL PROTECTED] (Court Shrock)
> Newsgroups: php.db
> Date: Thu, 7 Mar 2002 12:16:07 -0800
> To: 'Monty' <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Best way to store/retrieve content??
> 
> Actually, CSS is very powerful--way more than simple html.  One drawback is
> that CSS1 did not include any support for tables directly, but the generic
> controls work nicely, there just is no way to say "" in
> CSS1.  A great book that taught me a lot about CSS is
> http://www.oreilly.com/catalog/css/ --I'd lone it to you if you were local.
> 
> I think it would be feasible to store all content in one db: just use your
> templates to convert the articles to appropriate markup and then store the
> results.
> 
> (I am departing from html)
> The interview:
> [input_form]
> Template: "Interview"
> Question: 
> Answer: 
> 
> [form_submittal]
> $content = _header($template);
> foreach (question) {
> $content .= "Us:$question"
> " class='them'>Them:$answer";
> }
> insertArticle($content);
> 
> The beauty product:
> [input_form]
> Template: "picture"
> Picture: 
> Description: "Just imagine yourself all prettied up like this
> glorious person"
> 
> Transition: "And now that brings us to some really cool
> whale-inard products"
> 
> Picture: 
> Description: "We promise that no animals were harmed during the
> making."
> 
> [form_submittal]
> $content = _header($template);
> foreach(picture) {
> $content .= " src='$file'>$description";
> if ($transition != '')
> $content .= "$transition";
> }
> 
> 
> ...anyway, you get the idea.this is a rather simple approach--but, you
> could combine something like this with an output template to get really good
> results.
> 


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




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

2002-03-07 Thread Monty

Hi Peter, thanks a lot for your advice. I think where I'm stuck is how to
best store certain types of articles in a data table. Interviews would be
easy, because it's just paragraphs of text with an inline photo here and
there. The more structured articles are trickier and I can't figure out how
to use the same Article table for all articles. Using the example I gave in
a previous message, here's a rough page layout of one of these structured
articles:

+---+  +---+  +---+
|  image 1  |  |  image 2  |  |  image 3  |
+---+  +---+  +---+

Short paragraphShort paragraphShort paragraph
of text under  of text under  of text under
the image. the image. the image.

+---+  +---+  +---+
|  image 4  |  |  image 5  |  |  image 6  |
+---+  +---+  +---+

Short paragraphShort paragraphShort paragraph
of text under  of text under  of text under
the image. the image. the image.


If I have one field in the Article table for full_content (which works just
fine for interviews), how could I enter the above type of article into this
table so that the template will know to separate each element text block and
match it up with the associated image? Is this a matter of writing a special
parsing function that would take the following from the full_content
field...




Short paragraph of text under the image.



Short paragraph of text under the image.

...and format break it down into an array so it can then be formatted on the
page as illustrated above?

My real block is how the set up the database more than the templates. As I
mentioned, I'm trying to keep all articles in one data table so searches can
be easily done on all articles.

Thanks!

Monty




> From: [EMAIL PROTECTED] (Peter Lovatt)
> Newsgroups: php.db
> Date: Thu, 7 Mar 2002 20:11:00 -
> To: "Monty" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
> Subject: RE: [PHP-DB] Best way to store/retrieve content??
> 
> Hi
> 
> I have done a similar thing, and found that you can store just the text in
> the database.
> 
> I added  'Short_content' which was a leader, and some other fields for
> management.
> 
> I designed a few templates in Dreamweaver and embeded a function to display
> the content in the page
> 
> eg 
> 
> The function basically pulls the content from the database and prints it.
> You can just print the text, or you can add HTML in the function to give a
> particular layout. You can use the same principal to link images, or you can
> hard code them into the page.
> 
> If you want to be more sophisticated you can use a number of templates and
> store the one to use in the record, giving.
> 
> display.php?contentID=1234
> 
> ->query db to get template for 'Article 1234'
> 
> ->output 'template_1.htm' which has the correct layout, and the function for
> this article embedded in it
> 
> 
> CREATE TABLE S_content (
> ContentID int(11) NOT NULL auto_increment,
> Title varchar(100) NOT NULL default '',
> Description varchar(250) default NULL,
> Short_content text,
> Full_content text,
> UserID int(11) default NULL,
> Start_date date default NULL,
> End_date date default NULL,
> End_actionID int(11) NOT NULL default '0',
> Template_file varchar(50) ,
> 
> PRIMARY KEY (ContentID),
> KEY ContentID(ContentID),
> )
> 
> HTH
> 
> Peter
> 
> ---
> Excellence in internet and open source software
> ---
> Sunmaia
> www.sunmaia.net
> [EMAIL PROTECTED]
> tel. 0121-242-1473
> ---
> 


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




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

2002-03-07 Thread Shrock, Court

Actually, CSS is very powerful--way more than simple html.  One drawback is
that CSS1 did not include any support for tables directly, but the generic
controls work nicely, there just is no way to say "" in
CSS1.  A great book that taught me a lot about CSS is
http://www.oreilly.com/catalog/css/ --I'd lone it to you if you were local.

I think it would be feasible to store all content in one db: just use your
templates to convert the articles to appropriate markup and then store the
results.

(I am departing from html)
The interview:
[input_form]
Template: "Interview"
Question: 
Answer: 

[form_submittal]
$content = _header($template);
foreach (question) {
  $content .= "Us:$question"
  "Them:$answer";
}
insertArticle($content);

The beauty product:
[input_form]
Template: "picture"
Picture: 
Description: "Just imagine yourself all prettied up like this
glorious person"

Transition: "And now that brings us to some really cool
whale-inard products"

Picture: 
Description: "We promise that no animals were harmed during the
making."

[form_submittal]
$content = _header($template);
foreach(picture) {
  $content .= "$description";
  if ($transition != '')
$content .= "$transition";
}


...anyway, you get the idea.this is a rather simple approach--but, you
could combine something like this with an output template to get really good
results.

> -Original Message-
> From: Monty [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 07, 2002 11:46 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Best way to store/retrieve content??
> 
> 
> I will be using CSS for other thing, such as paragraph 
> formatting, but, not
> sure how to use it for creating tables and flowing text 
> around graphics. Can
> CSS really do all that? Still not sure if this will work 
> because I don't
> want the writers to have to type in any HMTL code at all if possible.
> 
> Here's a good example: One article may be a simple interview with some
> images (this is easy to enter into a database). But another 
> article about
> new beauty products has a grid of images plus a short blurb about each
> product next to the photo. This requires more intricate 
> formatting with HTML
> than an interview does.
> 
> I don't have a problem creating separate templates for these 
> special types
> of articles, but, it looks like I'd also have to set up 
> separate database
> tables to store this article data differently than it would 
> be stored for a
> simple interview. But, it would be better if all content was centrally
> stored in one table to make searches better/easier...or am I 
> expecting too
> much from just one content table?
> 
> What to do, what to do!
> 
> 
> 
> > From: [EMAIL PROTECTED] (Court Shrock)
> > Newsgroups: php.db
> > Date: Thu, 7 Mar 2002 11:31:20 -0800
> > To: 'Monty' <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> > Subject: RE: [PHP-DB] Best way to store/retrieve content??
> > 
> > I would try to use CSS, instead of complex tables.  That 
> way, you only need
> > to store the structural html in the database and the layout 
> is handled by
> > CSS--floating images and flowing text are really easy with CSS.
> > 
> >> -Original Message-
> >> From: Monty [mailto:[EMAIL PROTECTED]]
> >> Sent: Thursday, March 07, 2002 11:31 AM
> >> To: [EMAIL PROTECTED]
> >> Subject: [PHP-DB] Best way to store/retrieve content??
> >> 
> >> 
> >> I'm writing some content management scripts for an online
> >> magazine. Many
> >> articles are formatted in a similar way, but some have a
> >> unique page layout
> >> that includes grids of photos, tables, etc.
> >> 
> >> I'm not sure if the best way to store content is in a
> >> database so it can be
> >> flowed into an article template, or to simply lay out the
> >> page as HTML,
> >> surrounding it with a simple include("header.php") and
> >> include("footer.php")
> >> for header/footer HTML and graphics. For articles that
> >> require things like
> >> tables, it would be a pain to have to write this HTML by hand
> >> or lay it out
> >> in Dreamweaver then copy and past the code into the database
> >> field (using an
> >> Admin web form).
> >> 
> >> Or, is it prudent to set up a custom table in the databse for
> >> each type of
> >> content so that a matching template can be used to format the
> >> pages properly
> >> without having to include all the HTML in the database with
> >> the content
> >> itself?
> >> 
> >> Hope this makes some sense. Just trying to figure out the
> >> best way to tackle
> >> this. All input is appreciated!
> >> 
> >> Monty
> >> 
> >> 
> >> 
> >> -- 
> >> PHP Database Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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




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

2002-03-07 Thread Peter Lovatt

Hi

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

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

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

eg 

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

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

display.php?contentID=1234

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

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


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

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

   HTH

Peter

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

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





>


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




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

2002-03-07 Thread Leotta, Natalie (NCI/IMS)

In theory, if your writers are using a word processor such as Word you could
try just saving as HTML and seeing if that works.  I doubt they'd appreciate
it if you asked them to write in FrontPage, but that would give you what you
need too.

If these ideas don't work you may want to browse other magazines online (if
you go to fashion ones then they should have the tables you talked about).
You could try magazines like Cosmo, Seventeen, etc. and see if you can get
any feel for what they are developing in.  I only came up with the PDFs
because one site I go to uses them and we use them for some of our web
publications for the NCI.

Good luck!

-Natalie

> -Original Message-
> From: Monty [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, March 07, 2002 2:46 PM
> To:   [EMAIL PROTECTED]
> Subject:  Re: [PHP-DB] Best way to store/retrieve content??
> 
> Hi Natalie, no, PDFs won't work. I need to display the content as an HTML
> page.
> 
> > From: [EMAIL PROTECTED] (Natalie Leotta)
> > Newsgroups: php.db
> > Date: Thu, 7 Mar 2002 14:32:57 -0500
> > To: [EMAIL PROTECTED]
> > Subject: RE: [PHP-DB] Best way to store/retrieve content??
> > 
> > Could you use PDFs?
> > 
> > -Natalie
> > 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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




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

2002-03-07 Thread Monty

Hi Natalie, no, PDFs won't work. I need to display the content as an HTML
page.

> From: [EMAIL PROTECTED] (Natalie Leotta)
> Newsgroups: php.db
> Date: Thu, 7 Mar 2002 14:32:57 -0500
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Best way to store/retrieve content??
> 
> Could you use PDFs?
> 
> -Natalie
> 


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




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

2002-03-07 Thread Monty

I will be using CSS for other thing, such as paragraph formatting, but, not
sure how to use it for creating tables and flowing text around graphics. Can
CSS really do all that? Still not sure if this will work because I don't
want the writers to have to type in any HMTL code at all if possible.

Here's a good example: One article may be a simple interview with some
images (this is easy to enter into a database). But another article about
new beauty products has a grid of images plus a short blurb about each
product next to the photo. This requires more intricate formatting with HTML
than an interview does.

I don't have a problem creating separate templates for these special types
of articles, but, it looks like I'd also have to set up separate database
tables to store this article data differently than it would be stored for a
simple interview. But, it would be better if all content was centrally
stored in one table to make searches better/easier...or am I expecting too
much from just one content table?

What to do, what to do!



> From: [EMAIL PROTECTED] (Court Shrock)
> Newsgroups: php.db
> Date: Thu, 7 Mar 2002 11:31:20 -0800
> To: 'Monty' <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Best way to store/retrieve content??
> 
> I would try to use CSS, instead of complex tables.  That way, you only need
> to store the structural html in the database and the layout is handled by
> CSS--floating images and flowing text are really easy with CSS.
> 
>> -Original Message-
>> From: Monty [mailto:[EMAIL PROTECTED]]
>> Sent: Thursday, March 07, 2002 11:31 AM
>> To: [EMAIL PROTECTED]
>> Subject: [PHP-DB] Best way to store/retrieve content??
>> 
>> 
>> I'm writing some content management scripts for an online
>> magazine. Many
>> articles are formatted in a similar way, but some have a
>> unique page layout
>> that includes grids of photos, tables, etc.
>> 
>> I'm not sure if the best way to store content is in a
>> database so it can be
>> flowed into an article template, or to simply lay out the
>> page as HTML,
>> surrounding it with a simple include("header.php") and
>> include("footer.php")
>> for header/footer HTML and graphics. For articles that
>> require things like
>> tables, it would be a pain to have to write this HTML by hand
>> or lay it out
>> in Dreamweaver then copy and past the code into the database
>> field (using an
>> Admin web form).
>> 
>> Or, is it prudent to set up a custom table in the databse for
>> each type of
>> content so that a matching template can be used to format the
>> pages properly
>> without having to include all the HTML in the database with
>> the content
>> itself?
>> 
>> Hope this makes some sense. Just trying to figure out the
>> best way to tackle
>> this. All input is appreciated!
>> 
>> Monty
>> 
>> 
>> 
>> -- 
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 


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




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

2002-03-07 Thread Shrock, Court

I would try to use CSS, instead of complex tables.  That way, you only need
to store the structural html in the database and the layout is handled by
CSS--floating images and flowing text are really easy with CSS.

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

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




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

2002-03-07 Thread Leotta, Natalie (NCI/IMS)

Could you use PDFs?

-Natalie

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

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




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

2002-03-07 Thread Monty

I'm writing some content management scripts for an online magazine. Many
articles are formatted in a similar way, but some have a unique page layout
that includes grids of photos, tables, etc.

I'm not sure if the best way to store content is in a database so it can be
flowed into an article template, or to simply lay out the page as HTML,
surrounding it with a simple include("header.php") and include("footer.php")
for header/footer HTML and graphics. For articles that require things like
tables, it would be a pain to have to write this HTML by hand or lay it out
in Dreamweaver then copy and past the code into the database field (using an
Admin web form). 

Or, is it prudent to set up a custom table in the databse for each type of
content so that a matching template can be used to format the pages properly
without having to include all the HTML in the database with the content
itself?

Hope this makes some sense. Just trying to figure out the best way to tackle
this. All input is appreciated!

Monty



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




[PHP-DB] best way connect MS SQL

2001-08-10 Thread Sommai Fongnamthip

Hi,
I wonder which the best way to connect PHP from Linux to MS SQL on NT?
- freeTDS
- ODBC (iODBC, unixODBC, MyODBC)
I was still can not connect with anyone!

Regards,
Sommai Fongnamthip


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




Re: [PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Doug Semig

I see you there's been lots of responses already, but there's an important
related bit of news folks might want to know.

Everyone who uses the mysql_affected_rows() should know that a bug was
fixed in 3.23.36 that evidentally reports affected rows incorrectly if
MySQL was compiled without support for transactions.  Go to
http://www.mysql.com/documentation/mysql/bychapter/manual_News.html and
scroll down to section F.2.2.  It's the 8th item in the list.

So shy away depending on mysql_affected_rows() for anything unless you're
absolutely sure you're running at least 3.23.36 or have transaction support
compiled in.

Doug

At 12:00 PM 3/29/01 +0100, Jordan Elver wrote:
>Hi,
>i was just wondering what you guys do to check if a wquery suceeded or not?
>I know about mysql_num_rows() and mysql_affected_rows(), just wondered what 
>you guys do?
>
>I normally do something like:
>
>$sql = "SELECT something FROM table";
>$result = mysql_query($sql);
>if(@mysql_num_rows($result) > 0) {
>   echo'Query Suceeded';
>} else {
>   echo'Query failed';
>}
>
>Cheers,
>
>Jord



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




Re: [PHP-DB] Re: [PHP] RE: [PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Terry Romine


On Thursday, March 29, 2001, at 08:32 AM, Nick Davies wrote:

> Doesn't the command return 1 or 0 in success or failure?
>
> You may not have a result
>
> Probably wrong but something like
>
> if (mysql_query($query)) {
>
> } else {
>
> }

What I understand is that the return from the query only tells you if 
the syntax is correct. NOT whether there were any records returned. That 
is what the mysql_num_rows gets you-- the number of records returned.

Terry

-- 
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: [PHP] RE: [PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Boget, Chris

> Doesn't the command return 1 or 0 in success or failure?

Not 1 or 0.  It returns 0 or some other value.  Almost the same,
but not quite.
 
> You may not have a result 
> Probably wrong but something like
> if (mysql_query($query)) {
> } else {
> }
> or you could die out mysql_query($query) or die 

You could do that.  But once you run the query, that's it.  You'll
have nothing to use with any of the other mysql functions because
you need to pass to them the value that mysql() returns.  So while
the above might tell you whether or not the query succeeded, that's
all you would get out of it.

Chris



[PHP-DB] Re: [PHP] RE: [PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Nick Davies


Doesn't the command return 1 or 0 in success or failure?

You may not have a result 

Probably wrong but something like

if (mysql_query($query)) {

} else {

}

or you could die out mysql_query($query) or die 

On Thu, 29 Mar 2001, Boget, Chris wrote:

> > i was just wondering what you guys do to check if a wquery 
> > suceeded or not?
> > I know about mysql_num_rows() and mysql_affected_rows(), just 
> > wondered what 
> > you guys do?
> 
> I do this:
> 
> $result = mysql( $dbname, $query );
> if(( $result ) && ( mysql_errno() == 0 )) {
>   // query was successful
>   if( mysql_num_rows( $result ) > 0 ) {
> // do your stuff here...
> 
>   } else {
> echo "Successful query returned no rows";
> 
>   } 
> } else {
>   echo "Query failed: " . mysql_error() . "\n";
> 
> }
> 
> There is a difference between a "successful query" and
> a query that returns 0 rows and should be handled
> differently, typically.  Depending on what you are doing,
> you might not care -- 0 rows = unsuccessful query.
> However, in my case, I want to know if a query was
> malformed, contained erroneous data that's throwing
> mySQL off or whatever.  These types of errors will 
> return 0 rows as well.
> 
> Chris
> 


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




RE: [PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Boget, Chris

> i was just wondering what you guys do to check if a wquery 
> suceeded or not?
> I know about mysql_num_rows() and mysql_affected_rows(), just 
> wondered what 
> you guys do?

I do this:

$result = mysql( $dbname, $query );
if(( $result ) && ( mysql_errno() == 0 )) {
  // query was successful
  if( mysql_num_rows( $result ) > 0 ) {
// do your stuff here...

  } else {
echo "Successful query returned no rows";

  } 
} else {
  echo "Query failed: " . mysql_error() . "\n";

}

There is a difference between a "successful query" and
a query that returns 0 rows and should be handled
differently, typically.  Depending on what you are doing,
you might not care -- 0 rows = unsuccessful query.
However, in my case, I want to know if a query was
malformed, contained erroneous data that's throwing
mySQL off or whatever.  These types of errors will 
return 0 rows as well.

Chris



Re: Odp: [PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Karsten Dambekalns

On Thu, Mar 29, 2001 at 02:25:42PM +0200, Hans-Werner Guth wrote:

> We do it this way (code snippet)
> 
> Bartek Pawlik wrote:
> > ...snipp...
> > >
> > > I normally do something like:

You can do something like

---
if(mysql_query($sql))
{
  success
}
else
{
  error
}
---

Regards,
Karsten
-- 
fishfarm - Karsten Dambekalns
Echternstr. 73 - 38100 Braunschweig

Tel. +49 531 1232902  mailto:[EMAIL PROTECTED]
Fax. +49 531 1232906  http://www.fishfarm.de/
-


 PGP signature


Re: Odp: [PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Hans-Werner Guth

We do it this way (code snippet)

...
$dbqueryline = mysql_db_query ($mredatabase,
   "select vorgang, bezeichnung 
   from mrebewkennz 
   order by vorgang", $dbhandle);
if (mysql_errno() != 0)
{
   echo mysql_error(); echo "\n";
}
else
{
   $bewkenznzahl = mysql_num_rows($dbqueryline);
   print "$bewkenznzahl Bewegungskennzeichen\n";
}

Bartek Pawlik wrote:
> ...snipp...
> >
> > I normally do something like:
> >
> > $sql = "SELECT something FROM table";
> > $result = mysql_query($sql);
> > if(@mysql_num_rows($result) > 0) {
> > echo'Query Suceeded';
> > } else {
> > echo'Query failed';
> > }
...snipp...

-- 
Hans-Werner Guth  S http://www.qits.de
 QITS GmbH  T mailto:[EMAIL PROTECTED]
Formerstr 53  I fon +49-2102-852-145
40878 Ratingen  Q fax +49-2102-852-202

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




Odp: [PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Bartek Pawlik

I do the same and I think this is the only way

Bartek Pawlik


- Original Message -
From: Jordan Elver <[EMAIL PROTECTED]>
To: PHP Database Mailing List <[EMAIL PROTECTED]>; PHP General Mailing
List <[EMAIL PROTECTED]>
Sent: Thursday, March 29, 2001 1:00 PM
Subject: [PHP-DB] Best way to check if a query succeeded


> Hi,
> i was just wondering what you guys do to check if a wquery suceeded or
not?
> I know about mysql_num_rows() and mysql_affected_rows(), just wondered
what
> you guys do?
>
> I normally do something like:
>
> $sql = "SELECT something FROM table";
> $result = mysql_query($sql);
> if(@mysql_num_rows($result) > 0) {
> echo'Query Suceeded';
> } else {
> echo'Query failed';
> }
>
> Cheers,
>
> Jord
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
 

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




[PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Jordan Elver

Hi,
i was just wondering what you guys do to check if a wquery suceeded or not?
I know about mysql_num_rows() and mysql_affected_rows(), just wondered what 
you guys do?

I normally do something like:

$sql = "SELECT something FROM table";
$result = mysql_query($sql);
if(@mysql_num_rows($result) > 0) {
echo'Query Suceeded';
} else {
echo'Query failed';
}

Cheers,

Jord

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




Re: [PHP-DB] Best Way

2001-02-18 Thread Koos van den Hout

Quoting Don Smith who wrote on Sat, Feb 17, 2001 at 08:56:19PM -0600:

> I've searched the manual and read many examples, but I have to ask here for
> the best way to program for a number of possibilities. I've got my site
> working the hard way, but I'll bet there's a smarter way of doing the
> following:
> 
> Visitors to my site can search my database by lastname and/or firstname
> and/or company. Is there a succinct way to checking for all possible
> combinations? I alreay have NONE SELECTED covered, but the rest of the
> possibilities are spotty. Too many IF statements, youknowwhaddimeanverne?
> 
> SO... the user might just enter the last name, or just the first name, or
> just the first and last, or just the company or just the last name and the
> company.. and, oh well, you get the idea. Am I stuck with an awful lot of IF
> statements or is there a smarter way of handling this? The site is
> CameraCrews.com. Select "-by Name" to see the input page.

The smart way: building the query string on the fly. Something like:

$query="SELECT first,last,company FROM crews WHERE valid=1 ";

if ($q_firstname){
$query.="AND firstname like %$q_firstname% ";
}
if ($q_lastname){
$query.="AND lastname like %$q_lastname% ";
}
if ($q_company){
$query.="AND company like %$q_company% ";
}
$query.="ORDER BY entrydate";
$result=sybase_query($query);

Your query is a string too, use that fact :)

Koos

-- 
Koos van den Hout,   PGP keyid RSA/1024 0xCA845CB5 via keyservers
[EMAIL PROTECTED]or DSS/1024 0xF0D7C263-?)
Fax +31-30-2817051   Visit my site about books with reviews/\\
http://idefix.net/~koos/http://www.virtualbookcase.com/   _\_V

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




Re: [PHP-DB] Best Way

2001-02-18 Thread phobo

Just build the SQL statement with IFs...

sql = "SELECT * FROM table WHERE ";

if ($SearchByName) $sql .= "name = $Name AND ";
if ($SearchBySurname) $sql .= "surname = $Surname AND ";
if ($SearchByCompany) $sql .= "company = $Company AND ";

...

then just remove the last four characters, and perform the query...


Siggy

- Original Message -
From: "Don Smith" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 18, 2001 3:56 PM
Subject: [PHP-DB] Best Way


> I've searched the manual and read many examples, but I have to ask here
for
> the best way to program for a number of possibilities. I've got my site
> working the hard way, but I'll bet there's a smarter way of doing the
> following:
>
> Visitors to my site can search my database by lastname and/or firstname
> and/or company. Is there a succinct way to checking for all possible
> combinations? I alreay have NONE SELECTED covered, but the rest of the
> possibilities are spotty. Too many IF statements, youknowwhaddimeanverne?
>
> SO... the user might just enter the last name, or just the first name, or
> just the first and last, or just the company or just the last name and the
> company.. and, oh well, you get the idea. Am I stuck with an awful lot of
IF
> statements or is there a smarter way of handling this? The site is
> CameraCrews.com. Select "-by Name" to see the input page.
>
> Thanks for any help,
> Don Smith
> NewsVideo.com
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


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




[PHP-DB] Best Way

2001-02-17 Thread Don Smith

I've searched the manual and read many examples, but I have to ask here for
the best way to program for a number of possibilities. I've got my site
working the hard way, but I'll bet there's a smarter way of doing the
following:

Visitors to my site can search my database by lastname and/or firstname
and/or company. Is there a succinct way to checking for all possible
combinations? I alreay have NONE SELECTED covered, but the rest of the
possibilities are spotty. Too many IF statements, youknowwhaddimeanverne?

SO... the user might just enter the last name, or just the first name, or
just the first and last, or just the company or just the last name and the
company.. and, oh well, you get the idea. Am I stuck with an awful lot of IF
statements or is there a smarter way of handling this? The site is
CameraCrews.com. Select "-by Name" to see the input page.

Thanks for any help,
Don Smith
NewsVideo.com


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