RE: [PHP] Splitting Text

2001-08-06 Thread Alfredeen, Johan

Jord,
  I would accomplish this through SQL. You could use SELECT LEFT(mycolumn,x)
FROM mytable WHERE ...
and then display that along with a link to a page where you select the whole
string on that particular article ID. In fact, I do this exact thing on my
site.

Or you could read the whole string into an array, and use the PHP function
to retrieve the substring you want. I prefer the first option however.

Good luck,

Johan Alfredeen
PongWorld.com
www.pongworld.com

-Original Message-
From: Jordan Elver [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 3:20 PM
To: PHP General Mailing List
Subject: [PHP] Splitting Text


Hi, 
Can anyone give some pointers for my problem.
I want to pull articles out of a db and then show the first x number of
words 
with a read more link to the rest of the article. 

Could someone point me in the right direction. I've seen a code snippet for 
this, but now I can't find it :-(

TIA,

Jord

-- 
Jordan Elver
http://www.jordanelver.co.uk

Oops, my brain just hit a bad sector!

-- 
PHP General 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 General 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] selecting words

2001-08-07 Thread Alfredeen, Johan

Jamie,
  There was a post earlier very similar to this. If you have a database, you
could use SELECT LEFT(mycolumn, 100) FROM mytable WHERE ...

Without a db, you can use the PHP substring function:

substr()

Hope this helps,

Johan Alfredeen
www.pongworld.com


-Original Message-
From: Jamie Saunders [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 3:53 PM
To: [EMAIL PROTECTED]
Subject: [PHP] selecting words


Hi,

What I'd like to do is take a string (paragraph) of text consisting of say
500 words and display only the first 100 words.  Is there a function able to
do this?

Thanks.

Jamie



-- 
PHP General 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 General 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] Select

2001-08-14 Thread Alfredeen, Johan

Jeremy,
  The reason you are only getting the first value is because you are only
retrieving the first value and assigning it to $data. You need to step
through the result and do something with it. For example,

if ($row = mysql_fetch_array($result)) {
do  {
$data1 = $row["mycolumn1"];
$data2 = $row["mycolumn2"];
} while ($row = mysql_fetch_array($result));
// more code
}

Alternatively, you could insert the values into a multidimensional array
inside the loop, so you don't have to hardcode the columns. It's up to you.

Johan Alfredeen
pongworld.com


-Original Message-
From: Jeremy Morano [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 8:53 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Select


Hi,

I'm having a problem with my Select statement. This is what i'm doing:



$connection = @mysql_connect("l", "c", "c") or die("Couldn't connect.");

$db = @mysql_select_db($db_name, $connection) or die("Couldn't select
database.");

$sql =" SELECT *
FROM table_1
";

$result = @mysql_query($sql,$connection) or die("Couldn't execute query.");

$data=mysql_fetch_row($result);
$count=$data[0];

echo   $count;



Yet the only result I get is the first value of the first
column.


-- 
PHP General 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 General 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] Looking for link system

2001-08-14 Thread Alfredeen, Johan

Search 
http://sourceforge.net/ and

http://freshmeat.net/

Good luck,

Johan Alfredeen
PongWorld.com


-Original Message-
From: Thomas Deliduka [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 9:20 AM
To: PHP List
Subject: [PHP] Looking for link system


I'm looking for a yahoo-style link system done in PHP.

Anyone know if a good one exists out there and where I can find it?

-- 

Thomas Deliduka
IT Manager
 -
New Eve Media
The Solution To Your Internet Angst
http://www.neweve.com/



-- 
PHP General 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 General 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] insertion question

2001-08-15 Thread Alfredeen, Johan

My experience, at least from Oracle and SQLServer, is that very large tables
(many millions of records) is not really a problem as long as you design and
index well. Where you'll run into problems is when you try to join 2 very
large tables together on the fly. This is where you'll need to do prejoins
or look into the whole db wharehouse/OLAP design methodology.

So I recommend you use one large table with 3 columns (or 4 if you need the
source file info or some surrogate key). This will be a much sleeker and
flexible db design, and it sounds like you will not be doing any joins
between 2 or more large tables any way.

Johan Alfredeen
PongWorld.com



-Original Message-
From: Pétur Björn Thorsteinsson
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 11:49 AM
To: [EMAIL PROTECTED]
Subject: [PHP] insertion question


I have to store a whole lot of text files into a database, each one
containing 3 columns containing numbers and about 2500 lines. I was
wondering if anyone knew which would be the best way to store these files,
having one big table with each row containing the contents of the files, or
making one table for each file and inserting each line of the file into its
respective row in the database. The database will probably become pretty
big and I'm looking for the option that won't slow it down too much.

-petur


-- 
PHP General 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 General 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] weird array behaviour

