+ 1
Php code
Why is this php code not working https://code.sololearn.com/WBzJy47SR1I2/?ref=app
18 Answers
+ 6
how about putting your php code in a php script?
+ 5
There are multiple issues here.
For starters, most web servers require PHP scripts to end in the .php extension, similarly you are trying to run a PHP script using Sololearn's web compiler - you should be using the PHP compiler.
Your include statement is the first error you will run into since it is searching for the file locally.
+ 3
alphonce milambo I get it, I've been using XAMPP and coding PHP/WordPress since '07.
You weren't clear that you were using XAMPP stack locally. It's not mentioned anywhere.
+ 2
You need to show us "THIS" code, we cannot read your mind.
Don't re-post the same question multiple times.
+ 2
LINK the code. Put it on playground and LINK the script.
+ 1
That code won't work on the Playground. You need to test that on your local pc where Mysql is installed. You can install xampp that includes apache server, php and MySQL.
+ 1
alphonce milambo First of all, you chose a wrong language when you saved your code on the playground. You should have chosen PHP and not Web. If you change that and then filter out the MySql part, then you can test the rest of your code.
I tested a small part of your code that contained the DateTime, and it actually worked.
+ 1
Benedict Anewuoh You should create a new topic with your question by going to Create > Discuss > New Post
0
<?php
include("connfile.php");
date_default_timezone_set('Africa/Dar_es_salaam');
$sikusdfg = new DateTime();
$leo = $sikusdfg->format('Y-m-d H:i:s');
$leobilasaa = $sikusdfg->format('Y-m-d');
$leoasubuhikabisa = $sikusdfg->format('Y-m-d 00:00:00');
$leojionikabisa = $sikusdfg->format('Y-m-d 23:59:59');
$sikuzakuhamishahela = 15;
$tareheyaleo = $sikusdfg->format('Y-m-d 00:00:00');
$siku15nyumakutokaleo = date('Y-m-d 00:00:00', strtotime($tareheyaleo. " - $sikuzakuhamishahela days"));
$ano =$chakatammojammoja['userid'];
$angaliamiamalayake = mysqli_query($conn, "SELECT * FROM `staketable` WHERE `payment_date` <= '$siku15nyumakutokaleo' AND `stakeamount` > 0");
if (mysqli_num_rows($angaliamiamalayake) > 0) {
while ($taarifazamuamalammojammoja = mysqli_fetch_assoc($angaliamiamalayake)) {
$sikualiyoweka = $taarifazamuamalammojammoja['stakedate'];
$kiasialichoweka = $taarifazamuamalammojammoja['stakeamount'];
$anotyake = $taarifazamuamalammojammoja['userid'];
if (strtot
0
Seems like I can't post all the code
0
What do you mean??
0
Yeah,the website I created its done,am using mysql yes.
But that code is not working.
Here is the logic of that code.
Am using a real time,the code only execute two things,
1.every day to move Daily earning from a stackable table to withdrawable table.
2.after every 15 days,to move the amount staked to the withdrawalable table
0
Guys looks like you don't u don't get it,that code I made the whole website using notepad and running on xamppp,I just copied it here for you to help out what could be the problem
0
alphonce milambo But how do you expext us to test your code properly when we don't have your MySql database?
0
Yes,am using locally xamp,please just check my logic on ,whenever I try it's not working
0
How do I insert a picture in the middle of my website