can't delete any entry of any table in my database

I don’t remember what I did for tis to happen but I can’t delete any entry of any table in my database.

Said like that is a bit vague.

Can you say something more specific?

Check the database permissions for the database user you are using to connect…

error for all my nine (9) tables

But I can add and Edit !

Check your actionDelete() by default (Gii generated code) there is a check if the call to that action is an POST request if not it throws that exception…

just noticed that I can delete from View … Still not from admin (CGrdView)

this my UtilisateurController.php (seems correct like the others)




	public function actionDelete($id)

	{

		if(Yii::app()->request->isPostRequest)

		{

			// we only allow deletion via POST request

			$this->loadModel($id)->delete();


			// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser

			if(!isset($_GET['ajax']))

				$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));

		}

		else

			throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');

	}




I already wrote you in the previous post… the record is deleted only if Yii::app()->request->isPostRequest is true…

so it’s up to you to check how you are calling the actionDelete()… ;)

I’m (my delete action) using the standard CGridView with





		array(

			'class'=>'CButtonColumn',

		),




yes, but as you wrote above… maybe you made some changes… some global AJAX settings that makes GET calls instead of POST…

so you need to check what time of call is made… try with firefox / firebug… there you will see if it’s a POST request…

you can try to comment that IF line in the actionDelete()… then the delete should work… but that is not the solution…

Yes it works after that ;)… I’m still finding why that happen




11:09:45,367: Exception : $.fn.yiiGridView is undefined Fichier source : http://localhost/annonces2/index.php?r=materiel/admin Ligne : 225, Colonne: 0 Catégorie : content javascript

11:09:45,465: Réseau : GET http://localhost/annonces2/index.php?r=materiel/delete&id=1 [HTTP/1.0 400 CHttpException 1079ms]

11:09:46,668: Réseau : GET http://apture.com/js/aptureTmmBookmarklet.js [HTTP/1.0 200 OK 2982ms]

11:09:49,649: Réseau : GET http://cdn.apture.com/media/storage.gecko.v31619250.js [HTTP/1.1 200 OK 1198ms]

11:09:50,937: Réseau : GET http://cdn.apture.com/media/html/aptureLoadIframe.html?v=31619250 [HTTP/1.1 200 OK 636ms]

11:09:51,833: Avertissement : Erreur d'analyse de la valeur pour « border-collapse ».  Déclaration abandonnée. Fichier source : http://localhost/annonces2/index.php?r=materiel/delete&id=1 Ligne : 1, Colonne: 1044 Catégorie : CSS Parser

11:09:51,842: Avertissement : Erreur d'analyse de la valeur pour « font ».  Déclaration abandonnée. Fichier source : http://localhost/annonces2/index.php?r=materiel/delete&id=1 Ligne : 1, Colonne: 1092 Catégorie : CSS Parser

11:09:51,853: Avertissement : Propriété « -moz-background-clip » inconnue.  Déclaration abandonnée. Fichier source : http://localhost/annonces2/index.php?r=materiel/delete&id=1 Ligne : 1, Colonne: 11108 Catégorie : CSS Parser

11:09:51,862: Avertissement : Propriété « -moz-background-origin » inconnue.  Déclaration abandonnée. Fichier source : http://localhost/annonces2/index.php?r=materiel/delete&id=1 Ligne : 1, Colonne: 11138 Catégorie : CSS Parser

11:09:51,871: Avertissement : Erreur d'analyse de la valeur pour « filter ».  Déclaration abandonnée. Fichier source : http://localhost/annonces2/index.php?r=materiel/delete&id=1 Ligne : 1, Colonne: 13789 Catégorie : CSS Parser

11:09:51,881: Avertissement : Erreur d'analyse de la valeur pour « top ».  Déclaration abandonnée. Fichier source : http://localhost/annonces2/index.php?r=materiel/delete&id=1 Ligne : 1, Colonne: 86 Catégorie : CSS Parser

11:09:51,893: Avertissement : Pseudo-classe ou pseudo-élément « selection » inconnu.  Jeu de règles ignoré suite à un mauvais sélecteur. Fichier source : http://localhost/annonces2/index.php?r=materiel/delete&id=1 Ligne : 1, Colonne: 152 Catégorie : CSS Parser