2001-08-15 Thread Alfredeen, Johan

Nick,
  I also have noticed "weird" behavior with multi (or 2D) arrays. Read more
on the manual board about arrays. However, I have finally figured out
something that works. Be careful of you you define the subarray, assign
values, and read the array. Here's what works for me:

Creating: (you could also use array_push(), but I don't think that is
supported by PHP3)

$myarray = array();
$myarray[] = array();

Assigning:

$myarray[$i][$j] = "some value";
(j can be blank or i and j can be hardcoded integers).

Reading (this was the most tricky for me):
returning $myarray[$i][$j] didn't seem to work (although the manual says it
should). It seems to work when $i and $j are hardcoded integers,
ie $myarray[0][1]

When $i and $j must be variables like your $key and $value, I finally went
with nested for loops (this works):

function print_array2D($array) {
   if(gettype($array)=="array") {
$maxi = count($array) - 1;
reset($array);

for ($i=0; $i<=$maxi; $i++) {
echo "$i: ";
$subarray = $array[$i];

for ($j=0; $j<2; $j++) {
echo "$subarray[$j] ";
}

echo "";
}
   }
   else {
echo $array;
   }
}

Johan



-Original Message-
From: Nick Davies [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 15, 2001 9:33 AM
To: [EMAIL PROTECTED]
Subject: [PHP] weird array behaviour



I have a function which returns a mulit-dimensional array, but the array
which is returned doesn't "work" for some reason :/

If i print the array within the function using

while (list($key) = each($myArray)) {
while (list($key2, $value2) = each($myArray[$key])) {
print $key . " : " . $key . " : " . $value;
}
}

it works fine but doing the same thing after the array has been returned
jus yields -- Warning:  Variable passed to each() is not an array or
object in ... refering to $myArray[$key];

even though if i print $myArray[$key] it tells me that it's an Array :/

Thanks.

Nick.


-- 
PHP General 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 General 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] Zend Optimizer

2001-08-16 Thread Alfredeen, Johan

Ok, I've searched the archives and even contacted the Zend staff on this
one, and I'm still confused. I also posted this question at the Zend
Optimizer Forum but have not received an answer. I'm hoping one of you has
some idea of how the Zend Optimizer works and can explain it. My webhost
offers PHP 4 on Linux/Apache with the Zend Optimizer (v0.99) Engine (v1.0.3)
and I have checked phpinfo() to make sure it's installed and running. I
would like to optimize a particular function that generates a graph image on
the fly. What do I need to do make use of the Zend Optimizer? Is it used
automatically or do I first need to compile the code into a binary file? If
someone knows a great source of info on this (other than www.zend.com), that
would be helpful too.

Thanks,
Johan Alfredeen


-- 
PHP General 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] MySQL substrings?

2001-08-20 Thread Alfredeen, Johan

This is actually not so difficult. Just download the mySQL documentation
(from mysql.org or .com I believe is where I got it) and search the function
list.

Johan Alfredeen


