Question: I have a hadoop application. I write a java program which needs org.json.jar package as well as hadoop-core.jar. I compile this source file with the following linux command.

```
mkdir q3_classes
javac -classpath ${HADOOP_HOME}/hadoop-core.jar:${HADOOP_HOME}/org.json-20120521.jar -d q3_classes ETLQ3.java
jar -cvf q3.jar -C q3_classes/ .

```

It compiles successfully. But when I run this program with the following command. (The same command applies to WordCount example successfully.)

```
hadoop jar q3.jar MainClassName /input /output

```

It throws ClassNotFound exception. The org.json.object class cannot be found.

So I wonder is there anything wrong in my compile command? How to compile the java source file with these two jar packages?

Answer: 
[mysql\_affected\_rows](http://us1.php.net/mysql_affected_rows) count the number of affected rows on success, and -1 if the last query failed. 

```
echo ( mysql_affected_rows() > 0 ) ? "Success update" : "No rows update";

```
**mysql functions are deprecated, so you may want to use mysqli\_ functions.**

Using the deprecated mysql functions, one can use [mysql\_errno](http://php.net/manual/en/function.mysql-errno.php) to check if an error occurred.

```
$result = mysql_query("update testDb SET username ='$DataVar' WHERE ID = '$IdVar'");

if(mysql_errno($db)!=0) echo "Something went wrong";

```

I would not check mysql\_affected\_rows() as suggested by the other answers, because `mysql_affected_rows()=0` only implies that no row was updated, but it does not mean that an error occurred.

For example, if you have username="Rolf" with id=3, then if you execute

```
$result = mysql_query("update testDb SET username ='Rolf' WHERE ID = '3'")

```

no rows are affected, even though there was no error during the update.