Jump to content

csv Fatal Error


cmb

Recommended Posts

this is my code

<?php
require ("s_check_login.php");
include ('database.php');
if(isset($_POST['csv_btn'])){
$str = $_POST['csv'];
$date = mysql_real_escape_string($_POST['date']);
$gal = mysql_real_escape_string($_POST['gal']);
$op = mysql_real_escape_string($_POST['op']);

$parts = explode( "\n", $str );
$team = array();

foreach( $parts as $part )
	$team[] = str_getcsv($part);
unset($parts);

$tcount = count($team);
for($x=0; $x<$tcount; $x++){
	$p = $team[$x];
	$sql = "INSERT INTO gbsa_stats (id, Player, Day_Played, Opponent, Gallery_no, Goals, Assists, Shots, On_Goal, Off_Post, Offsides, Saves, Fouls, Shots_Corner, Goals_Corner, Yellow, Red) VALUES ('NULL','$p[1]','$date','$op','$gal','$p[2]','$p[3]','$p[4]','$p[5]','$p[6]','$p[7]','$p[8]','$p[9]','$p[10]','$p[11]','$p[12]','$p[13]')"or die ('Error Updateing Database ' .mysql_error());

	if (!mysql_query($sql)){
		die('Error : ' .mysql_error());
	}
}

}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
<h1>csv data:</h1>
    <textarea name="csv" cols="100" rows="25" id="csv"></textarea>
    <br />
    <h1>Date:</h1>
    <input type="text" name="date" id="date" />
    <br />
    <h1>Opponent:</h1>
    <input type="text" name="op" id="op" />
    <br />
    <h1>Gallery Number:</h1>
    <input type="text" name="gal" id="gal" />
    <br />
    <h1> </h1>
    <input type="submit" name="csv_btn" id="csv_btn" value="Submit" />
</form>
</body>
</html>

when i run it on my local machine it works with no problem but when i upload it to my server and try to run it i get this error

Fatal error: Call to undefined function str_getcsv() in /html/admin/stats.php on line 14

Link to comment
Share on other sites

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.