I have further edited the code, and it is back to the state (error wise) of the first script.
Here it is
[CODE=PHP]
<?php
$page_title = 'Homepage';
$loggedin = $_SESSION['loggedin'];
if ($_SESSION['ID'] >= 1) //then run non logged in homepage
{
include ('./includes/header.html');
?>
<p><h3>News</h3></p>...
User Profile
Collapse
-
I have updated the code slightly (adding in a line for the table, and adding to the queries) which shouldn't affect the rest of the script, however now I get the error messages displayed before just when logged in (see previous post)!
Here is the new code
[CODE=PHP]
<?php
$page_title = 'Homepage';
$loggedin = $_SESSION['loggedin'];
if ($loggedin != NULL) //then...Leave a comment:
-
I cannot understand why php flags up certain code that used elsewhere is fine
Hi, I am using PHP and mysql to create a website.
I am fairly new to PHP, and thus am grateful to anyone who helps!
Firstly I am running a homepage, that displays additional content if a user has logged in. I set a loggedin session in the log in page, which I have tested and works fine in other scripts.
I am displaying news on the homepage (which is stored in a mysql database), and this works fine when the user... -
-
Sorry but I don't understand what a static method is.
Thanks for your help...Leave a comment:
-
Thanks - sorry to ask, but as i'm new to java (started a week ago) could you show me the code and where to put it?
Thanks for your help...Leave a comment:
-
How to make a program do some maths!
Hello, I am trying to write a program to solve a simultaneous equation. It runs through all the possibilites for x, and if any of them forfil the conditions of y, then it is displayed. My problem is that i don't know how to make it so that only positive integers are displayed. What I have done was change a double value integer, and then display that, but all it does it cut of the decimals, not give me all the possibles for x and y that are whole... -
-
Sorry but I have another query about the same program.
I have now refined it, and want to use switch programs to give an error message if the user doesn't type in the exact things required.
Here is the code
[CODE]
class calculator {
public static void main(String[] arguments) {
float numbera = Float.parseFloa t(arguments[0]);
char sign = arguments[1].charAt(0);...Leave a comment:
-
-
-
Oh- it runs through my files?
Ok - so i cannot use that operator in this way?...Leave a comment:
-
Sorry I didn't see that, it now compiles correctly. All the functions except * work, and I get lists of he arguments used for those. When I use * I get 13 arguments,with [0] as the first number i typed in, [13] as the last number, and all the ones in between as random .java and .class files in the folder of calculator. I am new so i'm probably asking stupid questions but - Why is this? and How do i get it to work?
Thanks for your help...Leave a comment:
-
Here is my code [CODE]
class calculator {
public static void main(String[] arguments) {
for (int i= 0; i < arguments.lengt h; i++)
System.out.prin tln("arguments["+i"]="+arguments[i]);
float numbera = 100;
float numberb = 200;
char sign = '+';
numbera = Float.parseFloa t(arguments[0]);
...Leave a comment:
-
i updated my code and i am still getting the same error messages
thanksLeave a comment:
-
I did that and got the same error messages.
Here is my complete code (with yours included)
[CODE]
class calculator {
public static void main(String[] arguments) {
for (int i= 0; i < argument.length ; i++)
System.out.prin tln("argument["+i"]="+argument[i]);
float numbera = 100;
float numberb = 200; ...Leave a comment:
-
Sorry, I don't quite understand - where do i put that statement in my code and what does it do?
If i put your code directly after the public static void main(String[] arguments) {
I get 3 error messages saying that there is a ; expected (with the hat under the last ) of your code), that it is not a statement with the hat under the last put one square bracket, and that a normal bracket is expected, with the hat under the thrid...Leave a comment:
-
Thanks Ganon - now everything works except multiplication.
I am mystified to why this is, because the code is exactly the same to the other mathematical functions.
Here is my full code [CODE]
class calculator {
public static void main(String[] arguments) {
float numbera = 100;
float numberb = 200;
char sign = '*';
numbera = Float.parseFloa t(arguments[0]);...Leave a comment:
-
I got rid of all but one of the errors by declaring the "sign" variable at the beginning as a char variable so the first few lines look like this:
[CODE=java]
class calculator {
public static void main(String[] arguments) {
float numbera = 100;
float numberb = 200;
char sign = '+';
[/CODE]
I also changed Char to Character.parse Char
The only error that...Leave a comment:
-
It still doesn't work
Sorry Ganon I posted the second thing before I saw your reply. here is the code i am now using [CODE=java]
class calculator {
public static void main(String[] arguments) {
float numbera = 100;
float numberb = 200;
if (arguments.leng th > 0) {
numbera = Float.parseFloa t(arguments[0]);
sign = Char.parseChar (arguments[1]);...Leave a comment:
No activity results to display
Show More
Leave a comment: