The secret to wholesale...

In the article about buying Thai goods, I introduced wholesale markets and cheap...

Restaurant business and the...

Customers are a special figure in restaurants. This may seem obvious, but...

Guide the clues to...

Japanese goods Known for putting quality first. However, in the past, due...

Online cosmetics business and...

Starting a business, especially online cosmetics business is the silver trend and...
HomeLập trìnhPhpSự cố với...

Sự cố với PDO trong trang php


Tôi đang gặp sự cố với PDO. Ở đầu index.php của tôi, tôi có những điều sau:

<?php
session_start();
// start of script every time.

//  setup a path for all of your canned php scripts
$php_scripts="/home/foxclone/php/"; // a folder above the web accessible tree
//  load the pdo connection module  
require $php_scripts . 'PDO_Connection_Select.php';
require $php_scripts . 'GetUserIpAddr.php';

//*******************************
//   Begin the script here
$ip = GetUserIpAddr();
if (!$pdo = PDOConnect("foxclone_data")):
{
	echo "Failed to connect to database" ;
    exit;
}
else:
{
	$sql = "INSERT INTO Downloads (ip_address,filename) VALUES ('$ip','$down')";
	// use exec() because no results are returned
	$pdo->exec($sql); 
}

endif;
//exit();
?>

Đi sâu hơn vào index.php Tôi có một phần tải xuống mà tôi muốn ghi lại trong cùng một bảng:


   <?php
     $files = glob('download/*.iso');
     $file = $files[count($files) -1];
     $filename =  basename($file);
     $md5file = md5_file($file);
   ?>

   <div class="container">
     <div class="divL">                       
       <h3>Get the "https://forum.freecodecamp.org/t/problem-with-pdo-in-php-page/<?php echo"{$filename}";?>" file (approx. 600MB)</h3>
          <center>  <a href="https://forum.freecodecamp.org/t/problem-with-pdo-in-php-page/<?php echo"/{$file}";?>"><img src="images/button_get-the-app.png" alt=""></a>  </center>
                                
          <?php
            $down=$filename
           	$sql = "INSERT INTO Downloads (ip_address,filename) VALUES ('$ip','$down')"; <-- parse error here
	        $pdo->exec($sql); 
          ?>

Tôi đang gặp phải lỗi sau: Lỗi phân tích cú pháp: lỗi cú pháp, ‘$sql’ (T_VARIABLE) không mong muốn trong /home/foxclone/test.foxclone.com/index.php nhưng không hiểu tại sao. Tôi có cần dòng $sql không?

Cảm ơn trước,
Larry


Có vẻ như bạn vừa bỏ sót dấu chấm phẩy ở dòng trước.

Cảm ơn vì đã nắm bắt được điều đó.



Zik.vn – Biên dịch & Biên soạn Lại

Đọc thêm  Khóa học WordPress và PHP miễn phí trong 5 giờ
spot_img

Create a website from scratch

Just drag and drop elements in a page to get started with Newspaper Theme.

Buy Now ⟶

Bài viết liên quang

DMCA.com Protection Status