Jump to content

MaaSTaaR

Members
  • Posts

    26
  • Joined

  • Last visited

Posts posted by MaaSTaaR

  1. You can use empty() to check if $item1 and $item2 are empty as the following :

     

    $query = "select stores,item1,item2 from wp_dbt_nonnis_distro_data where state = '$_GET[state]' order by stores asc";
    $result = mysql_query($query,$conn);
    while ($row = mysql_fetch_array($result)){
       $stores = $row['stores'];
       $item1= $row['item1'];
       $item2= $row['item2'];
    
       if ( !empty( $item1 ) )
           $new1 = str_replace(',', '</li><li>', $item1);
       else
           $new1 = 'Not Available';
    
       if ( !empty( $item2 ) )
           $new2 = str_replace(',', '</li><li>', $item2);
       else
           $new2 = 'Not Available';
    
       echo <<<END
       <div class="stores">
       <h2>Store Name: $stores</h2>
       <h3>Brands Carried:</h3>
       <div class="items">
       <p>Item1</p>
       <ul><li>$new1</li></ul>
       </div>
       <div class="items">
       <p>Item2</p>
       <ul><li>$new2</li></ul>
       </div>
       </div>
       END;
    }

  2. In these lines :

     

    $sql = "UPDATE orders SET sent_order_confirm = 'yes' WHERE order_num = $order_num";
    $result=mysql_query($sql);

     

    Change the variable name "$result" to anything else.

     

    Example :

     

     

    $sql = "UPDATE orders SET sent_order_confirm = 'yes' WHERE order_num = $order_num";
    $update=mysql_query($sql);

  3. Hmmm , i think you need to hacking PHP code to do something like that , becuase it's a statement and not function .

    you can do it with PHP by compile it , i mean write function open the php source file and search the "loop" statement in the php source file , if find the statement replace it by real loop statement like "while" or "for" , i mean do something like templates engine (for example Smarty) .
  4. i don't know if i understand you correctly , but as i understand you want to unactive some accounts when their users aren't in the company .

    If i right , i think you have dual solution , the first solution is unactive these accounts after X clock , i mean in the login script you can check server time , if the server time is 3 PM or high stop the log in , otherwise if the time is between 8 AM to 2 PM login without any problem .

    the second solution you can do it if you have Unix server by Corn jobs .
  5. try this :)

    [code=php:0]
    <?php

    $string = '<td width="50%" class="playerbio">
                        <b>Height/Weight: </b> 6-6/229<br>
                        <b>Birthdate: </b> 04/22/1983<br>
                        <b>Birthplace: </b> Fort Smith, AR, USA<br>
                       
                      </td>

                      <td width="50%" class="playerbio">
                        <b>Team: </b> Jacksonville Jaguars<br>
                        <b>College: </b> Arkansas<br>';
                       
    $search = "~</b>\s*(.*?)\s*<br>~ise";
    $replace = "replace('\\1')";

    $do_search = preg_replace($search,$replace,$string);

    function replace($text)
    {
    echo $text . '<br />';
    }

    ?>
    [/code]

    try this page : http://gnosis.cx/publish/programming/regular_expressions.html it's great :)
  6. Hello ...

    great it's work fine now thanks :) , i have another question please .

    in the article (http://www.zend.com/php/internals/extension-writing1.php) the writer said "After running each of these commands, you should have a hello.so file in ext/hello/modules/" , The problem is i don't have hello.so i have hello.o only , so how i can generating the hello.so to use it as php extension ?
  7. Hello ...

    sorry for my bad English .

    My os is Ubuntu Linux and i have Bison 2.3 , Flex 2.5.31 , GCC 4.0.3 .

    i don't have any problem with compile php , but my problem exactly is i get this problem from config.m4 file :

    maastaar@MaaSTaaR:~/php-4.4.4/ext/hello$ ./config.m4
    ./config.m4: line 1: syntax error near unexpected token `hello,'
    ./config.m4: line 1: `PHP_ARG_ENABLE(hello, whether to enable Hello World support,'


    config.m4 :
    PHP_ARG_ENABLE(hello, whether to enable Hello World support,
    [ --enable-hello  Enable Hello World support])

    if test "$PHP_HELLO" = "yes"; then
      AC_DEFINE(HAVE_HELLO, 1, [Whether you have Hello World])
      PHP_NEW_EXTENSION(hello, hello.c, $ext_shared)
    fi


    hello.c :
    #ifdef HAVE_CONFIG_H
    #include "config.h"
    #endif

    #include "php.h"
    #include "php_hello.h"

    static function_entry hello_functions[] = {
        PHP_FE(hello_world, NULL)
        {NULL, NULL, NULL}
    };

    zend_module_entry hello_module_entry = {
    #if ZEND_MODULE_API_NO >= 20010901
        STANDARD_MODULE_HEADER,
    #endif
        PHP_HELLO_WORLD_EXTNAME,
        hello_functions,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
    #if ZEND_MODULE_API_NO >= 20010901
        PHP_HELLO_WORLD_VERSION,
    #endif
        STANDARD_MODULE_PROPERTIES
    };

    #ifdef COMPILE_DL_HELLO
    ZEND_GET_MODULE(hello)
    #endif

    PHP_FUNCTION(hello_world)
    {
        char *str;

        str = estrdup("Hello World");
        RETURN_STRING(str, 0);
    }


    php_hello.h :
    #ifndef PHP_HELLO_H
    #define PHP_HELLO_H 1

    #define PHP_HELLO_WORLD_VERSION "1.0"
    #define PHP_HELLO_WORLD_EXTNAME "hello"

    PHP_FUNCTION(hello_world);

    extern zend_module_entry hello_module_entry;
    #define phpext_hello_ptr &hello_module_entry

    #endif


    what is the problem , and how i can solve it ?
  8. if you want the emails store in the variable like 'em@em1.com,em@em2.com' try this :

    [code]
    $query = mysql_query('SELECT * FROM table');

    $mails = '';

    while ($r = mysql_fetch_array($query))
    {
        $mails .= $r['Email'] . ',';
    }
    [/code]
  9. if you want to make an array values the emails you should do something like this :

    [code=php:0]
    <?php

    $emails = array();

    $query = mysql_query('SELECT * FROM table');

    while ($r = mysql_fetch_array($query))
    {
        $emails[] = $r;
    }

    ?>
    [/code]

    then you will have $emails array which store all email , now try to print one of these emails :

    [code=php:0]
    <?php

    echo $emails[0]['Email']

    ?>
    [/code]

    so use "for" or "while" loop :)
  10. When you make form in (X)HTML like this :

    [code]
    <form metod="post" action="page.php">
    <input name="b" type="text" />
    </form>
    [/code]

    note the method in form tag :) it's post , so any "input" in this form will save in $_POST array .

    try :
    [code]print_r($_POST);[/code]

    in page.php :)
  11. Ok , try "LIKE" as alternative for "="

    [code=php:0]$query="SELECT * FROM Assembly WHERE PARTNUMBER='$search'";[/code]

    to

    [code=php:0]$query="SELECT * FROM Assembly WHERE PARTNUMBER LIKE '%" . $_POST['search'] . "%'";[/code]
  12. and better to write this line

    [code=php:0]$query="SELECT * FROM Assembly WHERE PARTNUMBER='$search'";[/code]

    like this

    [code=php:0]$query="SELECT * FROM Assembly WHERE PARTNUMBER='" . $_POST['search'] . "'";[/code]

    i mean use $_POST :) mybe you register_globals is off in php.ini
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.