Jump to content

jscix

Members
  • Posts

    197
  • Joined

  • Last visited

    Never

Everything posted by jscix

  1. -> and :: are simply ways to access a property or function of an object. $this refers to the current object. $show is an instance of an object. $show->BOLDING, is either accessing a method, or property on '$this'
  2. if your wanting the file list to update without reloading the page, you'l need to use AJAX. You setup your script that reads the files to output them in html list format, and print them to the page. From your form, on submit, or whatever event handler you want -- make an ajax request to that script
  3. Sessions data is saved server side.. I'm not aware of being able to disable session cookies VIA the web browser, (I know you can CLEAR them), anyway if they could.. the browser would simply not load load the data from the server. and no you can't force a browser to do anything.
  4. Having no idea how the zip class your using works. I would say to simply unzip the archive to a temporary folder, then manually move the files afterward.
  5. Yep there is. http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html#operator_or Select * FROM artists where `band` LIKE 'portishead' OR `band` like 'nine inch nails'; Sorry-- Just re-read your post. Yes there is also an XOR operator. Which I believe is just that, 'XOR'
  6. Count the total number of rows. Divide that number by 4. You have how many pages you need. EG: [1] - [2] ETC. Add a 'Limit 4' To each query.
  7. "There are alot of other languages where understanding OOP is really not the issue. C#, Java, Python, you are an Object Oriented Programmer weather you know it or not" Man, Wrong, wrong, wrong! Programming in an OOP Language does NOT equal programming in an OOP Way! OOP is a methodology which requires alot of practice and thought to do correctly and efficiently.
  8. "OOP is just a bunch of methods (functions) and variables put in a single place. Think about it like an fishtank or ecosystem of php code." So, totally, incorrect. OOP is a methodology for implementing functionality in a conceptual way. It enables you program in the terms of your problem by separating design and implementation. It also allows for ease of re-use, redesign and distributed development. One of the best books I've ever read on OOP/OOD is: http://books.google.com/books?id=FnNqkN17kDYC Totally free online. Enjoy!
  9. If you use, /path/to/image then your going to have to use the FULL path. /var/www/mywebsite/root/images/image.jpg
  10. SELECT DATE_FORMAT(CURDATE(), '%d/%m/%Y')
  11. For a relatively large website, is it impractical to store a potentially large number of images in the database rather than just storing them in the filesystem?
  12. <?php INCLUDE "connect.php"; $host = "host"; $database = "database"; $user = "user"; // I changed these for the post, they're right in my script $pass = "pass"; ConnectToDatabase($database, $user, $pass, $host); $query = "SELECT user, pass FROM users WHERE `user` = '$typed_user'"; $result = mysql_query($query); $row = mysql_fetch_array($result); $database_user == $row['user']; echo($database_user); print "hello, why don't you login? <br />"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Login</title> </head> <body> <form id="login" name="login" method="post" action="login.php"> <label> User <input type="text" name="user" id="user" /> </label> <p> Password <input type="password" name="pass" id = "pass" /> </p> <input type="submit" id="submit" name="sumbit" /> </form> </body> </html> <?php if ($typed_user == $database_user) { echo('Worked!'); } else { echo(' Didn\'t Work!'); } ?>
  13. <?php $database = "xxx"; $dbconnect = mysql_pconnect('localhost','xxx','xxx'); mysql_select_db($database, $dbconnect); $query = "select * FROM `products` WHERE `active`='Yes'"; $result = mysql_query($query, $dbconnect); while ($line = mysql_fetch_assoc($result)) { $return[] = $line; } $query2 = mysql_query($query); $seen = array(); $size2 = sizeof($seen); $numberz = $size2; while ($row = mysql_fetch_array($result)) { $cats = explode("|",$row['cats']); $main_cat = $cats[$numberz]; if (!in_array($main_cat,$seen) && !in_array($main_cat,$multiple)) { array_push($seen,$main_cat); } else { array_push($multiple,$main_cat); unset($seen[$main_cat]); } } $size = sizeof($seen); for ($i=0; $i<=$size; $i++) { $product_type = $seen[$i]; } $output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <rss version =\"2.0\" xmlns:g=\"http://base.google.com/ns/1.0\"> <channel> <title>GS Wholesale</title> <description>Your Consumer Electronics and More Store!</description> <link>http://GSWholesale.com</link>"; foreach($return as $line) { $output .= "<item><title>".htmlentities($line['man'])." ".htmlentities($line['mod'])." ".htmlentities($line['name'])."</title> <g:brand>".htmlentities($line['mod'])."</g:brand> <g:condition>new</g:condition> <g:description>".htmlentities($line['specs']).". About the manufacturer ".htmlentities($line['man'])." ".htmlentities($line['full'])."</g:description> <g:model_number>".htmlentities($line['mod'])."</g:model_number> <g:id>".htmlentities($line['mod'])."</g:id> <g:image_link>".htmlentities($line['img_url'])."</g:image_link> <g:pickup>true</g:pickup> <g:link>http://GSWholesale.com/product.php?id=".htmlentities($line['mod'])."</g:link> <g:mpn>".htmlentities($line['mod'])."</g:mpn> <g:price>".htmlentities($line['price'])."</g:price> <g:product_type>".$product_type."</g:product_type> <g:upc>".htmlentities($line['upc'])."</g:upc> <g:quantity>1000</g:quantity> <g:payment_accepted>Google Checkout</g:payment_accepted> <g:payment_accepted>PayPal</g:payment_accepted> <g:payment_accepted>Visa</g:payment_accepted> <g:payment_accepted>Mastercard</g:payment_accepted> <g:payment_accepted>American Express</g:payment_accepted> <g:payment_accepted>Discover</g:payment_accepted> <g:payment_accepted>Cash</g:payment_accepted> <g:payment_accepted>Checks</g:payment_accepted> <g:payment_accepted>Cashiers Checks</g:payment_accepted> <g:payment_accepted>Money Orders</g:payment_accepted> <g:payment_accepted>Wire Transfer</g:payment_accepted> </item>"; } $output .= "</channel></rss>"; header("Content-Type: application/rss+xml"); echo $output; ?> you were trying to use mysql_fetch_row, on a query string. not an actual query. I doubt this alone will fix your issue. but good luck.
  14. Switch ($row['rank']) { case '1': $_SESSION['registered']; break; case '2': $_SESSION['member']; break; default: // throw error break } etc
  15. Your problem is either: a.) a session value is not getting assigned, you are forgetting to start_session. b.) $row = mysql_fetch_assoc($result); if($row['rank'] == 1) { //set the session and redirect user $_SESSION['registered'] = TRUE; include('info.php'); }else{ //tell the user the account isn't activated if their rank is 0 echo "Your account is not activated"; } This code right here is not being satisfied correct. Eg: Your db value for 'rank' is not set, or not '1'. Thus when, if(isset($_SESSION['registered']) || isset($_SESSION['member']) || isset($_SESSION['moderator']) || isset($_SESSION['admin'])){ Is executed, it is going to return false and return the login form. hope that helps.
  16. I'm curious if anyone knows of any reason why persisting an object in a session could be a bad idea? Besides memory usage, and if anyone can answer this, how much memory usage would I be looking at by storing an object in a session? The object is merely a storehouse for user related data. (name, address, phone#, etc.) It also contains a few methods for manipulating that data.. Thanks in advance.
  17. I'm curious if anyone knows of any reason why persisting an object in a session could be a bad idea? Besides memory usage, and if anyone can answer this, how much memory usage would I be looking at by storing an object in a session? The object is merely a storehouse for user related data. (name, address, phone#, etc.) It also contains a few methods for manipulating that data.. Thanks in advance.
  18. Change: $upfile = '/ideas/' .$_FILES['image']['name'] ; To $upfile = 'ideas/' .$_FILES['image']['name'] ;
  19. Make sure the directory your uploading to has the correct privileges
  20. Well I have to say, PHP does not have quite the power of C++, or C#/Java or what have you.. but is by no means a 'toy language'.. I actually enjoy coding in multiple languages, because each has it's own uses and strengths/weaknesses. That guy is obviously a tool.
  21. $x = substr($filename, -1, 4); if ($x == '.jpg') { // file is jpg } etc... generalization, but check up on it.. really easy to do.
  22. I've got a spidering script, that indexes a websites contents.. it works beautifully on smaller sites, however when crawling large sites that take a good amount of time.. the script seems to just randomly stop. I've actually seen it complete a full crawl of a large site, but 95% (estimate) of the time, it will stop indexing and just quit. I have already added, set_time_limit(3600); ini_set('max_execution_time', 3600); I don't know what else could be causing it. If anyone has some suggestions, I'd be open to hear them. Thanks
  23. I hope this is for legit purposes <?php $con = mysql_connect("******","******","******") or die('Could not connect: ' . mysql_error()); mysql_select_db("login", $con); $result = mysql_query("SELECT * FROM subscribe"); if (!is_array($result)) { die("Result returned non-array"); } while($row = mysql_fetch_array($result)) { $emails .= ($row['email'] . ","); } print ($emails); mysql_close($con); ?>
  24. <?php $con = mysql_connect("******","******","******") or die('Could not connect: ' . mysql_error()); mysql_select_db("login", $con); $result = mysql_query("SELECT * FROM subscribe"); if (!is_array($result)) { die("Result returned non-array"); } while($row = mysql_fetch_array($result)) { print ($row['email'] . "<br>"); } mysql_close($con); ?>
  25. Well, if thats happening then the redirect code is never being executed so, check to see if your form fields have the correct names associated with your php post variables,
×
×
  • 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.