11:09:51,907: Avertissement : Pseudo-classe ou pseudo-élément « selection » inconnu.  Jeu de règles ignoré suite à un mauvais sélecteur. Fichier source : http://localhost/annonces2/index.php?r=materiel/delete&id=1 Ligne : 1, Colonne: 370 Catégorie : CSS Parser

11:09:51,921: Avertissement : Propriété « user-select » inconnue.  Déclaration abandonnée. Fichier source : http://localhost/annonces2/index.php?r=materiel/delete&id=1 Ligne : 1, Colonne: 2636 Catégorie : CSS Parser

11:09:51,942: Avertissement : Erreur d'analyse de la valeur pour « font ».  Déclaration abandonnée. Fichier source : http://localhost/annonces2/index.php?r=materiel/delete&id=1 Ligne : 1, Colonne: 3249 Catégorie : CSS Parser

11:09:51,975: Réseau : GET http://l.apture.com/v3/?1=%7B%22isTMMEnabled%22%3A1%2C%22fullBarEnabled%22%3Atrue%2C%22numLinks%22%3A0%2C%22numTmmLinks%22%3A0%2C%22socialLinkCount%22%3A0%2C%22socialLinkStatus%22%3A207%2C%22abTestLinkCountStyleSide%22%3A%22B%22%2C%22abTestLinkCursorStyleSide%22%3Anull%2C%22type%22%3A1131%2C%22siteId%22%3A-9999%2C%22visitId%22%3A9797832567269%7D&AC=X2jXyr7zHx [HTTP/1.1 200 OK 2270ms]

11:09:52,038: Réseau : GET http://l.apture.com/v3/?2=%7B%22existingVersion%22%3A%2231619250%22%2C%22newVersion%22%3A%2231619250%22%2C%22type%22%3A1128%2C%22siteId%22%3A-9999%2C%22visitId%22%3A9797832567269%7D&AC=X2jXyr7zHx [HTTP/1.1 200 OK 1911ms]

11:09:54,614: Réseau : GET http://l.apture.com/v3/?3=%7B%22stats%22%3A%22%5B2132%2C2374%5D%22%2C%22type%22%3A1125%2C%22siteId%22%3A-9999%2C%22visitId%22%3A9797832567269%7D&AC=X2jXyr7zHx [HTTP/1.1 200 OK 1752ms]




This is my firefx consol after trying to delete

As you can see… your application id doing a GET request instead of POST request…

but the problem is in the first line… "$.fn.yiiGridView is undefined"

Seems that jquery.yiifridview.js is not included or maybe you included jquery for a second time…

As you can see "jquery.yiifridview.js" is included. this is my complet html head of admin page




<!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" xml:lang="en" lang="en">

<head>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

	<meta name="language" content="en" />


	<!-- blueprint CSS framework -->

	<link rel="stylesheet" type="text/css" href="/annonces2/css/screen.css" media="screen, projection" />

	<link rel="stylesheet" type="text/css" href="/annonces2/css/print.css" media="print" />

	<!--[if lt IE 8]>

	<link rel="stylesheet" type="text/css" href="/annonces2/css/ie.css" media="screen, projection" />

	<![endif]-->


	<link rel="stylesheet" type="text/css" href="/annonces2/css/main.css" />

	<link rel="stylesheet" type="text/css" href="/annonces2/css/form.css" />


	<link rel="stylesheet" type="text/css" href="/annonces2/assets/5dfaf88d/gridview/styles.css" />

<link rel="stylesheet" type="text/css" href="/annonces2/assets/a3bda2e0/pager.css" />

<script type="text/javascript" src="/annonces2/assets/a49dd543/jquery.js"></script>

<script type="text/javascript" src="/annonces2/assets/a49dd543/jquery.ba-bbq.js"></script>

<script type="text/javascript" src="/annonces2/assets/5dfaf88d/gridview/jquery.yiigridview.js"></script>

<title>Centre d'Assistance Informatique - CAI - Admin Materiel</title>

</head>






The error is clear… $.fn.yiiGridView is undefined

so somewhere… .somehow… this gets undefined…

one way that this can happen is if jquery is included again…

check the complete page source to see if somewhere else jquery.js or jquery.min.js is included

could be something else… if you use firebug… try with it to find when this function gets undefined…

All my .js files are between <head></head> as seen above…

Maybe you included some widget or some javascript library that includes once again jquery.

It can be wherever, not only in the header. You just added some js library that conflicts, maybe some image gallery

I checked and any other js library or widjet which uses js on the website.