Antworten auf deine Fragen:
Neues Thema erstellen

Fehlerhafte Ausgabe von PHP

JackyJack

Noch nicht viel geschrieben

Hallo Leute,

Ich habe unter XAMPP eine fehlerhafte Ausgabe eines Scripts aber nur bei diesem Script.
PHP selber läuft und alles andere auch. Nur bei diesem Script gibt es Probleme.

Z.B. die index.php und alle anderen Dateien werden so angezeigt:

PHP:
contact; break; case "policy": $generalContent = $clsSite_config->policy; break; case "term": $generalContent = $clsSite_config->term; break; case "faq": $generalContent = $clsSite_config->faq; break; default: $generalContent = $clsSite_config->home; include_once ("class/photos.class.php"); $photos = new Photos(); $colsnum = (int)($clsSite_config->home_size); $template->assign_block_vars("homepage",array( )); //List lastest photos $result = $photos->GetPhotosLimitWhere(0, $colsnum, " WHERE `approved` = 1 ", "`photo_id` DESC"); //$clsSite_config->col_size $w = $clsSite_config->sample_size; while ($row = mysql_fetch_array($result)) { $fullname = $cats->GetCatFullName($row["category"]); $username = $photos->GetPosterName($row["photo_designer"]); $photo_level = $photos->GetLevel($row["download"],$row["resolution"]); $h = (double) $w*($row['photo_height']/$row['photo_width']); $template->assign_block_vars("indexcol",array( "PHOTO_SID" => $row["photo_sid"], "PHOTO_TITLE" => $row["photo_title"], "PHOTO_THUMB" => $row["photo_thumb"], "PHOTO_DESIGNER" => $row["photo_designer"], "RESOLUTION" => $row["resolution"], 'PHOTO_SIZE' => $row['photo_size']/1000000, 'PHOTO_PWIDTH' => CurrencyFormat1($w), 'PHOTO_PHEIGHT' => CurrencyFormat1($h), 'PHOTO_WIDTH' => $row['photo_width'], 'PHOTO_HEIGHT' => $row['photo_height'], 'PHOTO_DESIGNER' => $row['photo_designer'], "PHOTO_PRICE" => $photo_level['price'], "PHOTO_LEVEL" => $photo_level["level_name"], 'PHOTO_POST_DATE' => $row['photo_post_date'], 'FULLNAME' => $fullname, 'USERNAME' => $username, "SITENAME" => $clsSite_config->site_title, 'PHOTO_PREVIEW'=> $row['photo_preview'], "VIEW" => $row["view"], "DOWNLOAD" => $row["download"], "APPROVED" => $row["approved"] == "0"?"Unapproved":"Approved" )); } //List popular photos -- depend on download number $result = $photos->GetPhotosLimitWhere(0, $colsnum, " WHERE `approved` = 1 ", "`download` DESC"); while ($row = mysql_fetch_array($result)) { $fullname = $cats->GetCatFullName($row["category"]); $username = $photos->GetPosterName($row["photo_designer"]); $photo_level = $photos->GetLevel($row["download"],$row["resolution"]); $h = (double) $w*($row['photo_height']/$row['photo_width']); $template->assign_block_vars("indexcol1",array( "PHOTO_SID" => $row["photo_sid"], "PHOTO_TITLE" => $row["photo_title"], "PHOTO_THUMB" => $row["photo_thumb"], "PHOTO_DESIGNER" => $row["photo_designer"], "RESOLUTION" => $row["resolution"], 'PHOTO_SIZE' => $row['photo_size']/1000000, 'PHOTO_PWIDTH' => CurrencyFormat1($w), 'PHOTO_PHEIGHT' => CurrencyFormat1($h), 'PHOTO_WIDTH' => $row['photo_width'], 'PHOTO_HEIGHT' => $row['photo_height'], 'PHOTO_DESIGNER' => $row['photo_designer'], "PHOTO_PRICE" => $photo_level['price'], "PHOTO_LEVEL" => $photo_level["level_name"], 'PHOTO_POST_DATE' => $row['photo_post_date'], 'FULLNAME' => $fullname, 'USERNAME' => $username, "SITENAME" => $clsSite_config->site_title, 'PHOTO_PREVIEW'=> $row['photo_preview'], "VIEW" => $row["view"], "DOWNLOAD" => $row["download"], "APPROVED" => $row["approved"] == "0"?"Unapproved":"Approved" )); } //List free photos -- depend on download number $result = $photos->GetPhotosLimitWhere(0, $colsnum, " WHERE `approved` = 1 and `is_free`>=".time(), "`photo_id` DESC"); while ($row = mysql_fetch_array($result)) { $fullname = $cats->GetCatFullName($row["category"]); $username = $photos->GetPosterName($row["photo_designer"]); $photo_level = $photos->GetLevel($row["download"],$row["resolution"]); $h = (double) $w*($row['photo_height']/$row['photo_width']); $template->assign_block_vars("indexcol2",array( "PHOTO_SID" => $row["photo_sid"], "PHOTO_TITLE" => $row["photo_title"], "PHOTO_THUMB" => $row["photo_thumb"], "PHOTO_DESIGNER" => $row["photo_designer"], "RESOLUTION" => $row["resolution"], 'PHOTO_SIZE' => $row['photo_size']/1000000, 'PHOTO_PWIDTH' => CurrencyFormat1($w), 'PHOTO_PHEIGHT' => CurrencyFormat1($h), 'PHOTO_WIDTH' => $row['photo_width'], 'PHOTO_HEIGHT' => $row['photo_height'], 'PHOTO_DESIGNER' => $row['photo_designer'], "PHOTO_PRICE" => $photo_level['price'], "PHOTO_LEVEL" => $photo_level["level_name"], 'PHOTO_POST_DATE' => $row['photo_post_date'], 'FULLNAME' => $fullname, 'USERNAME' => $username, "SITENAME" => $clsSite_config->site_title, 'PHOTO_PREVIEW'=> $row['photo_preview'], "VIEW" => $row["view"], "DOWNLOAD" => $row["download"], "APPROVED" => $row["approved"] == "0"?"Unapproved":"Approved" )); } break; } $template->set_filenames(array("body" => "index.html")); $template->assign_vars(array( 'TITLE' => $tit, 'COLSNUM' => $colsnum, 'CONTENT'=> $generalContent, )); $template->pparse("body"); include("footer.php"); ?>