-Original Message-
From: Tom Carter [mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 19, 2001 8:53 AM
To: Chris Lambert; [EMAIL PROTECTED]
Subject: Re: [PHP] MySQL substrings?


very hard obviously.. I've looked quite a bit before to no avail! I tried
guessing it, obviously stupidity prevailed

(note to self.. go back and use substring function instead)
- Original Message -
From: "Chris Lambert" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 19, 2001 3:48 PM
Subject: Re: [PHP] MySQL substrings?


> There is a SUBSTRING() function, its just hard to find with their search
> system.
>
> /* Chris Lambert, CTO - [EMAIL PROTECTED]
> WhiteCrown Networks - More Than White Hats
> Web Application Security - www.whitecrown.net
> */
>
> - Original Message -
> From: Tom Carter <[EMAIL PROTECTED]>
> To: Seb Frost <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Sunday, August 19, 2001 10:32 AM
> Subject: Re: [PHP] MySQL substrings?
>
>
> | You can achieve the same effect by using left and right
> | - Original Message -
> | From: "Seb Frost" <[EMAIL PROTECTED]>
> | To: <[EMAIL PROTECTED]>
> | Sent: Sunday, August 19, 2001 3:12 PM
> | Subject: [PHP] MySQL substrings?
> |
> |
> | > This is thew sort of thing I want:
> | >
> | > SELECT * FROM table ORDER BY substr(field,5,6)
> | >
> | > but I don't know the correct function, if there is one, or how to
> | implement
> | > it.
> | >
> | > cheers,
> | >
> | > - seb
> | >
> | > -Original Message-
> | > From: Michael [mailto:[EMAIL PROTECTED]]
> | > Sent: 19 August 2001 12:51
> | > To: [EMAIL PROTECTED]
> | > Subject: [PHP] Re: transaction
> | >
> | >
> | > Nafiseh Saberi wrote:
> | > >
> | > > hi.
> | > > in large database with php,postgres
> | > > and when in each time come many request ,
> | > > how do we implement transactions??
> | >
> | > > nafiseh.
> | >
> | > If you are wanting to run several queries in the one script though the
> | > one transaction -
> | > you'll need to send a begin(as a query) and execute it - then to the
> | > same connection send all your other queries as normal, and follow it
up
> | > with a commit.
> | >
> | > --
> | > PHP General 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 General 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 General 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 General 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 General 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 General 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] php query for mysql table

2001-08-20 Thread Alfredeen, Johan

Wolfgang,
Use LIKE '%life%' as in

SELECT somecolumn FROM mytable WHERE LOWER(mycolumn) LIKE '%life%'

Don't forget to compare same case strings.

Johan Alfredeen
www.pongworld.com


>From mySQL manual:
mysql> SELECT * FROM tbl_name WHERE set_col LIKE '%value%';
mysql> SELECT * FROM tbl_name WHERE FIND_IN_SET('value',set_col)>0;



-Original Message-
From: Wolfgang Schneider [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 20, 2001 4:22 AM
To: php-general
Subject: [PHP] php query for mysql table


Hi

I am a newbie to php + mysql and wanted to ask for some help on a
particular item which I can't seem to find "the right key" in the
documentation.  I am trying to set up a simple Q&A system with an entry
page where one can select to either have all questions & answers from a
mysql database displayed or else search with a text field for only
those questions which contain a certain word(s).

Can someone tell me how to set in a query when trying to find records
in a mysql table that have a certain word or perhaps 2 or 3 words
(among others) ...? 

 I know about using SELECT and WHERE in order to find records which
match *exactly*, but am looking for something a bit different ...

Example:
The values of 3 records for the "question" field of the database might
be the following:

[1] How do you deal with anger?
[2] Ever been full of anger in your life?
[3] Is life always easy?

How can I set a PHP query with SELECT and WHERE to express the
following:

Which questions contain the word "life"? That is, have someone search
the database in the "question" field for records where the word "life"
is used as part of the question ...  The result then should return the
records 2 & 3 above

Any help is greatly appreciated. Thanks mucho.
God bless you with His grace and peace 
Wolfgang 

Looking for Biblical information? COME AND SEE! 
-- ONLINE Courses: http://classes.bibelcenter.de ... NEW!
-- BibelCenter: http://www.bibelcenter.de 
-- Bookstore: http://www.worthy.net/BibelCenter/ 




-- 
PHP General 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 General 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] Adding records to a MySql database

2001-08-20 Thread Alfredeen, Johan

Read in the mySQL manual at
/mysql_manual_split/manual-split/manual_Reference.html#CREATE_TABLE

etc

ie.

CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)]
[table_options] [select_statement]

ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...]

and more ...

Johan

