phplearner2008 Posted August 30, 2008 Share Posted August 30, 2008 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? Link to comment https://forums.phpfreaks.com/topic/121982-how-do-i-access-and-edit-variables-of-another-php-file/ Share on other sites More sharing options...
wildteen88 Posted August 30, 2008 Share Posted August 30, 2008 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; Link to comment https://forums.phpfreaks.com/topic/121982-how-do-i-access-and-edit-variables-of-another-php-file/#findComment-629640 Share on other sites More sharing options...
Barand Posted August 30, 2008 Share Posted August 30, 2008 FROM and TO are both reserved words. Change your column names or use `FROM` and `TO` Link to comment https://forums.phpfreaks.com/topic/121982-how-do-i-access-and-edit-variables-of-another-php-file/#findComment-629665 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.