Re: passing variables

From: Date: Mon, 19 Jun 2000 22:07:58 +0000
Subject: Re: passing variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-2229@lists.php.net to get a copy of this message
I understand that much. I guess it is the scope that I am having problems with. maybe you can take a look to see where I am going wrong. The error is coming from the "$cnote="... line. If I put data in place of the $thismsg variable the whole thing works. Thanks Erik <-----------------------------------> $mtype = mysql_query("select distinct msgtype from ticket"); if ($mtyperow=mysql_fetch_array($mtype)) do { $thismsg = $mtyperow["msgtype"]; echo "<table width=780px bgcolor=ivory border=1> <tr><th colspan=9 align=left bgcolor=black><font color=ivory>", $thismsg, "</font> <tr> <th>Ticket # <th>Message <th>Date Open <th>Date Closed <th>Status <th colspan=3>Impact<br> Current/<font color=blue>Planned</font>/<font color=red>Actual Max</font> <th>Last Modified"; /* list each ticket once */ $ticketno = mysql_query ("select distinct ticket from ticket"); if ($tickrow = mysql_fetch_array($ticketno)) do{ $tickno=$tickrow["ticket"]; /* find newest record of ticket*/ $newest = mysql_query ("select max(ID) as maxid from ticket where ticket=$tickno"); if($newestrow = mysql_fetch_array($newest)) do{ $thisid=$newestrow["maxid"]; /* print each ticket by msgtype*/ $cnote = mysql_query ("select * from ticket where msgtype= $thismsg and close_tick is NULL and logaction<>\"Deleted\" and ID = $thisid"); if ($cnoterow = mysql_fetch_array($cnote)) do{ echo "<tr>"; echo "<td valign=top>&nbsp;", $cnoterow["ticket"]; echo "<td valign=top width=30%>&nbsp;<b>", $cnoterow["subject"],"</b><br><font size=-1>", $cnoterow["message"], "</font>"; echo "<td valign=top>&nbsp;", substr($cnoterow["open_tick"],5,5); echo "<td valign=top>&nbsp;", substr($cnoterow["close_tick"],5,5); echo "<td valign=top>&nbsp;", $cnoterow["status"]; echo "<td valign=top width=10%>&nbsp;", $cnoterow["impact_now"]; echo "<td valign=top width=10%>&n bsp;<font color=blue>", $cnoterow["impact_plan"], "</font>"; echo "<td valign=top width = 10%>&nbsp;<font color=red>", $cnoterow["impact_max"], "</font>"; echo "<td valign=top>&nbsp;", substr($cnoterow["lastmod"],4,2), "-", substr($cnoterow["lastmod"],6,2); }while($cnoterow= mysql_fetch_array($cnote)); }while($newsetrow=mysql_fetch_array($newest)); }while($tickrow=mysql_fetch_array($ticketno)); echo "</table>"; }while($mtyperow=mysql_fetch_array($mtype)); ?> ----- Original Message ----- From: Sam Masiello <smasiello@chekinc.com> To: Erik Dawson <erik@gmservices.com>; <php-general@lists.php.net> Sent: Monday, June 19, 2000 11:47 AM Subject: RE: [PHP-GENERAL] passing variables > > If the variable exists within the scope of your page, you can create a SQL > string like this: > > $sqlstr = "SELECT * FROM table WHERE field = '$variable' " ; > > Sam Masiello > System Analyst > Chek.Com > (716) 853-1362 x289 > smasiello@chekinc.com > > -----Original Message----- > From: Erik Dawson [mailto:erik@gmservices.com] > Sent: Monday, June 19, 2000 5:29 PM > To: php-general@lists.php.net > Subject: [PHP-GENERAL] passing variables > > Hello, > > I have been enjoying this forum for a few weeks now and learning very much, > thank you to all who answer everyones questions. > > I now have a question. > > I need to pass a variable to an sql query that is nested inside 3 "do... > while" statements. I am sure there is even an easier way to do this than all > the "do... while" 's but this is the only idea that I had. > > I am still learning php and eager to learn more. Any help is greatly > appreciated. > Thanks > Erik > > > >

« previous php.general (#2229) next »