Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8849465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:39:35+00:00 2026-06-14T12:39:35+00:00

I am very new to PHP/MySQL and I don’t know the best toolset or

  • 0

I am very new to PHP/MySQL and I don’t know the best toolset or how to properly debug.

Here is the code snippet I’m working on. I have two main issues.

1: I’m noticing that escape sequences are not working. All of the \n are ignored in the page display.

2: My code is not entering the while loop, and therefore not displaying the result. When I run the same query on phpMyAdmin, I get one result.

This is the output:

I’m in your db!echoinside postWe have a result table exists name:
outside post

<?php
$mysqli = new mysqli("****", "*****", "******", "******");
if ($mysqli->connect_errno) {
    echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
echo "I'm in your db!";
echo "echo";
if( $_POST["submit"] ) {
echo "inside post"; 
    if (!($stmt = $mysqli->prepare("SELECT Cust_name FROM SERVICE_TICKET WHERE Ticket_num=?"))) {
            echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
    }
    if (!$stmt->bind_param("i", $_POST['ticket'])) {
        echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
    }
    if (!$stmt->execute()) {
        echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
    }
    if (!$stmt->bind_result($Cust_name)) {
        echo "Binding output parameters failed: (" . $stmt->errno . ") " . $stmt->error;
    }
    else {
        echo "We have a result";
        echo "<table><br/>";
        echo "table exists";
        printf("<br/>\n\n\n\n\nname:  %s", $Cust_name);
        while ($stmt->fetch()){
            echo "in while loop";
            echo "<tr>\n<td>".$Cust_name."</td>\n</tr>";
        }
        echo "</table>";
    }

}
echo "outside post";
?>

Adding html for the form:

<head>
    <title>Bicycle Store Service Ticket</title>
    <link rel="stylesheet" type="text/css" href="web.css" />
</head>
<body>
    <h1>ACME BICYCLE SHOP</h1>
    <h3 align="center">GET IN GEAR!</h3>

    <form action="search_service.php" method="post">
    <h3>CHECK A SERVICE TICKET</h3>

    <h4>Ticket Number: <input type="text" ticket="ticket">&nbsp;&nbsp;

    <input type="submit" name="submit" value="Search">
    </form>

    <p><a href="index.html">HOME</a></p>
</body>
</html>

Any advice would be super helpful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:39:37+00:00Added an answer on June 14, 2026 at 12:39 pm

    Problem #1: escape sequences are working but in HTML line breaks are “insignificant whitespace” and therefore are not displayed. You can add line breaks using the <br> tag.

    Problem #2: it looks like your query returns an empty result set (there is no ticket with the number specified) and so the first invocation of $stmt->fetch() returns false.

    EDIT: The line with the “ticket” input in your HTML should look like:

    <h4>Ticket Number: </h4><input type="text" name="ticket">&nbsp;&nbsp;
    

    So it’s name="ticket" instead of ticket="ticket", and the <h4> tag should be closed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Actually I am very new to PHP. My code goes here: <?php $mysql =
I am very new to PHP and MySql. Is there any method by which
I am VERY new to PHP, I'm currently working on a service, part which
I'm very new to php. I found some CMS like code for east text
I know the title isn't very clear. I'm new to PHP, so there might
I'm very new to php/MySQL and I'm having a bit of trouble. Help would
First of all, I am still very new to PHP / mySQL so excuse
I am very new to php and mysql. I am trying to learn as
Assume PHP/MYSQL but I don't necessarily need actual code, I'm just interested in the
Before reading, please note that I am very new to both PHP and MYSQL.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.