Jump to content
php.lv forumi

Recommended Posts

Posted

No savas puses ieteikšu aši, kamēr neviens vēl nav tavu forumu nonesis, skriet mācīties par to, kā nodrošināt lietotāja nodotos parametrus, pirms viņus bāzt iekšā sql pieprasījumā.

Posted
mysql_query("DELETE * FROM vestules WHERE id = '$vest_id'") or die(mysql_error());

echo "DELETE * FROM vestules WHERE id = '$vest_id'";

}

shadi ir gruti ,un brizjam pilnigi bezjedziigi debuugot..

jo tu 2 reizes Duble to Kveriju...

Ja 1 ielaidiisi Sintakses kljuudu , tad buus gruti to atrast....

---

$sql="SELECT * blaa...";

echo $sql;

mysql_query($sql);

---

Shadi buusi 100% parliecinats ka tas ir tas pats kas tiek padots DB ...

Posted

Vēl saistīts ar šo skriptu, gribu izveidot check all f-ju, un mēģinu ar javascript, bet kaut kas nesanāk..

 

<script LANGUAGE="JavaScript">
function checkAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = true;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = false;
}
</script>

 

<input type='checkbox' value='".$sanemtaas['0']."' name='id[]'/>

 

 

<input type=\"button\" name=\"Check All\" value=\"Ieķeksēt visu\" onClick=\"checkAll(document.vestules_visas.id[])\">
<input type=\"button\" name=\"UnCheckAll\" value=\"Atķeksēt visas\"
onClick=\"uncheckAll(document.myform.list)\">

 

Kas tur ir nepareizs?

Posted (edited)

Caur validatoru saka, ka there is no attribute "LANGUAGE".

 

 

 

 

document.myform has no properties

onclick(click clientX=0, clientY=0)vestules (line 1)

[break on this error]

vestules (line 1)

syntax error

Edited by anonīms
Posted (edited)

language="javascript" => type="text/javascript"

 

<script type="text/javascript">
function select(a) {
var theForm = document.myForm;
for (i=0; i<theForm.elements.length; i++) {
	if (theForm.elements[i].name=='mycheckbox[]')
		theForm.elements[i].checked = a;
}
}
</script>

<form name="myForm">
<input type="checkbox" name="mycheckbox[]" value="somevalue1" /><br/>
<input type="checkbox" name="mycheckbox[]" value="somevalue2" /><br/>
<input type="checkbox" name="mycheckbox[]" value="somevalue3" />
</form>

<a href="java script:select(1)">Check all</a> | <a href="java script:select(0)">Uncheck all</a>

Edited by Val
Posted

Val

theForm has no properties

select(1)vestules (line 21)

[break on this error] for (i=0; i<theForm.elements.length; i++) {

Posted (edited)

<script type="text/javascript">
function select(a) {
var theForm = document.myForm;
for (i=0; i<theForm.elements.length; i++) {
	if (theForm.elements[i].name=='id[]')
		theForm.elements[i].checked = a;
}
}
</script>

 

<input type='checkbox' value='".$sanemtaas['0']."' name='id[]'/>

 

<form method=\"POST\" name=\"theForm\">
..............
<a href=\"java script:select(1)\">Ieķeksēt visas</a> | <a href=\"java script:select(0)\">Izķeksēt visas</a>
...................

Edited by anonīms
Posted

tu pat formas nosaukumu nevari samainīt... un kāpēc eskeipo pēdiņas formā? visu to kluci laid caur php?

Posted

Vēl nedaudz pie šī skripta

 

 

foreach($_POST["id"] as $vest_id) 
{
mysql_query("DELETE FROM vestules WHERE id = '$vest_id'");
}

 

<input type='submit' value='Dzēst atzīmētās vēstules' />

 

Kā input pogu varētu pārveidot par parastu linku?

×
×
  • Create New...