Jump to content
MakeWebGames

I'm working on my first attempt on a code can someone help?


Recommended Posts

Posted

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();

?>

Posted
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.

Posted

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

Posted

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.

Posted
<?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. :)

Posted

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.

Posted

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 ^_-

Posted

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]

Guest Drizzle
Posted

I learned curly braces from css and if's from javascript.

Posted

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

Guest Drizzle
Posted

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

Posted

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.

Posted

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

Posted

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.

Posted
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

Posted

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

Posted
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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...