Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.
All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!
<?php
if(isset($_POST[save]))
{
//student,grade,section,subject
$ids=$_POST['id'];
$grades=$_POST['fg'];
$secs=$_POST['secs'];
$subs=$_POST['subs'];
$yirs=$g_year['acad_id'];
debug($_POST);
if(isset($_POST['save']))
{
unset($_POST['save']);
$i = count($_POST['id']); $x = 0;
for($x=0; $x <$i;$x++){
foreach($_POST as $data =>$d){
echo $data.'-'.$d[$x].'<br/>';
[COLOR="Red"][B]//DITO PO PAPANO PO UNG QUERY KO DITO ?? :noidea:[/B][/COLOR]
[COLOR="Red"][COLOR="Lime"]// OR PAPANO PO ITO -- > sql statement here (example): insert into table name (value ng $data) values( value ng $d[$x]) -- [/COLOR]
[/COLOR] }}}}
?>
<?php
function debug($arr){
echo "<pre>";
print_r($arr);
echo "</pre>";
}
?>
Pa help naman po gumawa ng
SQL QUERY na INSERT tapos EXECUTE sa loob ng LOOP
eto po ung code ,
Code:<?php if(isset($_POST[save])) { //student,grade,section,subject $ids=$_POST['id']; $grades=$_POST['fg']; $secs=$_POST['secs']; $subs=$_POST['subs']; $yirs=$g_year['acad_id']; debug($_POST); if(isset($_POST['save'])) { unset($_POST['save']); $i = count($_POST['id']); $x = 0; for($x=0; $x <$i;$x++){ foreach($_POST as $data =>$d){ echo $data.'-'.$d[$x].'<br/>'; [COLOR="Red"][B]//DITO PO PAPANO PO UNG QUERY KO DITO ?? :noidea:[/B][/COLOR] [COLOR="Red"][COLOR="Lime"]// OR PAPANO PO ITO -- > sql statement here (example): insert into table name (value ng $data) values( value ng $d[$x]) -- [/COLOR] [/COLOR] }}}} ?> <?php function debug($arr){ echo "<pre>"; print_r($arr); echo "</pre>"; } ?>
at ito po ung Pag Na-SUBMIT ko na.. need ko po sana pahelp sa query
pa help naman po. thanks in advance!!
$sql = mysql_query("INSERT INTO prodcuts (product_name, price, details, category, subcategory, date_added)
Pa help naman po gumawa ng
SQL QUERY na INSERT tapos EXECUTE sa loob ng LOOP
eto po ung code ,
at ito po ung Pag Na-SUBMIT ko na.. need ko po sana pahelp sa queryCode:<?php if(isset($_POST[save])) { //student,grade,section,subject $ids=$_POST['id']; $grades=$_POST['fg']; $secs=$_POST['secs']; $subs=$_POST['subs']; $yirs=$g_year['acad_id']; debug($_POST); if(isset($_POST['save'])) { unset($_POST['save']); $i = count($_POST['id']); $x = 0; for($x=0; $x <$i;$x++){ foreach($_POST as $data =>$d){ echo $data.'-'.$d[$x].'<br/>'; [COLOR=Red][B]//DITO PO PAPANO PO UNG QUERY KO DITO ?? :noidea:[/B][/COLOR] [COLOR=Red][COLOR=Lime]// OR PAPANO PO ITO -- > sql statement here (example): insert into table name (value ng $data) values( value ng $d[$x]) -- [/COLOR] [/COLOR] }}}} ?> <?php function debug($arr){ echo "<pre>"; print_r($arr); echo "</pre>"; } ?>
pa help naman po. thanks in advance!!
Code po kyo iung hindi mapapasukan ng SQL injection
ang ginawa mo pala is array inside an array.
Ganito bale.
Gawa ka pa ng isang variable na mag hohold ng numbers ng entries doon sa loob ng array na pinasok mo sa array gets?
Bale
$num_entry = count($_POST[$x]); //Di ko sure kung yan or eto
$num_entry = count($d); // <------ Pero mas tingin ko eto mas tama eto muna try mo
//tapos sa mysql querry mo. Eto gawin mo
//importante ung mga space dito sa querry
$sql = "INSERT INTO {$data} VALUES(";
for($i=0; $i<$num_entry;$i++){
if($i!=$num_entry){
$sql .="$d[$i] , ";
}
else
{
$sql .="$d[$i])";
}
}
$results= mysql_query($sql);
Ayan na.. ang pinaka tag tataka ko is ung sa foreach na loop mo dun sa array BAKIT $_POST lang??? PAANO MO NAPASOK ANG array sa loob ng isang $_POST???
Kung napasok mo man. Kaylangan mo parin sya ipasok sa loob ng isang Variable para magamit mo ung mga index nya at ma count() mo.
I wasn't able to get what you want. Please be concrete sa gusto mo. Ano ang e.insert ano ang e.loloop?
You can use, pg_escape_string (postgres),
mysql_real_escape_string(mysql), addslashes(), htmlentities() at marami pang functions available sa php.
Ang pinakaka.importante is yong algo how you treat at validate yong input mo.
san po pweede mag upload ng website na free? gusto ko lang po sana iupload ang site na nagawa ko.
san po pweede mag upload ng website na free? gusto ko lang po sana iupload ang site na nagawa ko.
How to debug php line by line?
What do you mean? Kasi automatic na naman yan eh. Maglalabas ng error si webserver mo kung saan may error.
Ang mas maganda eh gumamit ka ng text editor na pang php na may TELESENSE or in other words CODE HINTING para sure ka na tama ung syntax mo.
$text = trim($_POST['test']);
//explode all separate lines into an array
$textAr = explode("\n", $text);
//trim all lines contained in the array.
$textAr = array_filter($textAr, "trim");
//loop through the lines
foreach ($textAr as $line)
{
echo "Line " . $line . "<hr>";
$uid = mysql_query("SELECT uid FROM dr_users where mail LIKE '" . $line . "'") or die(mysql_error());
while ($row = mysql_fetch_assoc($uid))
{
echo "UID: " .$row["uid"] . "<br>";
}
}
Baka sa query nyo po ung mali.gusto ko kasi i run yung php file ko line by line.. my problem kasi ako sa website na ginagawa ko parang hindi sya nagloloop yung last lang ang binabasa nya.
Code:$text = trim($_POST['test']); //explode all separate lines into an array $textAr = explode("\n", $text); //trim all lines contained in the array. $textAr = array_filter($textAr, "trim"); //loop through the lines foreach ($textAr as $line) { echo "Line " . $line . "<hr>"; $uid = mysql_query("SELECT uid FROM dr_users where mail LIKE '" . $line . "'") or die(mysql_error()); while ($row = mysql_fetch_assoc($uid)) { echo "UID: " .$row["uid"] . "<br>"; } }
$num_rows = mysql_num_rows($uid);
LIKE '" . $line . "'")
LIKE '{$line}' ")
Baka kasi isa lang ung na fifind nung query mo.
<form action="" method="post">
<textarea name="test" rows="20" cols="50" type ='text'>
</textarea>
<input type="submit" value="Submit" />
</form>
<?php
$text = trim($_POST['test']);
//explode all separate lines into an array
$textAr = explode("\n", $text);
//trim all lines contained in the array.
$textAr = array_filter($textAr, "trim");
//loop through the lines
foreach ($textAr as $line)
{
echo "Line " . $line . "<hr>";
$uid = mysql_query("SELECT uid FROM dr_users where mail LIKE '{$line}' ") or die(mysql_error());
$num_rows = mysql_num_rows($uid);
while ($row = mysql_fetch_assoc($uid))
{
echo $num_rows;
echo "UID: " . $row['uid'] . "<br>";
}
}
?>