Q:

Executing multiple mysql queries in consectuive mysqli_query php

I want to execute these queries 
$q1 = "INSERT INTO t1 (id,desc) VALUES (1,'desc');" <br>
$q2 = "SET @last_id = LAST_INSERT_ID();" <br>
$q3 = "INSERT INTO t2 (parentid,desc) VALUES (@last_id, 'somedesc');"<br>

Will this work correctly 3 mysqli_query something like this?
$res = mysqli_query($q1);
$res2 = mysqli_query($q2);
$res3 = mysqli_query($q3);

A:

To start, desc is a MySQL reserved word

http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html

and must be wrapped in backticks if you're going to decide on using it, without renaming it to something else than desc, say description for instance.
Therefore, you will need to change it to the following, assuming your DB connection is established, and using $con as an example, which you haven't shown us what your DB connection is.
$q1 = "INSERT INTO t1 (id,`desc`) VALUES (1,'desc')";
$q2 = "SET @last_id = LAST_INSERT_ID()";
$q3 = "INSERT INTO t2 (parentid,`desc`) VALUES (@last_id, 'somedesc')";

minus all of your <br> tags, since you are inside PHP, unless that wasn't part of your code, but in trying to format your code in your question.
Sidenote: Your semi-colons were misplaced.
and passing DB connection to your queries:
$res = mysqli_query($con,$q1);
$res2 = mysqli_query($con,$q2);
$res3 = mysqli_query($con,$q3);

Plus, adding or die(mysqli_error($con)) to mysqli_query() to check for possible errors in your queries.