Ich komme absolut nicht dahinter woran es liegen kann?
Es handelt sich nur um dieses Script.

Bitte Codes über Einfügen -> Code einbinden - geändert von ackermaennchen
 
Zuletzt bearbeitet von einem Moderator:

owieortho

Aktives Mitglied

So wird das nix...
Ist das die ungeparste index.php oder schon die resultierende Browserdarstellung?
Da fehlt mir zumindet am Anfang doch einiges...

Und wenn Du hier Code darstellen willst, dann hilft es der Übersichtlichkeit (Einrückungen, Farbcodierung) sehr, wenn Du dazu in die weiteren Einstellungen gehst und dei passende Code-Darstellung wählst. So wie oben, müsste sich jeder, der Dir helfen wollte den Code erst aufräumen/strukturieren.

O.
 

JackyJack

Noch nicht viel geschrieben

So wird das nix...
Ist das die ungeparste index.php oder schon die resultierende Browserdarstellung?
Da fehlt mir zumindet am Anfang doch einiges...

Und wenn Du hier Code darstellen willst, dann hilft es der Übersichtlichkeit (Einrückungen, Farbcodierung) sehr, wenn Du dazu in die weiteren Einstellungen gehst und dei passende Code-Darstellung wählst. So wie oben, müsste sich jeder, der Dir helfen wollte den Code erst aufräumen/strukturieren.

O.
Die Fertige aufgerufene index im Browser. Die index.php selbst sieht so aus:
PHP:
<?

$mode = $_REQUEST["mod"];
switch ($mode) {
case "contact":
$tit = "CONTACT";
break;
case "policy":
$tit = "POLICY";
break;
case "term":
$tit = "TERMS AND CONDITIONS";
break;
case "faq":
$tit = "FAQ";
break;
default:
$tit = "HOME PAGE";
break;
}

