PHP/HTML Form
-
I see the post that was on here the other day about PHP and HTML form but it doesn’t seem to be working for me. When I view the page it just doesn’t show anything. I put the same php into a template and that seems to execute, just without any of the formatting. Here’s the code:
[insert_php]
mysql_connect(“sql”, “login”, “supersecret”)
or die(mysql_error());mysql_select_db(“mycars”)
or die(mysql_error());$sql = ” SELECT vehicles.VYear,
vmake.VMake,
vmodel.VModel,
vehicles.VTrim,
vehicles.VehicleID,
vehicles.VThumbnailFROM vehicles
INNER JOIN mycars.vmake ON vehicles.VMakeID = vmake.VMakeID
INNER JOIN mycars.vmodel ON vehicles.VModelID = vmodel.VModelIDWHERE vehicles.VCurrentlyOwn = ‘1’”;
$result = mysql_query($sql)or die(mysql_error());
while($row = mysql_fetch_array($result)){
$year = $row[‘VYear’];
$make = $row[‘VMake’];
$model = $row[‘VModel’];
$trim = $row[‘VTrim’];
$vid = $row[‘VehicleID’];
$pic = $row[‘VThumbnail’];echo “<table>”;
echo ” <tr>
<th>Year</th>
<th>Make</th>
<th>Model</th>
<th>Trim</th>
<th>”.’<img src=”images/addnew.png” width=”33px” height=”25px”>‘.”</th>
</tr>”;echo ” <tr>
<td style=’width: 50px;’>”.$year.”</td>
<td style=’width: 175px;’>”.$make.”</td>
<td style=’width: 200px;’>”.$model.”</td>
<td style=’width: 100px;’>”.$trim.”</td>
<td style=’width: 25px;’>”.’<img src=”images/document.png” width=”33px” height=”25px”>‘.”</td>
</tr>”;echo”</table>”;
[/insert_php]
This code works fine outside of wordpress.
The topic ‘PHP/HTML Form’ is closed to new replies.