1. Welcome to PHCorner Forums. Take a moment to Sign up and gain unlimited access and extra privileges that guests are not entitled to, such as:

    All that and more! Registration is quick, simple and absolutely free. Join our community today!

Help Patulong nmn po mga phc!!! :(

Discussion in 'Coding, Programming' started by lambutan, Aug 15, 2016.

  1. lambutan

    lambutan Enthusiast Established

    Patulong nmn po medyo nalilito na ako kung ano ang mali at ano ang kulang ko sa ginawa go websites Project po namin to sa Programming Midterm Exam po Patulong nmn po kung paano 2 mafifix..............
     

    Attached Files:

    You must or Register to view Attachment.
  2. henjie

    henjie Forum Expert Established

  3. depreciated na yung mysql na gingamit mo

    chatroom ba pati gngawa mo?
     
  4. lambutan

    lambutan Enthusiast Established

    Opo para sa mga Classmates namin Gagawa panga kami nga Ui sir ehh



    Sir ano ung depreciated
     
  5. hindi na gnagmit ung mysql. gumamit ka ng PDO o plitan mo lhat ng gawin mong mysqli ang query mo
     
    lambutan likes this.
  6. jokerger25

    jokerger25 Enthusiast Established

    Hello lambutanlambutan

    Hindi talaga yan ma aaccess kasi wrong yung host,username,password, or database mo.
    ...pakitingnan ang tamang mysql host,username,password, or database mo sa hostinger cpanel kasi iba yung gumawa ka sa local at sa web host may inaadd sila para maging unique yung database mo..at wag ka ng gumamit n mysql sa php gamitin mo ang mysqli. Yun lang po..
     
    lambutan likes this.
  7. lambutan

    lambutan Enthusiast Established

    so sir lht un papalitan ko ng mysqli lht ng mysql
     
  8. jokerger25

    jokerger25 Enthusiast Established

    Opo, di ka mahihirapan kasi halos magkapareha lang sila mysql at mysqli pro ang mysql ay old na extension, its better to use mysqli
     
    Last edited: Aug 17, 2016
  9. lambutan

    lambutan Enthusiast Established



    Sir napalitan ko na kaso ganun padin ehh nag kakaeror nmn sa mysqli_num_rows
     
  10. jokerger25

    jokerger25 Enthusiast Established

    Example establish ka ng connection
    $connect=mysqli_connect($host,$username,$password,$database);
    Note:ang parameters ay variable it means na initialize na ang variable.
    Tapos query ka na po
    $query=mysqli_query($connect,"Select * from table");
    Tapos fetch mo yung number of rows
    $count=mysqli_num_rows($query);

    Note:Example lang po ito may mga part of code na di na eexist
     
  11. lambutan

    lambutan Enthusiast Established

    ano ung ilalagay dun sa select from table
     
  12. jokerger25

    jokerger25 Enthusiast Established

    Query po yan...kahit anong query against database mo po...

    Example nag exist ang user na table sa database mo

    query sample:
    SELECT * FROM user
     
  13. lambutan

    lambutan Enthusiast Established

    Sirrr Ok na po kaso may bagong error nman po ETO po
     
  14. lambutan

    lambutan Enthusiast Established

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/u641301104/public_html/ch-ro-pr/submit.php on line 18



    ETO PO UNG CODE















    <?php
    require('includes/config.php');

    $dbactive = $row['active'];
    $user = $_POST['user'];
    $enroll = $_POST['enroll'];
    $pass = $_POST['pass'];
    $re_pass = $_POST['re-pass'];

    if($user=="" || $pass=="" || $re_pass == "" || $enroll == "" )
    header('location:reg.php?err=0');
    // echo $user." ".$pass." ".$re_pass
    else
    if($pass!=$re_pass)
    header('location:reg.php?err=1');
    else {
    $sql = "SELECT null FROM stud_data WHERE usr_name='".$user."' OR usr_roll='".$enroll."'";
    $result=mysql_query($sql);
    if ($result==false)
    {
    die(mysql_error());
    }
    $count = mysql_num_rows($result);
    if($count>0)
    header('location:reg.php?err=2');
    else {
    $pass = md5("5".$pass."@");
    $sql = "INSERT INTO stud_data (usr_name,usr_roll,usr_pass) VALUES('".$user."','".$enroll."','".$pass."')";
    mysql_query($sql);
    echo "Registered Successfully, <a href='index.php'>Login</a>";
    }
    }
    ?>

     
  15. jokerger25

    jokerger25 Enthusiast Established

    Yan bang na require mo po yan ba ang connection mo po? mysqli ba gamit mo po dyan o mysql po?
     
    Last edited: Aug 17, 2016
  16. may mail sa connection rin at sa version ng PHP c-ni-SET payon
     
  17. mali yung connection mo please double check. Wag kanang mag gamit ng mysql, use PDO or simpling mysqli.

    check link below :
    Please or Register to view links
    Please or Register to view links
     
Tags / Keywords: