Jump to content

RussellReal

Members
  • Posts

    1,773
  • Joined

  • Last visited

Everything posted by RussellReal

  1. if you want this INTERACTIVE you'd need to incorporate some javascript
  2. you could echo the names like so: choices[questionNumber][1] choices[questionNumber][2] choices[questionNumber][3] choices[questionNumber][4] for example.. while ($row = mysql_fetch_assoc($q)) { echo "$intNumber, {$info['Que_Question']} <br />\n"; for ($i =1; $i < 5; $i++) { echo "<input type=\"checkbox\" name=\"choices[{$row['id']}][{$i}]\" />{$row['Que_Choice'.$i]}"; } } and pull answers from $_POST[choices] by id $_POST[choices][idNumber]
  3. #1 your question is very vague, #2 mysql_fetch_array is more or less for looping numerically through a resultset, you're using mysql_fetch_array the way you would use mysql_fetch_assoc, you're pulling duplicate entries to the array for no reason with mysql_fetch_array.. but it really doesn't matter.. Bottom line, please rephrase your question
  4. its most likely conflicting rewriterules, if you have a rewrite rule like this: RewriteRule ^(.*)$ abc.php?x=$1 change it to: RewriteRule ^(.*)$ abc.php?x=$1 [L] that way it only redirects once
  5. linkWord(['cable':'http://google.com']); that should do it
  6. haha could be done in CSS Completely like HAKU said, I'll show you an example (without CSS:background-image hacks or CSS:background-position hacks) <style type="text/css"> a img { border: none; } a .dn { display: none; } a:hover .dn { display: block; } a:hover .up { display: none; } </style> <a href="link.html"> <img class='up' src="linkUp.gif" /> <img class='dn' src="linkDn.gif" /> </a> oh and to answer your question.. You're most likely better off using .src as setAttribute might not be supported by all browsers
  7. First, let me start by saying I'm not a porn site or a hacker.. So please no moral debate, I will explain exactly what I want it for in a moment. Basically what I need is something that will listen for when a page starts loading, to cancel the loading and then load up a different page Basically I have an iFrame which points to someone else's Java applet, I don't take credit away from them at all. That java applet if you click the close button, it will redirect the browser's top.location, instead of the frame that it is in.. Which then redirects the users away from my site.. I simply want to keep them on MY site until they navigate away from my page manually or if they close the browser. thanks
  8. Hey dude, I gave you the solution to your problem.. You could sit here waiting (hopefully) for someone to willingly fix your code for you, or you could attempt to fix it, come back if it doesn't work, and update the post
  9. everytime you loop you echo a new "<html>" block.. put the loop where the tables are
  10. if (!file_exists('../images/flags/imNum.txt')) { $file1 = fopen('../images/flags/imNum.txt','c'); fclose($file1); } why won't that work =\ it makes no sense to me
  11. Ok, let me draw up a scenario for you guys My site's code: lala.com <html><body> <iframe src="lol.com"></iframe> </body></html> lol.com's code: <html><body> <iframe src="random url"></iframe> </body></html> from lala.com I want to get lol.com's random url from their iframe.. I DO NOT WANT TO MODIFY THE DOM. BUT IF I MUST ITS OK I know that frames[0][0].location WILL WORK in internet explorer, but not in any other browser.. I need a cross browser solution, this feature is instrumental and needs immediate attention . THANKS!
  12. uhh.. yes you can.. where does $tbl get set @?
  13. this is not really a php question so much as it is an html question. try outputting each image like this: <div style="float: left;"> <div><img src="img/url/file.jpg" /></div> <div>Text goes here</div> </div>
  14. this can be done fairly easy.. but you need to make the inputs and stuff.. then the submit button onclick will gather all the information and trigger a parent function so you'd do something like this window.parent.formSubmit(field1,field2,field3,field4); and then in formSubmit, that will trigger the form to submit, after you make the form elements inside the form.. then set the values to those specific fields inside the parent's form.. because the fields inside the iframe will never be detectible by the form on the parents page.. so you'd need to manually send the data from the child to the parent like I said above.. goodluck
  15. you probably would want to change it to if/else then instead of if if if if ;P
  16. the only resource which is shared on a vps is the bandwidth.. on a vps you get ram, and then you get what they call burstable ram.. ram is what your account has dedicated.. so you will never be disallowed that much ram.. burstable ram is how much ram you could be bumped up to if other people aren't using as much RAM and your applications require more.. but that is your absolute max... and there is no guarantee to ever be able to touch your burstable ram limit.. most vps also give you a certain cpu percentage which you're dedicated, not sure if they have it set up for burstable also.. the only thing that is shared is the incoming and outgoing bandwidth
  17. if you're going to move to a VPS there are alot better VPS servers out there for less money than godaddy charges, I currently use WestHost (no this isn't a solicitation, no referral links here , just a friendly suggestion!) - Russell
  18. seems to only need 1 hidden update :)I doubt it would be any less effective than if it updated it the way it should on windows.. the only difference is it will make the script you're writing less portable.. but thats not a huge problem.
  19. I was also gonna suggest triggers, I think thats 2 thumbs up for triggers
  20. mm ur formatting is horrid echo "<tr> <td class='trow2' align='center' valign='center' width='1'></td> <td class='trow2' valign='center'> <strong><a href='server.php?view=details&id=" . $list['id'] . "'>" . capitalizeFirstCharacter($list['servername']) . "</a></strong> <div class=\"stat2\"> <div class=\"stat\">"; if(!$sock=@fsockopen($list_f['serverip'],$list_f['serverport'], $num, $error, 1)) { echo "<font color='red'><b>Offline</b></font>"; } else { echo "<font color='green'><b>Online</b></font>"; } echo "</div> </div> <div class='smalltext'>" . $list['shortdescription'] . "</div> </td> <td class='trow1' valign='middle' align='left' style='white-space: nowrap'><span class='smalltext'>" . $list['revision'] . "</span></td> <td class='trow2' valign='middle' align='right' style='white-space: nowrap'><font size='4px'>" . $voteAmount . " Votes</font></td> </tr>"; try that
  21. mysql_real_escape_string
  22. using a perm table for results than dropping results and adding results will add alot of overhead to that table, and will be alot of heavy operations.. I really doubt google uses mysql for their search engine.. Their search engine is really robust, and mysql has its limitations..temporary tables will speed up your results ten fold.. I was working on this project with this pretty cool group of people.. and they had like over 40million results in their database and they wanted to be able to index all of these in a seach and also add commenting functionality, and no matter how bad we tried to get the comments and the like working across 40 million results with just normal queries.. the queries were all over 1 second large with comment calculations and stuff, not to mention scanning 3 tables for data.. but then incorporating all of this information and cutting away results from the temp table.. instead of filtering directly from the result set (you know there were basic filters) but most of the filtering happened in the temp table.. and it sped it up dramatically to under 150ms/query on a good amount of server load.. temp tables are great because they are exclusively for that session with mysql, and aren't stored in the same way as permanent tables are.. so they're alot faster to work with.. also you can index them specifically for your application instead of working with indexs that are specific for the project as a whole.. I would look into temporary tables for sure
  23. oop is for like.. if you wanted to have more than 1 instance of the same code.. I'll write up a little class for you <?php class Game { public $players, $turn; public function changeTurn() { $this->turn = (($this->turn >= count($this->players)) 0:$this->turn + 1); echo "It is now {$players[$this->turn]->name}'s turn!"; } public function isTurn($player) { return (($player === $players[$this->turn])? true:false); } public function addPlayer($name) { $this->players[] = new Player($name); echo "New Player Has Joined!"; } public function scoredAPoint($score) { $this->players[$this->turn]->score += $score; echo "{$this->players[$this->turn]->name} Scored {$score} Points!"; } } class Player { public $name, $score; public function __construct($name) { $this->name = $name; $this->score = 0; } } ?> thats an example of a little game.. you can like make it an actual game with a server connection and stuff.. basically Player is an instantiable object.. to keep data specific to that Player the Game object is the object which indexs all of the players, its more of a package than an object.. but if you did make it an actual game, you would add connectivity functions to the Player class.. not the Game class, because each player needs to test connectivity individually.. etc.. a class for the MOST PART is just to have a batch of values and functions that work independantly and can be reused.. heres a script I made a while ago, its a server->client script.. it is long long ago so I don't know how good it is anymore, but it is a great example of using OOP http://lovinglori.com/newServer.phps I also wrote a connection class.. which you can use to create multiple connections.. wrapped in along with lots of easy to use functions.. <?php // Author: Russell Crevatas // E-Mail: RussellonMSN [AT] HotMail.com ~ Available For Hire // Scripted For: AltScripts.net class Connection { private $user, $pass, $host, $connection, $database, $lastResult; public function __construct($host,$user,$pass,$db = null) { $this->host = $host; $this->user = $user; $this->pass = $pass; $this->connect(); if ($db != null) { $this->db($db); } } public function close() { mysql_close($this->connection); } private function connect() { $this->connection = mysql_connect($this->host,$this->user,$this->pass); } public function db($database) { $this->database = $database; mysql_select_db($this->database,$this->connection); } public function query($query) { $this->lastResult = mysql_query($query,$this->connection); return $this->lastResult; } public function fetch_assoc($result = null) { $res = ((!$result)? $this->lastResult:$result); if ($res) return mysql_fetch_assoc($res); return false; } public function fetch_array($result = null) { $res = ((!$result)? $this->lastResult:$result); if ($res) return mysql_fetch_array($res); return false; } public function fetch_object($result = null) { $res = ((!$result)? $this->lastResult:$result); if ($res) return mysql_fetch_object($res); return false; } public function escape($string) { return mysql_real_escape_string($string,$this->connection); } public function rows($result = null) { $res = ((!$result)? $this->lastResult:$result); if ($res) return mysql_num_rows($res); return false; } public function id() { return mysql_insert_id($this->connection); } public function error() { return mysql_error($this->connection); } } ?> this is the version from an older project I've worked on, I've updated this class since.. however, the beauty of this being an object.. is I don't need to remember to specify an mysqlresult (which you get from mysql_query) in mysql_fetch_assoc and stuff.. since its an object you'll really only run 1 query at a time.. but in the event you do want to hold 1 result set and process another before the prior.. you can specify an optional field $result these are all 3 good examples of proper oop.. making a class just for 1 page which really doesn't NEED oop.. is just gonna give you a function feel to classes, classes are more powerful than just for that , although they lack in alot of ways in PHP compared to other languages, they're st ill really handy
  24. no doubt mark as solved THANKS!
×
×
  • 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.