Jump to content

how do I access and edit variables of another php file


phplearner2008

Recommended Posts

Hi,

 

I have a page called interest.php from where I insert variables $FROM and $TO to database. If it is successful, I want the values $FROM and $TO to be displayed in a table in another php file called interests_sent.php. How do I edit interests_sent.php file from interest.php file without using any url link or buttons.

 

interest.php

 

$sql = "INSERT INTO interests_sent(FROM,TO) values($FROM,$TO)";

$result = mysql_query($sql) or die("Query: " . $sql . "\n\n" . mysql_error());

 

how do I access interests_sent.php file here? Any ideas?

Your saving FORM and TO to the database, why don't you run a sql query in the interests_sent.php to retrieve these instead, eg

$sql = "SELECT FROM, TO FROM interests_sent ORDER DESC LIMIT 1";
$result = mysql_query($sql) or die("Query: " . $sql . "\n\n" . mysql_error());

list($FROM, $TO) = mysql_fetch_row($result);

echo $FROM . ' - ' . $TO;

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.