Re: [PHP] Syntax Help, Please
On Tue, 15 Jun 2004 13:20:24 -0400, Steve Douville <[EMAIL PROTECTED]> wrote: > > I've forgotten how to assign something like this... > > $someStr = EOF>>>" > bunch of raw non-echo'd html > " > EOF>>>; > > But can't seem to get the right syntax. Tried looking in the manual, but > don't even know what I'm looking for! Here they are in the manual: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Syntax Help, Please
In a message dated 6/15/2004 10:20:59 AM Pacific Daylight Time, [EMAIL PROTECTED] writes: >I've forgotten how to assign something like this... > >$someStr = EOF>>>" > bunch of raw non-echo'd html >" >EOF>>>; > >But can't seem to get the right syntax. Tried looking in the manual, but >don't even know what I'm looking for! This way of entering text is called a heredoc. The syntax goes like this: $varname = <
RE: [PHP] Syntax Help, Please
> I've forgotten how to assign something like this... > > $someStr = EOF>>>" > bunch of raw non-echo'd html > " > EOF>>>; > > But can't seem to get the right syntax. Tried looking in the > manual, but > don't even know what I'm looking for! You're looking for a "heredoc." http://www.php.net/manual/en/language.types.string.php#language.types.string .syntax.heredoc Cheers, Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Syntax Help, Please
I've forgotten how to assign something like this... $someStr = EOF>>>" bunch of raw non-echo'd html " EOF>>>; But can't seem to get the right syntax. Tried looking in the manual, but don't even know what I'm looking for! TIA, Steve
Re: [PHP] syntax help please?
On Thu, 30 Aug 2001 00:15, Glyndower wrote: > I'm coming over from the ASP side and I'm trying to get a handle on > this stuff, I could use a little help with the how and wheres, please. > I do ok with the SQl bits, but the PHP bits are still being elusive... > > Heres my code: > > $sql = "SELECT > listnum,agentname,listAgent,streetName,streetNum,curprice,email_addr,of >ficen > ame,officephone,agentname,agentphone,bedrooms,full_baths,half_baths,cus >tomer Remarks FROM mlsdb WHERE mlsdb.statusCode = 'A' AND mlsdb.catgNum > = '1'"; > > $result = mysql_query($sql); > > //load it all into the associative array > > while(list($listnum,$agentname,$streetName,$streetNum) = > mysql_fetch_row($result)): > echo "$listnum $agentname $streetNum $streetName "; > endwhile; > > ?> > > Which displays: > > 50730 Aubrey May Wyndwood Drive 0 > 873171 Tia Lingle Palm Trl 9903 > 902385 Anthony Kipen Normandy Blvd 6458 ... > > As you can see the $streetNum displays BEFORE the $streetName, I'm > assuming thats becuase thats the order they are in in the query..(?) > > Heres my "I'm a newbie" question... exactly how and where do I define > the variables so that i can use them in a different order than they are > in the query? Use extract ,which makes available variables of the same name as the fields in your table. $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { extract($row); echo "$listnum $agentname $streetNum $streetName "; } -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Oxymoron: Weather Forecast. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] syntax help please?
On Wednesday 29 August 2001 14:45, Glyndower wrote: > Heres my "I'm a newbie" question... exactly how and where do I define the > variables so that i can use them in a different order than they are in the > query? Go over your results like this instead: while ($row = mysql_fetch_row($result)) { echo $row['listnum']; // displays 'listnum' field echo $row['officephone']; // etc... } (I've assumed your syntax for the mysql_fetch_row() function, I haven't used it in a while (use PostgreSQL myself)). ad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] syntax help please?
I'm coming over from the ASP side and I'm trying to get a handle on this stuff, I could use a little help with the how and wheres, please. I do ok with the SQl bits, but the PHP bits are still being elusive... Heres my code: $sql = "SELECT listnum,agentname,listAgent,streetName,streetNum,curprice,email_addr,officen ame,officephone,agentname,agentphone,bedrooms,full_baths,half_baths,customer Remarks FROM mlsdb WHERE mlsdb.statusCode = 'A' AND mlsdb.catgNum = '1'"; $result = mysql_query($sql); //load it all into the associative array while(list($listnum,$agentname,$streetName,$streetNum) = mysql_fetch_row($result)): echo "$listnum $agentname $streetNum $streetName "; endwhile; ?> Which displays: 50730 Aubrey May Wyndwood Drive 0 873171 Tia Lingle Palm Trl 9903 902385 Anthony Kipen Normandy Blvd 6458 ... As you can see the $streetNum displays BEFORE the $streetName, I'm assuming thats becuase thats the order they are in in the query..(?) Heres my "I'm a newbie" question... exactly how and where do I define the variables so that i can use them in a different order than they are in the query? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]