This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Dreamweaver > February 2004 > DWMX and PHP4/3
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Phil King 2004-02-27, 3:28 pm |
| Hi All,
I'm creating a simple site for a colleague who happens to be on a PHP3
server.
When I create a simple paging process using DWMX behaviours I get a 'parse'
error.
This error seems to point to the 'array_push($newParams, $param);' element
of the snippet below.
$queryString_rsDisplay = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rsDisplay") == false &&
stristr($param, "totalRows_rsDisplay") == false) {
array_push($newParams, $param);
}
}
I believe that 'array_push' is not available at PHP3.
DWMX has inserted this as it uses the PHP4 model.
Can anyone advise on an equivalent command that will work with PHP3
Thanks very much for any assistance.
Phil.
| |
| Phil King 2004-02-29, 8:28 am |
| Hi Again,
After a bit of research I modified the code removing the array_push element
and replacing this with $newParams[] = $param;
(Snippet below)
Unfortunately I'm still getting the 'parse error' which indicates at the
line 'foreach ($params as $param) {'
Thanks for any advice you may have to offer.
Phil.
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rsDisplay") == false &&
stristr($param, "totalRows_rsDisplay") == false) {
/*array_push($newParams, $param);*/
$newParams[] = $param;
}
}
if (count($newParams) != 0) {
$queryString_rsDisplay = "&" . implode("&", $newParams);
}
}
$queryString_rsDisplay = sprintf("&totalRows_rsDisplay=%d%s",
$totalRows_rsDisplay, $queryString_rsDisplay);
?>
| |
| Gary White 2004-02-29, 11:28 am |
| "Phil King" <phil@REMOVEphil-king.com> wrote in message
news:c1skcs$rrb$1@forums.macromedia.com...
>
> Unfortunately I'm still getting the 'parse error' which indicates at the
> line 'foreach ($params as $param) {'
The foreach() construct was not introduced until PHP4. You can do something
like:
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
$n=count($params);
for($i=0;$i<$n;$i++){
$param=$params[$i];
if (stristr($param, "pageNum_rsDisplay") == false &&
stristr($param, "totalRows_rsDisplay") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rsDisplay = "&" . implode("&", $newParams);
}
}
$queryString_rsDisplay = sprintf("&totalRows_rsDisplay=%d%s",
$totalRows_rsDisplay, $queryString_rsDisplay);
Gary
| |
| Phil King 2004-02-29, 12:28 pm |
| Hi Gary,
Thanks very much for the advice.
Using your suggestion worked just fine.
Thanks again.
Phil.
"Gary White" <reply@newsgroup.please> wrote in message
news:c1t0b4$b01$1@forums.macromedia.com...
> "Phil King" <phil@REMOVEphil-king.com> wrote in message
> news:c1skcs$rrb$1@forums.macromedia.com...
>
>
> The foreach() construct was not introduced until PHP4. You can do
something
> like:
>
> if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
> $params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
> $newParams = array();
> $n=count($params);
> for($i=0;$i<$n;$i++){
> $param=$params[$i];
> if (stristr($param, "pageNum_rsDisplay") == false &&
> stristr($param, "totalRows_rsDisplay") == false) {
> array_push($newParams, $param);
> }
> }
> if (count($newParams) != 0) {
> $queryString_rsDisplay = "&" . implode("&", $newParams);
> }
> }
> $queryString_rsDisplay = sprintf("&totalRows_rsDisplay=%d%s",
> $totalRows_rsDisplay, $queryString_rsDisplay);
>
>
> Gary
>
>
| |
| Gary White 2004-02-29, 2:28 pm |
| "Phil King" <phil@REMOVEphil-king.com> wrote in message
news:c1t44f$f2e$1@forums.macromedia.com...
> Hi Gary,
>
> Thanks very much for the advice.
> Using your suggestion worked just fine.
>
> Thanks again.
You're welcome, Phil. Glad it helped.
Gary
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|