RE: Can I modify a MySQL object?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Depends on where you want to manipulate.

In mysql you can

$query = 'select first_name as FNAME from tablename';
In this result you changed the column name from first_name to FNAME for the
result only.


In this example we can change the data returned in a particular field by
using an if statement.


$query = 'select IF(first_name='John','Big Bad John',first_name) FROM
tablename;

If the first_name field contains john we convert the name else just return
the name in the row.

Is that what you wanted?




Richard L. Buskirk
Senior Software Engineer/Systems Administrator

You can't grow your business with systems that are on life support...

-----Original Message-----
From: Brian Dunning [mailto:brian@xxxxxxxxxxxxxxxx] 
Sent: Wednesday, March 23, 2011 8:07 PM
To: PHP-General List
Subject:  Can I modify a MySQL object?

Let's say I do a query:

$result = mysql_query("select * from tablename");

Is there some way I can manually update the contents of certain
columns/records in $result? I don't want to actually update MySQL, just the
results that I'm holding in memory for this script. Can I do it without
converting it to a regular array?
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux