Hey everyone, been a while since I have been here but I need some advice in a bad way. Being new to PHP I am at wit's end with this one. I created a main website that displays images and info about the images. All of the images and info can be uploaded through a separate admin site I created (PHP as well). Once info and images are entered and uploaded through the admin site, the info and images then get stored into a database (phpMyAdmin).
Here is the problem:
Either the database or the admin site is not storing the information correctly because once or twice a week the admin site is dumping all the data it contains. Not sure what code to show and troubleshoot, but below is the code for the admin site's upload file. Anything look wrong in here?
<?php
include( "config.php" );
$p = new Portfolio();
if ($_POST) {
if ( isset( $_POST['PortfolioCategoryID'] ) && (int) $_POST['PortfolioCategoryID'] > 0 ) {
$p->editPortfolioCategory();
} else {
$p->saveNewPortfolioCategory();
}
}
include( APP_AB_PATH . "includes" . DIRECTORY_SEPARATOR . "header.php" );
if ($_GET['p']) {
$port = $p->getPortfolioCategory($_GET['p']);
$pCategoryId = $port['PortfolioCategoryID'];
$pCategoryName = $port['PortfolioCategoryName'];
$pCategoryDefault = $port['PortfolioCategoryDefault'];
} else {
$pCategoryId = 0;
$pCategoryName = '';
$pCategoryDefault = 10000;
}
?>
<h2 style="margin-bottom:4px">Portfolio Category Form</h2>
<form action="" method="post" enctype="multipart/form-data" name="form1">
<table width="750" border="0" cellspacing="0" cellpadding="8" style="border:solid 1px black">
<tr>
<td width="22%" nowrap>
<strong>Name</strong>
</td>
<td width="78%">
<input name="PortfolioCategoryName" type="text" id="PortfolioCategoryName" size="40" value="<?=$pCategoryName;?>">
</td>
</tr>
<tr>
<td width="22%" nowrap>
<strong>Default</strong>
</td>
<td width="78%">
<select name="PortfolioCategoryDefault" id="PortfolioCategoryDefault">
<option value="NULL"<?php echo ( ( (int) $pCategoryDefault > 1 ) ? ' selected="selected"' : '' ); ?>>Select</option>
<option value="1"<?php echo ( ( (int) $pCategoryDefault == 1 ) ? ' selected="selected"' : '' ); ?>>Yes</option>
<option value="0"<?php echo ( ( (int) $pCategoryDefault == 0 ) ? ' selected="selected"' : '' ); ?>>No</option>
</select>
</td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Save"></td>
<td> </td>
</tr>
</table>
<input type="hidden" name="PortfolioCategoryID" value="<?=$pCategoryId;?>">
</form>
<?php
include("./includes/footer.php");
?>