-Original Message-
From: Dave.O [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 17, 2001 4:17 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Adding records to a MySql database


I am new to MySql but wanting to use PHP to update and maintain a database.
I thought I might use MySql.

I have installed MySql, and in PHP have created a database called 'mydir'. I
am trying to find php functions to add new records/fields to the database,
but all I can find are functions to query and get information from a
database.

Can anyone help or point me into the direction.

Thanks

Dave



-- 
PHP General 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 General 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] Adding records to a MySql database

2001-08-20 Thread Alfredeen, Johan

INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
[INTO] tbl_name [(col_name,...)]
VALUES (expression,...),(...),...
or  INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
[INTO] tbl_name [(col_name,...)]
SELECT ...
or  INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
[INTO] tbl_name
SET col_name=expression, col_name=expression, ...


-Original Message-
From: Dave.O [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 17, 2001 5:41 PM
To: Martín Marqués
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Adding records to a MySql database


I was looking for the command something like mysql_insert or something, just
found dba_insert() is this it ?!?

- Original Message -
From: "Martín Marqués" <[EMAIL PROTECTED]>
To: "Dave.O" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, August 18, 2001 12:23 AM
Subject: Re: [PHP] Adding records to a MySql database


> On Vie 17 Ago 2001 20:14, Dave.O wrote:
> > I have read the documentation already.
> >
> > I am trying to create a directory, which information can be added and
> > maintained through a the web browser.  I thought that using a MySql
> > database would be a good idea rather than writing it all to a file.  You
> > saying that MySql is a waste of time for this ?
> >
> > I thought that PHP can be used to add records etc and query databases
for
> > this
>
> You said that all you found were functions to query information. Thats all
> you need with an SQL database.
> The main SQL query commands are: SELECT, UPDATE, DELETE and INSERT. With
> those 4 comands you can read, insert and modify (also delete) the
information
> on your database.
>
> Hope you understand know.
>
> Saludos... :-)
>
> --
> Porqué usar una base de datos relacional cualquiera,
> si podés usar PostgreSQL?
> -
> Martín Marqués  |[EMAIL PROTECTED]
> Programador, Administrador, DBA |   Centro de Telematica
>Universidad Nacional
> del Litoral
> -
>
> --
> PHP General 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 General 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 General 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] PHP Security

2001-08-31 Thread Alfredeen, Johan

I am looking for a good, practical tutorial on what I should be doing as a
developer to create a secure web site (PHP related). I have looked in my PHP
text and searched the web, but haven't found anything real useful. I am not
interested in Apache or OS security, as this is -hopefully- taken care of by
my webhost. So if you know of a good guide, online or off, please
contribute.

Thanks,

Johan
PongWorld.com


-- 
PHP General 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] PHP Security

2001-08-31 Thread Alfredeen, Johan

Thanks for the tip. This is what I am talking about. Even with an error like
the one you mention below, preferably the page should die nicely and not
output a bunch of secret info or other stuff to the client. I am generally
careful to prevent that from happening in all my dealings with my mySQL db
by checking all the db connections, results, and things, and killing the
execution if there was some error. This works well. But I am sure I have not
covered every possibility.

I am mainly looking for a list of links or textbooks that outlines some of
these things. 

Johan


-Original Message-
From: Seb Frost [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 31, 2001 9:57 AM
To: Alfredeen, Johan; [EMAIL PROTECTED]
Subject: RE: [PHP] PHP Security


Great question - I'd love to know too.

I can give you one hint.  Make sure that you validate any variables passed
in the url.  I had a script that should take an integer, and realised if
someone put in a fraction or text then the script output errors to the html
page showing file and directory names that I wanted hidden.

To solve this I used:

function SecureInt($var,$default)
{
if (($var!=0) && ($var*1!=0) && is_int($var*1))
{
$var=$var*1;
//echo "is int";
}
else
{
$var=$default;
//echo "is not int";
}
return($var);
}

$intvar = SecureInt($intvar,1);


- seb

-----Original Message-
From: Alfredeen, Johan [mailto:[EMAIL PROTECTED]]
Sent: 31 August 2001 15:54
To: [EMAIL PROTECTED]
Subject: [PHP] PHP Security


I am looking for a good, practical tutorial on what I should be doing as a
developer to create a secure web site (PHP related). I have looked in my PHP
text and searched the web, but haven't found anything real useful. I am not
interested in Apache or OS security, as this is -hopefully- taken care of by
my webhost. So if you know of a good guide, online or off, please
contribute.

Thanks,

Johan
PongWorld.com


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001

-- 
PHP General 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] array search

