Working PHP/MySQL block breaks in 3.2.1
-
I’m setting up a WP site for a computer services company, and they need a work order form. I’m setting it up as a page, and the relevant tables are in the same database as the WP install. I’m using Grimp’s PHP plugin to run the code. The code block is as follows:
$query = "SELECT * FROM techs WHERE 1"; $q = mysql_query($query) or die(mysql_error()); ?> <select name="tech"> <?php while($row = mysql_fetch_assoc($q)) { ?> <option value="<?php echo $row['TechID']; ?>"><?php echo $row['techname']; ?></option><?php } ?> </select>
It works on it’s own (here), but when I use the same code block on a WP page I get outward-facing HTML like so:
<select name='tech'> <option value=""> </option> </select>
When I echo $q I get a resource link identifier, and even doing mysql_num_rows in an echo gives the correct result. So I’m at a loss as to why the code is breaking. Any help would be appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Working PHP/MySQL block breaks in 3.2.1’ is closed to new replies.