Function mysql_db_query () is deprecated error resolution

Source: Internet
Author: User
Tags deprecated

Method One: @
Add the @ sign before any error statements to block!

Method Two: Error_reporting

Add: error_reporting (0) in the first line of the PHP file; can be shielded!

Method Three: Display_errors
Open php.ini file, search display_errors = on, default should be on, change off to block!


<?php
$conn =mysql_connect ("localhost", "root", "root");
[Email Protected]_db_query ("blejtest", "SELECT * from Cblej_company", $conn);
Get query Results
$row =mysql_fetch_row ($result);


Echo ' <font face= ' Verdana > ';
Echo ' <table border= ' 1 "cellpadding=" 1 "cellspacing=" 2 ">";

Show Field names
echo "</b><tr></b>";
for ($i =0; $i <mysql_num_fields ($result); $i + +)
{
Echo ' <td bgcolor= ' #000F00 ><b> '.
Mysql_field_name ($result, $i);
echo "</b></td></b>";
}
echo "</tr></b>";
Navigate to the first record
Mysql_data_seek ($result, 0);
Loop out Records
while ($row =mysql_fetch_row ($result))
{
echo "<tr></b>";
for ($i =0; $i <mysql_num_fields ($result); $i + +)
{
Echo ' <td bgcolor= ' #00FF00 > ';
echo $row [$i];
Echo ' </td> ';
}
echo "</tr></b>";
}

echo "</table></b>";
echo "</font>";
Freeing resources
Mysql_free_result ($result);
Close connection
Mysql_close ($conn);
?>

Function mysql_db_query () is deprecated error resolution

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.