On Jan 20, 2008 5:23 AM, mrp <[EMAIL PROTECTED]> wrote:
>
> I have the following php script:
>
> I am trying to populate my php string as below:
>
> Code:
>
> $query_db_95 = "INSERT INTO `node_revisions` (`nid`, `vid`, `uid`,
> `title`, `body`, `teaser`, `log`, `timestamp`, `format`) VALUES (451,
> 451, 1, 'Import model images', '<?php\r\n\r\n// Written by Victor Kane
> it''s set to true,\r\n// and you get double imports.\r\n$active =
> false;\r\n$process_folder = ''import'';\r\n\r\include_once 'includes/
> bootstrap.inc;....?>',  ' ', ' ', ' ', ' ');

You might want to consider using heredoc syntax for that body part to
avoid having to add all those returns/newlines. Then just append it
into your SQL string.

You have doubled-up single quotes around the word "import". That would
be fine if the desired result was to have a single set of single
quotes around the word *and* this was an SQL script. However, what
you'll end up with is probably not going to work well for you. Change
that part to:

... false;\r\n$process_folder = 'import';\r\n\r\include_once ...

> $active and $process_folder are php variables.

You mean that they are variables in the same context as $query_db_95?
That is, there is a variable named $process_folder set before creating
this SQL string?

$process_folder = 'foo';

$query_db_95 = "INSERT INTO ..."

// results in:

... r\nfoo = ''import''; ...

In which case, you'll notice that you're missing a dollar sign. You'll
need to add one (escaped):

... false;\r\n\$${process_folder} = 'import';\r\n\r\include_once ...

> They are brown colored.
> I am not getting the green color for these two variables.

You're talking about your syntax highlighting? That's often a pretty
user-specific thing. I'm sure your browns & greens are not the same as
mine ;-)

> It is giving me the parsing error. What can be wrong? Please Help. I
> am stuck here.

$query_db_95 = "...";

debug($query_db_95);

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to