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

<B> madami ako tanung sir.hehe
ganito ung lumalabas sa ginawa kung registration form
kapag magcoconnect na siya sa registernext.php kung code ito po oh
"Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in D:\xampp\htdocs\registernext.php on line 14

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in D:\xampp\htdocs\registernext.php on line 14

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\registernext.php on line 15" yan ang error

ito yung code ng registernext.php
"<?php
//include('connection.php');

//test para makita kung ang username ay alphanumeric
$test=$_POST[uname];


if(!eregi(("[^A-Za-z0-9]") , $test)) {
echo "You are Successfully Registered.";


//test for duplicate names
$query="SELECT * FROM user WHERE username='$_POST[uname]'";
$result=mysql_query($query);
$num=mysql_num_rows($result);

if ($num==0) {

}else{
header("Location:duplicatename.html");
}

}else{
header("Location:invalidname.html");
}

?> "

ano po ba problem dun sir?

tsaka ito din yung code ng connection.php ko
"<?php

$host="localhost"; //hostname
$username="precious";//username
$password="cornal"; //database password
$db_name="login_form";//database name

//connect to database
mysql_connect("$host","$username","$password") or die ("cannot connect to server");
mysql_select_db("$db_name") or die ("cannot select DB");

?> "

tapos kapag nagreregister na ako di man napupunta ung information sa database ko na login_form tapos table na user :slap:</B>


ang cause nyan ay hindi magkatugma yung password ng mysql database mo dun sa connectiong string na gamit mo ($password);

$host="localhost"; //hostname
$username="precious";//username
$password="cornal"; //database password
$db_name="login_form";//database name

usually ang gamit na password sa mysql ay "mysql" din, pero para cgurado, reconfig mo yung mysql mo.

>>punta ka sa start>> mysql >> mysql server >> Mysql Server Instance Config Wizzard>>


dapat parehas yung password ng mysql database at sa magiging connection string..
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

my tanung p po ako sir Is it possible to build framesets inside of a table? have been working on it for a bit and it just doesn't show anything. I don't know if HTML doesn't allow you to do this or not. Thanks for any help, at pano po b gawin un? my table ksi akung ginawa tpos sa loob nun madaming pang tables.

mas maganda gamitin <div> or division, CSS yan.. kaysa sa table, kasi pag nag load ng yung website mo, mabagal pag table ang gamit, mas mabilis pag <div>
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

sir kung center mismo ung webpage sa css lang yn sir.

ganito po un usually n ginagawa ko..

html
Code:
<body>

    <div id="container">
           <!--- your code goes here --->
     </div>

</body>

css
Code:
#container {
   width:940px;
   height:1200px;
   position:relative;
   margin:0px auto;
   background:red;  /* eto para lang makita lng ung effect */
}

sna makatulong :)



Code:
<body>
       <table width ="100%">
           <tr>
                <td> </td>
                <td align ="center">
                         <div id ="container">
                                 <!--content goes here-->
                          </div>
                </td> 
               <td> </td>
           </tr>
      </table >
</body>


mas maganda kasi pag nasa table yung div para.. center talaga xa kahit anung size ng monitor..
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

<B> madami ako tanung sir.hehe
ganito ung lumalabas sa ginawa kung registration form
kapag magcoconnect na siya sa registernext.php kung code ito po oh
"Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in D:\xampp\htdocs\registernext.php on line 14

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in D:\xampp\htdocs\registernext.php on line 14

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\registernext.php on line 15" yan ang error

ito yung code ng registernext.php
"<?php
//include('connection.php');

//test para makita kung ang username ay alphanumeric
$test=$_POST[uname];


if(!eregi(("[^A-Za-z0-9]") , $test)) {
echo "You are Successfully Registered.";


//test for duplicate names
$query="SELECT * FROM user WHERE username='$_POST[uname]'";
$result=mysql_query($query);
$num=mysql_num_rows($result);

if ($num==0) {

}else{
header("Location:duplicatename.html");
}

}else{
header("Location:invalidname.html");
}

?> "

ano po ba problem dun sir?

tsaka ito din yung code ng connection.php ko
"<?php

$host="localhost"; //hostname
$username="precious";//username
$password="cornal"; //database password
$db_name="login_form";//database name

//connect to database
mysql_connect("$host","$username","$password") or die ("cannot connect to server");
mysql_select_db("$db_name") or die ("cannot select DB");

?> "

