Reputation: 2187
I want to embed this code into an html document:
<?php $sql="img_size=VERY_BIG"; $result = $conn->query($select.$sql); $result->num_rows; echo $result ?>
the problem is that i want it to be inside an option tag (of a select menu)
so i typed it like this:<option value="VERY_BIG">500x500<?php $sql="img_size=VERY_BIG"; $result = $conn->query($select.$sql); $result->num_rows; echo $result ?></option>
PROBLEM: the -> is being interpreted as the end of the tag... I have no idea what im doing wrong
Greetings
Upvotes: 0
Views: 36
Reputation: 2428
You don't want to have a connection to the database as an inline tag.
If you still want the php to be inline, make sure you have the correct file extension ( *.php instead of *.html ). For this you will need an Apache server installed in your computer (if you want to use a localhost).
Upvotes: -1
Reputation: 1280
You cannot just embed PHP in a HTML document.
If you want it to be parsed as PHP, you need to rename it to have .php extension.
There are actually alternative solutions for "parsing" html, but they are not recommended, since from there on, every HTML document has to 'go' through the interpreter, which can be a huge overhead.
Upvotes: 4