Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. trq

    MOVED: Help

    This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=340885.0
  2. It'll probably become clearer once you have read a few mod-rewrite tutorials. if you have a working url now (even using an id) maybe you should read a few of those now. Once you understand how it all works you can then go and change your script to use title or some other friendlier way of being identified.
  3. You really are missing massive chunks here. You do. That is exactly what I said to do. I didn't say you would start with a url like that. I said you would start with a url like: /article.php?title=this-is-article-foo Why? Because all mod-rewrite does is matches a pattern in a string and if found, will pass that string to your underlying php page. This means if your script is expecting an id, then your url rule will need to pass that to the script. Meaning you will never be able to use urls such as /creating-tableless-page-layouts.php, you rould need to use something more like /245.php I'm really not sure where you get this stuff from.
  4. trq

    Help

    You use == to compare values, not =
  5. This is easiest done via bash (which can be executed through php if need be). Something like.... tar zcvf - /www | ssh user@backupserver "cat > /backup/www-bkp.tar.gz" This tars the /www and sends the output directly to stdout which is then piped to ssh and cat'd into the new location.
  6. Can you at least post the relevant code that you have tried?
  7. The reason you can;t use an id is because there is no way of relating a url like /this-is-article-foo.php with and id. Instead of passing an id you would need to pass the title, making your underlying urls look something like: /article.php?title=this-is-article-foo You can then search the database by title, not id. And indeed, you no longer need your articles directory. You simply use mod-rewrite to make it look like it still exists. the first thing you need to do is get this all in place and working without mod_rewrite. You can then worry about adding your rules to make it look pretty.
  8. 1) As I said earlier, you will need to pass the title of the article not the id. 2) Yes. Each row should have a unique primary key. 3) Yes. 4) Have you looked at any mod_rewrite tutorials. this is a pretty straight forward rule and would be covered in any beginner tutorial.
  9. include("db.php"); $query = mysql_query("SELECT * FROM data_table"); $id = ""; $result = array(); while($row = mysql_fetch_assoc($query)){ $result[]['id'] = $row['id']; } $JSON_response = json_encode($result); header("Contents: type/json"); echo $JSON_response;
  10. Then you'd better post your code and a description of the problem.
  11. if( $r = mysql_query($query1) ) // LOTS AND LOTS OF ROWS RETURNED { $counter = 1; while( $row = mysql_fetch_assoc($r) ) // LOOP { print "Phone - {$row['jloc_phone']}<br/>"; print "This is record number ".$counter."<br/>"; //HOW TO REFENCE MY ROW NUMBER HERE? $counter++; } }
  12. trq

    code

    You use a simple if statement. example: if ($userismember) { // show this } else { // show that }
  13. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=340820.0
  14. Why? They are essentially the same. There is nothing wrong (syntax wise) with the original code.
  15. It is not recommended to do that. It actually makes the md5 less secure.
  16. Your going to have to start debugging. I'd start by echoing $weapon_name_check and $weapon_name and see if they do indeed contain what you think. How do you even know it's not working? And again I ask, why aren't you doing these checks in a query?
  17. Where is $weapon_name defined? Also, why aren't you simply querying the database for this?
  18. You really should check your queries succeed of fail (in your code) before proceeding. Anyway, range is a reserved word in mysql. You should change the name of the field to something that isn't reserved, or you can (not recommended) souround the reserved word in `backticks`.
  19. Have you done any debugging at all? Your not even checking to see if mysql_query fails or not.
  20. trq

    Function

    Take a look at the rand function.
  21. How hard would it be to do? That really depends. This is the kind of thing I could knock together in about 5 - 10 minutes, your time may obviously vary though. As for when I'll be on here, I'm on here quite allot. Though there are many people who could answer your questions.
  22. No. As the manual says, it means the full path to the file. And the name of the file.
  23. Once again I have had to move one of your threads because it is in the wrong board. Asking for help to search for something is not related to any PHP coding issue.
×
×
  • 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.