Need Help Getting Application Working


#1

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!!!


#2

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

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#3

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


#4

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?


#5

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

-Scott


#6

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


#7

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.


#8

[quote]33: $branches = mysql_query(“select * from branches where branchType = ‘physical’ ORDER BY branch”);
34: $numBranches = mysql_num_rows($branches);[/quote]
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 -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


#9

I have enabled some more MySQL error showing.

It is now displaying things such as:

Warning: mysql_query() [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. :frowning:


#10

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?


#11

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?