On Sat, 1 Feb 2003, Sunfire wrote:

> if i do this:
> /*all the mysql login stuff here*/
> 
> $query=mysql_query("select * from members");
> while($new=mysql_fetch_array($query)){
> echo "$new['company']";
> /*so on through the field list*/
> }
> on output all i get is the title with a submit button..
> otherwise blank..

  There is a bug in PHP 4.3.0 regarding the use of arrays
  in strings.  The following gave a parse error before
  PHP 4.3.0:

    print "Do not do this: $arr['key']";

  Now it gives an E_NOTICE error due to changes to the string
  scanner.  In PHP 4.3.1 it will no longer give a bogus E_NOTICE
  and instead it will work (no parse error either).  Surrounding
  the array with {braces} in the string works regardless, so:

    print "You can do this: {$arr['key']}";

  Regarding this question, don't write it like that but instead
  do the following (no quotes needed):

    echo $new['company'];

  For those wondering about this bug, see:

    http://bugs.php.net/bug.php?id=21820

  The string documentation has been updated to demonstrate
  the array in string phenomena (except the bug hasn't been
  mentioned as I'm waiting for it to be committed first).

    http://www.php.net/types.string

  Sunfire, you aren't seeing this E_NOTICE error because your
  error level is turned down (by default).  Put this on top 
  of your script to see them all:

    error_reporting(E_ALL);

  Regards,
  Philip


> same thing with fetch_object()...and i have 1 row in the members table..im
> sort of confused now that it doesnt work for a wierd reason
> 
> any better ideas on how to get the stuff out of the table and into vars?
> maybe im doing it wrong
> 
> 
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, February 01, 2003 5:33 PM
> Subject: Re: [PHP] using <input> tags with php
> 
> 
> > In a message dated 2/1/2003 2:02:06 PM Pacific Standard Time,
> > [EMAIL PROTECTED] writes:
> >
> > >i tried getting the values into vars using fetch_array/fetch_object and
> > >fetch_row and tried to put them in variables but for some odd reason it
> > >really doesnt work because when i try to use the vars in the value
> section
> > >instead of printing in the edit box the content of the variable i usually
> > >end up with "?>", ">", "<?php", or "}?>" instead... any reason this shows
> > >up? and when i do:
> > >echo "<input type=text name=$name value='$new_var'>";
> > >then on the web page i end up with some thing like this instead of the
> edit
> > >box:
> > >">";;">
> > >}?>
> > >any reason for that?
> >
> > It sounds like $name and/or $new_var may be empty. Did you echo the
> variables
> > before using them in your form to check whether the values from the
> database
> > are actually in the variables?
> >
> > Janet
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to