$curr_page = ucfirst(strtolower($tit));
$curr_page = ucfirst($curr_page);
include("header.php");

switch ($mode) {
case "contact":
$generalContent = $clsSite_config->contact;
break;
case "policy":
$generalContent = $clsSite_config->policy;
break;
case "term":
$generalContent = $clsSite_config->term;
break;
case "faq":
$generalContent = $clsSite_config->faq;
break;
default:
$generalContent = $clsSite_config->home;

include_once ("class/photos.class.php");
$photos = new Photos();
$colsnum = (int)($clsSite_config->home_size);

$template->assign_block_vars("homepage",array(
));
//List lastest photos
$result = $photos->GetPhotosLimitWhere(0, $colsnum, " WHERE `approved` = 1 ", "`photo_id` DESC");
//$clsSite_config->col_size
$w = $clsSite_config->sample_size;
while ($row = mysql_fetch_array($result))
{
$fullname = $cats->GetCatFullName($row["category"]);
$username = $photos->GetPosterName($row["photo_designer"]);
$photo_level = $photos->GetLevel($row["download"],$row["resolution"]);
$h = (double) $w*($row['photo_height']/$row['photo_width']);
$template->assign_block_vars("indexcol",array(
"PHOTO_SID" => $row["photo_sid"],
"PHOTO_TITLE" => $row["photo_title"],
"PHOTO_THUMB" => $row["photo_thumb"],
"PHOTO_DESIGNER" => $row["photo_designer"],
"RESOLUTION" => $row["resolution"],
'PHOTO_SIZE' => $row['photo_size']/1000000,
'PHOTO_PWIDTH' => CurrencyFormat1($w),
'PHOTO_PHEIGHT' => CurrencyFormat1($h),
'PHOTO_WIDTH' => $row['photo_width'],
'PHOTO_HEIGHT' => $row['photo_height'],
'PHOTO_DESIGNER' => $row['photo_designer'],
"PHOTO_PRICE" => $photo_level['price'],
"PHOTO_LEVEL" => $photo_level["level_name"],
'PHOTO_POST_DATE' => $row['photo_post_date'],
'FULLNAME' => $fullname,
'USERNAME' => $username,
"SITENAME" => $clsSite_config->site_title,
'PHOTO_PREVIEW'=> $row['photo_preview'],
"VIEW" => $row["view"],
"DOWNLOAD" => $row["download"],
"APPROVED" => $row["approved"] == "0"?"Unapproved":"Approved"
));
}
//List popular photos -- depend on download number
$result = $photos->GetPhotosLimitWhere(0, $colsnum, " WHERE `approved` = 1 ", "`download` DESC");
while ($row = mysql_fetch_array($result))
{
$fullname = $cats->GetCatFullName($row["category"]);
$username = $photos->GetPosterName($row["photo_designer"]);
$photo_level = $photos->GetLevel($row["download"],$row["resolution"]);
$h = (double) $w*($row['photo_height']/$row['photo_width']);
$template->assign_block_vars("indexcol1",array(
"PHOTO_SID" => $row["photo_sid"],
"PHOTO_TITLE" => $row["photo_title"],
"PHOTO_THUMB" => $row["photo_thumb"],
"PHOTO_DESIGNER" => $row["photo_designer"],
"RESOLUTION" => $row["resolution"],
'PHOTO_SIZE' => $row['photo_size']/1000000,
'PHOTO_PWIDTH' => CurrencyFormat1($w),
'PHOTO_PHEIGHT' => CurrencyFormat1($h),
'PHOTO_WIDTH' => $row['photo_width'],
'PHOTO_HEIGHT' => $row['photo_height'],
'PHOTO_DESIGNER' => $row['photo_designer'],
"PHOTO_PRICE" => $photo_level['price'],
"PHOTO_LEVEL" => $photo_level["level_name"],
'PHOTO_POST_DATE' => $row['photo_post_date'],
'FULLNAME' => $fullname,
'USERNAME' => $username,
"SITENAME" => $clsSite_config->site_title,
'PHOTO_PREVIEW'=> $row['photo_preview'],
"VIEW" => $row["view"],
"DOWNLOAD" => $row["download"],
"APPROVED" => $row["approved"] == "0"?"Unapproved":"Approved"
));
}
//List free photos -- depend on download number
$result = $photos->GetPhotosLimitWhere(0, $colsnum, " WHERE `approved` = 1 and `is_free`>=".time(), "`photo_id` DESC");
while ($row = mysql_fetch_array($result))
{
$fullname = $cats->GetCatFullName($row["category"]);
$username = $photos->GetPosterName($row["photo_designer"]);
$photo_level = $photos->GetLevel($row["download"],$row["resolution"]);
$h = (double) $w*($row['photo_height']/$row['photo_width']);
$template->assign_block_vars("indexcol2",array(
"PHOTO_SID" => $row["photo_sid"],
"PHOTO_TITLE" => $row["photo_title"],
"PHOTO_THUMB" => $row["photo_thumb"],
"PHOTO_DESIGNER" => $row["photo_designer"],
"RESOLUTION" => $row["resolution"],
'PHOTO_SIZE' => $row['photo_size']/1000000,
'PHOTO_PWIDTH' => CurrencyFormat1($w),
'PHOTO_PHEIGHT' => CurrencyFormat1($h),
'PHOTO_WIDTH' => $row['photo_width'],
'PHOTO_HEIGHT' => $row['photo_height'],
'PHOTO_DESIGNER' => $row['photo_designer'],
"PHOTO_PRICE" => $photo_level['price'],
"PHOTO_LEVEL" => $photo_level["level_name"],
'PHOTO_POST_DATE' => $row['photo_post_date'],
'FULLNAME' => $fullname,
'USERNAME' => $username,
"SITENAME" => $clsSite_config->site_title,
'PHOTO_PREVIEW'=> $row['photo_preview'],
"VIEW" => $row["view"],
"DOWNLOAD" => $row["download"],
"APPROVED" => $row["approved"] == "0"?"Unapproved":"Approved"
));
}

break;
}
$template->set_filenames(array("body" => "index.html"));

