Jump to content

DarkSuperHero

Members
  • Posts

    342
  • Joined

  • Last visited

Everything posted by DarkSuperHero

  1. im trying to learn more myself...i would suggest, reading the help forum, thinking out a possible solution, reading the solutions...and if your interested in OO PHP, i suggest "PHP Object-Oriented Solutions" great book....and the tutorials on here are awesome also...just try to think out of the box sometimes, and get away from your "usual" thinking....just my thoughts... :-) cheers!
  2. easiest way would be to include the forum inside an iframe.... :-P but thats lazy and unattractive... if the forum doesnt work when your trying to make it fit to your page....why not make your page fit to the forum... what i mean by that is why not make a template for the forum that matches your site, with the corresponding links going back to your page...if you make the forum template, the same as your site the transition would be seamless... although this doesnt fix the issues your having...
  3. there a big noticeable difference if you plan on going on to visit the world of php in Object Oriented detail.... :-P procedural code runs almost the same....with a some differences, and some removed and discontinues funtions and variables. PS- Some hosts, like dreamhost, which i dont use, but a client of mine does, gives the user the option to use either 4 or 5....just some food for thought... :-)
  4. you need to loop through the results....check this exmple from php.net out... <?php $conn = mysql_connect("localhost", "mysql_user", "mysql_password"); if (!$conn) { echo "Unable to connect to DB: " . mysql_error(); exit; } if (!mysql_select_db("mydbname")) { echo "Unable to select mydbname: " . mysql_error(); exit; } $sql = "SELECT id as userid, fullname, userstatus FROM sometable WHERE userstatus = 1"; $result = mysql_query($sql); if (!$result) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); exit; } if (mysql_num_rows($result) == 0) { echo "No rows found, nothing to print so am exiting"; exit; } // While a row of data exists, put that row in $row as an associative array // Note: If you're expecting just one row, no need to use a loop // Note: If you put extract($row); inside the following loop, you'll // then create $userid, $fullname, and $userstatus while ($row = mysql_fetch_assoc($result)) { echo $row["userid"]; echo $row["fullname"]; echo $row["userstatus"]; } mysql_free_result($result); ?> http://us.php.net/mysql_fetch_assoc other than that i think you will be all gravy....i gotta run otherwise i would try to set it to your specific code.... :-) cheers!
  5. php.net recommends reading a dir like this: <?php // Note that !== did not exist until 4.0.0-RC2 if ($handle = opendir('/path/to/files')) { echo "Directory handle: $handle\n"; echo "Files:\n"; /* This is the correct way to loop over the directory. */ while (false !== ($file = readdir($handle))) { echo "$file\n"; } /* This is the WRONG way to loop over the directory. */ while ($file = readdir($handle)) { echo "$file\n"; } closedir($handle); } ?> http://us3.php.net/readdir I believe your just not reading the dir the correct way so your loop never ends...
  6. check with your host to see what your max number of e-mails you can send in an allotted time, a cron job script might work best, and get the e-mail out in short burst's rather than all at once...last thing you migth want is your host suspending your account for TOS issues... :-)
  7. how about making a php page with all your css and having your script inthere.... when the php script prints all the css...in nice plain readable nothing more than css... :-)
  8. for those of you who know how to use smarty template system, how long did it take to pick up on it right ? :-)
  9. try reading this...is my last post didnt make much sence... http://www.phpfreaks.com/forums/index.php/topic,37442.0.html
  10. header() function can only beused before anything is output to the browser...if this code is at the top of your script and nothign has been sent to the browser then yes....otherwise...no....its all about placement
  11. i would suggest by reading up on some mysql functions on the php manual. at the same time i would also think up of the table structure, eg, the fields of information you will be storing.... what are some of the tutorials you read up on ? maybe we can clarify some of it... :-)
  12. maybe try adding and extra session or cookie variable that stores the id's of the post that have been read already ? eg. you log in at X post is made at Y you view Y, the script creates a new Y variable....saying it has been read.... short there after post Z is made....and looks new, because there no new Z variable..... inefficient ? :-(
  13. i think this tutorial might help,(pagination) http://www.sitepoint.com/article/perfect-php-pagination/
  14. try using a script that logs in using an ftp account for the second server.... theres ftp functions built into php... http://us.php.net/ftp_put
  15. <?php $date = 'dd/mm/yyyy'; //original string $piece = explode('/',$date); //array created by explode, containign different peices of the date... $date2 = $piece[2].$piece[1].$piece[0]; echo $data2; //returns yyyymmdd print_r($piece); /* array( [0] = 'dd'. [1] = 'mm' [2] = 'yyyy' ) */ this relies on the input date always being input at the same format....
  16. in that case all you need is a set of if,else statements <?php if(strlen($_POST['password'] < { echo('Your password must be at least 8 characters long'); } else{ echo('GOOD JOB!'); }
  17. whats wrong with Easy PHP ? Why not use it ? Ive used it for longest time! :-)
  18. if you dont want to do encoding, or do a demo, you could "give away" a stripped down version of your software....and possibly sell the upgrade, or sell the add-ons... maybe having a product key that stored on your server, and checked against whats stored on the server where the software is installed, although this would work best only for people who arn't too PHP savvy... :-P
  19. I would suggest thinking of your code and what it actually does, then split it down to different classes and functions.... eg in a cart project you would have; A Product Class would contains methods to deal with naming and pricing. extending the Product class to do deal Books, DVD's or Clothing. each putting forth their own methods, with parent class Products.... I would also suggest starting with the directory layout, and then coding the essential/core pieces of your project like the db connections, file handling...ect....im currently working on a project of my own....converting an existing procedural coded site to OOP... :-)
  20. <?php $output = ""; for ($i=0;$i<10000;$i++) //loop and create output string { $output .= "Something"; //gather everything into a string } echo $output; //output string this code took 10.362ms to run on avarage or <?php for ($i=0;$i<10000;$i++) //loop and create output string { echo "Something"; //output the string as it comes } this code took 11.45ms seconds to run on avarage used Zend Profiler for both...:-) this is probably a better comparison,
  21. yeah that also works....php.net has this warning on the site.... http://us.php.net/manual/en/function.extract.php
  22. i notices you have.... <?php ////blah blah blah... $_POST["prefix"] = $prefix; $_POST["fname"] = $fname; $_POST["lname"] = $lname; $_POST["title"] = $title; $_POST["pphone"] = $pphone; $_POST["sphone"] = $sphone; $_POST["email"] = $email; $_POST["cname"] = $cname; $_POST["caddress"] = $caddress; $_POST["ccity"] = $ccity; $_POST["cstate"] = $cstate; $_POST["czip"] = $czip; $_POST["cinfo"] = $cinfo; $_POST["clogo"] = $clogo; $_POST["cwebaddy"] = $cwebaddy; echo $prefix; echo $fname; echo $lname; echo $title; echo $pphone; echo $sphone; echo $email; //on and on?> and i think you meant.... <?php //blah blah blah $prefix = $_POST["prefix"]; $fname = $_POST["fname"]; $lname = $_POST["lname"]; $title = $_POST["title"]; $pphone = $_POST["pphone"]; $sphone = $_POST["sphone"]; $email = $_POST["email"]; $cname = $_POST["cname"]; $caddress = $_POST["caddress"]; $ccity = $_POST["ccity"]; $cstate = $_POST["cstate"]; $czip = $_POST["czip"] ; $cinfo = $_POST["cinfo"]; $clogo = $_POST["clogo"]; $cwebaddy = $_POST["cwebaddy"]; echo $prefix; echo $fname; echo $lname; echo $title; echo $pphone; echo $sphone; echo $email; //on and on?>
  23. I like to put it into a variable if I'm doing something else to it, like double checking its contents or formatting.. using Zend profiles, both took about the same to run...averaging out at .12ms...
×
×
  • 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.