Symbianize Forum

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!

Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok dito

Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

Code po kyo iung hindi mapapasukan ng SQL injection
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

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!!:praise:
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

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!!:praise:


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 :rofl: 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.
 
Last edited:
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

wow... paturo naman ng php.. me tutorial po ba kayo?? .. pa upload naman
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

mga master ano po kaya ung mali ko d2 kasi e2 po ung error nya

pag click ko add item

e2 nalabas

"Notice: Undefined index: price in C:\xampp\htdocs\storeadmin\inventory_list.php on line 33

Notice: Undefined index: details in C:\xampp\htdocs\storeadmin\inventory_list.php on line 36
Table 'jdccomp_database.prodcuts' doesn't exist


e2 ung code ko:

inventorylist.php

<?php

session_start();
if(!isset($_SESSION["manager"])){
header("location:admin_login.php");
exit();
}
//be sure to check this manager SESSION value is in fact in the database
$managerID = preg_replace('#[^0-9]#i','',$_SESSION["id"]); //filter everything but numbers and letters
$manager = preg_replace('#[^A-Za-z0-9]#i','',$_SESSION["manager"]); //filter everything but numbers and letters
$password = preg_replace('#[^A-Za-z0-9]#i','',$_SESSION["password"]); //filter everything but numbers and letters
//Run mySQL query to be sure that this person is an admin and their password session var equals the database information
//connect to mySQL database
include"../storescripts/connect_to_mysql.php";
$sql = mysql_query("SELECT*FROM admin WHERE id='$managerID'AND username='$manager' AND password='$password' LIMIT 1"); //query the person
//.......MAKE SURE PERSON EXISTS IN THE DATABASE............
$existCount = mysql_num_rows($sql); //count the rows nums
if($existCount ==0){//evaluate the count
echo "Your login session data is not on record in the database.";
exit();
}
?>
<?php
//Script Error Reporting
error_reporting(E_ALL);
ini_set('diplay_errors','1');
?>
<?php
//Parse the form data and add inventory item to the system
if(isset($_POST['product_name'])){

$product_name = mysql_real_escape_string($_POST['product_name']);
$price = mysql_real_escape_string($_POST['price']);
$category = mysql_real_escape_string($_POST['category']);
$subcategory = mysql_real_escape_string($_POST['subcategory']);
$details = mysql_real_escape_string($_POST['details']);
//See if that product name is an identical match to another product in the system
$sql = mysql_query("SELECT id FROM products WHERE product_name='$product_name'LIMIT 1");
$productMatch = mysql_num_rows($sql);//count the output amount
if($productMatch > 0){
echo 'Sorry you tried to place a duplicate "Product Name" into the system, <a href="inventory_list.php">click here</a>';
exit();
}
//Add this product into the database now
$sql = mysql_query("INSERT INTO prodcuts (product_name, price, details, category, subcategory, date_added)
VALUES('$product_name','$price','$details','$category','$subcategory', now())")or die(mysql_error());
$pid = mysql_insert_id();
//Place image in Folder
$newname = "$pid.jpg";
move_uploaded_file($_FILES['fileField']['tmp_name'],"../inventory_images/$newname");
header("location:inventory_list.php");
exit();
}
?>
<?php
//this block grabls the whole list for viewing
$product_list="";
$sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC");
$productCount = mysql_num_rows($sql); //count the output amount
if ($productCount > 0){
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$product_name = $row["product_name"];
$date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
$product_list .= "$date_added - $id - $product_name       <a href='#'>edit</a> • <a href='#'>delete</a><br />";
}
} else{
$product_list = "you have no products listed in your store yet";
}

?>


then e2 ung phpmyadmin db ko

http://www.sendspace.com/file/0ccw3j


Maraming salamat po!
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

$sql = mysql_query("INSERT INTO prodcuts (product_name, price, details, category, subcategory, date_added)

nakita ko na mali ko ung products ko sa insert into "prodcuts" nalagay ko wrong spelling pala hahaha.
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

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!!:praise:


I wasn't able to get what you want. Please be concrete sa gusto mo. Ano ang e.insert ano ang e.loloop?


Code po kyo iung hindi mapapasukan ng SQL injection

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.
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

Paturo naman sa HTML nkakagawa gusto ko gwing widget tong Stopwatch sa vb.net2010:noidea::noidea:
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

ayos tong na isip mo ts thanks
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

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 :rofl: 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.

ahhmm.. una po salamat sa pag pansin at pagtulong sa akin, and, itatry ko na po gawin ngaun. na stuck kasi ako jan kaya itinulog ko muna.. nabuhayan po ako~:excited:
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

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.

sorry sir, ah, ang i-insert ko po kasi is, ung inputs ng teacher na grades sa students niya. ang i-lo-loop niya po is kung ilang ung students niyang lalagyan, ay un din po ang ma-i-insert sa db, gnun po sana..
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

san po pweede mag upload ng website na free? gusto ko lang po sana iupload ang site na nagawa ko.
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

Meron po ba kayong php poker script na di kelangan ng flashplayer na magrun sa isang site?sana po matulungan niyo ako.salamat po..multiplayer po sana. . .salamat.
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

san po pweede mag upload ng website na free? gusto ko lang po sana iupload ang site na nagawa ko.

mag-register ka ng free subdomain sa freewebhostingarea.com
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

How to debug php line by line?
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

san po pweede mag upload ng website na free? gusto ko lang po sana iupload ang site na nagawa ko.

eto gamit ko ngayon http://www.000webhost.com/
ok naman sya kasi almost lahat ng phpscript is gumagana.

Un rin kasi dapat tignan mo sa mga hosting site. Kung allowed ung php script / scripts na nasa site mo. Lalo na FREE mahirap mag-hanap ng lahat eh available

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. :thumbsup:


@lastgame2007

Ano po nangyari? Na solve?
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2




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. :thumbsup:


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>";
		
			}
}
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

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>";
		
			}
}
Baka sa query nyo po ung mali.
Baka Isa lang talaga narereturn?

Try mo

$num_rows = mysql_num_rows($uid);

tapos echo mo.

Baka kasi isa lang ung na fifind nung query mo.

Tapos ung dito

LIKE '" . $line . "'")

try mo

LIKE '{$line}' ")

parehas lang yan pero mas readable diba?
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2


Baka kasi isa lang ung na fifind nung query mo.

uu tama ka nga isa lang.. bakit isa lang ehh 3 yung email address na nilalagay ko.. yung echo ng line tama 3 pero yung uid isa lang..

e2 yung code ko..

Code:
<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>";
			}
}			
?>

e2 yung ng output please see attached
80039280.png


http://imageshack.us/photo/my-images/210/80039280.png/
 
Last edited:
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

guys patulong naman sa cashier prog na gawa sa javascript na may sql parang ganito sya.

Item# :
Description:
Price:
Quantity:

Add button/Reset button

List of purchase item:
Description Price Quantity:

Total:
Payment:
Change:

Parang ganito ung structure nya
Pls help wala kasi akong idea.
 
Back
Top Bottom