Jump to content

Recommended Posts

I am having this problem:Fatal error: Call to undefined function: file_put_contents() in /home/cccccc/public_html/ccdfcdfd/popular_cards/index.php on line 13

 

this is my code

 

<?php
$filename = $_POST['file_name'];
$filecontent = $_POST['filecontent'];
if (!empty($filecontent) && !empty($filename)) {
include('config.php');

$query = mysql_query("SELECT * FROM popular_cards") or die(mysql_error());

while ($row = mysql_fetch_array($query)) {
    echo "ID: ".$row["ID"]." & the code is: ".$row["code"]."<br>";
}

$createfile = file_put_contents($filename,$filecontents) or die("Cannot create file"); // problem line

$query1 = "INSERT INTO popular_cards (code) VALUES ('$filecontent')";
mysql_query($query1);

mysql_close();

/*unset($filecontent);
unset($filename);*/
}
?>

'w' = Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length.

If the file does not exist, attempt to create it.

 

I think you must have missed this bit

 

~ Chocopi

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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