2001-08-31 Thread Alfredeen, Johan

Joseph,
 The below postings are what you're looking for. Hopefully the in_array PHP
function uses a smart search algorithm and doesn't go through the entire
array. If you store your values in a db you can make use of an index on the
column, or you could write your own search algorithm that uses a btree or
some other type of search methodology.

Johan


-Original Message-
From: Papp Gyozo [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 31, 2001 10:02 AM
To: Joseph Bannon; PHP (E-mail)
Subject: Re: [PHP] array search


yes, in_array($person, $people)!

however, you may take a look into the manual.
- Original Message -
From: Joseph Bannon <[EMAIL PROTECTED]>
To: PHP (E-mail) <[EMAIL PROTECTED]>
Sent: Friday, August 31, 2001 5:40 PM
Subject: [PHP] array search


> I have an array of names, like below...
>
> $people = array("Jim","John","JP");
>
> Is there a way in an IF statement to see if someone's name is in the
array?
> Like...
>
> if ($people =~ $person) { }
>
> I don't want to have to create a foreach loop to go through the array to
see
> if that person is there.
>
> Joseph
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> PHP General 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 General 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 General 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] RE: [PHP-WIN] Can PHP and Java work together?

2001-08-31 Thread Alfredeen, Johan

Jack,
  My apologies. Disregard my earlier example - it only works because the PHP
variable is "passed" to the javascript variable during onLoad when
everything is executed. But in your case, the page has already been sent to
the client and PHP can only be called by calling the server again.

Johan


> > -Original Message-
> > From: Jack [mailto:[EMAIL PROTECTED]]
> > Sent: August 31, 2001 2:13 AM
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: [PHP-WIN] Can PHP and Java work together?
> >
> >
> > Dear all
> > I want to ask if i want to perform two task after the user had click a
> > button,
> > 1 is the task perform by PHP
> > 2 is the task perform by JavaScript
> > is it possible to do so?
> >
> > I'm actually fresh on JavaScript, before i would call the
> JavaScript, what
> > should i do first or what should i set before though?
> >
> > Thx
> > Jack
> > [EMAIL PROTECTED]
> >
> >
> >
> > --
> > PHP Windows 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 General 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 General 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] Assign multiple variables from mysql_fetch_row() call

2001-09-04 Thread Alfredeen, Johan

You can use a while loop. Ie: (where $row is the result of a sql query)

if ($row = mysql_fetch_array($result)) {
do  {
$var1 = $row["column1"];
$var2 = $row["column2"];
$var2 = $row["column3"];
} while ($row = mysql_fetch_array($result));
}

Johan
Which World? PongWorld
www.pongworld.com


-Original Message-
From: Egan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 04, 2001 3:30 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Assign multiple variables from mysql_fetch_row() call


In perl I can say something like:

   ($var1, $var2) = $sqh->fetchrow_array()


to assign column values to more than one variable at a time.  So I
tried similar syntax with PHP:


($var1, $var2) = mysql_fetch_row($sqh);


but could not seem to work it out.

I know you can do this with a temporary array, and then take values
out of the array.  But it would be nice to omit the temporary array.

Is it possible?


Egan




-- 
PHP General 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 General 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] Can PHP and Java work together?

2001-08-31 Thread Alfredeen, Johan

Jack,
 Yes this is possible. I assume you want to use a javascript onClick event
function. Then in your javasript code, just execute your PHP code. You can
run PHP code within a javascript block. For example, on my site I assign a
javascript variable to the value held in a PHP variable like this:

var jstitle = ;

Good luck,

Johan
Which World?
www.pongworld.com


-Original Message-
From: Jack [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 31, 2001 2:13 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] Can PHP and Java work together?


Dear all
I want to ask if i want to perform two task after the user had click a
button,
1 is the task perform by PHP
2 is the task perform by JavaScript
is it possible to do so?

