Welcome Guest, Not a member yet? Register   Sign In
Tutorial for creating news item doesn't work
#1

(This post was last modified: 12-20-2021, 10:43 PM by vostronus. Edit Reason: additional )

Hi, I am going by this tutorial: https://codeigniter.com/user_guide/tutor...items.html.
I believe it is the controller code that is at fault. The main error message says: 
ErrorException

number_format(): Passing null to parameter #1 ($num) of type float is deprecated.

The rest of the error message is the usual gibberish. It may just as well be written in Japanese.
So, it there an updated tutorial? Could someone point toward the solution?

EDIT: This has to be a new one for me. It works on siteground (which is no doubt php 7.x)! So the issue is, that CI4 news tutorial does not work on php 8.

EDIT 2: oh for crying out loud I cannot even respond. This is not exactly making this very easy...
Reply
#2

Use PHP 8.0.
The current version of CI4 does not support PHP 8.1.
Reply
#3

At what point exactly do you encounter the error ? Would you mind sharing your code as well as the error messages ?
Reply
#4

Erm, yes I have just uploaded the pages to siteground shared. That has to be the first time for me that something worked on the server, and not on my PC. Usually the other way round.
Do you know if it will be updated? It means that if my hosting provider updates to php 8 I am screwed.
Reply
#5

(12-20-2021, 10:40 PM)Kenneth Kipchumba Wrote: At what point exactly do you encounter the error ? Would you mind sharing your code as well as the error messages ?
I gave the code, it is the link to the tutorial. It works on 7.4 but not php 8.1. I gave the main error, the rest of the message is like several pages worth of scrolling. It does not actually say what the error is like on asp.net/ visual studio, it just rambles on about various aspects of the internal system.
Reply
#6

(This post was last modified: 12-21-2021, 01:59 AM by InsiteFX. Edit Reason: Spelling Error fix. )

I use WebHostingBuzz and they have a dropdown in CPanel that I can use to chose what version of PHP
I want to run on my web site.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#7

(12-21-2021, 01:58 AM)InsiteFX Wrote: I use WebHostingBuzz and they have a dropdown in CPanel that I can use to chose what version of PHP
I want to run on my web site.

Ah, good point! Yes, they do. So it will be OK then if they upgrade, because then it is up to me to if I use the newer version. For now I have uninstalled Xampp and installed the previous version with php 7.4.26. All working ok now.
Reply
#8

OK, I have decided to go with Laravel now. Just a suggestion though, this forum is really awkward to use. Maybe damage control is better than preemptive control (for example moderating every post I write). I wish you all the best with the framework but I need something more. I am an experienced asp.net dev who wants to start using linux servers (i.e. more availability). This hasn't been a good changeover so far.
Reply
#9

(12-21-2021, 02:16 PM)vostronus Wrote: OK, I have decided to go with Laravel now. Just a suggestion though, this forum is really awkward to use. Maybe damage control is better than preemptive control (for example moderating every post I write). I wish you all the best with the framework but I need something more. I am an experienced asp.net dev who wants to start using linux servers (i.e. more availability). This hasn't been a good changeover so far.
Not every post are moderated. Just the first messages (not sure the exact number, something between 3 and 5). You wouldn't believe the amount of spam this forums gets. Once you're a regular user, you can post without the need for a mod to approve your post. 

But I guess we won't see you again as you seems to have decided Laravel is a better fit for your needs, which is totally fine. But if you gave up that quickly on CodeIgniter just by doing the "news" tutorial, good luck with Laravel!!  Tongue
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#10

(12-21-2021, 03:18 PM)includebeer Wrote:
(12-21-2021, 02:16 PM)vostronus Wrote: OK, I have decided to go with Laravel now. Just a suggestion though, this forum is really awkward to use. Maybe damage control is better than preemptive control (for example moderating every post I write). I wish you all the best with the framework but I need something more. I am an experienced asp.net dev who wants to start using linux servers (i.e. more availability). This hasn't been a good changeover so far.
Not every post are moderated. Just the first messages (not sure the exact number, something between 3 and 5). You wouldn't believe the amount of spam this forums gets. Once you're a regular user, you can post without the need for a mod to approve your post. 

But I guess we won't see you again as you seems to have decided Laravel is a better fit for your needs, which is totally fine. But if you gave up that quickly on CodeIgniter just by doing the "news" tutorial, good luck with Laravel!!  Tongue

Smile Yes I know it seems like quitter talk. I think it is a number of issues. CI seems just seems too lightweight. As soon as it comes to database input I obviously need authentication, right there and then. It is not there and ready in CI. I think for a lot of web devs we just want it there already. I do not want to go digging around for an external project. I am pretty sure laravel will not have the same level of ease of use of asp.net/ Visual studio, but I did try ROR before this one. ROR is, at least, closer to asp.net, than CI. CI does not seem like "rapid dev" framework, it seems like a low footprint (simple) framework. 

I think it means too much messing about tbh. I may eventually just go back to asp.net but I will give laravel a chance at least. I need stuff right there and then, no digging about. Asp.net is like that but... it needs windows servers (search all the top 10 hosting companies and see how many support windows hosting!)
Reply




Theme © iAndrew 2016 - Forum software by © MyBB