Jump to content

[SOLVED] really weird error... can php malfunction?


ohdang888

Recommended Posts

i am getting this error:

Parse error: syntax error, unexpected T_VARIABLE in /home/socialap/public_html/posters/include/rating_system/rate.php on line 1

 

from this code:

 

connect.php has no errors... i've already tested it. Maybe i'm just blind, but i can't seem to find out why i would ever get this error!?!?

 

thanks.

 

<?php
include('../../connect.php');
$id = mysql_real_escape_string($_GET['id']);
$rating = mysql_real_escape_string($_GET['rating']);

if(empty($id) or empty($rating) or $rating > 5){
die("Invalid poster/no rating");
}

Link to comment
Share on other sites

First of all, this is wrong:

if(empty($id) or empty($rating) or $rating > 5){
die("Invalid poster/no rating");
}

 

There is no "or" with PHP - use these instead...

|| OR (two "bar" symbols)
&& AND
!= Not equals to
== Equals to

 

So your code should read:

if(empty($id) || empty($rating) || $rating > 5){
die("Invalid poster/no rating");
}

 

That's probably not the error but worth pointing out.

 

It's worth also having a look at "connect.php" and make sure the code there is correct.

Link to comment
Share on other sites

First of all, this is wrong:

if(empty($id) or empty($rating) or $rating > 5){
die("Invalid poster/no rating");
}

 

There is no "or" with PHP - use these instead...

|| OR (two "bar" symbols)
&& AND
!= Not equals to
== Equals to

 

So your code should read:

if(empty($id) || empty($rating) || $rating > 5){
die("Invalid poster/no rating");
}

 

That's probably not the error but worth pointing out.

 

It's worth also having a look at "connect.php" and make sure the code there is correct.

 

error says line 1.  That condition is at the very least, line 6.  It has nothing to do with that line. And FYI, there most certainly is an 'or' in php.  and an 'and'.  They word exactly like their || and && counterparts, except that they are lower on the order of operation list.

 

http://us3.php.net/manual/en/language.operators.php

Link to comment
Share on other sites

nope..connect .php is just fine...

 

here's the link to that:

http://socialapps.sclek.com/posters/include/connect.php

 

and heres the link to rate.php

http://socialapps.sclek.com/posters/include/rating_system/rate.php

 

 

 

this is soooooooooo weird. the contents of rate.php are exactly, character by character, the same as written above.

 

 

could this be an error of php malfunctioning?

Link to comment
Share on other sites

ok i've found the problem, but i don't know how to solve it...

 

i'm use FileZilla to upload files, rather than editing them in the browser, because i hate doing that.

 

So in my notepad++ it displays the code as i write it, in differenet lines. But i looked at the file on the server, and it displays it like this:

 

<?php session_start();$head = false;require_once '../../include.php';$id = mysql_real_escape_string($_GET['id']);

 

so the whole thing is on 1 line...which makes it impossible to solve errors.

 

I've tried re-loading the file to get it into different lines, buts it not working...

 

 

 

hm, any ideas how to make that automatically go to seperate lines... i don't have this problem in all my other files i uploaded...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.