Code:
function get_subjects($name) {
mysql_select_db(DB_NAME);
$mysql = "SELECT * FROM subjects WHERE id = {$name} LIMIT 1";
echo $mysql;
....
}
// example call 1
$subjects = get_subjects('subjectname');
// example call 2
$subjects = get_subjects('100');
// example call 3
$subjects = get_subjects('');
Example call 1 wil display the following:
Code:
SELECT * FROM subjects WHERE id = {subjectname} LIMIT 1
Example call 2 wil display the following:
Code:
SELECT * FROM subjects WHERE id = {100} LIMIT 1
Example call 1 wil display the following:
Code:
SELECT * FROM subjects WHERE id = LIMIT 1
It "knows" what value of $name to use, because you pass that name when you call the get_subjects function.
Bookmarks