Jump to content

This topic is 7262 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have a web application that currently accesses a filemaker 6 database from unlimited on a mac os x machine using fx.php. We are trying to upgrade to filemaker server 7 advanced and have run into some issues pulling the data from the databases. I have upgraded my fx.php to the latest version so it will work with filemaker 7. The problem I'm having is that when I do a FMFind() or even a FMFindAll() my foundCount is always zero. For example, I am trying to query a login database for my username and password for the web application. The record exists so it should be returned however it's not. Here is what returns when I do a FMFindAll()???

array(9) { ["data"]=> array(0) { } ["linkNext"]=> string(0) "" ["linkPrevious"]=> string(59) "/login.php?skip=0&username=test&password=test&" ["foundCount"]=> int(0) ["fields"]=> array(3) { [0]=> array(5) { ["emptyok"]=> string(3) "YES" ["maxrepeat"]=> string(1) "1" ["name"]=> string(6) "username" ["type"]=> string(4) "TEXT" ["extra"]=> string(0) "" } [1]=> array(5) { ["emptyok"]=> string(3) "YES" ["maxrepeat"]=> string(1) "1" ["name"]=> string(4) "password" ["type"]=> string(4) "TEXT" ["extra"]=> string(0) "" } [2]=> array(5) { ["emptyok"]=> string(3) "YES" ["maxrepeat"]=> string(1) "1" ["name"]=> string(8) "clientId" ["type"]=> string(4) "TEXT" ["extra"]=> string(0) "" } } ["URL"]=> string(129) "http://xxxx:[email protected]:80/fmi/xml/FMPXMLRESULT.xml?-db=Login.fp7&-lay=login&-lay.response=login&-max=All&-findall" ["query"]=> string(0) "" ["errorCode"]=> string(1) "0" ["valueLists"]=> array(0) { } }

So it appears that it is reaching the database, however I can't get any records return. The database is open on server advanced and shared (it can be accessed on the web) and the privileges for the password I'm using to connect has access to everything..... Is there something I'm missing?

Here is the code I used:

$serverIP = "127.0.0.1";

$user = "xxxx";

$pwd = "xxxx;

$dbName = "Login.fp7";

$layout = "login";

$groupSize = "All";

include_once("FX.php");

$query = new FX($serverIP);

$query->SetDBPassword($pwd, $user);

$query->SetDBData($dbName, $layout, $groupSize, $layout);

$data = $query->FMFindAll();

var_dump($data);

Posted

