Jump to content

egorig

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

egorig's Achievements

Member

Member (2/5)

0

Reputation

  1. I'm looking for a simple newsletter system with wysiwyg editor. Simpler, better. Please help.
  2. Hi, I need a php/mysql system that accepts customers' emails and automatically creates tickets. I've seen this feature in many sites and I really liked the idea. Thanks in advance.
  3. Hi, I've made a script that import/update information and normally it took 4-5 hours to finish. I run the script today and it stops importing in every 5 minutes. Browser says "Done". No errors , no warnings. Like it's finished, but it's definitely not. These are some settings I use : set_time_limit(0); mysql_query('SET wait_timeout=28800;'); Someone can help me ?
  4. Okay, here's a question. We have a simple class class image extends MySQL { var $connection; function __construct() { parent::__construct(); } function generate_image ($filename) { //code here } } which method calling is better ? 1) image::generate_image('test.php'); 2) $images = new image(); $images->generate_image('test.php'); Need to know more about pros and cons. Very very thanks in advance.
  5. Hi everyone, in index.php i'm calling a function this way : Uploading Archived Filename <?php upload_to_server($archive_filename);?> : <b>Done</b> <br/> here's the function upload_to_server() [pre] function upload_to_server($fname) { $ftp = ftp_connect(FTP_SERVER) or die('Could not connect to FTP'); @ftp_login($ftp,FTP_USERNAME,FTP_PASSWORD) or die('Wrong username or password!'); ftp_put($ftp, $fname, $fname, FTP_BINARY) or die('Error while uploading file to the server'); ftp_close($ftp); } [/pre] The page says "Transfering .." till one time and then it says Done (in Firefox). But the file is still uploading (i'm checking that with FTP Client and on Refresh it changes its size) and the message <b>Done</b> is not displayed , so the other part of the page (footer ..). I tried this : set_time_limit(0); ftp_nb_put(); ftp_set_option($ftp, FTP_TIMEOUT_SEC, 10000); return true (at the end of the function) but they don't help. Can anyone tell me why is this happening ? Thanx in advance!
  6. I was wondering if opening a file line by line is too slow and it's unacceptable. Your suggestion is good , but i want to "bold" the text in capital letters. .And what is going to happen if i try opening larger files (3-4-5 pages) ?
  7. Hi there, I was wondering if it's too slow to use this function openFile($filename) { $file = fopen($filename,'r'); while (!feof($file)) { $line = trim(fgets($file)); if ($line == strtoupper($line) AND $line <> '') echo " <span class = \"bold\">".$line."</span><br/>"; else echo ' '.$line.'<br/>'; } } I don't want to include the file - "include 'filename.txt', because everything goes on one line. Using <pre> </pre> tag is not an option too.. Displaying small texts with the function above is not slow, but if i use texts with 4-5 pages?? Is it proper to use this function. Is there another way ?
  8. Hi, which quotation marks is correct to be used in php ? ' or " ? include ("") or include ('') echo "" or echo '' ? Thanx
  9. Yes, but the problem's still there. I tried almost everything...
  10. db.php <?php class MySQL { var $connection; function MySQL() { $this->connection = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error()); mysql_query("set names cp1251"); mysql_select_db(DB_NAME, $this->connection) or die(mysql_error()); } function getQuickSearchOffers($city,$type) { $q = "SELECT pid,ptype,pobject,pcity,pprice,pdate,ptop FROM ".TBL_PRODUCTS." WHERE ptype like '".$type."' AND pcity like '".$city."' ORDER BY pid desc LIMIT 5"; $result = mysql_query ($q, $this->connection) or die(mysql_error()); return $result; } function getNumRows($query) { $result = mysql_num_rows($query) or die (mysql_error()); return $result; } } $server = new MySQL(); ?> in another php file, firstly i include the db.php and then I'm calling the getQuickSearchOffers($city,$type) function like this $data = $server->getQuickSearchOffers(1,2); and then $rows = $server->getNumRows($data); The problem: if the query return 1 or more rows , when i echo the $rows variable it displays the correct amount of rows. If the query do not returns any result, when i echo $rows it doesn't return "0". If i add "echo mysql_num_rows($result)" in the getQuickSearchOffers(1,2) function, function getQuickSearchOffers($city,$type) { $q = "SELECT pid,ptype,pobject,pcity,pprice,pdate,ptop FROM ".TBL_PRODUCTS." WHERE ptype like '".$type."' AND pcity like '".$city."' ORDER BY pid desc LIMIT 5"; $result = mysql_query ($q, $this->connection) or die(mysql_error()); echo mysql_num_rows($result) return $result; } no matter if there is or there is not a result it echos the correct amount of rows (0,1,2,3,4...). Why is that happening? How can i fix this? By function getNumRows i want to check if the query returns any result, and if it doesn't i want to display a proper message. Thanks in advanced to everyone! EDITED BY WILDTEEN88: Please use code tags ( ) when posting code. Thank you
  11. Hope you like it <? $_one['Zach'][] = "18"; $_one['Zach'][] = "Mainesburg"; $_one['Jeff'][] = "17"; $_one['Jeff'][] = "Mainesburg"; $_one['Ducky'][] = "19"; $_one['Ducky'][] = "Mansfield"; foreach($_one as $key => $value) echo "$key is $value[0] years old, and lives in $value[1]!" . "<br>"; ?>
  12. Thanks, i figured it out where the problem was
  13. <?php $input = "this"; if (preg_match('/[^0-9a-z@,_.!:\'\s]+/im', $input)) { echo "Successful match"; } else { echo "Match attempt failed"; } die; ?> It says match attempt failed , but this string consist of regular symbols.
  14. it doesn't work with spaces ! Here's the function i've made function CheckField() { foreach($_POST as $val) { if (strlen($val) == 0) { $result = "You've missed a field !"; break; } if (!preg_match('/[^0-9a-z@,_.!:\'\s]+/im', $val)) { $result = "You've used irregular symbols"; break; } } return $result; }
  15. Another one ... <? $query = mysql_query ("SELECT id,name FROM table WHERE id>0"); $rand = rand(0,10); $result = mysql_result($query,$rand,"name"); echo $result; // this will display a random name from the table with names. ?>
×
×
  • 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.