Jump to content

WebStyles

Members
  • Posts

    1,216
  • Joined

  • Last visited

Everything posted by WebStyles

  1. that's hardly a coding problem, maybe this forum isn't the right place. You're looking for something like business strategy, business advice, marketing strategy, or similar. All I can suggest is, if you're afraid your idea will be ripped off, hire a lawyer before talking to anyone about it.
  2. From your question, I have no idea what you already have, I don't see any code, I don't even know if you have a database, so, first things first: You must start somewhere. Do you have a MySql database? have you created the table that will hold the data? if not, create it, add some bogus information, then write some code to pull out data, even if it doesn't work. (we like it when people send us the code they already have, at least it shows they're trying). Post code here, and we'll point you in the right direction.
  3. use "\n" instead of '\n'. with single quotes, newline is not inserted properly.
  4. to store the article id, use a session variable, like this: $_SESSION['article_id'] = 12345; That variable will be available on all your pages as long as you make sure you have session_start(); at the beginning of each .php file. to retrieve stuff from the database, you need to connect to it first, select the database, choose the fields you want to pull out and from which table, then grab the results. check out these functions on php.net: mysql_connect(); mysql_select_db(); mysql_query(); mysql_close(); hope that helps.
  5. try something like this: $allText = ''; $masterFile = file_get_contents('master.txt'); $filenames = explode("\n",$masterFile); foreach($filenames as $file){ $allText .= "\n".get_file_contents($file); } file_put_contents('text.txt',$allText);
  6. http://pt.php.net/manual/en/function.implode.php
  7. code is fine, but you need to implode the array before emailing it.
  8. this is not the best way to do it, but it will serve nicely as an example. note $started and how it's used to figure out if we need to insert the word 'AND' in the statement. <?php $keyword = '%'.$_POST['city'].'%'; $query = "select * from `database` where"; if(isset($_POST['club']) && $_POST['club'] != ''){ $query .= " `club` like '$keyword'"; $started = 'yes'; } if(isset($_POST['school']) && $_POST['school'] != ''){ if(isset($started) && $started == 'yes') $query .= ' and'; $query .= " `school` like '$keyword'"; $started = 'yes'; } if(isset($_POST['shop']) && $_POST['shop'] != ''){ if(isset($started) && $started == 'yes') $query .= ' and'; $query .= " `shop` like '$keyword'"; $started = 'yes'; } if(isset($_POST['tour']) && $_POST['tour'] != ''){ if(isset($started) && $started == 'yes') $query .= ' and'; $query .= " `tour` like '$keyword'"; } ?> hope this helps
  9. according to php.net nl2br() inserts <br> or <br /> before any newline characters, but it doesn't say it removes the newline characters. Personally I've always used str_replace() since it allows for other situations, like just inserting a space instead of a newline. if what you want is an actuall html line break, then nl2br() is the way to go.
  10. when you grab the text field you can convert them into <br /> or just remove them with str_replace("\n\r","<br />",$variable);
  11. I use something like this to build all my dynamic combos: <?php function buildCombo($table,$values,$displayText,$selectedValue,$comboName){ $conn = conn('databaseName'); $output = '<select name="'.$comboName.'" size="1">'; $q = mysql_query("select $values,$displayText from $table order by $displayText",$conn); while($r = mysql_fetch_assoc($q)){ $output .= '<option value="'.$r[$values].'"'; if($selectedValue==$r[$displayText]) $output .= ' selected'; // you can use $values or $displayText to check for selected $output .= '>'.$r[$displayText].'</option>'; } @mysql_close($conn); $output .= "</select>"; return $output; } // to show the comboBox use: echo buildCombo('tableName','fieldWithValues','fieldWithText','selectedValue','nameForSELECTelement'); // fieldWithValues can be the same as fieldWithText if needed ?> (p.s. I just typed all that in as an example, there maybe typo's) hope it helps
  12. if they have to logon to vote/rate then you can use their username in a session variable to track which ones they've voted on. this of course will be reset if they logout and then logon again. better to just store their votes in a database.
  13. you're quite welcome. Glad to have helped.
  14. well, if no one's on your site, no one is looking at the list of online users so it doesn't matter. as soon as someone comes online, the lists gets updated and what's displayed is correct again.
  15. so you just want the highest score of each user... ('total' holds the score value) SELECT username,MAX(score) as total FROM highscores_bubblepop group by username LIMIT 0 , 50" p.s. they guy was asking for it. lol
  16. javascript runs on all active browsers. it won't run on the closed one, but someone else will run it.
  17. sorry, it's the other way round: order by `username`,`score`
  18. yes, cause it's ordered by score. if you also want to order by username see my previous post
  19. so you're not even going to try? you want one of us to do it for you? that won't help you learn.
  20. if you want to order by score and username, do exactly that: ORDER BY `score`,`username`
  21. can you post an example of what is stored in your database?
  22. not sure what you want. page 3 does not start with session_start() so you wont be able to access $_SESSION variables. it also has some errors.
  23. SELECT distinct `username`,`score` FROM `highscores_bubblepop` ORDER BY `score` DESC LIMIT 0 , 50
×
×
  • 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.