Php code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Php code

Why is this php code not working https://code.sololearn.com/WBzJy47SR1I2/?ref=app

18th Nov 2023, 3:07 PM
alphonce milambo
alphonce milambo - avatar
17 Answers
+ 6
how about putting your php code in a php script?
18th Nov 2023, 3:24 PM
Lisa
Lisa - avatar
+ 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.
18th Nov 2023, 7:45 PM
Keith
Keith - avatar
+ 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.
19th Nov 2023, 11:45 AM
Keith
Keith - avatar
+ 2
You need to show us "THIS" code, we cannot read your mind. Don't re-post the same question multiple times.
18th Nov 2023, 3:08 PM
Lisa
Lisa - avatar
+ 2
LINK the code. Put it on playground and LINK the script.
18th Nov 2023, 3:15 PM
Lisa
Lisa - avatar
+ 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.
18th Nov 2023, 3:37 PM
Jan
Jan - avatar
+ 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.
18th Nov 2023, 4:48 PM
Jan
Jan - avatar
+ 1
Benedict Anewuoh You should create a new topic with your question by going to Create > Discuss > New Post
19th Nov 2023, 7:04 PM
Keith
Keith - avatar
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
18th Nov 2023, 3:10 PM
alphonce milambo
alphonce milambo - avatar
0
Seems like I can't post all the code
18th Nov 2023, 3:10 PM
alphonce milambo
alphonce milambo - avatar
18th Nov 2023, 3:16 PM
alphonce milambo
alphonce milambo - avatar
0
What do you mean??
18th Nov 2023, 3:25 PM
alphonce milambo
alphonce milambo - avatar
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
18th Nov 2023, 3:43 PM
alphonce milambo
alphonce milambo - avatar
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
19th Nov 2023, 10:46 AM
alphonce milambo
alphonce milambo - avatar
0
alphonce milambo But how do you expext us to test your code properly when we don't have your MySql database?
19th Nov 2023, 11:40 AM
Jan
Jan - avatar
0
Yes,am using locally xamp,please just check my logic on ,whenever I try it's not working
19th Nov 2023, 11:46 AM
alphonce milambo
alphonce milambo - avatar
0
How do I insert a picture in the middle of my website
19th Nov 2023, 6:59 PM
Benedict Anewuoh
Benedict Anewuoh - avatar