many querys

Codes here !

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 6
Joined: Wed Apr 18, 2012 1:50 am

Thu May 03, 2012 12:48 pm


I hope this is not too much of a silly question :)

In my form i have 5 drop down boxes, so do i write

query1 Select * from tableName
query2 Select * from tableName
query3 Select * from tableName
query4 Select * from tableName
query5 Select * from tableName

can i name the querys 1,2,3,4,5


User avatar
php-forum GURU
php-forum GURU
Posts: 2192
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Fri May 04, 2012 4:21 am

You can name them anyway you like.

$myStuff = "SELECT * FROM $table WHERE x=y";
$myOtherStuff = "SELECT * FROM $otherTable WHERE y=x";

$myStuff = msyql_query($myStuff);
$myOtherStuff = mysql_query($myOtherStuff);

$myStuff = mysql_fetch_assoc($myStuff);
$myOtherStuff = mysql_fetch_assoc($myOtherStuff);

User avatar
php-forum Fan User
php-forum Fan User
Posts: 979
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Fri May 04, 2012 5:04 am

What he means is you can name them however you want EXCEPT for the fact that variable names cannot start with numbers or contain special characters other than "_"

So you can name your queries:
$query1, $query2, $query3...

You can also name them:
$__1, $__2, $__3...

But you can't name them:
$1, $2, $3....

Post Reply