<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
            "http://my.netscape.com/publish/formats/rss-0.91.dtd">

<rss version="0.91">

<channel>
<title>php-general archive @ ASPN</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Browse/Threaded/php-general</link>
<description>Very high volume general list for PHP users.</description>
<language>en-us</language>
<copyright>Copyright 2005, ActiveState</copyright>
<managingEditor>aspn-feedback@activestate.com</managingEditor>
<webMaster>aspn-feedback@activestate.com</webMaster>

<image>
<title>php-general @ ASPN Mail Archive</title>
<url>http://ASPN.ActiveState.com/ASPN/img/logo_78x25.gif</url>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Browse/Threaded/php-general</link>
</image>

<item>
<title>[PHP] Re: rss feeds from db</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/php-general/3173793</link>
<description>&lt;PRE>Dan McCullough wrote:
> I'm having some problems where some undefined entity are getting in,
> these entities are usually html entities.
> 
> sad thing is&quot;&#166;bringing in these large chains is putting
> 
> the xml doc points to the &amp; in ";&amp;brvbar" as the problem.  what do I
> need to do to get this stuff cleaned up?

Not quite. That first ; is part of the previous entity, "&quot;". You 
want to do a search/replace for "&#166;"

And &#166; is a perfectly valid entity. It represents a pipe character 
("¦"), so it is NOT an undefined entity.

If you really don't want it there, do a search-replace for "&#166;" 
and either replace it with an alternative character (perhaps a ¦ 
directly), or an empty string to remove it entirely.

Regards, Adam.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
&lt;/PRE></description>
</item>

<item>
<title>Re: [PHP] Equivelant to mysql_fetch_row for normal array</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/php-general/3173778</link>
<description>&lt;PRE>Dave M G wrote:
> Jochem, Tul, Nicolas,
> 
> Thank you for your help.
> 
> I must be doing something wrong with how my array is generated. It's 
> actually just a MySQL result, but because it is returned from a 
> function, it does not seem to behave as I would expect a MySQL result 
> should.
> 
> I'm trying the foreach function and key values, but I'm clearly not 
> quite getting it right. Perhaps there is something about my code which 
> is wrong. So I'm presenting what I hope is all the relevant parts:
> 
> public function getData($row, $type, $column, $match) {
> $query = "SELECT " . $row . " FROM " . $type . " WHERE " .$column . " = 
> " . $match;
> echo "query = " . $query . "&lt;br />";
> $result = mysql_query($query);
> $data = mysql_fetch_array($result);
> return $data;
> }
> 
> foreach($elements as $key => $val){
> echo "val[type] = " . $val[type] . "&lt;br />";
> echo "val[resource] = " . $val[resource] . "&lt;br />";
> }
> 
> 
> What I'm getting back doesn't make sense. I can't go all the way into my 
> code, but $val[type] should be a string value containing the words 
> "Article" or "Text".
> 
> But instead, I get:
> val[type] = 2
> val[resource] = 2
> 
> Am I still not doing the foreach correctly?
> 
> -- 
> Dave M G

First of all, you're using invalid syntax. You should have $val['type'] 
rather than $val[type].

Second of all, mysql_fetch_array returns only a single row, $elements. 
This is an array. From there, you're asking foreach to return each 
element of the array as $val. So each time through the foreach loop, 
$val will have the contents of that element. The element isn't an array, 
it's a scalar. So you're taking a scalar and trying to treat it like an 
array.

You really should read the manual, the pages for all these functions 
describe EXACTLY what they do.

Remember that mysql_fetch_array returns an associative array. You can 
refer to the SQL fields by their names. So if your select query was 
"SELECT foo, bar FROM mytable", after doing a mysql_fetch_array you 
could do this:

echo $row['foo'] . "&lt;br />";
echo $row['bar'] . "&lt;br />";

Regards, Adam.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
&lt;/PRE></description>
</item>

<item>
<title>[PHP] rss feeds from db</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/php-general/3173777</link>
<description>&lt;PRE>I'm having some problems where some
undefined entity are getting in,
these entities are usually html entities.

sad thing is&quot;&#166;bringing in these large chains is putting