$template->assign_vars(array(
'TITLE' => $tit,
'COLSNUM' => $colsnum,
'CONTENT'=> $generalContent,
)); 

$template->pparse("body");
include("footer.php");
?>
Das mit der Farbeinstellung habe ich in den "weiteren Einstellungen" leider nicht finden können.
 
Zuletzt bearbeitet:

Duddle

Posting-Frequenz: 14µHz

Ist mglw. short_open_tag deaktiviert? Dann kannst du kein
PHP:
<?
als Start-Tag nutzen. Ansonsten würde ich mal das
PHP:
include("header.php");
auskommentieren und schauen ob sich was ändert. Kann ja sein dass dieses Script fehlerhaft ist und sich auf die index.php auswirkt.


Duddle
 

JackyJack

Noch nicht viel geschrieben

Das mit <? ist mir auch aufgefallen nur noch mehr Fehlermeldungen kommen wenn ich <?php hinschreibe...

Auskommentieren von include("header.php"); bring auch nichts.

short_open_tag ist es in allen Dateien z.B. auch in der header.php wie könnte ich short_open_tag aktivieren?

Vielleicht hilft das dann...

UPDATE: Habe jetzt den Test gemacht.
PHP:
<?

echo "Test";

?>

Ich habe außerdem in der php.ini unter C:\xampp\php

Folgendes ersetzt: (Original)
; short_open_tag
; Default Value: On
; Development Value: off
; Production Value: off

Durch: (Bearbeitet)
; short_open_tag = On
; Default Value: On
; Development Value: On
; Production Value: On

Oder auch:
; short_open_tag
; Default Value: On
; Development Value: On
; Production Value: On


So funktioniert es nicht auf meinem PC / XAMPP
Kein open short tag.


So sieht die Ausgabe im Browser aus mit <?php am Anfang.