tapos kapag nagreregister na ako di man napupunta ung information sa database ko na login_form tapos table na user :slap:</B>


mas maganda, pag ginamitan mo ng jquery, para di na kailangan mag load yung page during validation and registration of form.
Gamit ka ng ob (object buffer) para smooth ang lahat ng output ng page. extract mo yung mga file na naka rar, kasama sila..ask ka lang.. ha.


index.php
------------------------
Code:
<?php 
  ob_start();
  session_start();
  require_once("connection.php");
  include_once("header.php"); //nandito lahat ng header links mo 
?>
</head>
 <body>
   <?php
        include("registration_form.php"); //ito naman yung    registration form mo 
   ?>
</body>
</html>
<?php
  ob_end_flush();
?>



registration_form.php
------------------------------------------
Code:
<div>
  <form name ="registration" id="registration" method="post" action="">
    Full Name <br />
    <input type ="text" name="fullname" id="fullname" /><br />
    Username <br />
    <input type ="text" name="username" id="username" /><br />
    Password <br />
	<input type ="text" name="password" id="password" /><br />	
    Confirm Password <br />   	
	<input type ="text" name="cpassword" id="cpassword" /><br />
	<br />
	<input type="button" name="sbmbtn" id="sbmbtn" value ="Submit Registration" />
  </form>  
</div>
<!--eto ung mag vavalidate ng mga information mo, using jquery, 
para di na kailangan mag load yung site-->

<script type ="text" javascript">
 $(document).ready( function(){
	var name = document.getElementById("fullname"); //user fullname galing dun sa form
	var username = document.getElementById("username"); //user username
	var password = document.getElementById("password"); //user password
	var cpass = document.getElementById("cpassword"); //confirm password
	$("#sbmbtn").click( function(){ //pag click ng user ng submit button 
	  if((name.value="") || (username=="") || (password=="") || (cpassword==""))
	  {
	    alert("Registration Failed, Please try again");
	  }else{
	    if((password.value != cpassword.value))
		{
		  alert("Password and confirm password did not match!");
		}else{
		   $.ajax({
		     method: "POST",
			 url: "process_registration.php";
			 data: $("#registration").serialize(), //ito yung id ng registration_form 			 
			 success: function(msg){
			      alert(msg); //ito yung output ng registration, lahat ng echo dun sa process_registation dito ang output, if failed or success yung registration
			 }
		   }):
		}
	  }
	}
 });
</script>


process_registration.php
--------------------------------------------------
Code:
<?php 
require("connection.php");
global $server_connect // ito yung variable na ginamit mo dun sa mysql_connect, global xa, para kahit saan pwede xang tawagin

$fullname = $_POST['fullname'];
$username = $_POST[username];
$password = $_POST['password'];
$encrypt_password = md5($password); //dapat nka encrypt lahat ng password dun sa database md5 maganda gamitin

//protect mysql injection 
//to avoid any unnecessary character na ma store dun sa database

$clean_name = stripslashes($fullname);
$clean_username = stripslashes($username);
$clean_name = mysql_real_escape_string($fullname);
$clean_username = mysql_real_escape_string($username);

//dito yung validation of infortion na i sesend dun sa ajax na ginamit mu dun sa registration form


//first check if the username already exists in the database
$check_user = "SELECT * FROM tablename WHERE USERNAME ='$username' LIMIT 1";
$result = mysql_query($check_user, $server_connect);
$count = mysql_num_rows($result);
if($count==1) //kpag ang username na ginamit nya ang nakaregister na 
{
  echo "username already taken, Please provide another";
}else{
  if(!eregi(("[^A-Za-z0-9]") , $username)) 
  {
	echo "username must contain alphanumeric character";
  }else{
     //kapag ok na lahat ng information pwede nang i store yung data sa database
	 $adduser = mysql_query("INSERT INTO tablename(field1, field2, field3) VALUES('$clean_name','$clean_username','$encrypt_password')")
	 if(!adduser){
	   echo"An error has occured".mysql_error():
	 }else{
		echo "congratulations, you have been successfully registered";		
	 }
  }
}
?>
 

Attachments

  • jquery.rar
    25.6 KB · Views: 330
  • header.rar
    361 bytes · Views: 303
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

Code:
<body>
       <table width ="100%">
           <tr>
                <td> </td>
                <td align ="center">
                         <div id ="container">
                                 <!--content goes here-->
                          </div>
                </td> 
               <td> </td>
           </tr>
      </table >
</body>


mas maganda kasi pag nasa table yung div para.. center talaga xa kahit anung size ng monitor..

pareho rin yn sir magce2nter din yn s monitor, pg table kasi hindi pa2sok sa validation ng web standards ng w3c.. :)