the xml doc points to the &amp; in ";&amp;brvbar" as the problem.  what do I
need to do to get this stuff cleaned up?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
&lt;/PRE></description>
</item>

<item>
<title>[PHP] Oracle Commits</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/php-general/3173776</link>
<description>&lt;PRE>Good afternoon and salutations denizens of
the greatest list generated
by electrons!

I have a situation where I am trying to commit a transaction in Oracle
with PHP as follows;

$udGeocode = oci_parse($conn, "UPDATE CONT_ADDRESS SET GEOCODE =
'".$geocode[0]."' WHERE CONTRACT_ID = '".$row[0]."' AND POSTAL_CODE =
'".$ROW[1]."' AND ADDRESS_TYPE = 'S'");
oci_execute($udGeocode, OCI_DEFAULT);
	
// commit
	$committed = oci_commit($conn);
if (!$committed) {
   $error = oci_error($conn);
   echo 'Commit failed. Oracle reports: ' . $error['message'];
} else {
   echo '&#160;Commit succeeded';
}

The commit returns as successful, but it is not successful in the
database itself. Am I missing something here? I have RTFM on oci_execute
and oci_commit and cannot find anything.....

Thanks!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
&lt;/PRE></description>
</item>

<item>
<title>Re: [PHP] Equivelant to mysql_fetch_row for normal array</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/php-general/3173607</link>
<description>&lt;PRE>Jochem, Tul, Nicolas,

Thank you for your help.

I must be doing something wrong with how my array is generated. It's 
actually just a MySQL result, but because it is returned from a 
function, it does not seem to behave as I would expect a MySQL result 
should.

I'm trying the foreach function and key values, but I'm clearly not 
quite getting it right. Perhaps there is something about my code which 
is wrong. So I'm presenting what I hope is all the relevant parts:

public function getData($row, $type, $column, $match) {
$query = "SELECT " . $row . " FROM " . $type . " WHERE " .$column . " = 
" . $match;
echo "query = " . $query . "&lt;br />";
$result = mysql_query($query);
$data = mysql_fetch_array($result);
return $data;
}

foreach($elements as $key => $val){
echo "val[type] = " . $val[type] . "&lt;br />";
echo "val[resource] = " . $val[resource] . "&lt;br />";
}


What I'm getting back doesn't make sense. I can't go all the way into my 
code, but $val[type] should be a string value containing the words 
"Article" or "Text".

But instead, I get:
val[type] = 2
val[resource] = 2

Am I still not doing the foreach correctly?

--
Dave M G

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
&lt;/PRE></description>
</item>

<item>
<title>Re: [PHP] Equivelant to mysql_fetch_row for normal array</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/php-general/3173547</link>
<description>&lt;PRE>Dave M G wrote:
> PHP List,
> 
> Very frequently I use mysql_fetch_row in a while statement to
> 
> while($variable = mysql_fetch_row($mysqlResult)){
> echo $variable[text1];
> echo $variable[text2];

another thing. $variable[text2] is bad because you very likely don't
have a constant in your code named 'text2' - you should be using string keys
(if you had error_reporting set to include E_NOTICE errors you would see
notices output regarding non-existent constants... do this instead:

	echo $variable['text1'];
	echo $variable['text2'];

> }
> 
> Pretty standard.
> 
> But what do I do when I want to do the same kind of while loop not with
> a MySQL result, but with just a regular array?
> 
> while (variable = ????($array)){
> echo $variable[text1];
> echo $variable[text2];
> }
> 
> I've been up and down the manual, and looked at foreach statements and
> functions like each(), but I can't seem to zero in on what I need.
> 
> Can anyone let me know what it is I'm missing?
> 
> Thank you for any advice.
> 
> -- 
> Dave M G
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
&lt;/PRE></description>
</item>

<item>
<title>Re: [PHP] Equivelant to mysql_fetch_row for normal array</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/php-general/3173546</link>
<description>&lt;PRE>the foreach loop is probably better (it
doesn't require
reset()ing the array pointer for instance) but you should also
look at the example on this page (using the current() function in a
while loop):

	http://php.net/key


Dave M G wrote:
> PHP List,
> 
> Very frequently I use mysql_fetch_row in a while statement to
> 
> while($variable = mysql_fetch_row($mysqlResult)){
> echo $variable[text1];
> echo $variable[text2];
> }
> 
> Pretty standard.
> 
> But what do I do when I want to do the same kind of while loop not with
> a MySQL result, but with just a regular array?
> 
> while (variable = ????($array)){
> echo $variable[text1];
> echo $variable[text2];
> }
> 
> I've been up and down the manual, and looked at foreach statements and
> functions like each(), but I can't seem to zero in on what I need.
> 
> Can anyone let me know what it is I'm missing?
> 
> Thank you for any advice.
> 
> -- 
> Dave M G
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
&lt;/PRE></description>
</item>

<item>
<title>[PHP] Re: Equivelant to mysql_fetch_row for normal array</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/php-general/3173510</link>
<description>&lt;PRE>Dave M G wrote:
> PHP List,
> 
> Very frequently I use mysql_fetch_row in a while statement to
> 
> while($variable = mysql_fetch_row($mysqlResult)){
> echo $variable[text1];
> echo $variable[text2];
> }
> 
> Pretty standard.
> 
> But what do I do when I want to do the same kind of while loop not with 
> a MySQL result, but with just a regular array?
> 
> while (variable = ????($array)){
> echo $variable[text1];
> echo $variable[text2];
> }
> 
> I've been up and down the manual, and looked at foreach statements and 
> functions like each(), but I can't seem to zero in on what I need.
> 
> Can anyone let me know what it is I'm missing?
> 
> Thank you for any advice.
> 
> -- 
> Dave M G

If we "translate" a mysql resultset to an array notation, you would have:
restultset[1][text1] = a;
restultset[1][text2] = b;
restultset[2][text1] = c;
restultset[2][text2] = d;
restultset[3][text1] = e;
restultset[3][text2] = f;
Thus, going trough it with a foreacht:
foreach(resultset as $key=>$val) {
    echo $val[text1];
}
will give you the same result as the original loop construct you did 
with while() (assuming an array resultset for purposes of demonstration).

foreach($mysqlResultSet as $variable) {
    echo $variable[text1];
    echo $variable[text2];
}

is what you're probably after though. Might I suggest reading the manual 
about foreach (and especially array) construct again please? very 
carefuly preferably, as it seems you're missing quite a lot of insight 
there :)

- tul

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
&lt;/PRE></description>
</item>

<item>
<title>Re: [PHP] Equivelant to mysql_fetch_row for normal array</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/php-general/3173509</link>
<description>&lt;PRE>Dave M G a écrit :
> PHP List,
>
> Pretty standard.
>
> But what do I do when I want to do the same kind of while loop not 
> with a MySQL result, but with just a regular array?
>
> while (variable = ????($array)){
> echo $variable[text1];
> echo $variable[text2];
> }
>
did you try something like this ?
foreach ($array as $variable)
{ echo $variable;
}

or for "associative array"
foreach ($array as $key => $value)
{ echo $key." ".$value;
}
> I've been up and down the manual, and looked at foreach statements and 
> functions like each(), but I can't seem to zero in on what I need.
>
> Can anyone let me know what it is I'm missing?
>
> Thank you for any advice.
>
hope this'll help

N F
> -- 
> Dave M G
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
&lt;/PRE></description>
</item>

<item>
<title>[PHP] Equivelant to mysql_fetch_row for normal array</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/php-general/3173473</link>
<description>&lt;PRE>PHP List,

Very frequently I use mysql_fetch_row in a while statement to

while($variable = mysql_fetch_row($mysqlResult)){
echo $variable[text1];
echo $variable[text2];
}

Pretty standard.

But what do I do when I want to do the same kind of while loop not with 
a MySQL result, but with just a regular array?

while (variable = ????($array)){
echo $variable[text1];
echo $variable[text2];
}

I've been up and down the manual, and looked at foreach statements and 
functions like each(), but I can't seem to zero in on what I need.

Can anyone let me know what it is I'm missing?

Thank you for any advice.

--
Dave M G

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
&lt;/PRE></description>
</item>

</channel>
</rss>