Novice, Pat. Ladies and gentlemen, let me see what the php code is wrong.

Source: Internet
Author: User
Novice, Pat. Ladies and gentlemen, let me see what the php code is wrong. Html Code:


















[/Code]


PHP code:
Sales Rep Maintenance
 Successfully connected to MySQL.

';//mysql_close(); // close the connection}else {die('

Could not connect to MySQL because: ' .mysql_error() .'

');}if (@mysql_select_db("PREMIERE", $connection)){print '

The PREMIERE database has been selected.

';}else {die('

Cound not select the PREMIERE database because: ' .mysql_error().'

');}if(!$_REQUEST['submit']){generate_form();}else if($_REQUEST['submit'] == "Search"){search_rep();}else if($_REQUEST['submit'] == "Add"){add_rep();}else if($_REQUEST['submit'] == "Delete"){delete_rep();}else if($_REQUEST['submit'] == "Update"){update_rep();}function generate_form(){}function search_rep(){// Define the rep Number php variable name$rep = $_POST['rep_num'];print "The rep num chosen was $rep
";// Define the query$query = "SELECT * FROM REP WHERE CUSTOMER_NUM = '$rep'";// Output the resulting query tableif ($r = mysql_query($query)){while ($row = mysql_fetch_array($r)){print "

{$row['REP_NUM']}
{$row['LAST_NAME']}
{$row['FIRST_NAME']}
{$row['STREET']}
{$row['CITY']}
{$row['STATE']}
{$row['ZIP']}
{$row['COMMISSION']}
{$row['RATE']}

\n";}}}function add_rep(){}function delete_rep(){}function update_rep(){}?>


You can connect to the mySQL server, but cannot display results...


Reply to discussion (solution)

Error_reporting (E_ALL &~ E_NOTICE );
Change
Error_reporting (E_ALL );
You may know.

Change the join Key of $ row to lowercase.

Error_reporting (E_ALL &~ E_NOTICE );
Change
Error_reporting (E_ALL );
You may know.

Change the join Key of $ row to lowercase.

I tried it. the error message is:
Undefined index: submit... on line 28
Undefined index: submit... on line 33

28 rows are if (! $ _ REQUEST ['submit ']) receives the data submitted by the form.
However, there is no submit control in your form.

Upstairs, add name = submit to the input whose type is submit.

28 rows are if (! $ _ REQUEST ['submit ']) receives the data submitted by the form.
However, there is no submit control in your form.

So how should we change it?
Html file:

Rep Num:

Isn't it enough to set the input type to "submit?

Add a hidden input

Set




Change





In general, set the input type to "submit. However, the value of the untitled submit button will not be submitted.
However, in your application, the operation method is determined by the submitted value button, so you must name

Set




Change

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.