Jump to content

Parse Error on Line 44??


crose1211

Recommended Posts

I am currently writing a code for class where I have to get my php script to run a query through mysql database to retrieve the information that was built in the table I created.  I keep getting a parse error on line 44 message; when there is nothing on line 44, when I change the code in the script to run, whatever I do to this I keep getting the same error.  "Parse Error on Line 44".  I have rebuilt this code over and over and over.  I am also trying to use an html form to submit a query that will execute the query to search through the database with the SELECT statement but I cannot see if anything works because I cannot get past the parse error on line 44 message.  Please help if you can, I am bummed out here.  The tutoring center is down today because of all the snow they got and my Professor still hasn't gotten back in touch with me.

 

This is just the simple code for the form, I haven't modified it into a drop down menu yet to run a query from a selected state because I still don't have the query running right.

 

<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
Submit a Request for Information
<form action = "miller.php" method = "get">
<table align='Left'>
  <tr>
    <td>Sort by State:</td>
    <td><input name='State' /></td>
  </tr>
</table>
<input type = 'submit'/>
</form>
<a href="http://localhost/millerUnit7index.html</a>
</body>
</html>

 

this is the code for the contact table:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<?php
$ContactArray = file("contacts.txt");
sort($ContactArray);

echo "<table border='5' width ='300'>";
foreach($ContactArray as $record){
   $recordItems = explode (",",$record);
   echo "<tr>";
     echo "<td>  $recordItems[0], $recordItems[1]</td>";
     echo "<td> $recordItems[6], $recordItems[7] </td>";
     echo "</tr>";
  }//end foreach
  echo "</table>";
?>
</body>
</html>

 

and this is the code for the query I am trying to execute through mysql, this is the one that is giving me the parsing error

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<?php
$DBConnect = mysqli_connect("localhost","user1", "password1","miller");
$query = mysqli_query("SELECT lName,fName,number FROM contactform ORDER BY state ASC");
$result = mysqli_query($DBConnect,$query);
$row = mysqli_fetch_row($results);
	echo "<table width='100' border = '5'>\n";
		echo "<tr>";
			echo "<th> Last Name</th>";
			echo "<th> First Name</th>";
			echo "<th> Phone Number</th>";
		echo "</tr>\n";
while (($row = mysqli_fetch_row($results)) !==FALSE){
		echo "<tr>";
			echo "<td> $row[0]</td>";
			echo "<td> $row[1]</td>";
			echo "<td> $row[6], $row[7]</td>";

		echo "</tr>\n";
};
		echo "</table>\n";
mysqli_close($DBConnect);
?>
<a href="http://localhost/millerUnit7/millerQuery.php</a>
</body>
</html>

 

Link to comment
https://forums.phpfreaks.com/topic/226577-parse-error-on-line-44/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.