$_GET['Link1'] help please
Posted: Mon Apr 14, 2008 7:51 pm
Hello, I am a relitive newbie to php/mysql, and i am having some problems with it at the moment.
What i am trying to do is pull course data from my database, and post them as links on the page, (tmc.php) and then when you click on one of those links, it then opens a new page (courses.php) and gets the course data of that link and displays it in courses.php.
The 1st part is working fine, (tmc.php) is displaying the course links on the page, but then when i click on one of the links, no data is being pulled from the database.
(tmc.php)
(courses.php)
so when courses.php opens it should show the course information of the link that was clicked.
my tables are
Course
CourseID
CourseName
CourseDetails
CourseID
Title
Section1
Section2
Section3
Section4
Can somebody help me with this please, as i am going to cry soon :'(
Thank You
J
What i am trying to do is pull course data from my database, and post them as links on the page, (tmc.php) and then when you click on one of those links, it then opens a new page (courses.php) and gets the course data of that link and displays it in courses.php.
The 1st part is working fine, (tmc.php) is displaying the course links on the page, but then when i click on one of the links, no data is being pulled from the database.
(tmc.php)
Code: Select all
<?php
$con = mysql_connect("localhost","xxxxxx","xxxxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("xxxxxx", $con);
$mystring = "Select CourseName from Course";
$result = mysql_query ($mystring);
while($row = mysql_fetch_array($result))
{
// 1st is the Key, 2nd is what is displayed on screen
echo "<a href='courses.php?Link1=".$row ['CourseID']."'>".$row['CourseName']."  </a>";
echo "<br>";
}
?>Code: Select all
<?
$tester = $_GET['Link1'];
$con = mysql_connect("localhost","xxxxxxx","xxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("xxxxxxx", $con);
$mystring = "Select * from CourseDetails = '".$tester."'";
$result = mysql_query ($mystring);
while($row = mysql_fetch_array($result,MYSQL_NUM))
{
foreach($row as $attribute)
echo $attribute."<br>";
}
?>my tables are
Course
CourseID
CourseName
CourseDetails
CourseID
Title
Section1
Section2
Section3
Section4
Can somebody help me with this please, as i am going to cry soon :'(
Thank You
J