# Help with my code

**URL:** <https://www.phphelp.com/t/help-with-my-code/21678>\
**Category:** Beginners - Learning PHP\
**Created:** [December 8, 2013, 1:24am UTC](https://www.phphelp.com/t/help-with-my-code/21678 "2013-12-08T01:24:53Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![OzWaz](https://www.phphelp.com/letter_avatar_proxy/v4/letter/o/a8b319/32.png) [@OzWaz](https://www.phphelp.com/u/OzWaz)\
**Post date:** [December 12, 2013, 7:44am UTC](https://www.phphelp.com/t/help-with-my-code/21678/15 "2013-12-12T07:44:56Z")

</div>

Okay - Thanks on both accounts.

Here is my current code

Submission Form (form.html)

[php]

| First Name | |
| Family Name | |
| &nbsp; | &nbsp; |

[/php]

[b]Communication Form /b

[php]

\<?php //Variables for connecting to your database. //These variable values come from your hosting account. $hostname = "Godaddy IP address for where db is located "; $username = "username"; $dbname = "dbname"; //These variable values need to be changed by you before deploying $password = "thesetupdbpassword"; $usertable = "client"; $yourfield = "first"; $yourfield = "family"; //Connecting to your database mysql\_connect($hostname, $username, $password) OR DIE ("Unable to connect to database! Please try again later."); mysql\_select\_db($dbname); //Fetching from your database table. $query = "SELECT \* FROM $usertable"; $result = mysql\_query($query); if ($result) { while($row = mysql\_fetch\_array($result)) { $name = $row["$yourfield"]; echo "Name: $name  
"; } } ?\>

[/php]

Enquiry Form (view.php)

[php]

\<?php include ("comm.php"); if ($result = $mysqli-\>query("select \* from client order by id")) { if($results-\>num\_rows\>0) { echo ""; echo ""; while ($row = $result-\>fetch\_object()) { echo ""; echo ""; echo ""; echo ""; echo ""; } echo "

| ID | First Name | Family Name |
| --- | --- | --- |
| " . $row-\>id ." | " . $row-\>first ." | " . $row-\>family ." |

"; } } else { echo "Error" . $mysqli-\>error; } $mysqli-\>close(); ?\>

[/php]

Which produces No input into the Table and no enquiry result - just the errors shown previously.

---

_[View the full topic](https://www.phphelp.com/t/help-with-my-code/21678)._
