PHP - Hello World 2!!
I am working on a turn based game and I am having some difficulty making the HP counter stop counting at the specified number here is some of the code;
<?php session_start(); $player_hp = $_SESSION['player_hp']; $turns = $_SESSION['turns']; $turns = $turns - 1; ?> and this is how I was trying to stop it. <?php if($total_hp < 30){ $player = $player_hp + 5; echo "You Still Have More recovery to do!"; } else { echo "You are fully recovered!"; } $_SESSION['turns'] = $turns; $_SESSION['player_hp'] = $player_hp; ?> I know this is simple but I'm having a heck of a time getting the HP to stop counting at 30. Also here is the code which I use to refresh the page to count it out. Code: [Select] <form action="safe-spot.php" method="post"> <input type="hidden" name="sub"> <input type="submit" value="Click Here"> Thanks in advance, Similar TutorialsHi,
I installed cakePHH on my win 7 , apache, easyphp laptop.
php files work fine but I cant get anything to run with cakephp which is extracted where I can run html files.
I set fatabase config file, ran index.php and everything seemed fine until i tried to do something
my error is
Missing Controller
Error: UserController could not be found.
Error: Create the class UserController below in file: app\Controller\UserController.php
And I followed
http://www.grasphub....rld-in-cakephp/
Hi everyone,
I'm Kobra and I hack frameworks. My interests lie mostly in appsec, crypto, and anti-forensics.
I've been writing PHP code for over 12 years and I've found amusing ways to abuse language features. I'm a walking encyclopedia of antipatterns and security vulnerabilities. Let me know if you want to know more! I am getting nothing but my HTML outputted. Here is a screen shot: http://i.imgur.com/yoetz.png I have tested this on three different Apache servers, so I know it is not the settings. I am clueless and not sure why this is happening. Here is some code: <?php include("core/main.php"); //$page = new Page("New", ""); //$page->header(); //$page->footer(); include("core/includes/pages/header.php"); echo "STUFF"; include("core/includes/pages/footer.php"); ?> Hey, thanks guys. I am unsure. I am not really sure on what code I should post. That is the exact code from the screen shot. Please help me solve this riddle! Hi,
I'm a London (UK) based Senior Software Developer, over 10 years experience. Primarily interested in software and system design and development for HA environments.
I rally enjoy the challenge of taking an existing system forward from startup mode into something that can grow bigger and better.
Working in High Availability environments. PHP, Nodejs and Golang.
Skillsets..
* Software and System Design
* MySql and SQL Server as admin, programmer and .
* MongoDB, CouchDB, Lucene
* Linux and Windows sysadmin
* Email servers (postfix), built to filter spam/viruses.
* Configuration service designed and built for HA environment
* Zend Framework
* PHP based services inc. HA Email service,
* Javascript. jQuery, Nodejs, Angularjs
APIs inc. Facebook, Twitter, PayPal
Just ask.
Cheers,
Ian
Hey all at phpfreaks!
My name is Matt and I am 26 years old. Currently I run as an Assistant Logistics Lead at a well known chemical production facility. I make okay money. enough to support the family at least, for no degree required(~40k/yr), but loathe my job each and every day. That is partly why I am here!
I am a pretty well-motivated individual, and have finally committed to 'self-teaching' myself programming to find myself a job in my desired career field. I have a little experience in C#, C++, HTML, & CSS, but just the basics. My short-term goal is to learn PHP & SQL and find an entry level backend developer job. At the moment I'm looking for some beginner projects to work on that I ciould build upon and learn from.
Anyways, I suppose that is enough rambling, I'm sure I'll see you all on the forums.
Hello good people of phpfreak. WertySlash is here, I'm a two years graduate of IT here in the Philippines. I wanna become a professional web developer that's why I want to hone those skills I acquired from school and this is one of the way to do it. I'm doing self study through internet, thanks for that person who directed me here. It's a great opportunity to be in a forum like this where I can enhance my knowledge about PHP. So I'm looking forward to expand my php skills from you guys.
Hi,
I am learning PHP and appreciate to share knowledge with other people. I am developing a leave management system for a non-profit organization and I've released the source code : https://github.com/bbalet/lms
Any feedback is appreciated
See you
Edited by bbalet, 22 May 2014 - 01:37 PM. Hello!
My name is Jarrod and I am 18 and live in Australia. I have only just started coding in the past 3 months and PHP is my first language.
I have just completed the O'Riley book 'PHP, MYSQL, Javascript, CSS and HTML5'.
Edited by jazza96, 28 December 2014 - 06:23 AM. Hay guys.. Im not the best php coder for a start, I am trying to uses getfilecontent or some other php function to grab our clans roster from the official world of tanks website. The problem is that they seem to populate the roster after the page is loaded via jQuery and java. Is there any way with php for me to get access to this roster or is the fact their doing it like that a permanent block. the roster is here if anyone wants to have a crack at it http://game.worldoftanks.eu/clans/500000156/ There are ten list or bookmarks from Prof. Horner's Bible-Reading System found (http://www.facebook.com/group.php?gid=46416541831) each having set number of books from the Bible. One is to read ten chapters a day, one chapter from each of the bookmarks. Type in what day you are on and the program will show you on each of the lists as to what chapter you are suppose to be on. Also want to show statistics that will display how many times the Bible has been read with a break down of all 66 books of the Bible. Started a git respo http://github.com/Kutakizukari/Prof-Horners-Bible-Reading-System Bookmark list as follows: //List 1 $Matthew = 28; $Mark = 16; $Luke = 24; $John = 21; //List 2 $Genesis = 50; $Exodus = 40; $Levitieus = 27; $Numbers = 36; $Deuteronomy = 34; //List 3 $Romans = 16; $I_Corinthians = 16; $II_Corinthians = 13; $Galatians = 6; $Ephesians = 6; $Philipians = 4; $Colossians = 4; $Hebrews = 13; //List 4 $I_Thessalonians = 5; $II_Thessalonians = 3; $I_Timothy = 6; $II_Timothy = 4; $Titus = 3; $Philemon = 1; $James = 5; $I_Peter = 5 ; $II_Peter = 3 ; $I_John = 5; $II_John = 1; $III_John = 1; $Jude = 1; $Revelation = 22; //List 5 $Job = 42; $Ecclesiastes = 12; $Songs_of_Solomon = 8; //List 6 $Psalms = 150; //List 7 $Proverbs = 31; //List 8 $Joshua = 24; $Judges = 21; $Ruth = 4; $I_Samuel = 31; $II_Samuel = 24; $I_Kings = 22; $II_Kings = 25; $I_Chronicles = 29; $II_Chronicles = 36; $Ezra = 10; $Nehemiah = 13; $Esther = 10; //List 9 $Isaiah = 66; $Jeremiah = 52; $Lamentations = 5; $Ezekiel = 48; $Daniel = 12; $Hosea = 14; $Joel = 3; $Amos = 9; $Obadiah = 1; $Jonah = 4; $Micah = 7; $Nahum = 3; $Habakkuk = 3; $Zephaniah = 3; $Haggai = 2; $Zechariah = 14; $Malachi = 4; so on day 1 it should readout Matthew Chapter 1 Genesis Chapter 1 Romans Chapter 1 I Thessalonians Chapter 1 Job Chapter 1 Psalms Chapter 1 Proverbs Chapter 1 Joshua Chapter 1 Isaiah Chapter 1 Acts Chapter 1 on the second day it should all say Chapter two but Matthew reaches day 28 it should move on to Mark Chapter 1 and so on and so on and with each bookmark list. I am not sure if this can be done with PHP, if at all. Basically, I want to create a world map where people can input data for a specified post code/zip code and this data will then show on the map. ANY way of doing this? Here is my code: <?php class Test { function hello() { echo"hello"; } public function &world() { echo" world"; } } $test = new Test(); $test->hello() ->world(); ?> I know it can be done like: $test = new Test(); $test->hello(); $test->world(); ?> However I want it too look like: (as I believe it's cleaner) $test = new Test(); $test->hello() ->world(); ?> Hi All i hope someone can help about to scream! basically I am trying to do a few things with the statement below; First i want to check if the user id exists in member_categories_position. If it Does i want then to exclude all entries from the second statement where member_id equals all results from the first statement the third statement is the else statement that displays if the member_id is not present in the member_categories position. PROBLEM - the result from the first system loops fine, however when i try and insert into the second statement (!='$memid') is produces no results and has no effect. I think the problem is that $memid is a looped result. How do i get the second statement to say that any member_id that is in member_categories_position will not show in that statement? Code: [Select] $sql2 = "SELECT * FROM member_categories_position a JOIN member_users b ON b.id = a.member_id"; $rs2 = mysql_query($sql2); while ($row = mysql_fetch_array($rs2)){ $memid = "".$row['member_id'].""; } if(mysql_num_rows($rs2) != 0){ $new= "SELECT * FROM member_categories JOIN member_users on member_categories.member_id=member_users.id JOIN member_config on member_categories.member_id=member_config.member_id WHERE member_categories.categories='$category' and member_categories.member_id !='$field' group by member_config.member_id order by RAND() limit 0,42"; $rs = mysql_query($new); while ($row = mysql_fetch_assoc($rs)) { echo "result excluding member ids from the first statement"; } echo "<div class=\"clear\"></div>"; } else{ $new= "SELECT * FROM member_categories JOIN member_users on member_categories.member_id=member_users.id JOIN member_config on member_categories.member_id=member_config.member_id WHERE member_categories.categories='$category' group by member_config.member_id order by RAND() limit 0,42"; $rs = mysql_query($new); while ($row = mysql_fetch_assoc($rs)) { echo "Result with all member ids"; } echo "<div class=\"clear\"></div>"; }} Hi, this is my first post and I just need some guidance, I'm trying to write a function (ultimatly create a page) where it would show where in the world is 12 clock e.g. so I'm base din UK and I visit the page (run the function) and it would scan all time options possible and spits out where (if) in the world it's 12 lock.
Thanks.
This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=307639.0 This is object programming right? Is there a performance issue with this? for example: $notfications = ( blah blah ) ? : ''; then if ($notificatiosn != blabla){ echo 'hey'; }or.... $notifications = function(){ do my stuff here then return 'hey'; }Which way is faster or slower? Reason I Ask this is because I've been doing some object orientated programming in javascript, and didn't know you could do it in php. I'd rather do the objective way so I don't have to use so many freaking variables above the regular way, lol. Edited by Monkuar, 22 January 2015 - 12:22 PM. Code: [Select] <?php // plm require_once (dirname(__FILE__) . "/inc/main.php"); $lang = load_language('view_post'); $id = intval($_GET['id']); if ( $id >= 1 ) { dbconn(); // la la la } else { echo "$id\n"; // for debugging die ("no id specified"); } ?>when it's executed of curse i get "0 no id specified" 1. i dont get why i get 0 as a result even if the url is /x.php?id=204 2. in error.log i get Quote PHP Notice: Undefined index: id in x.php i intend to inform that formerly the script was running smoothly on lighttpd webserver, now i use nginx ( so i wont use words ) i know that are people with more complicated things around here ... but still i'm struggling for 1 hour with this xxx thanks in advance btw : php version 5.3.x I've been searching high and low for some decent (actually, they can be crap, just be REAL) real-world examples of uses of abstract classes and interfaces. I've seen many design patterns, and I get the concept, but now I need to put them into practice. And I gotta say, I'm absolutely sick of class Animal, class Dog extends Animal, class Vehicle, class Van extends Vehicle examples. Those are CRAP for illustrating real uses of the functionality given to us by OOP. It's one thing to teach a concept, and it's another to put into use within a real application. I can only find the former and the not the latter. Does anyone have any links to, or can they post their own examples of, abstract classes and interfaces in use? Hello,
Can you guys point me to something where I can follow some tutorial or something and learning CI?
I've already made tons of 'Cars' models... 'Dogs' .. 'Cats'.. etc but I really need some project where I can follow steps to creat and learn while I create.
p.s. I think I post this thread in right place but please correct me if is wrong.
Thank's!
I have a website http://www.pbm-biz.com/cricket/ where I am streaming Live Cricket world cup matches. My question is that during the streaming, I would like to keep the code in PHP so that others don't copy it. I can't find any solution. Any suggestions. Thanks, Faisal |