Jump to content
php.lv forumi

DATEFROM un DATETO ieraksts DB nestrada


gkazhus

Recommended Posts

Vai kaads man var pateikt ko esmu palaidis garaam ka man netiek ierakstiiti dati no laukiem DATEFROM un DATETO? Pareejais straadaa super.

 

$action = $_POST['ac'];
$banner_id = $_POST['id']; /* get banner id*/
$newUrl = $_POST['newUrl'];
$DATEFROM = $_POST['DATEFROM'];
$DATETO = $_POST['DATETO'];

$find="http://";
$pos=strpos($newUrl,$find);
if($pos===false) $newUrl=$find.$newUrl;

if($banner_id!=''){
if($action=='5'){
	$sql = "INSERT INTO right_side_banners (DATEFROM) VALUES ('".$DATEFROM."')"; 
	$res = mysql_query($sql) or die(mysql_error());
}

{
if($action=='6'){
	$sql = "INSERT INTO right_side_banners (DATETO) VALUES ('".$DATETO."')";
	$res = mysql_query($sql) or die(mysql_error());
}

{
if($action=='3'){
	$sql = "UPDATE right_side_banners SET link_URL='".$newUrl."' WHERE ID=".$banner_id; 
	$res = mysql_query($sql) or die(mysql_error());
}
if($action=='4'){
	$sqlSelect = "SELECT `banner` FROM right_side_banners WHERE ID=".$banner_id; 
	$resSelect = mysql_query($sqlSelect) or die(mysql_error());
	$banner = mysql_fetch_array($resSelect);
	if($banner[0]!=''){
		// delete file
		$uploaddir_logo = $_SERVER['DOCUMENT_ROOT'].$banner[0];
		unlink($uploaddir_logo);
		// clean DB
		$sql = "DELETE from right_side_banners WHERE ID=".$banner_id; 
		$res = mysql_query($sql) or die(mysql_error());
	}
}
if($action=='2'){
	$sql = "UPDATE right_side_banners SET active='1' WHERE ID=".$banner_id; 
	$res = mysql_query($sql) or die(mysql_error());
}
if($action=='1'){
	$sql = "UPDATE right_side_banners SET active='0' WHERE ID=".$banner_id; 
	$res = mysql_query($sql) or die(mysql_error());
}

}

?>

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...