Not getting expected result from file()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm using the file function create an array.  I'm using a value from a form 
to see if it matches in elements in the array.

My problem is I expect  the condition to be true but info but my DB isn't 
populated as I in the right DB...
=================Code 
Begins======================================================
$theFileArray = file('C:\htdocs\folder1\file.txt');


if(isset($_POST['strName'], $_POST['strCity'], $_POST['strState']))
{
 $space = " ";
 $stringOne = $_POST['strName']. $space. $_POST['strCity']. $space . 
$_POST['strState'];

}
//I match the string "Grantsville Foodland Grantsville MD" letter for letter 
in the form and form info gets stored in unknown table and not central as it 
should...?

 if(in_array($stringOne, $theFileArray)) //Any Problem solvers, suggestions, 
or new ways to code welcome
 {
  $queryCentral = "INSERT INTO central (conName, conAddress, conCity,

conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, 
strName,

strCity, strState) VALUES('$regName', '$regAddress', '$regCity', 
'$regState',

'$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState',

'$sclZip', '$stoName', '$stoCity', '$stoState')";

  mysql_query($queryCentral, $connection) or die("Query failed: ".

mysql_error($connection));
 }


else
{
$queryUnknown = "INSERT INTO unknown (conName, conAddress, conCity, 
conState,

conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, 
strCity,

strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', 
'$regZip',

'$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState', '$sclZip',

'$stoName', '$stoCity', '$stoState')";
mysql_query($queryUnknown, $connection) or die("Query failed: ".

mysql_error($connection));
}

THIS WHAT FILE LOOKS LIKE //Any Problem solvers and suggestion welcome
=================================================
Begin Row 1
Grantsville Foodland Grantsville MD
Deep Creek Foodland Fresh Mc Henry MD
Oakland Foodland Oakland MD
Bridgeport Foodland Bridgeport WV
Grafton Foodland Grafton WV
Morgan's Foodland Fresh Kingwood WV
Petersburg Foodland Petersburg WV
Rainelle Foodland Rainelle WV
6th Avenue Foodland St. Albans WV
Weston Foodland Weston WV
Ambridge Foodland Ambridge PA
Curry Hollow Road Foodland Baldwin Pleasant Hills PA
Tusca Plaza Foodland Fresh Beaver PA
Bethel Park Foodland Bethel Park PA
Lebanon Shops Foodland Castle Shannon PA
Fatur's Foodland Delmont PA
Ford City Ford City PA
Glassport Foodland Glassport PA
Mount Royal Foodland Glenshaw PA
Grindstone Foodland Grindstone PA
Kittanning Foodland Kittanning PA
Mars Foodland Mars PA
Fifth Avenue Foodland Mc Keesport PA
Mckees Rocks Mckees Rocks PA
Monessen Foodland Fresh Monessen PA
Monongahela Foodland Monongahela PA
Great Valley Foodland N. Versailles PA
Gold Crown Foodland Nanty Glo PA
New Brighton Foodland New Brighton PA
J & J Foodland New Kensington PA
Brownsville Road Foodland Pittsburgh PA
Mt Washington Foodland Fresh Pittsburgh PA
Beechview Foodland Pittsburgh PA
Mcneilly Road Foodland Pittsburgh PA
Rochester Road Foodland Pittsburgh PA
Pines Plaza Foodland Pittsburgh PA
Point Marion Foodland Point Marion PA
Beulah Road Foodland Turtle Creek PA
Midtown Foodland Uniontown PA
Henderson Avenue Foodland Washington PA
Interstate Foodland Washington PA
Maiden Street Foodland Washington PA
Buttermilk Hollow Foodland West Mifflin PA
Village Foodland Fresh West Mifflin PA
Wellston Foodland Wellston OH
Westmoreland Foodland Fresh Huntington WV 

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux