I am trying to translate the PHP script into Java. If anything please advise what or how this translates?

PHP:

if(isset($_GET['getClientId'])){  
  $res = mysql_query("select * from tableOne where clientID='".$_GET['getClientId']."'") or die(mysql_error());
  if($inf = mysql_fetch_array($res)

...

My attempt in Java and it is giving me errors with getClientId part and lost in fetching array part.

//db connection part here...

try {
String res = "";
if(getParameter("getClientId")) {
   res = stmt.executeQuery("select * from tableOne where clientID='" + getParameter("getClientId") + "');
  
String $inf []; 
if($inf.equals(getParameterValues($res)) {

....

Recommended Answers

All 4 Replies

are you wanting us to translate it into java for you or just explain what the php is doing so you can make it into java.

are you wanting us to translate it into java for you or just explain what the php is doing so you can make it into java.

I tried translating it to Java and its not working. I am trying (in Java) to take the results and return it as an array, where each field of the row is in an array key.

Please correct my translation attempt in Java if possible.

sorry i don't know java. hopefully someone else will be able to help.

Umm.. wouldn't it be better if you post your question in Java forum ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.