Jump to content

[SOLVED] Parse Error, syntax error - big page, warning


Recommended Posts

http://pastebin.com/m66e4c3a0

 

I pasted it on there.

Now I have counted the {'s brackets and its not that, but I cannot see anything else.

 

I just thought 2+ heads is better than 1.

 

Its line 14 btw. (although my actual page is a lot larger but I thought I only needed that part).

 

Thanks for any help :)

You can't have a quoted array index inside a double quoted string. Change this:

<?php
$buildingnameDB = mysql_query("SELECT name FROM buildings WHERE ID = $_POST['BuildingID']");
?>

to one of the following:

<?php
$buildingnameDB = mysql_query("SELECT name FROM buildings WHERE ID = " . $_POST['BuildingID']);

$buildingnameDB = mysql_query("SELECT name FROM buildings WHERE ID = {$_POST['BuildingID']}");

$buildingnameDB = mysql_query("SELECT name FROM buildings WHERE ID = $_POST[buildingID]");
?>

 

My preferences is the first format. Other people like the second.

 

Ken

Ok I have been told this before, but in such a way that it just goes right over my head.

 

(I have always learn that " " for strings, ' ' for ints, but I can't use " " so I went for ' ' but this also doesn't work in this case).

 

So for things like SESSION and POST, inside the square brackets, should I always try and use quotes of some sort, but why?

 

 

Thanks if you can explain in simple Lokolo terms :)

 

 

p.s. omg why did i not see it, the lines below have the quotes taken out of them ARGH :(:)

Not sure who told you about Quotes, but that really is not correct.  Quotes have more to do with Variables than Strings or Int data types.

 

Double Quotes will let you display a String that includes Variables.  Single Quotes will let you display a String that is exactly as shown, ie.

 

$variable="Hello"

echo "This will print Hello: $variable";

 

echo 'This will print $variable: $variable';

 

Ok I have been told this before, but in such a way that it just goes right over my head.

 

(I have always learn that " " for strings, ' ' for ints, but I can't use " " so I went for ' ' but this also doesn't work in this case).

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.