473,398 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Unexpected T_VARIABLE in image database script

38
No doubt this has been covered lots in detail. I think I've almost got is sorted but for this one error.

"Parse error: syntax error, unexpected T_VARIABLE in /home/fhlinux162/g/greatestalbumsever.com/user/htdocs/php/image.php on line 11"

Usually something to do with a bracket missing or something, but I can't see what it is.

My code is as follows. $albumNumber is being passed from via a html link to this script. "content" is the row in my table storing the image data

Expand|Select|Wrap|Line Numbers
  1. <?
  2. if(isset($_GET['albumNumber'])) 
  3. {
  4. mysql_connect("__MUNGED__","__MUNGED__","__MUNGED__"); 
  5. mysql_select_db("freelance"); 
  6.  
  7. $albumNumber = $_GET['albumNumber'];
  8. $query = "SELECT content FROM Albums WHERE albumNumber = '$albumNumber'";
  9.  
  10. $result = mysql_query($query)
  11. $content=$r["content"];
  12.  
  13. header("Content-Type: image/jpeg"); 
  14. echo $content;
  15. }
  16. ?>
  17.  
  18.  
Any suggestions would be most welcome. Thanks!
Oct 14 '07 #1
6 1585
Markus
6,050 Expert 4TB
Use code tags please. Makes things easier.

DONT PUT YOUR DETAILS UP EITHER! Anyone can get into your mysql now!

Change your password asap.
Oct 14 '07 #2
pbmods
5,821 Expert 4TB
Heya, Philth.

Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).

Please use CODE tags when posting source code:

[CODE=php]
PHP code goes here.
[/CODE]

You're missing a semicolon.
Oct 14 '07 #3
Markus
6,050 Expert 4TB
Expand|Select|Wrap|Line Numbers
  1. <?
  2. if(isset($_GET['albumNumber'])) 
  3. {
  4. mysql_connect("__MUNGED__","__MUNGED__","__MUNGED__"); 
  5. mysql_select_db("freelance"); 
  6.  
  7. $albumNumber = $_GET['albumNumber'];
  8. $query = "SELECT content FROM Albums WHERE albumNumber = '$albumNumber'";
  9.  
  10. $result = mysql_query($query) // <<<< missing ';' as pbmods said.
  11. $content=$r["content"];
  12.  
  13. header("Content-Type: image/jpeg"); 
  14. echo $content;
  15. }
  16. ?>
  17.  
  18.  
Oct 14 '07 #4
Philth
38
Cheers guys!

Obvously wasn't paying too much attention when posting this - thanks for the help.
Oct 14 '07 #5
pbmods
5,821 Expert 4TB
Heya, Philth.

Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Oct 14 '07 #6
Philth
38
Well, couldn't check last night, but it seems to have dealt with the error issue, now it doesn't actually do anything - no error, no action - don't know which is worse.

I'm using the following as my html image script...

<img src='php/image.php?albumNumber=$albumNumber'/>

Which is successfully picking up the album number variable.

The image date is definately in the database, it just doesn't want to pick it up.
Oct 15 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: mooneater | last post by:
Hallo, ich bin neu mit dem Umgang mit PHP, und ich habe folgendes (siehe unten) programmiert. Nun erhalte ich bei Aufruf meiner PHP-Datei folgende Fehlermeldung: Parse error: parse error,...
2
by: aamer | last post by:
can anyone please help me, im getting a dumb: Parse error: syntax error, unexpected T_VARIABLE in /home/jeddah/public_html/lomar/cart/remove.php on line 5 in the following file, <?php...
4
by: bovanshi | last post by:
got this annoying error I'm completly new to php... and i have no clue what is wrong here, from what i can tell there is nothing rong with this code... but that isn't what the borwser say :P ...
10
by: kilo | last post by:
Someone please see what the problem is.. I have getting an error: Parse error: syntax error, unexpected T_VARIABLE, expecting '{' in /customers/test-dig.dk/test-dig.dk/httpd.www/database.inc.php on...
4
by: needhelp08 | last post by:
I am getting the error Parse error: syntax error, unexpected T_VARIABLE on line 4 but I can't seem to find what is wrong. Could someone please help. <?php $conn = @mysql_connect("localhost",...
8
by: illuzion | last post by:
ok I keep getting this error: Parse error: syntax error, unexpected T_VARIABLE in /home/illuzion/public_html/BAMF/contactus.php on line 38 and this error is possibly on other lines could...
4
by: redsky | last post by:
Hi, I'm getting this error in my code (trying to make a submit button work) and can't figure out what the problem is. Can someone help me? Parse error: parse error, unexpected T_VARIABLE in...
2
by: fburn | last post by:
I need some help with an error I'm getting using php 5.2.5 running on linux. I receive an error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or...
25
by: URmusicandvideo | last post by:
I have just finshed my first php code and posted it online and I am getting a Parse error: syntax error, unexpected T_VARIABLE in /home/hydeands/public_html/phpmail.php on line 45 But when I look...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.