Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Help with tedious but yet simple php code D:


  • Please log in to reply
9 replies to this topic

#1 rajjaak24

rajjaak24

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:58 AM

Posted 04 May 2012 - 01:30 PM

Hi there I've been having some problem getting to the root of this error:
Parse error: syntax error, unexpected T_VARIABLE in /home/ultima44/public_html/global_func.php on line 398

On line 398:
removed by op

Now I know that sometimes PHP isn't exact and sometimes the error might be on the line before so here is the full page:

removed by op


Iv'e tried various things to solve this problem taking away adding nothing seems to work. Thanks to anyone that can help

GO TO BOTTOM POST

Edited by rajjaak24, 04 May 2012 - 03:51 PM.


BC AdBot (Login to Remove)

 


#2 alexsmith2709

alexsmith2709

  • Members
  • 504 posts
  • OFFLINE
  •  
  • Local time:03:58 AM

Posted 04 May 2012 - 01:46 PM

Im not brilliant at PHP but have some experience. It looks like you havent opened your while loop.
The line before should be
while($r=$db->fetch_row($q) {
Give that a go. It should help.

#3 rajjaak24

rajjaak24
  • Topic Starter

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:58 AM

Posted 04 May 2012 - 02:26 PM

Nope I've tried that when I add it I get this error:
Parse error: syntax error, unexpected '{' in /home/ultima44/public_html/global_func.php on line 396

Any other ideas?

#4 rajjaak24

rajjaak24
  • Topic Starter

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:58 AM

Posted 04 May 2012 - 02:46 PM

Okay fixed the problem (I think) I simply replaced the file with an earlier version that I made for backup. But then I got a unexpected "(" I looked around the and found this function Theme_dropdown($connection,$ddname="Theme",$select ed=-1) notice the gap near the end of select and ed I can't think of any variable with the value of -1 so I removed the space and voila! The page is sorted (now it was on to the next page) This is something I really don't understand.

error:
Fatal error: Call to a member function query() on a non-object in /home/ultima44/public_html/header.php on line 3

Line 3 in header.php:
removed by op

The whole page:
removed by op

Any ideas with this one as I don't understand the error

Edited by rajjaak24, 04 May 2012 - 03:00 PM.


#5 rajjaak24

rajjaak24
  • Topic Starter

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:58 AM

Posted 04 May 2012 - 02:59 PM

I'm such an idiot xD It took me 15 seconds to look under the code and work out what I did wrong. I feel like such a douche xD

I've fixed everything thanks alot alexsmith2709 for trying to help.

#6 rajjaak24

rajjaak24
  • Topic Starter

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:58 AM

Posted 04 May 2012 - 03:01 PM

I came here after 3 hours of headache... I guess I need to take longer before asking for support

#7 rajjaak24

rajjaak24
  • Topic Starter

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:58 AM

Posted 04 May 2012 - 03:52 PM

Ok I am stuck again...

error code:
Parse error: syntax error, unexpected T_STRING, expecting ']' in /home/ultima44/public_html/staff_themecreator.php on line 96

line 96:
$q = $db->query("SELECT * FROM <span class='highlight'>Theme</span> WHERE ThemeDATA='{$_POST['<span class='highlight'>Theme</span>']}'");

any ideas?

edit:
if I take these " and replace with '
$q = $db->query('SELECT * FROM <span class='highlight'>Theme</span> WHERE ThemeDATA='{$_POST['<span class='highlight'>Theme</span>'}]'');

I get unexpected T_STRING same line...

Edited by rajjaak24, 04 May 2012 - 03:57 PM.


#8 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:08:58 PM

Posted 04 May 2012 - 06:25 PM

It would be really helpful if you quit removing code. The idea of a forum is to solve problems so that others can benefit. Since I now have no idea of what you are trying to accomplish all I can say, based on what code is left, is that you cannot have html tags in your sql query. As it is, the query is meaningless. If you are trying to pull all of the data from a table, then your query would be something like 'select * from myTable'.

This should work (depending on how your server is set up):
$q = $db->query("SELECT * FROM Theme WHERE ThemeDATA='{$_POST['Theme']}'");
This is assuming that your table has a column named ThemeDATA. I suspect that you might really be looking for this:
$q = $db->query("SELECT * FROM Theme WHERE Theme='{$_POST['Theme']}'");
or
$q = $db->query("SELECT * FROM Theme WHERE Theme=" . $_POST['Theme']);

The problem is not with your php. The problem is with your sql. Programming languages work in completely consistent manners according to the rules by which they were designed.

Edited by groovicus, 04 May 2012 - 07:41 PM.


#9 rajjaak24

rajjaak24
  • Topic Starter

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:58 AM

Posted 05 May 2012 - 08:59 AM

I continously remove the code because I don't want a huge portion of my site exposed B)

I only have a table called ThemeID. You were right! It was the html tags. I did have a doubt at the back of my head about them but didn't think would make much difference thanks for the help. I can fix all the other bugs using this scenario I think. That's the problem handling code that's 4 years old...

#10 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:08:58 PM

Posted 05 May 2012 - 09:22 AM

but didn't think would make much difference


I'm not sure what that means. Either your code is correct, or it isn't. If you have syntax in places that it doesn't belong, it will never work, period. Whether the code is 4 years old or 14, it makes no difference. :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users