Re: Return Array from Function

From: Date: Thu, 26 Sep 2002 20:31:08 +0000
Subject: Re: Return Array from Function
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-22034@lists.php.net to get a copy of this message
Try single-quotes instead of double (' instead of "). Could be an interpolation issue. --Dave On Thu, 26 Sep 2002, Hutchins, Richard wrote: > Can somebody tell me what I might be doing wrong in the code below? I'm > trying to use a function to perform an often-used db query and return the > resulting resource to the calling script. I keep getting this error though: > > Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' > in c:\spidey\public\addleveltwo.php on line 51 > > I've looked and looked, but I can't find what could be causing a parse > error. Most likely, I've just been looking at it for too long. Any fresh > eyes available? > > <?php > include("../protected/getContent.php"); > > getLevelOnes($docnum); //user-defined function from included file. > Definition appears after this snippet. > > $num=mysql_num_rows($levelones); > > if($num<1) > { > echo("There is no level one (Section) content for this > document in the database."); > exit(); > } > > while($row=mysql_fetch_array($levelones)) > { > $1contentID=$row["1contentID"]; > $parentID=$row["parentID"]; > $1child=$row["childID"]; > $1content=$row["1content"]; > $1ordinal=$row["ordinal"]; > > echo("<tr><td>".$1content."</td><td><a > href=\"contentMgr.php?docnum=".$docnum."\" > target=\"_right\">Add</a></td></tr>"); > } > ?> > > <?php > function getLevelOnes($docnum) > { > $sql="SELECT 1contentID, parentID, childID, 1content, 1ordinal FROM > levelone WHERE 1contentID='$docnum'"; > $levelones=mysql_query($sql) > or die(mysql_error()); > return $levelones; > } > ?> > > > -- ,-._.-._.-._.-._.-. `-. ,-' .----------------------. | | | Cool nerds use ASCII | | | | art at the bottom of | | | | their emails. | | | | | ,';".________.-. | | ;';_' )] | | ; `-| | . T- | `----------------------._ \ | | `-; | | |..________..-| /\/ |________..| ,'`./ >,( | \_.-|_/,-/ ii | | ."' -/ .-"""|| | /`^"-; | ||____| / / `.__/ | || / | || | ||

« previous php.db (#22034) next »