many querys

Codes here !

Moderators: macek, egami, gesf

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

many querys

Postby QueenBea » Thu May 03, 2012 12:48 pm

Hello

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

thanks

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

Re: many querys

Postby egami » 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
Nullsig
php-forum Fan User
php-forum Fan User
Posts: 981
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Re: many querys

Postby Nullsig » 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....


Return to “mySQL & php coding”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron