Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Everything posted by dreamwest

  1. http://www.wizecho.com/nav=php&s=switch http://www.wizecho.com/nav=php&s=operators
  2. Html: <input type='checkbox' name='money[]' value='1' /> <input type='checkbox' name='money[]' value='2' /> <input type='checkbox' name='money[]' value='3' /> Php: $type = $_GET['money']; if($type){ if(is_array($type)){ foreach($type as $x){ echo "$x\n"; } } } You can look at the global by print_r($_GET);
  3. $low =5; $high = 8; if($low <= $high){ echo 'Low is less that or equal to high'; }else{ echo 'High is greater but not equal to low '; }
  4. http://www.wizecho.com/nav=php&s=email
  5. You do realize gamefaqs.com uses smarty , and are one of the fastest websites out there. Ive never heard anyone complain about smarty who uses it in production website
  6. Gotta love those pesky boundries http://www.wizecho.com/nav=php&s=email
  7. Come hereith my child, let me lead you to the light with the almighty smarty http://www.smarty.net/
  8. I order pizza online, i can see a menu, its cheaper, no waiting, it doesnt cost me a ph call on my mobile .. and im lazy
  9. Im getting this error message randomly 1 in 6 times itll lag and eventually show this error when i try to upload an image to a remote server. Warning: ftp_put() [function.ftp-put]: php_connect_nonb() failed: Operation now in progress (115) in /home/user/public_html/2.php on line 22 Warning: ftp_put() [function.ftp-put]: Type set to I in /home/user/public_html/2.php on line 22 Script: $ftp_server = ""; $ftp_user = ""; $ftp_pass = ""; // connect to target ftp server $target_conn = ftp_connect($ftp_server) or die("Could not connect to server try again!"); if(ftp_login($target_conn, $ftp_user, $ftp_pass)){ echo 'Success'; }else{ echo 'Failed or timed out'; } // switch to passive mode if behind a firewall - REMOVE THIS IF YOU RUN INTO PROBLEMS ftp_pasv($target_conn, true ); // change to the target path ftp_chdir($target_conn, '/1/'); // upload the thumbnail ftp_put($target_conn, 'test.jpg', 'tmb_4.jpg', FTP_BINARY) or die("There was an error uploading the thumbnail. Please try again"); ftp_close($target_conn); echo "<hr>All done!"; Anyone know what the error means?
  10. RewriteRule ^thing thing.php [L,QSA] RewriteRule ^thing/(.*) thing.php?k=$1 [L,QSA]
  11. You mean you want http://mysite.com/thing.php => http://mysite.com/thing
  12. It fascinating. Both exactly the same data, but 2 different sizes. I figured one was compressed somehow
  13. theres a video "twitter" called keek.com - supposed to save ppl typing their message
  14. I found a logo design website a while back but ive forgotten the name. They make high quality logos for about $120 and they give you 5 samples to choose from, they also have a gallery of their previous work and a forum Anyone know who they are?
  15. Why is utf8_unicode_ci (98MB) smaller in size compared to latin1_swedish_ci (120MB)
  16. SimpleXML is much easier $data = file_get_contents("superman.xml"); $n_data = new SimpleXmlElement($data, LIBXML_NOCDATA); foreach ($n_data->movies->movie as $d) { $show .= "{$d->friends} went to see {$d->title}<br />"; } echo $show;
  17. Just use the alias "AS" for each table name. Same process as joining
  18. <?php #################################################################### # WIZECHO Database Backup - Copyright © 2010 Wizecho Software. All Rights # # Reserved. # # This file may be redistributed in whole or significant part with this copy write attached # # http://www.wizecho.com/nav=php&s=php_mysql_backup # #################################################################### //*************** config ***************// $mysql_host='localhost'; $mysql_database='name'; // database name $mysql_username='user'; // user name $mysql_password='password'; // password $storing_dir = "/home/user/html/backups/"; // directory path with an ending slash //************* end config ************// $file_name = $mysql_database."_".date('YmdHis').".sql"; $link = mysql_connect($mysql_host, $mysql_username, $mysql_password); if (!$link){ fwrite($fh, 'Could not connect: ' . mysql_error()); exit(); } $db_selected = mysql_select_db($mysql_database, $link); if (!$db_selected){ fwrite($fh, 'Can\'t use $mysql_database : ' . mysql_error()); exit(); } $myFile = $storing_dir . $file_name; $fh = fopen($myFile, 'w') or die("can't open file"); _mysqldump($mysql_database); fclose($fh); function _mysqldump($mysql_database){ global $fh; _mysqldump_schema_structure($mysql_database); $sql="show tables;"; $result= mysql_query($sql); if( $result){ while( $row= mysql_fetch_row($result)){ _mysqldump_table_structure($row[0]); _mysqldump_table_data($row[0]); } }else{ $content = "/* no tables in $mysql_database */\n"; fwrite($fh, $content); } mysql_free_result($result); } function _mysqldump_schema_structure($schema){ global $fh; fwrite($fh, "/* database : `$schema` */\n"); $sql="show create schema `$schema`; "; $result=mysql_query($sql); if( $result){ if($row= mysql_fetch_assoc($result)){ fwrite($fh, $row['Create Database'].";\n\n"); } } fwrite($fh, "USE `$schema`; \n\n"); mysql_free_result($result); } function _mysqldump_table_structure($table){ global $fh; fwrite($fh, "/* Table structure for table `$table` */\n"); fwrite($fh, "DROP TABLE IF EXISTS `$table`;\n\n"); $sql="show create table `$table`; "; $result=mysql_query($sql); if( $result){ if($row= mysql_fetch_assoc($result)){ fwrite($fh, $row['Create Table'].";\n\n"); } } mysql_free_result($result); } function _mysqldump_table_data($table){ global $fh; $sql="select * from `$table`;"; $result=mysql_query($sql); if( $result){ $num_rows= mysql_num_rows($result); $num_fields= mysql_num_fields($result); if( $num_rows > 0){ fwrite($fh, "/* dumping data for table `$table` */\n"); $field_type=array(); $i=0; while( $i < $num_fields){ $meta= mysql_fetch_field($result, $i); array_push($field_type, $meta->type); $i++; } //print_r( $field_type); fwrite($fh, "insert into `$table` values\n"); $index=0; while( $row= mysql_fetch_row($result)){ fwrite($fh, "("); for( $i=0; $i < $num_fields; $i++){ if( is_null( $row[$i])){ fwrite($fh, "null"); }else{ switch( $field_type[$i]){ case 'int': fwrite($fh, $row[$i]); break; case 'string': case 'blob' : default: fwrite($fh, "'".mysql_real_escape_string($row[$i])."'"); } } if( $i < $num_fields-1) fwrite($fh, ","); } fwrite($fh, ")"); if( $index < $num_rows-1) fwrite($fh, ","); else fwrite($fh, ";"); fwrite($fh, "\n"); $index++; } } } mysql_free_result($result); fwrite($fh, "\n"); } echo 'All Done!!'; ?>
  19. Use break; to prevent looping example: $x = 2; switch ($x){ case 1: echo "The number is one"; break; case 2: echo "The number is two"; break; case 3: echo "The number is three"; break; default: echo "Number is greater than 3"; }
  20. give them a key when they start using the API. If you want scalabilty store the data in cassandra then use the php thrift to simply update and retrieve the data cassandra rocks!
  21. curl -k https://site.com/file.swf Use curl_getinfo or just get the headers (Content-length)
  22. dreamwest

    mysqld

    I took basedir away from /etc/my.cnf because mysql couldnt restart with it, but the PID has --basedir=/ Im running the latest version root@blue [~]# mysql --version mysql Ver 14.14 Distrib 5.1.56, for pc-linux-gnu (i686) using readline 5.1
×
×
  • 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.