Using two queries in one table

Codes here !

Moderators: macek, egami, gesf

Post Reply
User avatar
freshnet
php-forum Active User
php-forum Active User
Posts: 359
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: Using two queries in one table

Post by freshnet » Mon Aug 20, 2012 4:05 am

Firstly, you shouldn't be using mysql_query. Mysqli_query is more secure, although PDO is far better. You can read about these on the PHP manual pages.

If you want to put in another query, just do what you've already done, e.g.

Code: Select all

$result2 = mysql_query("SELECT SUM.....");
$resultRow = mysql_fetch_row($result2);
Then you can output the row in whichever cell you want.

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: Using two queries in one table

Post by Nullsig » Mon Aug 20, 2012 5:59 am

mysql_query is just as secure as mysqli... you just have to not be dumb when you use it.

User avatar
freshnet
php-forum Active User
php-forum Active User
Posts: 359
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: Using two queries in one table

Post by freshnet » Fri Aug 24, 2012 3:17 am

fair point - but mysql should still not be used for new code!

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: Using two queries in one table

Post by Nullsig » Fri Aug 24, 2012 8:10 am

My response to your other post stands.

As far as using the mysql on new code... it doesn't matter as long as the PHP build they are currently using supports it. There is no valid reason to convert to mysqli until it is necessary. Especially in the case where existing code on the server is using mysql; converting to mysqli would then create a disjunction in the code of the website. It is an all or nothing thing.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests