halfbaked Posted March 9, 2010 Posted March 9, 2010 SQL ALTER TABLE 'yourgang' ADD 'peaceful' ADD 'aggressive' NOT NULL DEFAULT '1'; <? php require_once ("globabls.php"); if($gang['<30 days old'] { die("<font color=red><font size=5>echo ("You damn bully what you thinking? You can't attack a gang less then 30 days old."); } if($gang['>30 days old'] Declare War echo "You have declared war on $gang."; } } } $h->endpage(); ?> Quote
seanybob Posted March 9, 2010 Posted March 9, 2010 SQL ALTER TABLE 'yourgang' ADD 'peaceful' ADD 'aggressive' NOT NULL DEFAULT '1'; <? php require_once ("globabls.php"); if($gang['<30 days old'] { die("<font color=red><font size=5>echo ("You damn bully what you thinking? You can't attack a gang less then 30 days old."); } if($gang['>30 days old'] Declare War echo "You have declared war on $gang."; } } } $h->endpage(); ?> First: You get points for having the longest title I've ever seen on a thread. Second: Honestly, if I were you, I'd give up. The code you posted here is some of the simplest code there is, and yet you demonstrated you don't understand anything about it at all. You need to take a step back and spend a week or two reading about different data types, arrays, what curly braces are and how they are used, etc - specifically in php. I understand everybody starts somewhere, but I've never seen people make the mistakes that you made in that code buddy. You need to do a bit of studying. To respond to posts saying I should not 'diss' the guy but should try to help him: How do you explain color to a blind man? I can't really explain to this guy about matching curly braces or how to use array keys when he obviously doesn't know what a curly brace is used for, nor what an array key is, nor how a string is formed. Quote
Danny696 Posted March 9, 2010 Posted March 9, 2010 honstly ive never seen someone mess up on an if, mabey whats inside the if, but not an if Quote
Jordan Palmer Posted March 9, 2010 Posted March 9, 2010 Well I have to agree with seanybob you have some real issue's. You've spelt globals.php wrong You aint defined $gang You're if statement is messed Your query isn't correct Ah and well done on the longest title ever xD Quote
halfbaked Posted March 9, 2010 Author Posted March 9, 2010 thanks for the reply's. looks like back to the drawing board for me. have to read up more. and find more info on coding. the site i was reading really wasnt telling me much. Quote
wrx Posted March 9, 2010 Posted March 9, 2010 the site i was reading really wasnt telling me much. try php.net i hear that site has some good info Quote
Redex Posted March 9, 2010 Posted March 9, 2010 Ya wouldoun't say :P. Meh a quick search on Google would return that. Quote
Djkanna Posted March 9, 2010 Posted March 9, 2010 <?php //Above opening a PHP tag.. require_once "globals.php"; // your requiring the file Globals.php if ($someVar['someValue'] != $someOtherValue) { // Curly Brace :D (if one variable in not equal to another variable. die("Gosh people use die it's yak.."); // Kill the page with a message } else { // Two curly braces 'else' meaning it equals to $someOtherValue echo 'WooP'; // echo success message } $h->endpage(); // I'll give you credit most people including me forget this.. // Below closing the PHP tag . ?> I didn't go into great detail I'm far too tired.. http://www.php.net and w3schools.com. Also try to learn HTML and Javascript first. :) Quote
halfbaked Posted March 10, 2010 Author Posted March 10, 2010 thank you all for the info and help. the 1st site i was studying was PHP Buddy but the info i found was very little then it would have me click else where then send me somewhere else saying download this or that. Quote
Joshua Posted March 10, 2010 Posted March 10, 2010 May not be correct but he is trying is he not? Lets not start a bashafest on new users (: php.net w3schools are the top 2 i'd recommend, there are others of course. We all learn by asking questions. There is no such thing as a stupid question only stupid answers Boy do I see a lot of stupid answers in this post ^_- Quote
Zero-Affect Posted March 10, 2010 Posted March 10, 2010 I must agree there is alot of stupid posts and one of them is the above post. php.net is the place i took notes from, i always look up functions and so forth. You can send me a mail if you want i don't mind answering afew questions (saves on spamming the forum). if you need security at any point, the following may interest you [mp]17[/mp] Quote
Jordan Palmer Posted March 10, 2010 Posted March 10, 2010 I don't think mine is a stupid post :O I wouldn't say mine is either :) Quote
Guest Drizzle Posted March 10, 2010 Posted March 10, 2010 I learned curly braces from css and if's from javascript. Quote
Djkanna Posted March 10, 2010 Posted March 10, 2010 I learned 'Curly Braces' from PHP and if() else() from PHP I learned CSS before I learn't proper HTML (stupid?!?) I learn't what I know of PHP before I learn't HTML :S Quote
Guest Drizzle Posted March 11, 2010 Posted March 11, 2010 Yea i dont understand html properly. like i know all the tags except for remembering the doctype stuff, but like im no good at speed coding for xhtml. When i do xhtml, which is more of template design than coding, i go through many errors. Usually i just use html tidy from w3 and just change accordingly. But im still studying how it works Quote
Redex Posted March 13, 2010 Posted March 13, 2010 Meh just looking if i can change some things, without looking at the other posts :P <? php require_once ("globabls.php"); if($gang['<30 days old']) { die("<font color=red><font size=5>echo ("You damn bully what you thinking? You can't attack a gang less then 30 days old."); } else if($gang['>30 days old']) { Declare War echo "You have declared war on $gang."; } $h->endpage(); ?> Please point out any errors from here xD. Meh it was just my attempt xd. Quote
Jordan Palmer Posted March 13, 2010 Posted March 13, 2010 Redex, You've used die(); then echo(); in the die(); You cannot do that -.-, Also the $gang still isn't defined. Here's a working code,  All it does if the user has been in the gang for 30days then they can declare war  <?php require_once (DIRNAME(__FILE__) . '/globals.php'); global $ir,$h; if($ir['daysingang'] < 30) { echo "You cannot declear war right now"; $h->endpage(); exit; } else if($ir['daysingang'] > 30) { echo "You can now [url='yourgang.php?action=staff&act2=declare'][b]Declare War[/b][/url] "; } $h->endpage(); ?> Not tested but I think it'll work Quote
Redex Posted March 13, 2010 Posted March 13, 2010 Jordan you've misunderstood. All i've done is make it so the if statement and if else statements syntax is correct. As in: if () { } else () { } etc. That's about it. Quote
Jordan Palmer Posted March 13, 2010 Posted March 13, 2010 Jordan you've misunderstood. All i've done is make it so the if statement and if else statements syntax is correct. As in: if () { } else () { } etc. That's about it. All I've done is made it work, I think thats what he was after, All he has to do is edit Quote
CrazyT Posted March 15, 2010 Posted March 15, 2010 Pudda you use so much code. lol <?php include("./globals.php"); if ($ir['daysingang'] < 30) echo "You cannot declear war right now"; else echo "You can now [url='yourgang.php?action=staff&act2=declare'][b]Declare War[/b][/url] "; $h->endpage(); ?> Less code xD Or.. <?php include("./globals.php"); echo ($ir['daysingang'] < 30) ? "You cannot declear war right now" : "You can now [url='yourgang.php?action=staff&act2=declare'][b]Declare War[/b][/url] "; $h->endpage(); ?> xD Quote
Jordan Palmer Posted March 15, 2010 Posted March 15, 2010 Pudda you use so much code. lol include("./globals.php"); if ($ir['daysingang'] < 30) echo "You cannot declear war right now"; else echo "You can now Declare War "; $h->endpage(); ?> Less code xD Or.. include("./globals.php"); echo ($ir['daysingang'] < 30) ? "You cannot declear war right now" : "You can now Declare War "; $h->endpage(); ?> xD Good Point xD Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.