jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
She means something like that: INSERT INTO tbl_temp2 (fld_id) SELECT tbl_temp1.fld_order_id FROM tbl_temp1 http://dev.mysql.com/doc/refman/5.0/en/insert-select.html
-
Who knows.....maybe one day
-
Did you really read seandisanti's reply how to use the implode php function? Is it true ? $ids = implode('ars_no, phone_number, category_1, category_2, status, create_date, resolved_date, trouble_type_priority, ban_type, employee_id_name', $_POST['id']);
-
Aside of the error that you got above, did you restart the http and the mysql server after upgrading php? BTW - nice Italian family
-
Yes, you can add a nice option to exec command, but why are you using php to do this? Anyway, before do this make sure what permissions has apache to the nice folder. Then create a string like: <?php $nice = 'which nice'; // find where is a nice command in your system $str = "$php_path . ' -c ' . $config_ini . ' mirrors/rapidshare.php ' . $file_uid . ' ' . $status.';'"; $str .="$nice n 5 u $user"; exec($str); // or with a shell_exec() shell_exec($str);
-
Extract rows from database in a particular order
jazzman1 replied to Waleed-KH's topic in PHP Coding Help
Only one table - check this out. You can google it - how to display hierarchy in php. -
Jessi, I understand what you want to say to him, but sometimes the users especially windows one, they messed up php, http, mysql, smtp, etc..... What wrong I said here: He doesn't have to have a web server to execute php scripts and to send emails it has requered an mail server.
-
Just to be clear: 1. He doesn't have a web server running php scripts, he needs to have only a server for example a linux one. 2. The web server doesn't care about emails only mail server cares of that.
-
Workaround for file_put_contents not working
jazzman1 replied to qwertyportne's topic in PHP Coding Help
The logic of that function is completly wrong. You can not use it in this way. -
You need to use a "=" symbol after the value html attribute.
-
Convert UTF8 characters to ISO when exporting from MySQL DB to Excel file
jazzman1 replied to Baltas's topic in MySQL Help
Well, what charset microsoft exel used for? -
Try, CREATE EVENT newEvent ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY DO UPDATE orderrader SET vs=1 WHERE order_datum <= DATE_SUB(NOW(), INTERVAL 14 DAY) ; I've tested that one, it worked to me. CREATE EVENT newEvent ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 minute DO UPDATE orderrader SET vs=1 WHERE order_datum <= DATE_SUB(NOW(), INTERVAL 14 DAY) ; I don't know why that one does not work to me. CREATE EVENT newEvent ON SCHEDULE EVERY 1 minute DO UPDATE orderrader SET vs=1 WHERE order_datum <= DATE_SUB(NOW(), INTERVAL 14 DAY) ;
-
PHP Include workaround need for tough/rough coded site
jazzman1 replied to mag00's topic in PHP Coding Help
You can create a custom php.ini file, it must called - php5.ini Then, you have to describe which directives of the core php.ini file you want to override. Store this file into your core home directory (to have effect to all websites) or into a specific directory. Next, you need to kill the web processes to get your php5.ini file to take effect. 1. Log in to your Account Manager. 2. Click Web Hosting. 3. Next to the hosting account you want to use, click Launch. 4. In the Stats & Monitors section of the Control Panel in your hosting account, click the System Processes icon. 5. Click End Web and follow any prompts. 6. To check whether your php5.ini file takes effect, open a plain text editor and create a file called phpinfo.php. Insert the following line: <? phpinfo(); ?> We don't know which directive of the new php.ini file has a conflict with your old school php code. -
I don't see any reason to set a $_SERVER['HTTP_REFERER'] into the html form. As @davidannis said if the form has been submitted the referer is gonna be set to the email message if not it is gonna be set to null .
-
Try, // change $Page = $_POST['Page']; to $Page = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
-
Are you able to see it in your database? SHOW EVENTS;
-
Convert UTF8 characters to ISO when exporting from MySQL DB to Excel file
jazzman1 replied to Baltas's topic in MySQL Help
Ok, let's say that we have the next data in mysql database and all tables are on collation utf8_general_ci. <?php date_default_timezone_set("America/Toronto"); //connect to database define('DB_SERVER', 'localhost'); define('DB_USER', 'jazzman'); define('DB_PASSWORD', 'password'); define('DB_NAME', 'test_database'); $conn = mysql_connect (DB_SERVER, DB_USER, DB_PASSWORD) or die(mysql_error()); mysql_select_db (DB_NAME,$conn) or die(mysql_error()); if(!$conn){ die( "Sorry! There seems to be a problem connecting to our database."); } // set charset to utf8 mysql_set_charset('utf8',$conn); //create query to select as data from your table $select = "SELECT * FROM posts"; //run mysql query and then count number of fields $export = mysql_query ($select) or die ("Sql error : " . mysql_error( )); $fields = mysql_num_fields ($export); //create csv header row, to contain table headers //with database field names for ( $i = 0; $i < $fields; $i++ ) { $header = mysql_field_name( $export , $i ) . ","; } // set empty data array $data = array(); while( $row = mysql_fetch_assoc($export) ) { //$data[] = array($row['title'], $row['body']); $data[] = $row; } echo '<pre>'.print_r($data,true).'</pre>'; /* //create a file and send to browser for user to download header("Content-type: application/vnd.ms-excel"); header("Content-disposition: csv" . date("Y-m-d") . ".csv"); header( "Content-disposition: filename="."test.csv"); print $header."\n". implode(',', $data[0]); exit; */ Results: As you can see from the log file, we have a content with bulgarian, engish and lithuanian characters. Now let's say we want to get only titles and bodies then save them into .cvs file from array #7 this one with lithuanian characters. Sure if you want to save every bodies and titles you need to loop and explode them. I've got this result when I try to open the file into my openOffice software. <?php date_default_timezone_set("America/Toronto"); //connect to database define('DB_SERVER', 'localhost'); define('DB_USER', 'jazzman'); define('DB_PASSWORD', 'password'); define('DB_NAME', 'test_database'); $conn = mysql_connect (DB_SERVER, DB_USER, DB_PASSWORD) or die(mysql_error()); mysql_select_db (DB_NAME,$conn) or die(mysql_error()); if(!$conn){ die( "Sorry! There seems to be a problem connecting to our database."); } // set charset to utf8 mysql_set_charset('utf8',$conn); //create query to select as data from your table $select = "SELECT * FROM posts"; //run mysql query and then count number of fields $export = mysql_query ($select) or die ("Sql error : " . mysql_error( )); $fields = mysql_num_fields ($export); //create csv header row, to contain table headers //with database field names for ( $i = 0; $i < $fields; $i++ ) { $header = mysql_field_name( $export , $i ) . ","; } // set empty data array $data = array(); while( $row = mysql_fetch_assoc($export) ) { $data[] = array($row['title'], $row['body']); //$data[] = $row; } // echo '<pre>'.print_r($data,true).'</pre>'; //create a file and send to browser for user to download header("Content-type: application/vnd.ms-excel"); header("Content-disposition: csv" . date("Y-m-d") . ".csv"); header( "Content-disposition: filename="."test.csv"); print $header."\n". implode(',', $data[7]); exit; Result: -
Sometimes I'm using this guide - tested. Instead WHERE User='root', you sould use WHERE User='userName';
-
What is your operating system?
-
PHP Exec Function Doesn't work with cd Ubuntu Command
jazzman1 replied to unemployment's topic in PHP Coding Help
Tony, I'm agree with you, in that case BASH is gonna be much more suitable and powerful than php. -
Try to change (just for a test) database driver from 'datasource' => 'Database/Sqlserver' to 'datasource' => 'Database/Mysql'.
-
PHP Exec Function Doesn't work with cd Ubuntu Command
jazzman1 replied to unemployment's topic in PHP Coding Help
Wow.....very strange directories names You don't have to execute shell_exec() every time, just put your logic into a simple string and execute it at once. Something like: <?php $str = 'cd /var/www/trekeffect.com/trekeffect.com;'; $str .='pwd;'; $str .= 'ls -d'; // etc..... //execute the string $dir = shell_exec($str); echo $dir; Don't forget to separate the individual unix commands with semicolon -
PHP Exec Function Doesn't work with cd Ubuntu Command
jazzman1 replied to unemployment's topic in PHP Coding Help
What will you get: <?php $dir = shell_exec('cd /var/www/trekeffect.com/trekeffect.com;pwd'); echo $dir; -
PHP Exec Function Doesn't work with cd Ubuntu Command
jazzman1 replied to unemployment's topic in PHP Coding Help
Sorry for delay but I'm working. So, the "deploy" is your working directory on the server not "trekeffect.com"