Jump to content

[SOLVED] Pharse Error


mike6256

Recommended Posts

Hi all

I am having some problems with this code--keeps kicking pharse error codes

<?php 
# Connect to the database 
$dbLink = mysqli_connect("xx.xx.54.10", "root", "xxxxxxxx", "tools"); 
if(mysqli_connect_errno()) { 
    die("MySQL connection failed: ". mysqli_connect_error()); 
} 
  
# Query for a list of all existing files 
// just one possibility... 
$textfield = $_POST['textfield'];  
  
$result = mysqli_query($dbLink,   
  "SELECT FileID, FileName, FileMime,   
  FileSize, ToolNumber, Created   
  FROM FileStorage   
  WHERE ToolNumber =   
  '" . mysqli_real_escape_string($dbLink,$textfield) . "'"; 
  


  
# Check if it was successfull 
if($result)  
{ 
  
    # Make sure there are some files in there 
    if(mysqli_num_rows($result) == 0) { 
        echo "<p>There are no files in the database</p>"; 
    } 
    else 
    { 
        # Print the top of a table 
        echo "<table width='100%'><tr>"; 
        echo "<td><b>Name</b></td>"; 
        echo "<td><b>Mime</b></td>"; 
        echo "<td><b>Size (bytes)</b></td>"; 
        echo "<td><b>Created</b></td>"; 
	echo "<td><b>Tool Number</b></td>";
        echo "<td><b> </b></td>"; 	
        echo "</tr>"; 
  
        # Print each file 
        while($row = mysqli_fetch_assoc($result)) 
        { 
            # Print file info 
            echo "<tr><td>". $row['FileName']. "</td>"; 
            echo "<td>". $row['FileMime']. "</td>"; 
            echo "<td>". $row['FileSize']. "</td>"; 
            echo "<td>". $row['Created']. "</td>"; 
		echo "<td>". $row['ToolNumber']. "</td>";
  
            # Print download link 
            echo "<td><a href='get_file.php?id=". $row['FileID'] ."'>Download</a></td>"; 
            echo "</tr>"; 
        } 
  
        # Close table 
        echo "</table>"; 
    } 
  
    # Free the result 
    mysqli_free_result($result); 
} 
else  
{ 
    echo "Error! SQL query failed:"; 
    echo "<pre>". $dbLink->error ."</pre>"; 
} 
  
# Close the mysql connection 
mysqli_close($dbLink); 
?> 
  

any help would be appreciated

Link to comment
https://forums.phpfreaks.com/topic/147085-solved-pharse-error/
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.