Jump to content

need help to figure something


Go to solution Solved by requinix,

Recommended Posts

so i am trying to include the timer of the events in the user profile table and for some reason there is a number 1 appearing from nowhere but only if i include the whole countdown file if i just paste the code in my profile file it doesnt appear but i also cant get the timer to set a date. i would need to figure why this number one is spawning for no reasons since this is not even showing on the actual subscription page initially working with the subscription countdown file and everything is working well on this side.. this is just strange.

<?php
$stmt = $con->prepare("SELECT  subscriptiondate, sub_status FROM subscriptions WHERE user_id = ?");
$stmt->bind_param('i', $_SESSION['id']);
$stmt->bind_result($sub_date, $sub_status);
 $stmt->execute();
 $stmt->fetch();
 $stmt->close();
 if (isset($sub_date)) {
$subscription_time = $sub_date;
}
else if (!isset($sub_date)) {
  $subscription_time = '2022-11-05 23:59:59';
}





$rem_time = $subscription_time;
$target = $rem_time;                   // SET OR GET TARGET TIME HERE
$targ = new DateTime($target);
$target_time = $targ->format('g:ia');
$target_date = $targ->format('F jS Y');
                 $remain = ['days' => 0, 'hrs' => 0, 'mins' => 0, 'secs' => 0];
                #$dt1 = new DateTime( $_GET['target'] );
                $dt2 = new DateTime('now');
                if ($targ > $dt2) {
                    $diff = $targ->diff($dt2);
                    $remain['days'] = $diff->days;
                    $remain['hrs'] =  $diff->h;
                    $remain['mins'] = $diff->i;
                    $remain['secs'] = $diff->s;
                  }
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html charset='utf-8'">
<link rel="stylesheet" href="donation-clash.css" type="text/css">
<title>Countdown</title>
</head>
<body class="body4">
<div class="timerall">
        <p class="p3">Countdown to</p>
        <p class='target'><?=$target_time?> on <?=$target_date?> </p>
        <table>
            <tr>
                <th>Days</th><th>Hours</th><th>Mins</th><th>secs</th>
            </tr>
            <tr>
                <td class='remain' id='days'><?=$remain['days']?></td>
                <td class='remain' id='hrs'><?=$remain['hrs']?></td>
                <td class='remain' id='mins'><?=$remain['mins']?></td>
                <td class='remain' id='secs'><?=$remain['secs']?></td>
            </tr>
        </table>
</div>
</body>
</html>

so this above is the countdown file for the subscription.

	<div>
					<p>registered to the:</p>
					<table>
						<tr>
							<th>Quicky event</th><th>Bronze event</th><th> Silver event</th><th>Golden event</th><th>Vip event</th><th class="sub_th">monthly Subscription</th>
	</tr>

						<tr>

							<td><?=$quicky_status?></td><td><?=$bronze_status?></td>	<td><?=$silver_status?></td><td><?=$golden_status?></td><td><?=$vip_status?></td><td class="sub_th"><?=$subscription?></td>
						</tr>
						<tr>
							<td><?=$totalparticipant5?></td><td><?=$totalparticipant?></td><td><?=$totalparticipant2?></td><td><?=$totalparticipant3?></td><td><?=$totalparticipant4?></td><td class="sub_th"><?=include '../subscribe/sub_countdown.php'?></td>
						</tr>
					</table>
				</div>

and this above is the part of the profile page including the countdown file.

image.thumb.png.20af7ab35a7872b843cc5a30eecbdaf2.png

in the image you can clearly see under the timer that there is a 1 that should not be there. if anyone can find the cause of that , please let me know because it makes about 3 to 4 days that i am stuck on that ...

 

Link to comment
https://forums.phpfreaks.com/topic/315829-need-help-to-figure-something/
Share on other sites

for real? but why would it be appearing if i dont use a return for this exact boolean ? by that i mean that i have been using many includes and this is the first time it is returning a boolean.

Edited by alexandre

i use the same method to display my paginations and it is not showing me any boolean result.. , is there something i dont know with the use of the include in a table ? because, to me i dont see any logical reasons , my paginations are also included in the html  so there isnt much difference left that can be. in the include above , i didnt close the line inside the quotes with semi column or whatever is called the dot and coma , but once i did it didnt changed anything. 

thats strange ... i can see the number one everywhere now that i am aware of it 😂.. would you have a solution to this issue ? dos it count if it is included in the php part of the code because i just found that on the subscription page the countdown is included in the php and it doesnt show the boolean result.

Edited by alexandre

i just realized that not long ago i switched my code , instead of only using php to do everything, i declared the variables in php to then output them in the html but as it was before only with php , it wasnt showing those number one

Edited by alexandre
  • Solution

I'll give this one more try:

1. I've already mentioned that include() will return a boolean. Specifically, true if it was able to include the file and false if it was not.
2. You are using <?= tags instead of regular <?php. Remind yourself of what the special <?= form does.

Do you know what happens when you combine those two together?

i honestly dont know about that. i thought it was simply the way to include php into html but i should have noticed the difference between the normal php tags and the ones i am using . i will go look this up . thank you for specifying it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.