Re: Building an array, kind of?
| From: | tedd | Date: | Fri, 24 Oct 2008 18:00:49 +0000 |
| Subject: | Re: Building an array, kind of? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-282413@lists.php.net to get a copy of this message | ||
At 10:52 AM -0400 10/24/08, Dan Shirah wrote:
TGIF? Apparently my brain isn't working this Friday. I'm trying to query my table to get the first 16 ID's. I then want to assign the ID's to a variable and have them comma seperated. // My query to select the first 16 rows $get_charges2 = "SELECT FIRST 16 * FROM history WHERE id = '$id"; // Executing the query $charge_result2 = ifx_query ($get_charges2, $connect_id); How would I assign the result to a variable? For instance, say my query returns rows like: 1234 1235 1236 1237 1238 1239 How would I go about putting that in a variable to equal "1234,1235,1236,1237,1238,1239" ?from memory. $var=''; while($row = mysql_fetch_array($charge_result2)) { $var .= $row['id'] . ','; } cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com