Jump to content

stuffradio

Members
  • Posts

    253
  • Joined

  • Last visited

Everything posted by stuffradio

  1. Is it possible to hack php to make it so you can write a little mini type language for Browser based games? I don't know how to explain it exactly... but just write something that lets you write some things, and certain things will happen in the game.
  2. When I do something in the database like add or remove a row... it doesn't auto update. Any ideas? <script type="text/javascript"> function createRequestObject() { var req; if(window.XMLHttpRequest){ // Firefox, Safari, Opera... req = new XMLHttpRequest(); } else if(window.ActiveXObject) { // Internet Explorer 5+ req = new ActiveXObject("Microsoft.XMLHTTP"); } else { // There is an error creating the object, // just as an old browser is being used. alert('There was a problem creating the XMLHttpRequest object'); } return req; } // Make the XMLHttpRequest object var http = createRequestObject(); function sendRequest(act) { // Open PHP script for requests http.open('get', 'index.php?act='+act); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ // Text returned FROM PHP script var response = http.responseText; if(response) { // UPDATE ajaxTest content document.getElementById("countPosts").innerHTML = response; setTimeout(countPosts,20); } </script> <?php require_once('config.php'); if ($_GET['act'] == "countPosts") { $sql = mysql_query("SELECT * FROM `activate`"); echo "<div id='countPosts'>"; while($count = mysql_fetch_array($sql)) { echo "<b>".$count['id']."</b> - ".$count['code']."<br /><br />"; } echo "</div>"; }
  3. So... do you think I should basically copy what he has there, and change it to how I want? Or should I just learn the method that was used, and try and invent my own?
  4. I'm trying to do a php search script that searches a mysql table with 4 or 5 different checkbox items and about 12 other fields. I'm not sure how the best way would be to do this... I'm trying to use foreach, but how would I do this with the 5 different fields needing to have a checkbox, and they each have at least 2 values. Example: <input type='checkbox' name='Area[]' value='A'> <input type='checkbox' name='Area[]' value='B'> <input type='checkbox' name='Area[]' value='C'> <input type='checkbox' name='City[]' value='A'> <input type='checkbox' name='City[]' value='B'> <input type='checkbox' name='City[]' value='C'> etc. etc.
  5. I just need to design a really simple template system. What sorts of things do i need to use when making a templating system. I will be using Classes of course. I already know about simple things like require_once and includes... but I want it like Folders: Themes->Theme Name->index file Classes->Template.class(or something)->contains code for the templates What types of methods in PHP should I use to accomplish this? It's partly for my previous post I made in this forum and partly for educational purpose and practice with classes. Any suggestions?
  6. I think you should also use sockets for this(Don't hold me to this). I have never done anything like that... but that's just what I would think that I would try and do.
  7. <? $text = file('reading.txt'); $row = 4; // loop through array and output contents foreach($text as $chunk) { echo "<tr><td>" . $chunk . "</td></tr>\n"; if ($row == 0) { echo "<br />"; } } ?> That will and should do it for you
  8. I already know how to make games.. that's not the issue. I want them to be highly customizable via classes and OOP. I need to have an efficient structure in my files and directories so I can make everything nice and customizable, etc.
  9. It depends, what types of stuff will be tied in to it... what framework you're using for your existing website, etc. etc. Maybe describe a bit more and someone will tell you more
  10. Copy paste this code, it should be better and working for you. <?php $result = mysql_query("SELECT textblock FROM text WHERE textid = '3"'0) or die(mysql_error()); // Unless you are still debugging you need to remove the mysql_error part... it leaves for some potential exploits $row = mysql_fetch_array( $result ); $texttoedit = $row['textblock']; ?> <form action="<?php $PHP_SELF ?>" method="post" name="edittext" id="edittext"> <textarea name="edittext" cols="100" rows="40"><?php echo $texttoedit; ?></textarea> <input name="Submit" type="submit" value="Submit" name="Yourbutton"/> </form> <?php $editedtext = $_POST['edittext']; echo $editedtext; if ($_POST['Yourbutton']) { $query="UPDATE text SET textblock='$editedtext' WHERE textid = 3"; mysql_query($query); echo "Record Updated"; mysql_close(); } else { // Do nothing or add something here } ?>
  11. Can you give us an example of what you're using to pull this information so we can better help? Thanks
  12. '$this' is a saved variable... As in, in a function you use it to refer to itself. function testing($variable) { $this->$variable = "blah"; } Don't know if that helps you much... Don't know how to explain '=>' to you, somone will though!
  13. So this is a mysql query? mysql_query("SELECT * FROM `table_name` LIMIT 0,10"); That limits it to 10 results You can order it by Asc if you want to show first 10 rows or Desc if you want 10 last rows.
  14. Do you mean: <?php if (!file_exists('filename')) { echo "Error, file doesn't exist"; } else { echo "Success"; } ?> ??
  15. Well... just do what you did. Change file location to "Content/image.jpg" or whatever it was. When you include the html file on the main page... it includes it as if it's actually executing the file. So it's trying to get the file from /image.jpg not content/image.jpg
  16. Hello, it may be my first post... but I thought I was registered here before. Maybe I was inactive for a long time. Anywho, I'm making a PHP Game Maker/Manager. It'll have the options to make, and manage different categories of games: Turn Based RPG Virtual Pet etc. Here is what I'm planning(thoughts so far) Have a master account, allow that master account to choose games to make from a drop down list. They will choose a name, and I will be trying to make it highly customizable. How I'm going to do this, no idea. What can you suggest to me, how can I structure this out efficiently, any tips? I will incorporate my own subscription manager. It will run through paypal. It'll be pay what you want, but don't know if I should make a $1 minimum. Also, I am trying to contemplate whether or not I want to have a flat file based databased of domain addresses... and make it so the user has to have it on that url on my file so they can't freely distribute it. All these things are out in there, and I want this to be a success. Any tips are appreciated!
×
×
  • 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.