#1 (permalink)  
Old 11-06-2007, 07:53 PM
Registered User
 
Join Date: Jul 2004
Posts: 247
array and split warning in php

I get the following:
Quote:
Warning: split() [function.split]: REG_BADRPT in C:\xampp\htdocs\wheelofgod\search\cat\query.php on line 33

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\wheelofgod\search\cat\query.php on line 34

Warning: split() [function.split]: REG_BADRPT in C:\xampp\htdocs\wheelofgod\search\cat\query.php on line 42

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\wheelofgod\search\cat\query.php on line 44

Warning: split() [function.split]: REG_BADRPT in C:\xampp\htdocs\wheelofgod\search\cat\query.php on line 53

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\wheelofgod\search\cat\query.php on line 55
PHP Code:
    $keyworda $_REQUEST["keyworda"];
    
$keywordb $_REQUEST["keywordb"];
    
$keywordc $_REQUEST["keywordc"];
    
$keywordd $_REQUEST["keywordd"];
    
$keyworde $_REQUEST["keyworde"];
    
$keywordf $_REQUEST["keywordf"];
    
$keywordg $_REQUEST["keywordg"];
    
$keywordh $_REQUEST["keywordh"];
    
$spoke $_GET["spoke"]; //Request.Querystring("spoke")
    
$number $_GET["number"]; //Request.QueryString("number")
    
$id $_GET["id"]; //Request.QueryString("id")

    
$sql "Select * FROM book WHERE 1=1";

$i 0;

if 
/*($keyworda != "")*/(!empty($keyworda))
    {
        
$myarray split('+'$keyworda); [color="Cyan"]//line 33[/color]
        
foreach($myarray as $value)[color="Cyan"]//line 34[/color]
            
{
                
$whereclause .= " AND text_data LIKE '%".$value."%'";
            }
        
$sql .= $whereclause;        
    }
if (
$keywordb != "")
    {
        
$myarray split('+'$keywordb);[color="Cyan"]//line 43[/color]

        
foreach($myarray as $value)[color="Cyan"]//line 44[/color]
            
{
                
$whereclause .= " AND text_data LIKE '%".$value."%'";
                
$i++;
            }
        
$sql .= $whereclause;        
    }
if (
$keywordc != "")
    {
        
$myarray split('+'$keywordc);[color="Cyan"]//line 53[/color]

        
foreach($myarray as $value)[color="Cyan"]//line 53[/color]
            
{
                
$whereclause .= " AND text_data LIKE '%".$value."%'";
            }
        
$sql .= $whereclause;        
    }
        if (
$i != 0
            {
                
$sql.= " AND ";
        
$i ++;
            }
        
$sql.= " AND text_data LIKE '%".$keywordc."%' "
Reply With Quote

  #2 (permalink)  
Old 11-07-2007, 06:25 AM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,437
Try escaping the "+" character in your split statements. I didn't realize it, but apparently the split function accepts regex statements, which means that the "+" is a special character that needs to be escaped. Therefore, your split statements should look like:
PHP Code:
split('\+'$keyworda
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote
  #3 (permalink)  
Old 11-07-2007, 02:19 PM
Registered User
 
Join Date: Jul 2004
Posts: 247
I found the answer in http://www.w3schools.com/. I used explode() instead of split().
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I highlight a split function text? gilgalbiblewhee Programming and Scripting 7 01-31-2006 05:12 PM
Newb needs help with parsing an array into html output GregGaub Programming and Scripting 1 03-20-2005 06:39 PM


All times are GMT -5. The time now is 06:17 PM.

 
Bitrix
Clicky Web Analytics
CloudContacts
Maxtango


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
© 1997-2007 HTMLCenter