Need Help Getting Application Working

Need Help Getting Application Working

Posted by: Takodo
Posted on: 2008-03-16 19:04:00

I have an application i have been trying to get runing under DH for a while now, now I really need to get this working. Any help is greatly appreciated.

I have an internal app we use and it is runing fine on the internal WAMP server. It is now time to take it to an external host but I am having a few issues. It seems like MySQL issues but not 100% sure.

http://cdndemo.ytrack.org

Is the domain I am installing it to. One of the errors there is:

"Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/.laverne/ckikea/cdndemo.ytrack.org/selectBranch.php on line 34"

The code on that line is:

33: $branches = mysql_query("select * from branches where branchType = 'physical' ORDER BY branch");
34: $numBranches = mysql_num_rows($branches);

Any ideas what is going on here?

Thanks In Advance!!!

Re: Need Help Getting Application Working

Posted by: scjessey
Posted on: 2008-03-16 19:59:00

The error is almost certainly the result of a problem with your database connection (the "resource" the query needs).

-- si-blog --

Re: Need Help Getting Application Working

Posted by: sdayman
Posted on: 2008-03-16 20:01:00

The first error I'm seeing is that it can't connect to the SQL server. Do you have a database set up? You can't use 'localhost' for the server name. It should be something like db.ytrack.org, which is how I name my database servers when I set up a database.

As a side note, which version of MySQL were you running before? You may run into a compatibility issue as well.

-Scott

Re: Need Help Getting Application Working

Posted by: Takodo
Posted on: 2008-03-16 20:01:00

I can login in fine and use some of the applications functions. Trying some other things generates similar MySQL errors.

What would be the best way to see what is going on?

Re: Need Help Getting Application Working

Posted by: sdayman
Posted on: 2008-03-16 20:04:00

A Google search came up with this:
http://www.thescripts.com/forum/thread566858.html

-Scott

Re: Need Help Getting Application Working

Posted by: rlparker
Posted on: 2008-03-16 20:29:00

In reply to:

What would be the best way to see what is going on?


Sometimes I find it helpful to use phpMyAdmin interactively to test queries and troubleshoot. You can log into an instance of phpMyAdmin for your database by browsing directly to your host and providing your db user/pass.

--rlparker

Re: Need Help Getting Application Working

Posted by: Takodo
Posted on: 2008-03-16 20:59:00

I am running MySQl 5.0 on the local server. A DB is setup on the DH servers and I have changed the conection file to reflect this.

I can login which pulls the user/pass from the DB. I can also search for names in the application but do get MySQL errors. Kinda stumped here.

Re: Need Help Getting Application Working

Posted by: Atropos7
Posted on: 2008-03-16 21:06:00

In reply to:

33: $branches = mysql_query("select * from branches where branchType = 'physical' ORDER BY branch");
34: $numBranches = mysql_num_rows($branches);


It might help if there was a bit of error capturing going on. After all, mysql_query returns FALSE if there was an error.

$statement = 'SQL GOES HERE';
$result = mysql_query($statement);
if ($result === FALSE)) {
$error_message = mysql_error();
die('Database error: " . $error_message . " File: " . __FILE__ . " on line: " . __LINE__);
}
$branches = $result;
$num_branches = mysql_num_rows($branches);

In otherwords don't assume what was returned by the first function is indeed what you need to pass onto the second function when the documentation says the result value maybe of more than one type. In this case the mysql_query functiuon can return a 'resource' or a 'boolean' (the FALSE value).






cool openvein.org -//-

Re: Need Help Getting Application Working

Posted by: Takodo
Posted on: 2008-03-16 23:17:00

I have enabled some more MySQL error showing.

It is now displaying things such as:

Warning: mysql_query() [http://www.mysql.com/doc]: Table 'ytrackdemo.yConfiguration' doesn't exist in /home/.laverne/ckikea/cdndemo.ytrack.org/header.php on line 29

I know the table and the data it needs do exist. I can login to PHPMyAdmin view and query the data fine.

I'm sure it is some small configuration or compatibility issue but not sure what. :(

Re: Need Help Getting Application Working

Posted by: houkouonchi
Posted on: 2008-03-17 01:25:00

I noticed from the error message that the table listed is:

'yConfiguration'

I noticed that the C is capital. Do you think it could be a problem with the table name being case-sensitive?

Re: Need Help Getting Application Working

Posted by: Takodo
Posted on: 2008-03-17 22:18:00

I looked at the code and the line that it is getting an error on is:

$qryData = mysql_fetch_array(mysql_query("select description from yConfiguration where yItem = 'country'"));

It looks fine and the query works fine in PHPMyAdmin and on the local server. Some MySQL queries work others do not that should. Very stumped here.

I did notice in phpMyAdmin at the bottom it says:

The mbstring PHP extension was not found and you seem to be using a multibyte charset. Without the mbstring extension phpMyAdmin is unable to split strings correctly and it may result in unexpected results.

Could that be related?

Tags: mysql result resourcethanks in advancedhmysql result resourcethanks in advancedh