Reply to Re: While Loop Issues

Your name:

Reply:


Posted by Rik Wasmus on 12/23/07 15:14

On Sat, 22 Dec 2007 23:42:47 +0100, <MKruer@gmail.com> wrote:
> On Dec 22, 2:04 pm, MKr...@gmail.com wrote:
>> On Dec 22, 9:46 am, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
>> > > [Code]
>> > > while ( $row =3D mysql_fetch_object( $result ) ) {
>> > > // remove extra slashes
>> > > $subject =3D stripslashes( $row->subject );
>> > > // Some messages still had the single quote in them without a=
\
>> > > // which was causing import problems so we
>> > > // removed the single quote and replaced it with HTML for the=

>> > > quote
>> > > $subject =3D preg_replace ('/\'/', '\\\'', $subject);
>> > > $query=3D"INSERT INTO {$phpbb_dbprefix}topics"
>> > > ." (topic_id, forum_id, topic_poster, topic_title, =

>> topic_time,"
>> > > ." topic_views, topic_replies, topic_status, topic_vote,
>> > > topic_type,"
>> > > ." topic_first_post_id, topic_last_post_id, topic_moved_id=
)"
>> > > ." VALUES ('$row->id', '$row->catid', '$row->userid',
>> > > '$subject', '$row->time',"
>> > > ." '$row->hits', '$row->reply', '$row->locked', '0', '',"
>> > > ." '$row->min', '$row->max', '0')";
>> > > $updateresult =3D mysql_query($query) or die("<br />Invalid=

>> > > query:<br />$query<br />" . mysql_error());
>> > > }
>> > > mysql_free_result($result);
>>
>> > > [/Code]
>>
>> > First of all: mysql_real_escape_string()
>> > Also, try to use curly braces around 'complex' variables in strings=
..
>> > Lastly, probably you don't even need a loop and you can do this wit=
h a
>> > simple 'INSERT .... SELECT...' query.
>> > --
>> > Rik Wasmus
>>
>> That still does not answer my question of what is wrong with the loop=
..
>> What I posted is a simple while loop. there are other parts of the
>> code that are much more complex that I simply cant update the query
>> with a replace string SQL query.
>>
> Never mind. i found the issue. it was problem with the Select
> statement above. By itself its fine but in a while loop, it blew it
> up.


You seem to be obsessed with the loop. Don't be. Without a loop it still=
=

would've produced the same error.


-- =

Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация