Jump to content

xProteuSx

Members
  • Posts

    476
  • Joined

  • Last visited

Everything posted by xProteuSx

  1. I hope I can make someone understand what the problem is ... its 1 am and I am crashing hard. The whole problem is that this snippet really does not like the <ol type="a"> outside of the 'while' loop. What I am trying to do is, say the array has 4 variables, I would like a., b., c., and d., to appear to the left of the <input type="radio" name="answer" value="' . $value . '"> button(s). Now, I am getting something there, but I am getting 0., 0., 0., and 0. instead of the letters. Please help!!!! Thanks in advance. echo '<center>'; echo '<form action="mark_spec.php">'; echo '<ol type="a">'; while (list($key,$value) = each($answers_array)) { echo '<table width="400" cellspacing="0" cellpadding="2">'; echo '<tr>'; echo '<td valign="top">'; echo '<li>'; echo '<font size="-1"> <input type="radio" name="answer" value="' . $value . '"></font>'; echo '</td>'; echo '<td valign="top">'; echo '<font size="-1">' . $value . '</font>'; echo '</li>'; echo '</td>'; echo '</tr>'; echo '</table>'; } echo '</ol>'; echo '<input type="submit" value="Check Answer">'; echo '</form>'; echo '</center>';
  2. I hope I can make someone understand what the problem is ... its 1 am and I am crashing hard. The whole problem is that this snippet really does not like the <ol type="a"> outside of the 'while' loop. What I am trying to do is, say the array has 4 variables, I would like a., b., c., and d., to appear to the left of the <input type="radio" name="answer" value="' . $value . '"> button(s). Now, I am getting something there, but I am getting 0., 0., 0., and 0. instead of the letters. Please help!!!! Thanks in advance. echo '<center>'; echo '<form action="mark_spec.php">'; echo '<ol type="a">'; while (list($key,$value) = each($answers_array)) { echo '<table width="400" cellspacing="0" cellpadding="2">'; echo '<tr>'; echo '<td valign="top">'; echo '<li>'; echo '<font size="-1"> <input type="radio" name="answer" value="' . $value . '"></font>'; echo '</td>'; echo '<td valign="top">'; echo '<font size="-1">' . $value . '</font>'; echo '</li>'; echo '</td>'; echo '</tr>'; echo '</table>'; } echo '</ol>'; echo '<input type="submit" value="Check Answer">'; echo '</form>'; echo '</center>';
  3. I am really new to this whole WYSIWYG idea, and I am trying to find out how to implement it on the numerous forms that I have on my website. The editors that I have come across, so far, have been for single text fields and are much too complex for what I need. Any ideas? I have spent a lot of time searching, and the frustration is starting to get to me. Thanks for all your help.
  4. Thank you guys. I got it to work. Consider this topic SOLVED. However, if you have a minute ... Why is the 'total' alias needed? (as in 'SELECT SUM(users_pagesviewed) as total FROM users'). Why can't it just be 'SELECT SUM(users_pagesviewed) FROM users'?? Just trying to learn the reasoning ... thanks again.
  5. Thanks for your input guys. Northern Flame, I was looking to do something without a loop. It figured that there would be a function which would tally a column. God knows it would be a function used often. So what pocobueno1388 was saying was along the lines of what I expected. I have done the following, pocobueno: $tallypageviews = mysql_query("SELECT SUM(users_pagesviewed) as total FROM users"); echo 'Pages Viewed By All Members: '; echo $tallypageviews; However, the output is: Pages Viewed By All Members: Resource id #14 I'm trying to figure this one out, but help would be appreciated.
  6. I am trying to figure out how to tally the column in a table. I have a table, and for each user there is a value in the 'PagesViewed' column. I would like to add up the page views of all the users in the database. How do I go about doing this? If I use a 'FOR' loop this would take a lot of calculation. Is there an easier way? Thanks in advance.
  7. Right on! That did it. I have yet to learn about 'mysql_fetch_assoc' so that's why I could not figure this out on my own. Thanks very much. This topic is now SOLVED ... speaking of which, wasn't there a 'Solved' button somewhere before??
  8. rhodesa, the code you have given me does not seem to function (even when I put the missing ';' following 'mysql_data_seek($result,$num-1)'. I have a couple of questions, if you don't mind. First of all, what does 'if($num)' do? That does not seem like a proper boolean argument to me. Am I missing something? Second, '$last['handle]' comes back blank. I have changed the tablename. My table is entitled 'users' and I am looking to get the value of the 'handle' column for the last row. I have it as ... <?php $sql = "SELECT * FROM `users` ORDER BY 'id'"; $result = mysql_query($sql); $num = mysql_num_rows($result); if($num){ mysql_data_seek($result,$num-1) $last = mysql_fetch_array($result); echo 'The last registered member is: ' . $last['handle']; } ?>
  9. Caesar, thanks for you input. I will try this out soon, and I will get back to you about whether it works. Thanks a bunch.
  10. So, if $numberofrows is the number of rows in a table I can get the data as follows?? $specificresult = mysql_query(mysql_data_seek($numberofrows)) or die (mysql_error()); I have never used this function before, and the official manual is confusing the crap out of me.
  11. I understand what you are saying, but the problem is that the IP's do not start with only 24. They start with a whole whack of different numbers. I could write a huge series of IF statments, but that would be very harsh on the server, right? I mean, it would have a branching effect and would result in hundreds, if not thousands, of IF statements. I'm wondering if there isn't a way to load the numbers into an array and just run it through a single loop. Know what I mean?
  12. I am writing a PHP script that determines the number of rows in a mysql table, then goes to the last row and retrieves data from that row. I have written a script which determines the number or rows, but how do I get it to read data from the last row specifically?
  13. Here is a sample section of the file: 24.108.0.0 24.109.255.255 24.114.0.0 24.114.255.255 24.122.0.0 24.122.255.255 24.129.224.0 24.129.239.255 24.137.32.0 24.137.47.255 24.137.64.0 24.137.127.255 24.137.192.0 24.137.223.255 24.138.0.0 24.138.191.255 24.139.0.0 24.139.31.255 24.141.0.0 24.141.255.255 24.146.0.0 24.146.31.255 24.150.0.0 24.150.255.255 24.153.0.0 24.153.31.255 24.156.128.0 24.156.159.255 24.200.0.0 24.203.255.255 24.207.0.0 24.207.127.255 24.212.0.0 24.212.127.255 24.213.64.0 24.213.95.255 24.215.0.0 24.215.127.255 24.222.0.0 24.222.255.255 24.224.128.0 24.224.255.255 It goes on and on, but it looks like this ... hope that helps.
  14. I am writing a small snippet which displays a particular HTML table but only if the IP is a Canadian one. I have downloaded a file with Canadian IP ranges from http://www.ipaddresslocation.org/ip_ranges/get_ranges.php and I am trying to figure out what the easiest way to run the script is, without causing the PHP server to crap out. I don't know how hard it is for a server to run an IF statement that includes so many 'variables'. Any ideas? Would it be best to do this as an array? If so, how do I go about doing it? Thanks in advance guys!
  15. I will try this out when I get the chance. Thanks. I assume it will work.
  16. Are you trying to write to a table, or are you trying to read from a table? The SELECT option is used to read from a table. If you answer this question, someone will be able to help you.
  17. Is there a way to do the following: Have a link on page1.php that sends a variable to page page2.php which then modifies a DB then automatically goes back to page1.php? I have a small table that requests info from a DB and I want to provide a button that will go to a page with a small script that updates the DB then reloads the original page with the updated table. Is this possible without pausing at page2.php?
  18. Go to Edit -> Preferences -> Site and make sure the two boxes named 'Prompt on get/check out' and 'Prompt on put/check in' are NOT checked.
  19. Effigy and Fenway. Thanks for your help. I am just amidst finding out, from my host, if there have been any updates to MySQL. I am starting to lean to that direction. Thanks again.
  20. Effigy ... lol ... I'll try to take in some deep and consistent breaths. Being that I am very new to all this, but have been hacked a few times before, I am very uncomfortable with the idea of the appearance of mysterious files and/or databases. I do see that it is on the official MySQL site, and it doesn't sound threatening, but why does it pop up now? Did I trigger it, or is it an automated thing? Usually, if something on a website changes, I assume that someone made it change. And since it wasn't me ... (or at least I don't think it was). Thanks for you help. I love these boards.
  21. I'm sorry Effigy, I can't figure out what this is. Can you please take a minute to spell this out for my in layman's terms? I really don't know what I am into here. Have I been hacked? If so, what is this hack capable of doing? Can I get a tool to scan my site so that I can find the hole in my security? I really cannot have this happen again. I have worked really hard to write the code for my site. I would be devastated if it was destroyed.
  22. I have been gone for about 3 weeks and upon coming back I have discovered that there is now a 'mystery' database on my website. It is entitled 'information schema' and contains 17 tables. Does anyone know what the hell this is, and what it does? What can I do to prevent it?
  23. Agentsteal, or anyone else who can help: How do I go about eliminating these 'Array' problems? Array: http://www.mcatzone.com/mark_rand.php?a20[] Array: http://www.mcatzone.com/mark_spec.php?answer[] Kudos.
  24. For those who are following this thread ... If you can't get this to work: if (!ereg("^[a-zA-Z0-9]{4,12}$", $string) { echo 'You have entered an invalid character, or your sting is not 4-12 characters long.'; } This should fix it: if (!ereg("^([a-zA-Z0-9]){4,12}$", $string) { echo 'You have entered an invalid character, or your sting is not 4-12 characters long.'; } That's just something that I found. I had the first snippet work on one page, but not on another. I did not take the time to figure out why, because this second snippet was the fix and I'm short on time.
  25. Also, I with this string, does it accept upper case characters? if (!eregi("^[a-z0-9]{4,12}4", $string)) or do I have to do this: if (!eregi("^[a-zA-Z0-9]{4,12}4", $string)) ??
×
×
  • 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.