You seem to have the $layout variable listed twice in your SetDBParam() line - kill the last one (unless it's a typing or copy/paste error!) as it's only needed once.

Cheers,

Kevin Futter

Posted

Thanks for your replies! I have managed to narrow it down and figure out what my problem was. I had changed the dataServerType to FMPro 7. The problem was the $groupSize = "All". This must no longer work with filemaker 7 because once I removed it I got records returned. It also worked if I changed the $groupSize = 1. Everything is working now.

Posted

jfrancis, can you post your full code here now? I'm stuck in almost the same spot, or was earlier, now when I FMFindall() i get a -1 back. Perhaps its something your code could help me solve. Thanks alot.

Posted

I changed two lines in the FX v3: line 50 to FMPro 7, as DanBrill noted and line 196 where I changed the dataPort to 80. My code is basically the same as I originally posted, here it is again with the minor changes:

-------My config.php file----------

//I'm using this ip as an example I'm not actually work on the localhost

session_start();

// if no session then login

if(!isset($HTTP_SESSION_VARS["clientId"])){

$serverIP = "127.0.0.1";

$dbName = "Login.fp7";

$layout = "login";

$user = "test";

$pwd = "test";

$groupSize = 1;

}

else{

//...additional code for searching once logged in

// too long to post

}

-------My db_conn.php file-------------

include_once("FX.php");

$query = new FX($serverIP);

$query->SetDBPassword($pwd, $user);

$query->SetDBData($dbName, $layout, $groupSize);

//search db from passed variables, POST or GET, unfortunately I'm stuck using a server with an old version of php, hence the HTTP_POST_VARS

$arrayName = 'HTTP_' . $HTTP_SERVER_VARS["REQUEST_METHOD"] . '_VARS';

if(count($$arrayName) != 0){

foreach ($$arrayName as $key => $value) {

$query->AddDBParam($key, $value, 'eq');

}

$data = $query->FMFind();

}

-----My login.php file-----

//called from my login form

require("config.php");

include("db_conn.php");

if($data['foundCount'] > 0){

$username = $HTTP_POST_VARS["username"];

foreach ($data['data'] as $key => $value) {

$clientId = $value['clientId'][0];

}

$HTTP_SESSION_VARS["username"] = $username;

$HTTP_SESSION_VARS["clientId"] = $clientId;

header("Location: ../search/");

}

else{

$error = urlencode("Incorrect username and/or password");

header("Location: /?error=$error");

}

You don't need to have groupSize on the SetDBData() however I am reusing the db_conn.php to display results where I'm using paging (I believe you can use $groupSize = "" to get all results back with a FMFind() instead of "All"). Other than that make sure the IP that you are calling on has server 7 advanced and apache running. Also make sure the username and password you are using to connect to the database has permission to access the data (for 7 I believe you must have a username and password.)

Hopefully that helps....

Posted

sorry, apache needs to be running if your on a mac, I just noticed that you are using Windows. According to the system requirements for windows it appears that you have to use IIS.... so that's doesn't look like that would be the issue.

  • 3 weeks later...
Posted

$serverIP = "127.0.0.1";

$user = "xxxx";

$pwd = "xxxx;

$dbName = "Login.fp7";

$layout = "login";

$groupSize = "All";

include_once("FX.php");

$query = new FX($serverIP);

$query->SetDBPassword($pwd, $user);

$query->SetDBData($dbName, $layout, $groupSize, $layout);

$data = $query->FMFindAll();

var_dump($data);

once you have that, how can you display all the data in a table? any clues

  • 3 weeks later...
  • Newbies
Posted

The next step is to grab the data and output/parse the xml.

Your last 2 lines could be

$result = $query->FMFindAll();

$data = current($result['data']);

Since you're finding everything, you need to use PHP to step it out...

foreach ($result['data'] as $field) {

echo $field['firstName'][0] . " " . $field['firstName'][0] . "<br />";

}

If you had a found count of 1, forget the foreach and your data would be $data['firstName'][0]

The last [0] has to do with xml arrays that FileMaker outputs. They're easy to forget, but don't!

Hope this helps. One caveat, I haven't tested in server 7 advanced, but everyone says it works the same... I'll find out for myself

  • 3 months later...
  • Newbies
Posted

I've previously used -findAll with groupSize=0 to get the number of records (using foundCount) in a FM 6 database (without retrieving the records).

However - there is a difference in the XML retrieved from FM6 and FM7SA.

In FM7SA - the correct foundCount is present in the DATABASE tag as e.g. RECORDS=56 but in the RESULTSET tag FOUND is set to 0 (or the number of groupsize is groupsize<foundCount) - (and hence foundCount will be 0).

In FM 6 the RESULTSET tag displays FOUND="56" even if groupsize is set to 0 (and hence foundCount will be correct).

Therefore I cannot use the same method to get the the number of records in the two different types of databases.

Is there a way to use the same methods from FX, that can return the number of records in a FM6 and an FM7SA database (except from, of course, changing dataServerType)??

  • Newbies
Posted

I've previously used -findAll with groupSize=0 to get the number of records (using foundCount) in a FM 6 database (without retrieving the records).

However - there is a difference in the XML retrieved from FM6 and FM7SA.

In FM7SA - the correct foundCount is present in the DATABASE tag as e.g. RECORDS=56 but in the RESULTSET tag FOUND is set to 0 (or the number of groupsize is groupsize<foundCount) - (and hence foundCount will be 0).

In FM 6 the RESULTSET tag displays FOUND="56" even if groupsize is set to 0 (and hence foundCount will be correct).

Therefore I cannot use the same method to get the the number of records in the two different types of databases.

Is there a way to use the same methods from FX, that can return the number of records in a FM6 and an FM7SA database (except from, of course, changing dataServerType)??

  • Newbies
Posted

I've previously used -findAll with groupSize=0 to get the number of records (using foundCount) in a FM 6 database (without retrieving the records).

However - there is a difference in the XML retrieved from FM6 and FM7SA.

In FM7SA - the correct foundCount is present in the DATABASE tag as e.g. RECORDS=56 but in the RESULTSET tag FOUND is set to 0 (or the number of groupsize is groupsize<foundCount) - (and hence foundCount will be 0).

In FM 6 the RESULTSET tag displays FOUND="56" even if groupsize is set to 0 (and hence foundCount will be correct).

Therefore I cannot use the same method to get the the number of records in the two different types of databases.

Is there a way to use the same methods from FX, that can return the number of records in a FM6 and an FM7SA database (except from, of course, changing dataServerType)??

This topic is 7262 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.