Notice: Undefined index: mod in C:\xampp2\htdocs\stockphoto\index.php on line 13
page_size>0?$clsSite_config->page_size:10; $pagerange = 3; $fheader = "header.html"; $ffooter = "footer.html"; if (isset($_SESSION["username"]) && $_SESSION["username"] != "") { include_once ("class/members.class.php"); $member = new Members(); $result = $member->GetBySId($_SESSION["suserid"]); if ($row = mysql_fetch_array($result)) { $_SESSION["credits"] = $row['credits']; $_SESSION["subcription"] = $member->CountSPackage($row['sid']); $_SESSION["username"] = $row['username']; } $template->assign_block_vars("login_success",array( 'USERNAME' => $_SESSION["username"], 'CREDITS' => $_SESSION["credits"], 'SUBCRIPTION' => $_SESSION["subcription"]>0?"
plus ".$_SESSION["subcription"]." supcriptions":"" )); } else { $template->assign_block_vars("not_yet_login",array( )); } $template->set_filenames(array("header" => $fheader)); if ($curr_page == "") $curr_page = "Home page"; $template->assign_vars(array( 'META' => $meta, 'SITETITLE' => $curr_page." - ".$clsSite_config->site_title, 'TEMPLATE_DIR' => $template_dir, 'WEBROOT' => $webroot, "HOME_IMG" => $curr_page == "Home page"?"home_over.jpg":"home.jpg", "HOME_OVER" => $curr_page == "Home page"?"home.jpg":"home_over.jpg", "CAT_IMG" => $curr_page == "Category"?"cat_over.jpg":"cat.jpg", "CAT_OVER" => $curr_page == "Category"?"cat.jpg":"cat_over.jpg", "DESIGNER_IMG" => $curr_page == "Designer Area"?"designer_over.jpg":"designer.jpg", "DESINGER_OVER" => $curr_page == "Designer Area"?"designer.jpg":"designer_over.jpg", "PHOTOER_IMG" => $curr_page == "Photographer Area"?"photoer_over.jpg":"photoer.jpg", "PHOTOER_OVER" => $curr_page == "Photographer Area"?"photoer.jpg":"photoer_over.jpg", "REGISTER_IMG" => $curr_page == "Registration"?"register_over.jpg":"register.jpg", "REGISTER_OVER" => $curr_page == "Registration"?"register.jpg":"register_over.jpg", "FAQ_IMG" => $curr_page == "Faq"?"faq_over.jpg":"faq.jpg", "FAQ_OVER" => $curr_page == "Faq"?"faq.jpg":"faq_over.jpg" )); include_once ("class/cats.class.php"); $cats = new Cats(); $result = $cats->GetRootCat(); $s1 = 0; while ($row = mysql_fetch_array($result)) { $listsubcat = ""; $s1 ++; if ((isset($_REQUEST["cat_sid"]) && $_REQUEST["cat_sid"]==$row["cat_sid"])|| (isset($_REQUEST["p_sid"]) && $_REQUEST["p_sid"]==$row["cat_sid"])) { //List subcategory $result1 = $cats->GetChildCat($row["cat_sid"]); while ($row1 = mysql_fetch_array($result1)) { if ($row1["cat_sid"] == $_REQUEST["cat_sid"]) { $listsubcat .=" ".$row1["cat_name"]." "; }else { $listsubcat .=" ".$row1["cat_name"]." "; } } } $template->assign_block_vars("category_list",array( "NOTSTART" => ($s1 >1)?" | ":"", "CAT_CLASS" => $row["cat_sid"] == $_REQUEST["cat_sid"]?" class = 'sidelinks'":" class = 'sidelinks2' ", "CAT_SID" => $row["cat_sid"], "CAT_NAME" => $row["cat_name"], "SELECTED" => $row["cat_sid"] == $cat_parent?" selected ":"", "LISTSUBCAT" => $listsubcat )); } $template->assign_vars(array( 'TOTAL_APPROVED' => $clsSite_config->Total_approved(), 'TODAY_POST' => $clsSite_config->Today_post(), 'TOTAL_UNAPPROVED' => $clsSite_config->Total_unapproved() )); $template->pparse("header"); ?>
Notice: Undefined variable: clsSite_config in C:\xampp2\htdocs\stockphoto\index.php on line 58

Notice: Trying to get property of non-object in C:\xampp2\htdocs\stockphoto\index.php on line 58
runQuery($sql)); } function InsertPhotos($photo_title, $resubmit_sid, $photo_tag, $photo_des, $photo_license, $category, $is_free, $photo_format, $photo_size, $resolution, $photo_width, $photo_height, $photo_designer, $photo_post_date, $photo_thumb, $photo_preview, $photo_orginal, $approved) { $sql = "INSERT INTO `photos`( `photo_title`, `resubmit_sid`, `photo_tag`, `photo_des`, `photo_license`, `category`, `is_free`, `photo_format`, `photo_size`, `resolution`, `photo_width`, `photo_height`, `photo_designer`, `photo_post_date`, `photo_thumb`, `photo_preview`, `photo_orginal`, `view`, `download`, `approved`) VALUES ( '".$photo_title."', '".$resubmit_sid."', '".$photo_tag."', '".$photo_des."', '".$photo_license."', '".$category."', '".$is_free."', '".$photo_format."', '".$photo_size."', '".$resolution."', '".$photo_width."', '".$photo_height."', '".$photo_designer."', '".$photo_post_date."', '".$photo_thumb."', '".$photo_preview."', '".$photo_orginal."', '0','0', '".$approved."' ) "; $this->runQuery($sql); $id=mysql_insert_id(); $sid=md5($id); $sql = "UPDATE `photos` SET `photo_sid`= '".$sid."' WHERE `photo_id`= '".$id."'"; $this->runQuery($sql); return $sid; } function UpdateCommonInfo($photo_sid, $photo_title, $photo_tag, $photo_des, $photo_license, $category, $resolution) { $sql = "UPDATE `photos` SET `photo_title` = '".$photo_title."', `photo_tag` = '".$photo_tag."', `photo_des` = '".$photo_des."', `photo_license` = '".$photo_license."', `resolution` = '".$resolution."', `category` = '".$category."' WHERE `photo_sid` = '".$photo_sid."'"; $this->runQuery($sql); return $photo_sid; } function UpdatePhotos($photo_sid, $photo_format, $photo_size, $photo_width, $photo_height, $photo_thumb, $photo_preview, $photo_orginal) { $sql = "SELECT `photo_thumb`, `photo_preview`, `photo_orginal` FROM `photos` WHERE `photo_sid` = '".$photo_sid."'"; $row = mysql_fetch_array($this->runQuery($sql)); if ($row["photo_thumb"] != $photo_thumb) @unlink($row["photo_thumb"]); //Xoa file anh cu di if ($row["photo_preview"] != $photo_preview) @unlink($row["photo_preview"]); //Xoa file anh cu di if ($row["photo_orginal"] != $photo_orginal) { @unlink($row["photo_orginal"]); //Xoa file anh cu di //Xoa ca thu muc cu di $dir = substr($row["photo_orginal"],0,strrpos($row["photo_orginal"],"/")); @unlink($dir."/index.html"); //Xoa file index @rmdir($dir); } $sql = "UPDATE `photos` SET `photo_format` = '".$photo_format."', `photo_size` = '".$photo_size."', `photo_width` = '".$photo_width."', `photo_height` = '".$photo_height."', `photo_thumb` = '".$photo_thumb."', `photo_preview` = '".$photo_preview."', `photo_orginal` = '".$photo_orginal."' WHERE `photo_sid` = '".$photo_sid."'"; $this->runQuery($sql); return $photo_sid; } function UpdateStatus($photo_sid, $approved) { $sql = "UPDATE `photos` SET `approved` = '".$approved."' WHERE `photo_sid` = '".$photo_sid."'"; $this->runQuery($sql); return; } //Update view or download number function UpdateViewNumber($photo_sid) { $sql = "SELECT `view` FROM `photos` WHERE `photo_sid` = '".$photo_sid."'"; if ($row = mysql_fetch_array($this->runQuery($sql))) { $newinc = $row[0] + 1; $sql = "UPDATE `photos` SET `view` = '".$newinc."' WHERE `photo_sid` = '".$photo_sid."'"; $this->runQuery($sql); return $photo_sid; } else return 0; } function UpdateDownloadNumber($photo_sid) { $sql = "SELECT `download` FROM `photos` WHERE `photo_sid` = '".$photo_sid."'"; if ($row = mysql_fetch_array($this->runQuery($sql))) { $newinc = $row[0] + 1; $sql = "UPDATE `photos` SET `download` = '".$newinc."' WHERE `photo_sid` = '".$photo_sid."'"; $this->runQuery($sql); return $photo_sid; } else return 0; } function GetPhotosLimitWhere($start, $pagesize, $where, $orderby="`photo_title` ASC") { $sql = "SELECT * FROM `photos` ".$where." ORDER BY ".$orderby." LIMIT ".$start.",".$pagesize; return $this->runQuery($sql); } //GetTotalRecords function GetTotalPhotosWhere($where) { $sql = "SELECT count(`photo_sid`) FROM `photos` ".$where; if ($row=mysql_fetch_array($this->runQuery($sql))) { return $row[0]; }else return 0; // $total = mysql_num_rows(); } function GetPhotosOfMem($start, $pagesize, $m_sid, $approved, $orderby="`photo_title` ASC") { $app_w = ($approved < 2)?" and `approved` = ".$approved:""; $sql = "SELECT * FROM `photos` WHERE `photo_designer` = '".$m_sid."' ".$app_w." ORDER BY ".$orderby." LIMIT ".$start.",".$pagesize; return $this->runQuery($sql); } //GetTotalRecords function GetTotalPhotosOfMem($m_sid, $approved) { $app_w = ($approved < 2)?" and `approved` = ".$approved:""; $sql = "SELECT count(`photo_sid`) FROM `photos` WHERE `photo_designer` = '".$m_sid."' ".$app_w; if ($row=mysql_fetch_array($this->runQuery($sql))) { return $row[0]; }else return 0; } function StaticByUser($m_sid) { $sql = "SELECT count(`photo_sid`) as `total_uploads`, sum(`view`) as `total_views`, sum(`download`) as `total_downloads`, max(`photo_id`) as `lastest_upload` FROM `photos` WHERE `photo_designer` = '".$m_sid."'"; return $this->runQuery($sql); } function GetInfoByID($photo_id) { $sql = "SELECT * FROM `photos` WHERE `photo_id` = '".$photo_id."'"; return $this->runQuery($sql); } function GetPosterName($m_sid) { $sql = "SELECT `username` FROM `members` WHERE `sid` = '".$m_sid."'"; if ($row=mysql_fetch_array($this->runQuery($sql))) { return $row[0]; }else return 0; } function GetLevel($download, $resolution) { $sql = "SELECT * FROM `levels` WHERE `resolution` = '".$resolution."' and `max_img_down` >= ".$download." and `min_img_down` <= ".$download." ORDER BY `level_id` DESC"; return $this->runQuery($sql); } //Update function Update($photo_sid, $fieldname, $field_data) { $sql = "UPDATE `photos` SET `".$fieldname."` = '".$field_data."' WHERE `photo_sid` = '".$photo_sid."'"; $this->runQuery($sql); $fieldname = $field_data; return; } //Delete function Delete($photo_sid) { $sql = "SELECT `photo_sid`, `photo_thumb`, `photo_preview`, `photo_orginal` FROM `photos` WHERE `photo_sid` = '".$photo_sid."'"; $result = $this->runQuery($sql); while ($r = mysql_fetch_array($result)) { //Delete cac anh @unlink($r["photo_thumb"]); @unlink($r["photo_preview"]); @unlink($r["photo_orginal"]); //Xoa ca thu muc cu di $dir = substr($r["photo_orginal"],0,strrpos($r["photo_orginal"],"/")); @unlink($dir."/index.html"); //Xoa file index @rmdir($dir); } $sql = "DELETE FROM `photos` WHERE `photo_sid` = '".$photo_sid."'"; $this->runQuery($sql); return $d_sid; } //Dem so member buy photo nay function CountBuyer($photo_sid) { $sql = "SELECT count(`photo_sid`) FROM `transaction` WHERE `photo_sid` = '".$photo_sid."'"; if ($row=mysql_fetch_array($this->runQuery($sql))) { return $row[0]; }else return 0; // $total = mysql_num_rows(); } /////////////////////////////////////////////////// ///////////////// COMMENT ////////////////////// ////////////////////////////////////////////////// function InsertComment($photo_sid, $comment_text, $comment_poster, $comment_post_date) { $sql = "INSERT INTO `comments`( `photo_sid`, `comment_text`, `comment_poster`, `comment_post_date`) VALUES ( '".$photo_sid."', '".$comment_text."', '".$comment_poster."', '".$comment_post_date."' ) "; $this->runQuery($sql); $id = mysql_insert_id(); $sid = md5($id); $sql = "UPDATE `comments` SET `comment_sid`= '".$sid."' WHERE `comment_id`= '".$id."'"; $this->runQuery($sql); return $sid; } //Delete function DeleteComment($comment_sid) { $sql = "DELETE FROM `comments` WHERE `comment_sid` = '".$comment_sid."'"; $this->runQuery($sql); return $comment_sid; } function GetListComment($photo_sid) { $sql = "SELECT c.*, m.* FROM `comments` as c, `members` as m WHERE c.`comment_poster` = m.`sid` and c.`photo_sid` = '".$photo_sid."'"; return $this->runQuery($sql); } } ?>
Fatal error: Class 'Photos' not found in C:\xampp2\htdocs\stockphoto\index.php on line 61


So sieht die Ausgabe im Browser aus mit <?php am Anfang.
 
Zuletzt bearbeitet:

JackyJack

Noch nicht viel geschrieben

Update 2:

Auf dem Server klappt es. Also lag es wahrscheinlich am open short tag.
Wird ja nicht ohne Grund empfohlen nicht zu faul zu sein und einfach mal 3 Buchstaben mehr zu schreiben <?php!
Aber dazu muss ich sagen das es dennoch einen Fehler im Code gab und zwar:

PHP:
CREATE DATABASE IF NOT EXISTS `DataBase` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `BaseData`;

Als Beispiel habe ich DataBase genommen. Oben stand ein Wort wie DataBase und unten BaseData.

Ich vermute das es dadurch auch zu Komplikationen kam oder irre ich mich?
 

Duddle

Posting-Frequenz: 14µHz

Was ist die Fehlermeldung bzgl. des SQLs?
"DataBase" ist jedenfalls ein und darf darf nicht als Bezeichner benutzt werden.

Edit: und ja, wenn du die Datenbank "A" nennst und dann versuchst sie als "B" zu nutzen wird das nix.


Duddle
 

patrick_l

Hat es drauf

Nur so am rande. Wenn du hier Quellcode postest, dann bitte auch mit entsprechenden Tags. Dafür im Editor auf
icontium3.png
-Icon klicken, den Eintrag Code auswählen, Sprache festlegen und deinen Quellcode einfügen. Danke.
 

Jormungand

VonAllemEtwas

Ich bin jetzt nicht das PHP-Genie, aber wenn ich mich recht erinnere, gibts bei der Switch Anweisung nach default kein break. Keine Ahnung ob eine Änderung was bewirkt.
 
Bilder bitte hier hochladen und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Antworten auf deine Fragen:
Neues Thema erstellen

Willkommen auf PSD-Tutorials.de

In unseren Foren vernetzt du dich mit anderen Personen, um dich rund um die Themen Fotografie, Grafik, Gestaltung, Bildbearbeitung und 3D auszutauschen. Außerdem schalten wir für dich regelmäßig kostenlose Inhalte frei. Liebe Grüße senden dir die PSD-Gründer Stefan und Matthias Petri aus Waren an der Müritz. Hier erfährst du mehr über uns.

Stefan und Matthias Petri von PSD-Tutorials.de

Nächster neuer Gratisinhalt

03
Stunden
:
:
25
Minuten
:
:
19
Sekunden

Flatrate für Tutorials, Assets, Vorlagen

Zurzeit aktive Besucher

Statistik des Forums

Themen
118.639
Beiträge
1.538.504
Mitglieder
67.559
Neuestes Mitglied
mic4mac
Oben