Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. Right. It looks like what I posted before with the mysql_fetch_assoc. That looks like the loop runs as long as there are still rows to do something with in rs and .MoveNext looks like it moves the internal pointer to the next row in rs, just like mysql_fetch_assoc does.
  2. It looks like it's for looping through the sql results. With PHP, after you query the database, it returns a result source (assuming it's valid and there are results to return, etc..) and you then have to retrieve the info out of the result source using a number of functions. I assume that since in ASP you are refering to column names from the result, you'll want to use like mysql_fetch_assoc so a basic PHP query scenario would look like this: $sql = "select column from table"; $rs = mysql_query($sql); while($info = mysql_fetch_assoc($rs)) { $x = $info['column']; echo "$x <br />"; } $rs is the result source returned. The loop iterates while the condition is true. What the condition does is grabs the first row in the result source and assigns it to $info and moves an internal pointer to the next row in the result source.
  3. I was just asking how you know whether something is necessary or not when you said you didn't know what the script was supposed to be doing. I think that's a valid question, don't you? And anyways, what other part did you need translated? I don't really see any other pieces in there that are different than the earlier pieces that were already translated, that you can't just wash, rinse and repeat, unless I missed something? But more importantly, like I and others have said, we can't really help you all that much unless we know what it is you're trying to do. Going back to the whole language translation thing. Go to any language translator and enter in a sentence and translate it to a different language like say, spanish. Or go to a spanish site, pick a sentence, and try to translate it. It's not going to come out the way we would "normally" say it in english, and in fact, it might not mean the same thing at all! Again, if you want some real help, you need to tell us what it is your script is supposed to be doing.
  4. Well I mean, am I understanding it right, that the variable name is stored in your table too?
  5. Could be wrong, but if I understand correct, you need to use eval() to get php to parse the var like that.
  6. I guess it kind of depends on your specific situation. I mean, there really isn't a whole lot to the proverbial "blahbblahblah read more..." thing.
  7. And that's why the product industry is going downhill and being replaced by the service industry.
  8. Yes.
  9. umm...no offense, but how do you know whether some of it is needed or not, if you're not sure what it's supposed to be doing?
  10. I don't really know asp but from a general coding perspective it looks like you're trying to do this (after the part you already have): looks like you're trying to find out how many rows are returned? that would translate to $x = mysql_num_rows($rs); would be $x = $x + 0.9; $col1 = round($x / 3); I'm assuming this isn't the end of the code, and you are incrementing m in that do while somewhere and doing something with tempcatname? Not really sure how you are using tempcatname but if it's just a simple var being assigned something new on each iteration, it would be: while ($m < $col1) { $t = mysql_fetch_assoc($rs); $tempcatname = $t['Categoryname']; // other code here } translating all that literally kinda makes me think that there is probably a better way to actually "say" it (kind of like how literally translating something from one language to another sounds funny grammar wise, etc..) Maybe if you explain what it is you're trying to do, a more "grammatically correct" way can be given.
  11. fopen opens a resource stream. You would use fread to read the contents and fwrite to write the contents. file_get_contents requires the actual file name and it reads the file into a giant string of the file's contents, so you don't really use file_get_contents with fopen. You'd really be using one or the other.
  12. You obviously don't have very much experience teaching people.
  13. $q = mysql_query(" SELECT * FROM table ORDER BY rand( ) LIMIT 1 "); $r = mysql_fetch_array($q); foreach ($r as $key => $val) { echo "$key => $val <br/>"; }
  14. what is the spam?
  15. It's always about you, isn't it?
  16. you do not need backticks on column or table names unless they are named the same as reserved words (which you shouldn't be doing)
  17. desc counts down so if commid was like 100, 12, 42, 20, 52 it would return 100 52 42 20 12
  18. okay this is a crappy table I know (I don't really do layout, sorry), but here are the loops for that array and hopefully if the table is not to your liking that should be all you have to play with: echo "<table border = '1'><tr>"; foreach($data as $year => $yearinfo) { echo "<td>"; echo "<table border = '1'>"; echo "<tr>$year</tr>"; echo "<tr>"; foreach($yearinfo as $month => $monthinfo) { if ($month != 'pp') { echo "<td>"; echo "<table border = '1'>"; echo "<tr><td>$month</td></tr>"; foreach($monthinfo as $val) { echo "<tr><td>$val</td></tr>"; } // end foreach $monthinfo echo "</table>"; echo "</td>"; } // end if $month != 'pp } // end foreach $yearinfo echo "</tr>"; echo "</table>"; echo "</td>"; } // end foreach $data echo "</tr></table>"; p.s.- I'm not really sure what you are trying to sort so I didn't include any kind of sorting in this. I just went off the table layout you made.
  19. $this is an alias for the class name. You can't use it outside of the class.
  20. because php is parsed on the server and the output is then sent to the browser. Your browser doesn't know anything about $java. By the time it gets to the browser all it sees is your tags.
  21. so...does that folder have appropriate permissions? just for shits and grins, try this: <?php session_start(); echo session_id(); ?> does something echo?
  22. De ja vu... I hear marketing people make lots of money coming up with stuff like this...
  23. De ja vu? I hear marketing people make tons of money to come up with stuff like that...
  24. It's really simple: page1.php <?php // must have this before any output and before you want to use session vars // must even be on the page where the session var is first set session_start(); // example session var $_SESSION['logged'] = 1; // example to get to next page. can use header() or whatever who cares echo "<a href = 'page2.php'>page2</a>"; ?> page2.php <?php session_start(); // is there a session var called 'logged' and does it equal 1? if ($_SESSION['logged'] == 1) { echo "yay!"; } else { echo "nay!"; } ?> If that's the basic format you have and you're sure everything is spelled right etc.. then perhaps you have cookies turned off in your browser?
  25. Okay well I would certainly never do a nested ternary like that. Also, one-man wave I think not! I have many imaginary friends. It helps if I've been drinking...
×
×
  • 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.