pero kanya2ng preference lang ng devs yn.. hehe..

ang cause nyan ay hindi magkatugma yung password ng mysql database mo dun sa connectiong string na gamit mo ($password);

$host="localhost"; //hostname
$username="precious";//username
$password="cornal"; //database password
$db_name="login_form";//database name

usually ang gamit na password sa mysql ay "mysql" din, pero para cgurado, reconfig mo yung mysql mo.

>>punta ka sa start>> mysql >> mysql server >> Mysql Server Instance Config Wizzard>>


dapat parehas yung password ng mysql database at sa magiging connection string..

sir naka host n b ung ginagawa mo or naka WAMP/XAMPP k.

kasi pg hosted n xa, kailangan mong iconfigure ung database mo dun s hosting server mo, dun mo n rin ku2nin ung username and password mo.

pero kung naka WAMP/XAMPP k, ang default is

username="root";
password="";

unless po n naiconfigure nio ung WAMP/XAMPP mo para magkaroon ng password. :)
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

dapat naka quote pala yun: :lol: sorry for that..


for localhost only
---------------
config.php
---------------
Code:
<?php 

   define("SERVER_PROVIDER", "localhost");
   define("SERVER_USERNAME", "root");
   define("SERVER_PASSWORD", "mysql");  //dapat same itong password na to dun sa pag configure mo sa mysql configuration wizzard
   define("SERVER_DATABASE", "database name");

   $sever_connect = mysql_connect (SERVER_PROVIDER, SERVER_USERNAME, SERVER_PASSWORD) or die ("Unable to connect with the server due to ".mysql_error());
   
   mysql_select_db(SERVER_DATABASE, $server_connect) or die ("Cant select database, Error: ".mysql_error());

   global $server_connect;

?>
 
Last edited:
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

pareho rin yn sir magce2nter din yn s monitor, pg table kasi hindi pa2sok sa validation ng web standards ng w3c.. :)

pero kanya2ng preference lang ng devs yn.. hehe..



sir naka host n b ung ginagawa mo or naka WAMP/XAMPP k.

kasi pg hosted n xa, kailangan mong iconfigure ung database mo dun s hosting server mo, dun mo n rin ku2nin ung username and password mo.

pero kung naka WAMP/XAMPP k, ang default is

username="root";
password="";

unless po n naiconfigure nio ung WAMP/XAMPP mo para magkaroon ng password. :)

tama.. maraming reference..din, dpende na kung pano mo gagamitin.. thnx sa pag share ng idea mo d2 sir.. :salute:
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

Sir pa tambay d2

para sa mga assignment ko
i hope na marami kaung m22lungan
:salute:

cge lang.. free to ask.. we are here to help.. hanggat alam namin i shashare namin..
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

ang cause nyan ay hindi magkatugma yung password ng mysql database mo dun sa connectiong string na gamit mo ($password);

$host="localhost"; //hostname
$username="precious";//username
$password="cornal"; //database password
$db_name="login_form";//database name

usually ang gamit na password sa mysql ay "mysql" din, pero para cgurado, reconfig mo yung mysql mo.

>>punta ka sa start>> mysql >> mysql server >> Mysql Server Instance Config Wizzard>>


dapat parehas yung password ng mysql database at sa magiging connection string..
sge po sir try ko to maya..

pero gumawa n ako ng password sa database eh ito oh

"cannot select DB"

gumawa n ako ng database s phpmyadmin which is login_form --> at my mga table na temp at user--> it is composed of i.d,username,password and email.

sa button na PRIVILEGES--> gumawa ako ng new user
user = precious
host = localhost
password = yes --> password ko ay cornal
Global privileges - USAGE
Grant = No


ook n po yung iosang error ko about sa localhost ,tpos ito naman yung lumabas na error
ito code ng connection.php ko
<?php

$host="localhost"; //hostname
$username="precious";//username
$password="cornal"; //database password
$db_name="login_form";//database name

//connect to database
mysql_connect("$host","$username","$password") or die ("cannot connect to server");
mysql_select_db("$db_name")or die("cannot select DB");

