Jump to content

Search the Community

Showing results for tags 'filling'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello all, I'm having a bit of a problem with my code here. I'm trying to allow the user to enter a number (an office number) from a database, and based on that value, after submitting it, an html table will fill with the appropriate results (lastName, firstName, jobTitle). For whatever reason, though, I keep getting this error: "Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in... <website name> <line number>" It's very weird, because I'm doing this straight from notes / w3 and I'm still getting errors. I'm still new to this, so I'm sorry if I'm sounding completely inexperienced... well I am haha. Anyway, here's the code: <!DOCTYPE html > <html lang ="en"> <head> <title> Homepage </title> </head> <body bgcolor="gray"> <h1 align=middle> Welcome to the Site </h1> <?php DEFINE ('DB_USER', '*******); DEFINE ('DB_PASSWORD', '******'); DEFINE ('DB_HOST','*****'); DEFINE ('DB_NAME','******'); $dbc = @mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME) or die ('Could not connect to MySQL: '.mysqli_connect_error($dbc) ); mysqli_set_charset($dbc, 'utf8'); //$r = @mysqli_query($dbc, $q); ?> <form action ="Homepage.php" method="get"> Enter Office Code: <input type="text" name="oCode" id="OfficeCode" maxlength="15"> <input type="submit" name="formSubmit" value="Submit"> </form> <? $code = $_GET['oCode']; $result = mysqli_query($dbc, "select lastName, firstName, jobTitle from Employees where OfficeCode='$code'"); echo "<table border='1'>"; echo "<tr>"; echo "<th>LastName</th>"; echo "<th>FirstName</th>"; echo "<th>Job Title</th>"; echo "</tr>"; while ($row = mysqli_fetch_array($result)) //this is where I'm getting the error { echo "<tr>"; echo "<td>" . $row['lastName'] . "</td>"; echo "<td>" . $row['firstName']. "</td>"; echo "<td>" . $row['jobTitle'] . "</td>"; echo "</tr>"; } echo "</table>"; mysqli_close($dbc); ?> Any help would be great. Thank you!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.