473,385 Members | 1,875 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,385 software developers and data experts.

Concatenate variable in image file name

Hi,

Can some please help me correct the following code. Thanks.

<?php
$pic = "betty.jpg"
echo "<img src=\"http://somedomain.com/\" . $pic . \" width=\"560\" height=\"400\" alt=\"betty\" />";
?>
Aug 15 '11 #1

✓ answered by Oralloy

TJ,

Try
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $pic = "betty.jpg"
  3. echo "<img src='http://somedomain.com/$pic' width='560' height='400' alt='betty' />";
  4. ?> 

5 4770
Oralloy
987 Expert 512MB
TJ,

Try
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $pic = "betty.jpg"
  3. echo "<img src='http://somedomain.com/$pic' width='560' height='400' alt='betty' />";
  4. ?> 
Aug 15 '11 #2
Hi Oralloy,

Thanks for your reply.
I tried, but I'm still getting syntax error. I'm working on a facebook app, does it requires a different syntax?

Thanks
Aug 15 '11 #3
Oralloy
987 Expert 512MB
TJ,

Do you need a semicolon after $pic = "betty.jpg"?

Oralloy
Aug 15 '11 #4
Oralloy,

Yes its the missing ;
You are great. Thanks.

TJ
Aug 15 '11 #5
Oralloy
987 Expert 512MB
Please mark the correct solution?
Aug 15 '11 #6

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

Similar topics

1
by: JonChart | last post by:
Hi all, I would like to know ho to validate a file name when uploading via asp and whether or not this can be validated with javascript? I need to upload 2 images and the file names must be...
4
by: Amir | last post by:
Hi, I'd like to know if it's possible to pass an image name (the IMG SRC attribute) from HREF element to a function that is activated by onClick event and creates a Web page. I have this HREF...
17
by: Joe Laughlin | last post by:
I've not used C much before, so I don't know how robust or good this code is. I'd appreciate any feedback or criticisms anyone has! Thanks, Joe #include <stdio.h> #include <string.h>
4
by: moondaddy | last post by:
Using vb.net I need to download image files to the client browser where they can save to disk. Below is some sample code I'm using. when I run this the File Download window in the browser says: ...
2
by: Tommy | last post by:
Hi all, I use DataGridView in my form and add image column and 2 textbox column, and I want to change image column's image on runtime. But there is no any example on this function. What can I do ?...
0
by: aris1234 | last post by:
hello.. How to upload image file in page update ..?? i have logic like this : if user upload new image then old image must delete and update DB used new name if user not upload new image then...
7
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. I have an ASP.NET 2.0 web application which contains an Images directory with all website images. How can I prevent other websites from creating img tags with the source as my images? I want...
2
by: amritranjan | last post by:
This is my Jsp code for image upload in database: -----------Upload.jsp---------------- <html> <head> <title>Account Details </title> </head> <body bgproperties="fixed" bgcolor="#CCFFFF">...
1
by: Sinan Alkan | last post by:
Hi All, I have a method to resize any image file to the specific dimensions and save this new image to a path. I found it on a web page(By Joel Neubeck) and i changed it for my project. The...
6
by: mfaisalwarraich | last post by:
hi every body, i am using the following code to upload an image. it directly jumps to the error message please tell me what im doing wrong here. <form name="myform"...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.