RE: [PHP] SQL statement

From: Date: Wed, 24 Sep 2003 00:59:41 +0000
Subject: RE: [PHP] SQL statement
Groups: php.general 
Request: Send a blank email to php-general+get-163676@lists.php.net to get a copy of this message
You need to change timestamp to formatted_ts in your php code. -----Original Message----- From: Dan J. Rychlik [mailto:drychlik@tcsconsult.com] Sent: Tuesday, September 23, 2003 5:45 PM To: goodie@apollointeractive.com; php-general@lists.php.net Subject: Re: [PHP] SQL statement Thank you for your time on this. I do apologize for being a pain. Here is my code... <?php // Function that runs reports on logon history function logonHist() { db_connect(); //establish connection $_qlogonhist = ("SELECT username,host_info,status, DATE_FORMAT(timestamp, '%d%m%y') as formatted_ts FROM custlogon_hist"); // Build query. //$_qlogonhist = ('SELECT * FROM custlogon_hist'); $_rlogonhist = mysql_query($_qlogonhist); ?> <table width="50%" border="0" align="center" cellpadding="0" cellspacing="0"> <?php while ($row = mysql_fetch_array($_rlogonhist)) { ?> <tr> <td width="27%"><strong><font color="#000000" size="2" face="Arial, Helvetica, sans-serif">Username</font></strong></td> <td colspan="3"><font color="#000000" size="2" face="Arial, Helvetica, sans-serif"> <?php echo $row['username'];?></font></td> </tr> <tr> <td><strong><font color="#000000" size="2" face="Arial, Helvetica, sans-serif">Host Info </font></strong></td> <td colspan="3"><font color="#000000" size="2" face="Arial, Helvetica, sans-serif"> <?php echo $row['host_info'];?></font></td> </tr> <tr> <td><strong><font color="#000000" size="2" face="Arial, Helvetica, sans-serif">Status</font></strong></td> <td colspan="3"><font color="#000000" size="2" face="Arial, Helvetica, sans-serif"> <?php echo $row['status'];?></font></td> </tr> <tr> <td><strong><font color="#000000" size="2" face="Arial, Helvetica, sans-serif">Time Stamp </font></strong></td> <td colspan="3"><font color="#000000" size="2" face="Arial, Helvetica, sans-serif"> <?php echo $row['timestamp'];?></font></td> </tr> <tr bgcolor="#999999"> <td>&nbsp;</td> <td width="38%">&nbsp;</td> <td colspan="2">&nbsp;</td> </tr> <?php } // end while ?> </table> <?php } // end function ?> ERROR Username drychlik Host Info 127.0.0.1 Status OK Time Stamp Notice: Undefined index: timestamp in C:\Program Files\Apache Group\Apache2\htdocs\Ameriforms\admintool\includes\getlogonhist.php on line 44 ----- Original Message ----- From: "Jennifer Goodie" <goodie@apollointeractive.com> To: "Dan J. Rychlik" <drychlik@tcsconsult.com>; <php-general@lists.php.net> Sent: Tuesday, September 23, 2003 7:39 PM Subject: RE: [PHP] SQL statement > > > > Jennifer, you're right, I am using fetch_array... I tried to > > > > use your > > > > suggestion, and it failing as well, It wont even execute.... > > > > > > > > > > There's probably an error in my SQL syntax. What is > > mysql_error() telling > > > you? > > > I dont believe it to be an error because Ive run this from the CLI > > on my zeus system. I have also echoed out the sql statement to read > > exactly what I know its got to be problem with the string > > terminators and or the way the > > fetch_array reads the elements of a record in my database. > > > Why don't you humor me and tell me what the error is and show me the > code that is generating it. A PHP error message and the output from > mysql_error() will go a long way in debugging a problem. I can't > really work with "it stops working" and "it fails to execute", those > don't tell me > much except that there's probably a problem with the query. > > -- > 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

« previous php.general (#163676) next »