Output of PHP as placeholder
up vote
-1
down vote
favorite
I have a website with an x amount of markers that are stored in mysql database. I want to show the amount of markers (as a figure) showing on the map.
With php I counted the amount of rows in the database, and made an html button that functions as a dropdowntrigger.
Now, I want to have that number as the placeholder on the button.
Where the EN
is in the example pic, I want to show the amount of markers. what is the best way to do this??
<div class="right">
<span data-dropdown-id="counter" id="counter" class="button actionButton dropdownTrigger">
<iframe src="Counter.php"></iframe>
</span>
</div>
Code PHP
<?php
require("test.php");
if(!$con)
{
echo 'Not Connected To Server';
}
if(!mysqli_select_db($con,'test'))
{
echo 'Database Not Selected';
}
$sql="SELECT * FROM markers";
if ($result=mysqli_query($con,$sql))
{
// Return the number of rows in result set
$rowcount=mysqli_num_rows($result);
printf("<div style='font:25px/25px Arial;color:#73AD21'>$rowcount</div>");
// Free result set
mysqli_free_result($result);
}
mysqli_close($con);
?>
UPDATE using echo and iframe:
update example
The text is selectable (cursor changes to 'select') and not clickable (like the dropdowntrigger) and not alined.
php html mysql iframe
add a comment |
up vote
-1
down vote
favorite
I have a website with an x amount of markers that are stored in mysql database. I want to show the amount of markers (as a figure) showing on the map.
With php I counted the amount of rows in the database, and made an html button that functions as a dropdowntrigger.
Now, I want to have that number as the placeholder on the button.
Where the EN
is in the example pic, I want to show the amount of markers. what is the best way to do this??
<div class="right">
<span data-dropdown-id="counter" id="counter" class="button actionButton dropdownTrigger">
<iframe src="Counter.php"></iframe>
</span>
</div>
Code PHP
<?php
require("test.php");
if(!$con)
{
echo 'Not Connected To Server';
}
if(!mysqli_select_db($con,'test'))
{
echo 'Database Not Selected';
}
$sql="SELECT * FROM markers";
if ($result=mysqli_query($con,$sql))
{
// Return the number of rows in result set
$rowcount=mysqli_num_rows($result);
printf("<div style='font:25px/25px Arial;color:#73AD21'>$rowcount</div>");
// Free result set
mysqli_free_result($result);
}
mysqli_close($con);
?>
UPDATE using echo and iframe:
update example
The text is selectable (cursor changes to 'select') and not clickable (like the dropdowntrigger) and not alined.
php html mysql iframe
printf("rowcount");
- You forgot the$
sign here.
– Funk Forty Niner
Nov 11 at 14:13
Sorry, i deleted the div style to make the php script more clear. I edited it back to my initial code :)
– Job de Ruiter
Nov 11 at 14:19
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have a website with an x amount of markers that are stored in mysql database. I want to show the amount of markers (as a figure) showing on the map.
With php I counted the amount of rows in the database, and made an html button that functions as a dropdowntrigger.
Now, I want to have that number as the placeholder on the button.
Where the EN
is in the example pic, I want to show the amount of markers. what is the best way to do this??
<div class="right">
<span data-dropdown-id="counter" id="counter" class="button actionButton dropdownTrigger">
<iframe src="Counter.php"></iframe>
</span>
</div>
Code PHP
<?php
require("test.php");
if(!$con)
{
echo 'Not Connected To Server';
}
if(!mysqli_select_db($con,'test'))
{
echo 'Database Not Selected';
}
$sql="SELECT * FROM markers";
if ($result=mysqli_query($con,$sql))
{
// Return the number of rows in result set
$rowcount=mysqli_num_rows($result);
printf("<div style='font:25px/25px Arial;color:#73AD21'>$rowcount</div>");
// Free result set
mysqli_free_result($result);
}
mysqli_close($con);
?>
UPDATE using echo and iframe:
update example
The text is selectable (cursor changes to 'select') and not clickable (like the dropdowntrigger) and not alined.
php html mysql iframe
I have a website with an x amount of markers that are stored in mysql database. I want to show the amount of markers (as a figure) showing on the map.
With php I counted the amount of rows in the database, and made an html button that functions as a dropdowntrigger.
Now, I want to have that number as the placeholder on the button.
Where the EN
is in the example pic, I want to show the amount of markers. what is the best way to do this??
<div class="right">
<span data-dropdown-id="counter" id="counter" class="button actionButton dropdownTrigger">
<iframe src="Counter.php"></iframe>
</span>
</div>
Code PHP
<?php
require("test.php");
if(!$con)
{
echo 'Not Connected To Server';
}
if(!mysqli_select_db($con,'test'))
{
echo 'Database Not Selected';
}
$sql="SELECT * FROM markers";
if ($result=mysqli_query($con,$sql))
{
// Return the number of rows in result set
$rowcount=mysqli_num_rows($result);
printf("<div style='font:25px/25px Arial;color:#73AD21'>$rowcount</div>");
// Free result set
mysqli_free_result($result);
}
mysqli_close($con);
?>
UPDATE using echo and iframe:
update example
The text is selectable (cursor changes to 'select') and not clickable (like the dropdowntrigger) and not alined.
php html mysql iframe
php html mysql iframe
edited Nov 11 at 14:40
asked Nov 11 at 14:03
Job de Ruiter
13
13
printf("rowcount");
- You forgot the$
sign here.
– Funk Forty Niner
Nov 11 at 14:13
Sorry, i deleted the div style to make the php script more clear. I edited it back to my initial code :)
– Job de Ruiter
Nov 11 at 14:19
add a comment |
printf("rowcount");
- You forgot the$
sign here.
– Funk Forty Niner
Nov 11 at 14:13
Sorry, i deleted the div style to make the php script more clear. I edited it back to my initial code :)
– Job de Ruiter
Nov 11 at 14:19
printf("rowcount");
- You forgot the $
sign here.– Funk Forty Niner
Nov 11 at 14:13
printf("rowcount");
- You forgot the $
sign here.– Funk Forty Niner
Nov 11 at 14:13
Sorry, i deleted the div style to make the php script more clear. I edited it back to my initial code :)
– Job de Ruiter
Nov 11 at 14:19
Sorry, i deleted the div style to make the php script more clear. I edited it back to my initial code :)
– Job de Ruiter
Nov 11 at 14:19
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
just replace printf("rowcount")
by echo $rowcount
and I think you shall be good to go.
add a comment |
up vote
-1
down vote
Just use the echo attribut of php and is done. for example if your value is stored in lets say $rowcount.
<?php echo $rowcount ?>
Printf will output only a formatted string.For example
$number = 28;
$str = "India";
printf("There are %u states in %s.",$number,$str);
Replace the printf with Echo
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
just replace printf("rowcount")
by echo $rowcount
and I think you shall be good to go.
add a comment |
up vote
0
down vote
just replace printf("rowcount")
by echo $rowcount
and I think you shall be good to go.
add a comment |
up vote
0
down vote
up vote
0
down vote
just replace printf("rowcount")
by echo $rowcount
and I think you shall be good to go.
just replace printf("rowcount")
by echo $rowcount
and I think you shall be good to go.
answered Nov 11 at 14:09
Ditrix 36
162
162
add a comment |
add a comment |
up vote
-1
down vote
Just use the echo attribut of php and is done. for example if your value is stored in lets say $rowcount.
<?php echo $rowcount ?>
Printf will output only a formatted string.For example
$number = 28;
$str = "India";
printf("There are %u states in %s.",$number,$str);
Replace the printf with Echo
add a comment |
up vote
-1
down vote
Just use the echo attribut of php and is done. for example if your value is stored in lets say $rowcount.
<?php echo $rowcount ?>
Printf will output only a formatted string.For example
$number = 28;
$str = "India";
printf("There are %u states in %s.",$number,$str);
Replace the printf with Echo
add a comment |
up vote
-1
down vote
up vote
-1
down vote
Just use the echo attribut of php and is done. for example if your value is stored in lets say $rowcount.
<?php echo $rowcount ?>
Printf will output only a formatted string.For example
$number = 28;
$str = "India";
printf("There are %u states in %s.",$number,$str);
Replace the printf with Echo
Just use the echo attribut of php and is done. for example if your value is stored in lets say $rowcount.
<?php echo $rowcount ?>
Printf will output only a formatted string.For example
$number = 28;
$str = "India";
printf("There are %u states in %s.",$number,$str);
Replace the printf with Echo
edited Nov 11 at 14:20
answered Nov 11 at 14:11
Sreeraj Nair
13
13
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249513%2foutput-of-php-as-placeholder%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
printf("rowcount");
- You forgot the$
sign here.– Funk Forty Niner
Nov 11 at 14:13
Sorry, i deleted the div style to make the php script more clear. I edited it back to my initial code :)
– Job de Ruiter
Nov 11 at 14:19