Note that there are some explanatory texts on larger screens.

plurals
  1. POMaking Variables Global in PHP?
    text
    copied!<p>Need to make $courseInfo and $row global so that they can be used for printing the row details in the header DIV.</p> <p>Don't have a clue how to do this. Any help would be great.</p> <p></p> <pre><code>&lt;?php // Get Course ID From Link $ID = mysql_real_escape_string($_REQUEST['ID']); // Check the Course ID exists $courseCheck = mysql_query("SELECT * FROM Courses WHERE CourseID = '".$ID."'"); if (mysql_num_rows($courseCheck) == 1) { $checkMember = mysql_query("SELECT * FROM CourseMembers WHERE CourseID = '".$ID."' AND UserID = '".$_SESSION['UserID']."'"); if (mysql_num_rows($checkMember) == 1) { ?&gt; &lt;html&gt; &lt;head&gt; &lt;!-- Style Sheets --&gt; &lt;link rel="stylesheet" href="style/reset.css" type="text/css" media=screen /&gt; &lt;link rel="stylesheet" href="style/style.css" type="text/css" media=screen /&gt; &lt;/head&gt; &lt;body&gt; &lt;?php if ($_SESSION['LoggedIn'] == 1){ $courseInfo = mysql_query("SELECT * FROM Courses WHERE CourseID = '".$ID."'"); $row = mysql_fetch_assoc($courseInfo); ?&gt; &lt;div id="container"&gt; &lt;div id="side"&gt; &lt;?php include("lib/sidebar.php"); ?&gt; &lt;/div&gt; &lt;div id="main"&gt; &lt;div id="mainbox"&gt; &lt;div id="header"&gt;&lt;b&gt;&lt;?php echo $row['CourseName']; ?&gt;&lt;/b&gt;&lt;/div&gt; &lt;p&gt;Hello world, this is a test.&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;?php } else { echo "Not logged in."; } } else { echo "You are not a member of this Course"; } } else { echo "No Course Found"; } ?&gt; &lt;/body&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload