Re: hide warnings
| From: | Cody Caughlan | Date: | Sun, 29 Oct 2000 02:48:06 +0000 |
| Subject: | Re: hide warnings | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-4017@lists.php.net to get a copy of this message | ||
In the php.ini file (PHP's configuration file) there is a setting to display
error message. If you turn this off then you wont see any errors, but of
course if your program isnt working as expected than errors are good to see.
So test it and when it works turn off the errors. Although, in this case why
would you want to turn off errors, obviously your script is producing an
error, why dont you fix this rather than turn off errors?
/Cody Caughlan
Database Fiend wrote:
> Hello,
>
> I am working with PHP and MySQL on a UNIX box running Apache.
>
> I have a form with several text fields that calls a PHP file which
> inserts this info into a record in a MySQL db and displays the inserted
> info in a web page. Everything is working fine ... a record is created
> with the correct data ... the inserted data is displayed properly on the
> page ... EXCEPT this warning:
>
> Warning: Unexpected character in input: '' (ASCII=5) state=1 in
> /usr/local/etc/httpd/htdocs/hal9k/db/new_record_done.php on line 75
>
> always displays at the top of the PHP page!
>
> How do I hide this warning?
>
> I had read in a post that adding an @ charachter to your code will stop
> a warning from displaying so I have changed every $sql_query to
> @$sql_query, but I am still getting the error.
>
> Can someone help me?
>
> Thanks!
>
> dbfiend
>
> FYI ... I have inserted the PHP file below:
>
> <html>
> <head>
> <title>Record Added</title>
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">
>
> <link rel="stylesheet" href="../resources/styles.css">
> </head>
>
> <body bgcolor="#999999">
>
> <?
>
> $connection = mysql_connect("X","Y","Z")
> or die ("Couldn't connect to server.");
>
> $db = mysql_select_db("NPP", $connection)
> or die ("Couldn't select database.");
>
> $presql = "SELECT MAX(ContactID) AS ContactID FROM Contact";
>
> $sql_result = @mysql_query($presql,$connection)
> or die ("Couldn't add 1.");
>
> if (!$sql_result) {
> echo "<P>Couldn't get list!";
>
> } else {
>
> }
>
> $row = @mysql_fetch_array($sql_result);
> $ContactID2 = $row["ContactID"];
> $ContactID22 = $ContactID2 += 1;
>
> $sql = "INSERT INTO Contact
> (ContactID, Name, Address1, Address2, Address3, State, Country,
> ZipCode, URL)
> VALUES
> ('$ContactID', '$Name', '$Address1',
> '$Address2', '$Address3',
> '$State', '$Country', '$ZipCode', '$URL')";
>
> $sql2 = "INSERT INTO ServiceContact
> (CategoryID, ContactID)
> VALUES
> ('$CategoryID1', '$ContactID22')";
>
> $sql3 = "INSERT INTO ServiceContact
> (CategoryID, ContactID)
> VALUES
> ('$CategoryID2', '$ContactID22')";
>
> $sql4 = "INSERT INTO ServiceContact
> (CategoryID, ContactID)
> VALUES
> ('$CategoryID3', '$ContactID22')";
>
> $sql5 = "INSERT INTO ServiceContact
> (CategoryID, ContactID)
> VALUES
> ('$CategoryID4', '$ContactID22')";
>
> $sql6 = "INSERT INTO ServiceContact
> (CategoryID, ContactID)
> VALUES
> ('$CategoryID5', '$ContactID22')";
>
> $sql7 = "INSERT INTO ServiceContact
> (CategoryID, ContactID)
> VALUES
> ('$CategoryID6', '$ContactID22')";
>
> # $sql8 = "DELETE FROM ServiceContact WHERE CategoryID = '0'";
>
> $sql_result1 = @mysql_query($sql,$connection)
> or die ("Couldn't add 11.");
>
> $sql_result2 = @mysql_query($sql2,$connection)
> or die ("Couldn't add 2.");
>
> $sql_result3 = @mysql_query($sql3,$connection)
> or die ("Couldn't add 3.");
>
> $sql_result4 = @mysql_query($sql4,$connection)
> or die ("Couldn't add 4.");
>
> $sql_result5 = @mysql_query($sql5,$connection)
> or die ("Couldn't add 5.");
>
> $sql_result6 = @mysql_query($sql6,$connection)
> or die ("Couldn't add 6.");
>
> $sql_result7 = @mysql_query($sql7,$connection)
> or die ("Couldn't add 7.");
>
> # $sql_result8 = @mysql_query($sql8,$connection)
> # or die ("Couldn't add 8.");
>
> echo "
> <div align=center>
> <p> </p>
> <p><img src=../images/top.gif width=635 height=131>
> </p>
> <p> </p>
> <p><span class=sectionhead>Record Added</span></p>
> <hr noshade width=40%>
> <p> </p>
>
> <table border=1 cellpadding=4>
> <tr>
> <td class=adminmenu>
> <div>Service(s):</div>
> </td>
> <td colspan=4><p>
> ";
>
> if ($CategoryID1 == 1) {
>
> echo 'Authors<br>';
>
> }
>
> if ($CategoryID2 == 2) {
>
> echo 'Publishers<br>';
>
> }
>
> if ($CategoryID3 == 3) {
>
> echo 'Booksellers<br>';
>
> }
>
> if ($CategoryID4 == 4) {
>
> echo 'Libraries<br>';
>
> }
>
> if ($CategoryID5 == 5) {
>
> echo 'Readers<br>';
>
> }
>
> if ($CategoryID6 == 6) {
>
> echo 'Agents<br>';
>
> }
>
> echo "
> </p></td>
> </tr>
> <tr>
> <td class=adminmenu>
> <div align=left>Company Name:</div>
> </td>
> <td colspan=4><p>$Name</p></td>
> </tr>
> <tr>
> <td class=adminmenu>
> <div align=left>Street:</div>
> </td>
> <td colspan=4><p>$Address1</p></td>
> </tr>
> <tr>
> <td>
> <div align=left><span class=adminmenu>Apt/Ste/Fl</span>:</div>
> </td>
> <td colspan=4><p>$Address2</p></td>
> </tr>
> <tr>
> <td class=adminmenu>
> <div>City:</div>
> </td>
> <td colspan=4><p>$Address3</p></td>
> </tr>
> <tr>
> <td class=adminmenu>
> <div>State:</div>
> </td>
> <td colspan=4><p>$State</p></td>
> </tr>
> <tr>
> <td class=adminmenu>Zip:</td>
> <td colspan=4>
> <p>$ZipCode</p>
> </td>
> </tr>
> <tr>
> <td class=adminmenu>Country:</td>
> <td colspan=4><p>$Country</p></td>
> </tr>
> <tr>
> <td class=adminmenu>Web Address:</td>
> <td colspan=4><p>$URL</p></td>
> </tr>
> </table>
>
> ";
>
> ?>
>
> </body>
> </html>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net