Jump to content

include problem


alin19

Recommended Posts

i'm using an open flash chart to create a grafic

 

 

the problem is that the index file looks like this:

<?php
include_once 'ofc-library/open_flash_chart_object.php';
open_flash_chart_object( 1500,'90%', 'chart-data.php', false );
?>

 

and from the file chart-data.php is created the grafic image,

 

and if i want to select from what to create the grafic i can't without modifing the chart-data.php code,

 

 

i made an improvization by adding in the index file 2 input slots and then write those values into a include.php and in the cart-data.php include that file, but the problem is that if the second user wants to view something else that include.php is modified for the first user also,

index file modified:


<form method="POST">
<table>
<tr><td><input type="text" name="simbol"></td><td><input type="text" name="scadenta"></td><td><input type="submit" name="submit" value="submit"></td></tr>
</table>
</form>

<?php
include_once 'ofc-library/open_flash_chart_object.php';
open_flash_chart_object( 1500,'90%', 'chart-data.php', false );
$simbol=$_POST['simbol'];
$scadenta=$_POST['scadenta'];

$write = fopen('/opt/lampp/htdocs/include.php','w');

$scris="<?php \$simbol='$simbol'; \$scadenta='$scadenta'; ?>";
fwrite($write,$scris);

?>

 

and in the chart data.php

<?php
include '/opt/lampp/htdocs/include.php';
// generate some random data:
/*
srand((double)microtime()*1000000);

$max = 50;
$data = array();
for( $i=0; $i<12; $i++ )
{
  $data[] = rand(0,$max);
}
*/
$hostname="**9*";
$username="**";
$password="**";
$database="**";

$conexiune=mysql_connect($hostname,$username,$password)
or die ("Nu ma pot conecta la baza de date");

$bazadate=mysql_select_db($database,$conexiune)
or die ("Nu gasesc baza de date");

$cerereMin="Select min(`price`) from tranzactii where `contract`='$simbol' and `scadenta`='$scadenta'";
$cerAM=mysql_query($cerereMin);
$cerEM=mysql_fetch_array($cerAM);
$min=$cerEM[0];
$min=$min*1000;
$cerereMax="Select max(`price`) from tranzactii where `contract`='$simbol' and `scadenta`='$scadenta'";
$cerAMa=mysql_query($cerereMax);
$cerEMa=mysql_fetch_array($cerAMa);
$max=$cerEMa[0];
$max=$max*1000;
..

 

what can i do to transmit some vars from the index file to chart-data.php without saving them into a file?

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.