Posts: 1,832
Location: Somewhere else entirely
|
j2be: The dot . operator will concatenate two PHP variables, but in order to concatenate two SQL fields during the query you'll need to use the SQL function CONCAT(string1,string2)
PHP Code:
$sql2="SELECT ui FROM raw_allele WHERE CONCAT(fam_ui,d_no) = " . $fam_ui_result . $matches;
rungss: you are missing some quotes in the where clause of the query.
PHP Code:
$sql="SELECT `fam_ui` FROM `fam_data` WHERE `fam_i` = '$fam_i' and in_i = '$in_i' ";
Or if you want to separate the PHP and SQL:
PHP Code:
$sql="SELECT `fam_ui` FROM `fam_data` WHERE `fam_i` = '" . $fam_i . "' and in_i = '" . $in_i' ";
Personally I use a combination of PHP variables inside and outside the string - sometimes the variable cause confusion especially if they are parts of an array. Other times the quotes get confusing as to what is SQL and what is the edge of the PHP string.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';
Please login or register to view this content. Registration is FREE (aka MSN handwriting for forums)
Last edited by 0beron; 11-09-2005 at 02:01 PM..
|