I'm actually fresh on JavaScript, before i would call the JavaScript, what
should i do first or what should i set before though?

Thx
Jack
[EMAIL PROTECTED]



-- 
PHP General 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 General 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] Variable naming

2001-09-25 Thread Alfredeen, Johan

Read this
http://www.php.net/manual/en/language.variables.variable.php

Johan
www.pongworld.com
php tt

-Original Message-
From: Fábio Migliorini [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 25, 2001 12:28 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Variable naming


$id = 1;
$sql_1 = "hey";
$vname = "sql_".$id;
echo $$vname;
--
Fábio Migliorini
http://www.atua.com.br
[EMAIL PROTECTED]
UIN: 42729458
Linux User: 175409
- Original Message -
From: "Kyle Moore" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 25, 2001 1:15 PM
Subject: [PHP] Variable naming


> I want to use the value of a variable in a variable name. For instance:
>
> $id = 1;
> $sql_$id = "hey"; //set variable $sql_1 to hey
> print $sql_1; //should print hey
>
> I have looked high and low on how to do this. My first idea was eval but
> I can't seem to get that to work in this instance. Any ideas? I'm sure
> it is possible and easy but I just can't figure out how to do this in
> php.
>
> Thanks
>
> --
> Kyle
>
>
> --
> PHP General 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 General 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 General 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] PHP & MySQL

2001-10-02 Thread Alfredeen, Johan

I'm a little confused over why you would display the same flavor more than
once for a single item. But ok. Have you thought about populating an array
with the flavors and then retrieving flavors from the array however many
times you need to in an if statement. Maybe it would be easier to comment if
we could see a sample page.

Johan

-Original Message-
From: Brian Lee [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 02, 2001 12:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP & MySQL


OK,

I am working on my first shopping cart using PHP and MySQL and I am having a

few problems.

The first problems is I need to bring out of a database a group of Jam 
flavors. I can do that but when certain items come up there needs to be the 
same flavors but repeated mutiple times and I am not sure how to get that to

work. I also am having a problem adding mutiple flavors to my cookies for 
check out later

Here is the code to bring the flavor selection up once. What I need is to 
figure out a way to bring it up 3,4,5 times depending on which item is 
clicked.








">




that will bring up the set of flavors once i need to be able to bring it up 
more than once but keep it in the same format and set it to a cookie.

Any help would be great. The project is already overdue so I am sort of a 
hurry.

-Brian

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


-- 
PHP General 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 General 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] MySQL tables are read-only

2001-10-04 Thread Alfredeen, Johan

My webhost recently migrated my site over to a new server and IP. Everything
looks ok, except that all my MySQL tables now are read-only (at least that's
the error I get when trying to delete or insert records). How do I change
the tables back to write? Can I switch individual tables to write or is
there a setting to set the whole db instance to write?

I am using MySQL 3.23.32 and phpAdmin 2.2.0rc3. I appreciate your help.

Johan Alfredeen
www.pongworld.com


-- 
PHP General 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] Timestamp math and format

2001-10-19 Thread Alfredeen Johan K

Thanks, That was just what I needed, ie:
SELECT DATE_FORMAT(DATE_SUB(insert_date, INTERVAL 2 HOUR), '%b %e (%r)')

Johan

> On 17-Oct-2001 Alfredeen Johan K wrote:
> > I store a timestamp in a database of when a record was 
> inserted. When I pull
> > it out, I format it like this SELECT 
> DATE_FORMAT(insert_date,'%b %e (%r)')
> > AS idate
> > 
> > Now I would like to subtract 2 hours from the hour part of 
> the timestamp.
> > What's the easiest way to do this, before or after the 
> formatting? In PHP or
> > mySQL function? Can someone give me some code of how they 
> would do this.
> > 
> 
> SELECT DATE_FORMAT(DATE_SUB(insert_date, INTERVAL 2 HOUR), 
> '%b %e (%r)')
> 
> Regards,
> -- 
> Don Read   [EMAIL PROTECTED]
> -- It is necessary for me to learn from others' mistakes. I 
>will not live long enough to make them all by myself.
> 



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