Name: noko 2011-03-22 16:46
ERROR, ERROR, ERROR, ERROR
Notice: Undefined variable
Warning: Missing argument 2 for fileInfo()
Warning: Missing argument 3 for fileInfo()
Notice: Undefined variable: name
and so on...
i can make this system easy, and much more advanced(with lotzz of if()'z), but i think i missed a very big basic-part of PHP.
Please can anyone help me?
<?php
// Enables Sessions
session_start();
// MYSQL connection
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());
FILE.php
if($_SESSION['access'] == "granted") {
// Retrive informations from MYSQL row
function fileInfo($id, $name, $content) {
$query = mysql_query("SELECT * FROM smartcms_files WHERE id='{$id}' LIMIT 1");
while($file = mysql_fetch_array($query)) {
if($id == $file['id']) {
$id = $row['id'];
$name = $row['filename'];
$content = $row['filecontent'];
}
}
}
// Connects to specific MYSQL row.
if(isset($_GET['id'])) {
$fileid = fileInfo($id);
$filename = fileInfo($name);
$filecontent = fileInfo($content);
}
else {
echo "Please Choose a File";
}
}
?>
Notice: Undefined variable
Warning: Missing argument 2 for fileInfo()
Warning: Missing argument 3 for fileInfo()
Notice: Undefined variable: name
and so on...
i can make this system easy, and much more advanced(with lotzz of if()'z), but i think i missed a very big basic-part of PHP.
Please can anyone help me?
<?php
// Enables Sessions
session_start();
// MYSQL connection
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());
FILE.php
if($_SESSION['access'] == "granted") {
// Retrive informations from MYSQL row
function fileInfo($id, $name, $content) {
$query = mysql_query("SELECT * FROM smartcms_files WHERE id='{$id}' LIMIT 1");
while($file = mysql_fetch_array($query)) {
if($id == $file['id']) {
$id = $row['id'];
$name = $row['filename'];
$content = $row['filecontent'];
}
}
}
// Connects to specific MYSQL row.
if(isset($_GET['id'])) {
$fileid = fileInfo($id);
$filename = fileInfo($name);
$filecontent = fileInfo($content);
}
else {
echo "Please Choose a File";
}
}
?>