In my admin section, I want the user to be able to click a button and a HTML report to display all fields from all tables with the user id that is set in that session.
So $user_id = intval($_SESSION['user_id']);
Would the button be something like:
<?php
if (isset($_POST['doReport'])) {
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make connection.");
$query = ("SELECT user_id FROM users WHERE user_id = '$user_id');
}
// redirect to report page
header('Location: report.php?id=' . $user_id);
?>
<p align="center">
<input name="doReport" type="submit" id="doThesisReport" value="View Report">
Also, what would be the best way to lay it out in the report page as I have 7 tables.
I am looking for a quick easy fix
Thank you!
The good way to achieve this would be :
Now create the following logic for redirect page:
mysql_select_db();to select the database.Write the query like :
$result=mysql_query($query); Note that the result from database is saved into$result.print_r($result)mysql_close();Hopefully since the question is not clear, I’ve posted the basic logic.
EDITED : forgot to put query in code block.