Hi, All, A php variable question.
I've done this to take the requested category from the URL (www.foo.com/file.htm?r=1)
and use it to build the page:
if (isset($_GET['r']) && !empty($_GET['r'])) {
$r = "'{$_GET['r']}'"; //Set the variable $r to mean the category number
$fields = '*';
} else {
$where = '';
$fields = 'cv.cv_id,cv.category,dates,cv.job_title,cv.company,cv.job,cv.sort, jobcat.category';
$sort = "ORDER BY cv.sort";
}
$sql = "
SELECT cv.cv_id,cv.category,dates,cv.job_title,cv.company,cv.job,cv.sort,jobcat .category
FROM cv, cvjobcats, jobcat
WHERE cvjobcats.cv_id=cv.cv_id AND cvjobcats.jobcat_id = $r AND jobcat.jobcat_id=cvjobcats.jobcat_id";
In this case $r comes out literally to the number surrounded by single quotes (ie, '1'). And it works great.
But I need *just* the number for something later (to fetch an include based on the category selected by $r). Since I've set the value of the field cv.category to mean the english translation from the intersecting table, using
<php include_once "/path/to/cv.$r.include.php"; ?> asks for cv.'1'.include.php ... And I need it to ask for cv.1.include.php
How can I make a variable to fetch the literal number from the field cv.category?
Thanks in advance! Jack
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php