Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Php / Mysql :0:,:1:

Question posted by: nicolino101 (Newbie) on May 8th, 2008 02:56 PM
Has anyone ever seen or used these type of variables when creating an sql_query?

ex...

Insert Into db.table ('id','name','address') Values(:0:, :1:, :2:)

Please let me know what the heck they are?
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
ronverdonk's Avatar
ronverdonk
Moderator
4,138 Posts
May 8th, 2008
03:58 PM
#2

Re: Php / Mysql :0:,:1:
No never seen it. I also never have seen a column name within single quotes. I am sure that will not work.

Ronald
__________________
RTFM is an almost extinct art form.

Reply
nicolino101's Avatar
nicolino101
Newbie
3 Posts
May 8th, 2008
05:13 PM
#3

Re: Php / Mysql :0:,:1:
Quote:
Originally Posted by ronverdonk
No never seen it. I also never have seen a column name within single quotes. I am sure that will not work.

Ronald



Actually it's only the :0:, :1: (use of colons) that I'm concerned with...
<br />
Can't seem to find anything on it.

Reply
Atli's Avatar
Atli
Moderator
1,866 Posts
May 9th, 2008
06:12 AM
#4

Re: Php / Mysql :0:,:1:
I have never seen this either, nor do I think this is valid syntax in either PHP or MySQL.

Only possible reason I can see for doing something like this is if you plan on using regex to replace them with valid values.
Perhaps a part of some custom template system?

Reply
dlite922's Avatar
dlite922
Needs Regular Fix
406 Posts
May 9th, 2008
07:04 AM
#5

Re: Php / Mysql :0:,:1:
Quote:
Originally Posted by nicolino101
Has anyone ever seen or used these type of variables when creating an sql_query?

ex...

Insert Into db.table ('id','name','address') Values(:0:, :1:, :2:)

Please let me know what the heck they are?


Actually i have seen this, but it intrigued me then but never followed through.

It has to do with variables like you said, mysql variables.

Why not check out the manual and let us know. I'd like to find out and i'm sure these two knuckleheads would like to know that this is actually valid syntax. (or there is something like this).

Reply
dlite922's Avatar
dlite922
Needs Regular Fix
406 Posts
May 9th, 2008
07:13 AM
#6

Re: Php / Mysql :0:,:1:
FOUND IT!!

http://dev.mysql.com/doc/refman/6.0...-variables.html

That's in 6.0, didn't look to see in prev ver but i'm sure this isn't something new.

roverdonk, atli..... go hit the books! ;)

But your right, what he had, was not valid syntax, but I think this is where I've seen colons used. In his example 1 and 2 are variable names.

C YA!

Reply
rpnew's Avatar
rpnew
Familiar Sight
174 Posts
May 9th, 2008
07:22 AM
#7

Re: Php / Mysql :0:,:1:
Quote:
Originally Posted by nicolino101
Has anyone ever seen or used these type of variables when creating an sql_query?

ex...

Insert Into db.table ('id','name','address') Values(:0:, :1:, :2:)

Please let me know what the heck they are?


Hi,

'id' can be `id` in MySql but never seen the values clause like that... post here if anyone gets answer..

Regards,
RP

Reply
rpnew's Avatar
rpnew
Familiar Sight
174 Posts
May 9th, 2008
07:31 AM
#8

Re: Php / Mysql :0:,:1:
Quote:
Originally Posted by dlite922
FOUND IT!!

http://dev.mysql.com/doc/refman/6.0...-variables.html

That's in 6.0, didn't look to see in prev ver but i'm sure this isn't something new.

roverdonk, atli..... go hit the books! ;)

But your right, what he had, was not valid syntax, but I think this is where I've seen colons used. In his example 1 and 2 are variable names.

C YA!


Hi,

Its there in earlier version as well but not what he has written... : on both side.. or something like that...

Regards,
RP

Reply
nicolino101's Avatar
nicolino101
Newbie
3 Posts
May 9th, 2008
03:08 PM
#9

Re: Php / Mysql :0:,:1:
Thanks for the help... and I'm sorry about the confusion.
It should have been

Insert Into db.table id, name, address Values(:0:, :1:, :2:)

The colons are used for user defined variables in Mysql 6.
But, in my case I believe that they are being used differently.

Possibly as stated above in a regex statement on retrieval.

Not a MySql or PHP thing.

This is a great forum...

Last edited by nicolino101 : May 9th, 2008 at 03:17 PM. Reason: Made a small error
Reply
Reply
Not the answer you were looking for? Post your question . . .
170,098 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top PHP Forum Contributors