err php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bartosz Wegrzyn

    err php

    HI THERE

    I have created a form that I use to fill with the customer and workorder
    information. Depends on what button I press I can add delete change or
    print the customer information. My script is called process.php

    Then depends on the action scripts call another php script.

    Then it checks if customer exist ot not. If exist it goes to another form
    and fills in the customer information. If there is no such a customer it
    goes back
    to the main form.

    My problems is that when is goes back to original form it displays this
    error:

    Warning: extract() expects first argument to be an array in
    /var/www/html/login/checkdata.php on line 17

    Also, do you know how to delete cached information releted to forms.
    Sometimes it is showing up and even the reset button cannot delet it.

    Those are my two scripts process.php and checkdata.php


    PROCESS SCRIPT


    <table width="100%" border="0" cellspacing="0" cellpadding="0" >
    <tr>
    <td>
    <?php

    $host = "localhost" ;
    $login_name = "root";
    $password = "xxx";

    //Connecting to MYSQL
    MySQL_connect(" $host","$login_ name","$passwor d");

    //Select the database we want to use
    MySQL_select_db ("lexon") or die("Could not select database");

    //Assign contents of form to variables
    //Customer Data
    $name = $_POST['name'];
    $address = $_POST['address'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $zipcode = $_POST['zipcode'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $ss = $_POST['ss'];
    $cc = $_POST['cc'];
    $exp = $_POST['exp'];
    $notes = $_POST['notes'];
    $customerid = $_POST['customerid'];

    //Wordorder Data
    $date = $_POST['date'];
    $time = $_POST['time'];
    $service = $_POST['service'];
    $due = $_POST['due'];
    $special = $_POST['special'];
    $extrawork = $_POST['extrawork'];
    $due2= $_POST['due2'];
    $company= $_POST['company'];
    $installer= $_POST['installer'];
    $total = $due + $due2;

    $select = $_POST['select'] ;

    if ($select == 'check') {
    //function to get data from database
    include '../login/checkdata.php';
    }


    if ($select == 'save') {
    //function to save data into database
    include '../login/save.php';
    }

    if ($select == 'addcustomer') {
    //function to save customer data into database
    include '../login/addcustomer.php ';
    }

    if ($select == 'save-print') {
    //function to save customer data into database
    include '../login/save-print.php';
    }

    if ($select == 'addworkorder') {
    //function to save customer data into database
    include '../login/add-workorder.php';
    }



    //Close connection with MySQL
    MySQL_close()
    ?>
    </td>
    </tr>
    </table>



    CHECK DATA

    <?php


    $getdata = "select * from addressindex where name = '$name'";
    $result = mysql_query($ge tdata);

    //Code to check if statement executed properly and display message

    if ($result) {

    //put the row into array

    $array = mysql_fetch_ass oc($result);

    //extract the field names

    $getdata=extrac t($array) ;

    if ($getdata) {

    include '../login/existcustomer.p hp';

    }

    else {

    include '../login/newcustomer.php ';

    }



    }

    else {

    include '../login/error-broken.php';

    }



    ?>





  • Randell D.

    #2
    Re: err php



    "Bartosz Wegrzyn" <blwegrzyn@lexo n.ws> wrote in message
    news:dzTYa.2729 $Ih1.1037605@ne wssrv26.news.pr odigy.com...[color=blue]
    > HI THERE
    >
    > I have created a form that I use to fill with the customer and workorder
    > information. Depends on what button I press I can add delete change or
    > print the customer information. My script is called process.php
    >
    > Then depends on the action scripts call another php script.
    >
    > Then it checks if customer exist ot not. If exist it goes to another form
    > and fills in the customer information. If there is no such a customer it
    > goes back
    > to the main form.
    >
    > My problems is that when is goes back to original form it displays this
    > error:
    >
    > Warning: extract() expects first argument to be an array in
    > /var/www/html/login/checkdata.php on line 17
    >
    > Also, do you know how to delete cached information releted to forms.
    > Sometimes it is showing up and even the reset button cannot delet it.
    >
    > Those are my two scripts process.php and checkdata.php
    >
    >
    > PROCESS SCRIPT
    >
    >
    > <table width="100%" border="0" cellspacing="0" cellpadding="0" >
    > <tr>
    > <td>
    > <?php
    >
    > $host = "localhost" ;
    > $login_name = "root";
    > $password = "xxx";
    >
    > //Connecting to MYSQL
    > MySQL_connect(" $host","$login_ name","$passwor d");
    >
    > //Select the database we want to use
    > MySQL_select_db ("lexon") or die("Could not select database");
    >
    > //Assign contents of form to variables
    > //Customer Data
    > $name = $_POST['name'];
    > $address = $_POST['address'];
    > $city = $_POST['city'];
    > $state = $_POST['state'];
    > $zipcode = $_POST['zipcode'];
    > $email = $_POST['email'];
    > $phone = $_POST['phone'];
    > $ss = $_POST['ss'];
    > $cc = $_POST['cc'];
    > $exp = $_POST['exp'];
    > $notes = $_POST['notes'];
    > $customerid = $_POST['customerid'];
    >
    > //Wordorder Data
    > $date = $_POST['date'];
    > $time = $_POST['time'];
    > $service = $_POST['service'];
    > $due = $_POST['due'];
    > $special = $_POST['special'];
    > $extrawork = $_POST['extrawork'];
    > $due2= $_POST['due2'];
    > $company= $_POST['company'];
    > $installer= $_POST['installer'];
    > $total = $due + $due2;
    >
    > $select = $_POST['select'] ;
    >
    > if ($select == 'check') {
    > //function to get data from database
    > include '../login/checkdata.php';
    > }
    >
    >
    > if ($select == 'save') {
    > //function to save data into database
    > include '../login/save.php';
    > }
    >
    > if ($select == 'addcustomer') {
    > //function to save customer data into database
    > include '../login/addcustomer.php ';
    > }
    >
    > if ($select == 'save-print') {
    > //function to save customer data into database
    > include '../login/save-print.php';
    > }
    >
    > if ($select == 'addworkorder') {
    > //function to save customer data into database
    > include '../login/add-workorder.php';
    > }
    >
    >
    >
    > //Close connection with MySQL
    > MySQL_close()
    > ?>
    > </td>
    > </tr>
    > </table>
    >
    >
    >
    > CHECK DATA
    >
    > <?php
    >
    >
    > $getdata = "select * from addressindex where name = '$name'";
    > $result = mysql_query($ge tdata);
    >
    > //Code to check if statement executed properly and display message
    >
    > if ($result) {
    >
    > //put the row into array
    >
    > $array = mysql_fetch_ass oc($result);
    >
    > //extract the field names
    >
    > $getdata=extrac t($array) ;
    >
    > if ($getdata) {
    >
    > include '../login/existcustomer.p hp';
    >
    > }
    >
    > else {
    >
    > include '../login/newcustomer.php ';
    >
    > }
    >
    >
    >
    > }
    >
    > else {
    >
    > include '../login/error-broken.php';
    >
    > }
    >
    >
    >
    > ?>
    >[/color]


    In your checkdata.php function/script - change the if($result) to
    if(isset($resul t)) - it sounds like your conditional statement is always
    proving true hence the request to extract is always being performed...



    Comment

    Working...