This is probably simple, but I want to pull out data (not count) from
a string, and the preg_grep looked like the best option. I'm pulling
an entry out of the database (which is a text field), a sample being:
Note #13 for Task #23 added to the system. I want to pull the 13, and
the 23 out. (probably need 2 different calls, but that's ok).
The problem that I'm having though is this: Warning: preg_grep()
expects parameter 2 to be array, string given in table.php on line 18
Here is the code for that line: $note = preg_grep("/^Note #([0-9]+)/",
$text);
$text is the value of $row['text'] (tried $row['text'] first, but had
the same thing).
Now, I thought that something of type text would be a string/array, so
why doesn't it like it? I'm running PHP 5.2.1 right now, if that
helps any. 4 3012
On 05.06.2007 22:38 pa***********@gmail.com wrote:
This is probably simple, but I want to pull out data (not count) from
a string, and the preg_grep looked like the best option. I'm pulling
an entry out of the database (which is a text field), a sample being:
Note #13 for Task #23 added to the system. I want to pull the 13, and
the 23 out. (probably need 2 different calls, but that's ok).
The problem that I'm having though is this: Warning: preg_grep()
expects parameter 2 to be array, string given in table.php on line 18
Here is the code for that line: $note = preg_grep("/^Note #([0-9]+)/",
$text);
$text is the value of $row['text'] (tried $row['text'] first, but had
the same thing).
Now, I thought that something of type text would be a string/array, so
why doesn't it like it? I'm running PHP 5.2.1 right now, if that
helps any.
You want preg_match or preg_match_all, not preg_grep.
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
On Jun 5, 4:58 pm, gosha bine <stereof...@gmail.comwrote:
On 05.06.2007 22:38 paladin.ri...@gmail.com wrote:
This is probably simple, but I want to pull out data (not count) from
a string, and the preg_grep looked like the best option. I'm pulling
an entry out of the database (which is a text field), a sample being:
Note #13 for Task #23 added to the system. I want to pull the 13, and
the 23 out. (probably need 2 different calls, but that's ok).
The problem that I'm having though is this: Warning: preg_grep()
expects parameter 2 to be array, string given in table.php on line 18
Here is the code for that line: $note = preg_grep("/^Note #([0-9]+)/",
$text);
$text is the value of $row['text'] (tried $row['text'] first, but had
the same thing).
Now, I thought that something of type text would be a string/array, so
why doesn't it like it? I'm running PHP 5.2.1 right now, if that
helps any.
You want preg_match or preg_match_all, not preg_grep.
--
gosha bine
extended php parser ~http://code.google.com/p/pihipi
blok ~http://www.tagarga.com/blok
But I want to pull the data out. I know it's already there.
preg_match just tells me how many matches there are (in this case, 1) pa***********@gmail.com wrote:
On Jun 5, 4:58 pm, gosha bine <stereof...@gmail.comwrote:
>On 05.06.2007 22:38 paladin.ri...@gmail.com wrote:
>>This is probably simple, but I want to pull out data (not count) from a string, and the preg_grep looked like the best option. I'm pulling an entry out of the database (which is a text field), a sample being: Note #13 for Task #23 added to the system. I want to pull the 13, and the 23 out. (probably need 2 different calls, but that's ok). The problem that I'm having though is this: Warning: preg_grep() expects parameter 2 to be array, string given in table.php on line 18 Here is the code for that line: $note = preg_grep("/^Note #([0-9]+)/", $text); $text is the value of $row['text'] (tried $row['text'] first, but had the same thing). Now, I thought that something of type text would be a string/array, so why doesn't it like it? I'm running PHP 5.2.1 right now, if that helps any.
You want preg_match or preg_match_all, not preg_grep.
-- gosha bine
extended php parser ~http://code.google.com/p/pihipi blok ~http://www.tagarga.com/blok
But I want to pull the data out. I know it's already there.
preg_match just tells me how many matches there are (in this case, 1)
I'd suggest you just read documentation http://php.net/preg_match http://php.net/preg_match_all http://php.net/preg_grep
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
On Jun 5, 5:46 pm, gosha bine <stereof...@gmail.comwrote:
paladin.ri...@gmail.com wrote:
On Jun 5, 4:58 pm, gosha bine <stereof...@gmail.comwrote:
On 05.06.2007 22:38 paladin.ri...@gmail.com wrote:
>This is probably simple, but I want to pull out data (not count) from a string, and the preg_grep looked like the best option. I'm pulling an entry out of the database (which is a text field), a sample being: Note #13 for Task #23 added to the system. I want to pull the 13, and the 23 out. (probably need 2 different calls, but that's ok). The problem that I'm having though is this: Warning: preg_grep() expects parameter 2 to be array, string given in table.php on line 18 Here is the code for that line: $note = preg_grep("/^Note #([0-9]+)/", $text); $text is the value of $row['text'] (tried $row['text'] first, but had the same thing). Now, I thought that something of type text would be a string/array, so why doesn't it like it? I'm running PHP 5.2.1 right now, if that helps any.
You want preg_match or preg_match_all, not preg_grep.
--
gosha bine
extended php parser ~http://code.google.com/p/pihipi
blok ~http://www.tagarga.com/blok
But I want to pull the data out. I know it's already there.
preg_match just tells me how many matches there are (in this case, 1)
I'd suggest you just read documentation
http://php.net/preg_matchhttp://php.....net/preg_grep
--
gosha bine
extended php parser ~http://code.google.com/p/pihipi
blok ~http://www.tagarga.com/blok
Ahhh... I missed the extra parameters for preg_match.... I was
looking at what was returned. Silly me. Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Stevey |
last post by:
I have the following XML file...
<?xml version="1.0"?>
<animals>
<animal>
<name>Tiger</name>
<questions>
<question index="0">true</question>
<question index="1">true</question>
</questions>
|
by: nospam |
last post by:
Ok, 3rd or is it the 4th time I have asked this question on Partial Types,
so, since it seems to me that Partial Types is still in the design or
development stages at Microsoft, I am going to ask...
|
by: Ekqvist Marko |
last post by:
Hi,
I have one Access database table including questions and answers. Now
I need to give answer id automatically to questionID column. But I
don't know how it is best (fastest) to do?
table...
|
by: glenn |
last post by:
I am use to programming in php and the way session and post vars are past
from fields on one page through to the post page automatically where I can
get to their values easily to write to a...
|
by: Rider |
last post by:
Hi, simple(?) question about asp.net configuration..
I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm
first start application the follow message shown.
=========
Server...
| |
by: Jeff |
last post by:
In the function below, can size ever be 0 (zero)?
char *clc_strdup(const char * CLC_RESTRICT s)
{
size_t size;
char *p;
clc_assert_not_null(clc_strdup, s);
size = strlen(s) + 1;
|
by: spibou |
last post by:
In the statement "a *= expression" is expression assumed to be
parenthesized ? For example if I write "a *= b+c" is this the same
as "a = a * (b+c)" or "a = a * b+c" ?
|
by: Allan Ebdrup |
last post by:
Hi,
I'm trying to render a Matrix question in my ASP.Net 2.0 page, A matrix
question is a question where you have several options that can all be rated
according to several possible ratings (from...
|
by: Zhang Weiwu |
last post by:
Hello!
I wrote this:
..required-question p:after {
content: "*";
}
Corresponding HTML:
<div class="required-question"><p>Question Text</p><input /></div>
<div...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |