Jump to content

[SOLVED] PHP / JAVA echo out java help


thisisnuts123

Recommended Posts

hello guys

i have read some articles and am trying to figure out how to echo out java script.. i never really understand the consept..

any one can explain better?

 

phpfuntion()
{
$query  = "SELECT `itemnum` , `sitedat` FROM layout WHERE `set` = 'dropbox' ";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
        $site[0] = $row[1];
      } 	 	

 

i wana alert out site[0]

how can this be done thanks

Link to comment
https://forums.phpfreaks.com/topic/75749-solved-php-java-echo-out-java-help/
Share on other sites

here you go

 

funtion()
{
$query  = "SELECT `itemnum` , `sitedat` FROM layout WHERE `set` = 'dropbox' ";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
        $site[0] = $row[1];

echo "<script>alert('{$site[0]}');</script>";
      } 		

 

function update_dropbox($data_array, $col_check)
{
      	$i = 0;
$o = array();
foreach($data_array AS $set => $items)
{
foreach($items AS $item)
{
$item = mysql_escape_string($item);
       	$set  = mysql_escape_string($set);
$o[$i] = $items[$i];

       $query  = "SELECT `sitedat` FROM layout WHERE `item` = '$o[0]'";
       $result = mysql_query($query);
       $row = mysql_fetch_row($result);
       $sitevalue = $row[0];
       $i ++;
       
  	}
}
        echo "<script>alert('{$sitevalue}');</script>";

return $sitevalue;
}

 

function sajax_update($data)
{
  $data = parse_data($data);
  $website = update_dropbox($data, "AND (`set` = 'dropbox')");
  return $website;
  return 'y';
}

 

 

Firstly, you must understand that Java is not Javascript. Secondly, PHP is a server side language which is run on the server and then sends its response to the client. Javascript on the other hand is run on the client. You cannot simply call a Javascript function from PHP and vice versa.

it is using sajax so the information is passed properly to php

 

if i use a debuger program i can see

echo "<script>alert('{$site[0]}');</script>";

 

the variable getting populated.

 

but i can't figure out how to use sajax to now pass the information back to java

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.