sql select with php variable
- by user1572526
I'm trying to print out a html-table from db-table 'dimensions'. I only want dimensions from the selected pipetype which I get from a dropdownbox. For now I just put in "Steel" manually. Steel has pipe_id = 2 in db-table 'pipes'.
I've run the first query in my db-tool and it returns 2 so there's nothing wrong there. The second query returns nothing. But when I manually set $wq = 2 (which I comment out below) it prints out the html-table perfectly. What am I doing wrong here?
$wq="SELECT pipe_id FROM pipes WHERE title_en = 'Steel'";
//$wq = '2';
$sql="SELECT * FROM dimensions WHERE pipe_id = '".$wq."'";