473,513 Members | 2,401 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple question, but I`m puzzled :(

Hi!
I`ve got a simple question but I`m puzzled:( When I create variable: for example
$query for query to MySQL its obvieus that I want to use variables. Now should I do
something like that:
1) $query = "blahblahblah".$variable1."blahblahblah"
."blahblahblah".$variable2."blahblahblah";
OR
2) $query = "blahblahblah."$variable1."blahblahblah"
."blahblahblah."$variable2."blahblahblah";

It`s the 1st one right? I have to be sure:(
TIA

--
Best regards,
Maciej Nadolski
Jul 17 '05 #1
5 1920
On Sat, 4 Oct 2003 13:31:23 +0000 (UTC), Maciej Nadolski
<us****@WYTNIJ-TO.nadolski.net> wrote:
Hi!
I`ve got a simple question but I`m puzzled:( When I create variable: for example
$query for query to MySQL its obvieus that I want to use variables. Now should I do
something like that:
1) $query = "blahblahblah".$variable1."blahblahblah"
."blahblahblah".$variable2."blahblahblah";
OR
2) $query = "blahblahblah."$variable1."blahblahblah"
."blahblahblah."$variable2."blahblahblah";

It`s the 1st one right? I have to be sure:(


The first one is valid PHP, the second one is a syntax error, as PHP would
have told you if you'd tried it...

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #2
Andy Hassall <an**@andyh.co.uk> wrote in
news:cm********************************@4ax.com:
The first one is valid PHP, the second one is a syntax error, as PHP
would
have told you if you'd tried it...

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)


I haven`t run tests yet and I wanted to make sure before them so I asked. Thanks:)

--
Pozdrawiam,
Maciej Nadolski
Jul 17 '05 #3
On Sat, 04 Oct 2003 14:10:28 +0000, Maciej Nadolski wrote:
Andy Hassall <an**@andyh.co.uk> wrote in
news:cm********************************@4ax.com:
The first one is valid PHP, the second one is a syntax error, as PHP
would
have told you if you'd tried it...

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)


I haven`t run tests yet and I wanted to make sure before them so I asked. Thanks:)


Well why the heck not?? A simple test would've answered your question more
quickly than posting to this newsgroup!
--
Jeffrey D. Silverman | jeffrey AT jhu DOT edu
Johns Hopkins University | Baltimore, MD
Website | http://www.wse.jhu.edu/newtnotes/

Jul 17 '05 #4
"Maciej Nadolski" <us****@WYTNIJ-TO.nadolski.net> wrote in message
news:Xn*******************************@193.110.122 .80...
Hi!
I`ve got a simple question but I`m puzzled:( When I create variable: for example $query for query to MySQL its obvieus that I want to use variables. Now should I do something like that:
1) $query = "blahblahblah".$variable1."blahblahblah"
."blahblahblah".$variable2."blahblahblah";
OR
2) $query = "blahblahblah."$variable1."blahblahblah"
."blahblahblah."$variable2."blahblahblah";

It`s the 1st one right? I have to be sure:(


What was the point of this question? I ask only because the only difference
between your examples would appear to be a typo (concatenation operator
inside quotes in second example).

- Virgil
Jul 17 '05 #5

"Maciej Nadolski" <us****@WYTNIJ-TO.nadolski.net> wrote in message
news:Xn*******************************@193.110.122 .80...
Hi!
I`ve got a simple question but I`m puzzled:( When I create variable: for example $query for query to MySQL its obvieus that I want to use variables. Now should I do something like that:
1) $query = "blahblahblah".$variable1."blahblahblah"
."blahblahblah".$variable2."blahblahblah";
OR
2) $query = "blahblahblah."$variable1."blahblahblah"
."blahblahblah."$variable2."blahblahblah";

It`s the 1st one right? I have to be sure:(
TIA

--
Best regards,
Maciej Nadolski


RTFM. If you did you would see that 1 is valid php and 2 is not, but that
neither are partiularly efficient.

You are using double quotes where single would suffice:

$query = 'blahblahblah'.$variable1.'blahblahblahblahblahbla h'
.$variable2.'blahblahblah';

would be favourable. If you really wanted to use doube quotes (maybe your
keyboard is broken?) then you could use:

$query = "blahblahblah{$variable1}blahblahblah
{$variable2}blahblahblah";

but this will be slower as php will be parsing the pre-defined text as well.

PS
--
Divide By Cucumber Error. Please Reinstall Universe And Reboot
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1615
by: Harry | last post by:
but I'm a bit puzzled with javascript functions you can include to use in a JSP page - you can't see them in the page source code but can call them - does this mean they are called on the server...
7
2445
by: ohaya | last post by:
Hi, I have an HTML page that has a single FRAMESET and several FRAMEs on it. One of the FRAMEs contains a page with a table in it. The problem that I'm running into is that when the page is...
10
1796
by: Steve K | last post by:
Hi, You helped get the bottom border on the td cells for me, but now there is a tiny gap in between each cell on this border. How do I get rid of that? ...
6
787
by: chri_schiller | last post by:
SInce many years, I have a web site that allows to download a 1100 page physics textbook for free. I recently redesigned the layout. Unfortunately, now it looks different in Firefox and Safary on...
3
1103
by: Katie S | last post by:
I have a method that takes a string, formats it and returns it I want to use this in multiple ASP.NET pages, by putting it in a namespace and using that in each asp.net page What I don't...
3
1805
by: Xiaoshen Li | last post by:
Dear All, I am puzzled by how to use strtod(). I have pasted its man page below. I don't understand what char **endptr is and why it is needed there. Thank you very much. STRTOD(3) ...
24
6288
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to...
1
940
by: Johnny Jörgensen | last post by:
I do a lot of winforms programming in C# and VB.NET, but not I've been asked to do an ASP.NET application, and that's a first for me. So I hope you will bear with this basic question, because I'm...
7
1760
by: KC-Mass | last post by:
I have a module that walks down a file of unique claim numbers. Db is Current db. For each claim number I want it to retrieve, to a recordset all the transactions related to that claim. The...
0
7166
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
7386
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
7543
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7106
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...
1
5094
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...
0
4749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3236
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3226
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1601
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.