Jump to content

passing a variable across a page


deansaddigh

Recommended Posts

Thanks for that.

For somereason it saying variable undifined

 

I have this sql statment which gets the school id

 

<?php
	$query = "SELECT course.course_id, course.name AS course_name, course.level, course.price, course.duration, course.info, school.school_id, school.name AS school_name, school.street, school.town, school.city, school.county, school.region, school.postcode, school.country, school.school_facts, school.general_info, school.school_facilities
            FROM school_course
            JOIN course
            ON school_course.course_id = course.course_id
            JOIN school
            ON school_course.school_id = school.school_id";
           
            //Use this query below         
            $result = mysql_query($query, $conn)
               or die ("Unable to perform query: " . mysql_error());   
          
	  //get school id
	   $school_id = $row['school.school_id'];

 

Is there something wrong with this line:

 

 $school_id = $row['school.school_id'];

[/code]

variables that u send via url to another page are stored in  super global array $_GET.

so if u send school id like jl5501  sayd

 

echo  '<a href="school_details.php?id='.$school_id.'">link to page2</a>';

 

then school_details.php could look like this:

<?php

$school_id = $_GET['id'];

 

//connection

mysql_query("SELECT * FROM schools WHERE id=$school_id LIMIT 1");

?>

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.