|
Posted by burgermeister01@gmail.com on 08/29/07 14:05
On Aug 28, 4:25 pm, TechieGrl <cschal...@gmail.com> wrote:
> On Aug 28, 3:57 pm, "burgermeiste...@gmail.com"
>
>
>
> <burgermeiste...@gmail.com> wrote:
> > > Here is the error:
> > > Fatal error: Cannot pass parameter 2 by reference...
>
> > > Any thoughts would be so VERY much appreciated!!!
>
> > If I'm reading your code right, it should just be a simple matter of
> > correcting your array references.
> > I think the following lines of code need to change like so...
>
> > ...
> > $field1 = $i[0];
> > $field2 = $i[1];
> > ...
>
> > $i is already assigned to each subsequent value of $rss->items_array,
> > so in the code that you posted, you're iterating through the array and
> > then using one of the array's 2nd dimension arrays as an array
> > position. I haven't used the method you're employing to make sql
> > statements, so there could be further problems, but this one seems
> > fairly glaring to me.
>
> Unfortunately, I made the changes as suggested and still get the same
> error - Fatal error: Cannot pass parameter 2 by reference...
>
> I replaced this:
> $stmt_insert->bind_param($sql_insert, 'is', $field1, $field2);
> $field1 = $rss->items_array[$i][0];
> $field2 = $rss->items_array[$i][1];
> echo "sql " . $sql_insert . "\n";
> $stmt_insert->execute();
>
> With this:
>
> $stmt_insert->bind_param($sql_insert, 'is', $field1, $field2);
> $field1 = $i[0];
> $field2 = $i[1];
> echo "sql " . $sql_insert . "\n";
> $stmt_insert->execute();
>
> Thanks!
Does it matter if you declare $field1 and $field2 before calling
bind_param(), e.g.
....
$field1 = $i[0];
$field2 = $i[1];
$stmt_insert->bind_param($sql_insert, 'is', $field1, $field2);
....
I'm not sure what database engine (mysql?pgsql?) or function
library(mysqli?3rd party?) you're using to do this. In fact, if this
suggestion doesn't help, that would be good information to post next
time.
Navigation:
[Reply to this message]
|