Hi

I have 2 php files first file index.php send the selected product_id to edit_order.php to be selected from the mysql DB and the related row be stored into an array and the array will be paged into index php to be loaded into the edit prompt screen to be edited by user and be submited again.

the problem is that, the edit_user.php wont send the query back to index.php

It surly selects the row, as it echo the array for me.


here is the index.php JScript function that sends the product_id

Code:
function editRecord(f1) {
var mySite= document.getElementById('rowNu').value
t = './edit_order.php?s=' + mySite;
t = encodeURI (t);
f1.action = t;
f1.submit();
}
and here is the edit_record. php
PHP Code:


<?php
//include 'delfile.php'; 

$q=$_GET["s"];

$con mysql_connect('localhost''root''');
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }

mysql_select_db("userinfo"$con);
mysql_query("INSERT INTO admin1 unit_price VALUE (34) WHERE product_id = '".$q."'");
        
$sql sprintf("SELECT * FROM admin1 WHERE product_id = '".$q."'"$q);


//$sql="SELECT * FROM admin1 WHERE product_id = '".$q."'";
$result mysql_query($sql);

$row json_encode(mysql_fetch_array($result));

echo 
"queryResults('" $row "');";
//$rowedit = mysql_fetch_array($result);
//setcookie("rowEdit",$rowedit);
?>
here is the code in index.php that suppose to read the json
Code:
<script src="edit_order.php?query=jones">
function queryResults(data) {

var results = JSON.parse(data);

prompt(document.write("<p>Unit Price = " + result.unit_price + "</p>"));

}
</script>
I have learnt it fromhttp://www.ehow.com/how_8584143_java...y-via-php.html