?>
my ginawa n po kasi akung isang username dun sa login_form n database ko at my table n user, pero pag tinatype ko s register.php yung username which is "pclogger" cannot select DB lagi ,ganun din nangyayari kapag ibang username din ininput ko :(
 
Last edited:
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

try mo tong connection string:
lagyan mo ng variable the mag hohold sa connection mo. $server_connect.

Code:
$server_connect = mysql_connect('$host','$username','$password') or die ("Can't connect to server"); 

mysql_select_db("db_name", $server_connect) or die ("cant select database");
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

sge po sir :salute: thankyou try ko mya dito p ksi ako comshop la net s bhay
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

ok cge... :)
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

ayan.. may thread na dito.. tulong ako sa pagsagot kung sakaling di makaonline yung mga sir dito.. for immediate answer sa mga katanungan about php, mysql, jquery, css3, html, ajax, xml.. chat me lang sa facebook.. vrynxzent
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

MGA IDOL BAKA NAMAN GUSTO NYONG GUMAWA NG TUT.. on how to make an online system kahit simple lang..geh willing to learn po ko hehe... sa mysql mejo alam ko na parehas lang naman kasi halos ng MSsql... geh na :D thanks po
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

MGA IDOL BAKA NAMAN GUSTO NYONG GUMAWA NG TUT.. on how to make an online system kahit simple lang..geh willing to learn po ko hehe... sa mysql mejo alam ko na parehas lang naman kasi halos ng MSsql... geh na thanks po
ako din :happy:
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

Code:
<?php

 $test=$_POST[[COLOR="Red"]uname[/COLOR]];

 if(!eregi(("[^A-Za-z0-9]") , $test)) { 
 echo "You are Successfully Registered.";

 $query="SELECT * FROM user WHERE username='[COLOR="red"]$_POST[uname][/COLOR]'";
 $result=mysql_query($query);
 $num=mysql_num_rows($result);

if ($num==0) {

 }else{
         header("Location:duplicatename.html");
}

}else{
         header("Location:invalidname.html"); 
}

?>

Sa first error mo, Hindi concatenated yung Value ng Input box mo. You should have written it to, "$_POST['uname'];"

Whilst on the second error that executes to check duplicate detail is also not properly coded. Hindi po kasi properly contatenated yung, " '$_POST['uname']' " mo.
Dapat ganito sya, " ' . $_POST['uname'] . ' ".

Pero, hindi sya recomended dahil nga, Value na sya ng variable $test. Therefore, Ganito dapat yung value ng username sa database table mo, " username = '$test' ".

Kaya hindi makuha ng PHP yung details or Parameter dahil may error sya sa line na yan. Kindly re-write your codes to what I had written. Oh wait, para hindi magulo. :D

Code:
$test = $_POST['uname'];

$query = mysql_query("SELECT * FROm user WHERE username = '$test'");
$num = mysql_num_rows($query);


SymbianHyu, wag kana mag-taka kung sino ako after mo mabasa 'to.

Cleo is my Meri Lewa. :)

WAG KA MAINGAY. :D


Modification:

One more thing, Your condition below isn't correct.

Code:
"if ($num==0) {

}[COLOR="red"]else[/COLOR]{
header("Location:duplicatename.html");
[COLOR="Red"]}[/COLOR]

}else{
header("Location:invalidname.html"); 
}"

Double Bracket po ata. (:

Tsaka, asan na yung logic dito? Bakit ka po nag else kahit na wala pa ang first statement mo? Then, Bakit po sya Double else?

Pinapakita ko lang po yung mga mali mo. I'm not being Arrogant here. (:

Then again, dapat ganito po sya:

Code:
if ( $num == 0 ) {

   header ('Location: duplicatename.html"); 

} else {

   header ('Location: invalidname.html");
}

HTML Doc. :D
 
Last edited:
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

@vrynxzent: bro.

@Dark_Getsu: WTH!, ano nangyari sa isang acc mo? :D

@pclogger: and i think its a best practice to change ur .html to .php extension, since u might wanna insert some php codes. :)
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

@pclogger: and i think its a best practice to change ur .html to .php extension, since u might wanna insert some php codes.
test lng po yan sir :) papalitan ko nalang pag ok n yung webpages
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

@pclogger: and i think its a best practice to change ur .html to .php extension, since u might wanna insert some php codes.
test lng po yan sir :) papalitan ko nalang pag ok n yung webpages
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

@pclogger try mung mag .html mas madali un
 
Back
Top Bottom