Re: defining recordset according to first three digitsof code
Thanks Mike,
looks like that's probably the answer but when I start to make changes the
Dreamweaver recordset panel doesn't seem to like it too much. Maybe I'm better
just working in the code:
Anyway I've given it a go a few times and got myself pretty mixed up now.
Here's the code I ended up with. Any idea where I'm going wrong?
Dave
$unstrippedcode = $_GET['code'];
$strippedcode = substr($unstrippedcode,0,3);
$colname_rs_allcourses = "-1";
if (isset($strippedcode)) {
$colname_rs_allcourses = (get_magic_quotes_gpc()) ? $strippedcode :
addslashes($strippedcode);
}
mysql_select_db($database_con_dcc, $con_dcc);
$query_rs_allcourses = sprintf("SELECT * FROM courses WHERE coursecode LIKE
'$strippedcode'", GetSQLValueString($colname_rs_allcourses, "text"));
$rs_allcourses = mysql_query($query_rs_allcourses, $con_dcc) or
die(mysql_error());
$row_rs_allcourses = mysql_fetch_assoc($rs_allcourses);
$totalRows_rs_allcourses = mysql_num_rows($rs_allcourses);
|