Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: vars in wml and php


Message #1 by "Richard D. Williams" <richard@a...> on Mon, 11 Mar 2002 14:36:54 -0600
Okay... hmm.  A lot of the issues you're having can probably be answered by
reading these two sections in the PHP manual:

http://www.php.net/manual/en/language.variables.php
http://www.php.net/manual/en/language.types.string.php

I still think that your problem lies in the VALUE of your variable.

Have you tried using print_r() or other variables functions to make sure
that you're actually running a valid query?

Have you output the contents of your query to the screen to make sure that
what you're sending to the database is what you expect?


nik


> -----Original Message-----
> From: Richard D. Williams [mailto:richard@a...]
> Sent: Monday, March 11, 2002 12:37 PM
> To: professional php
> Subject: [pro_php] vars in wml and php
>
>
> Thanks for the response Mikael.
>
> I still have an issue with variables.
> Why are variables past between pages in this way; postfield
> name="varname" value="$(varname)",?
>
> Then refered to on the next page like this; Variable: $(varname)?
>
> Is there a special syntax to use when a variable is referred to inside a
> query, like this:
> $query = "select * from tablename where fieldxyz = '$varname'";
>
> I have not been able to get a variable to work inside a query like the
> one above.  If have tried
> $query = "select * from tablename where fieldxyz = '$varname'";
> $query = "select * from tablename where fieldxyz = $varname";
> $query = "select * from tablename where fieldxyz = '$(varname)'";
>
> None of these worked. Yet I have always been able to echo the variables
> like this;
> echo ("<p>Variable: $(varname)</p>").
>
> I have seen variable with different syntax, i.e.;
> if (${$choice} == "subject"){ etc. etc.
> echo ("<input type=\"text\" name=\"${$choice}\" />");
> echo ("<postfield name=\"$choice\" value=\"$"."$choice"."\"/>");
> echo ("<postfield name=\"${$choice}\" value=\"$"."${$choice}"."\"/>");
>
> Do the ( and the { become part of the variable, or are these required
> syntax?  If required sysntax when do you use them?
>
> Any help out there,
> Richard D. Williams
>
>
>


  Return to Index