Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Posts posted by justsomeguy

  1. You need to add a "value" to each of the radio buttons. This entire list needs to be reformatted. All the radio buttons need the same "name" attribute, but each one needs a different "value" attribute. Like this:

    <input type="radio" name="CVreference" value="something">Something<br><input type="radio" name="CVreference" value="another">Another<br><input type="radio" name="CVreference" value="other">Other<br>

    Notice that they all have the same "name", and that the "value" is different for each. Then in the PHP page, when you get the value of the radio button from $_POST, it will equal the value of whatever they chose.The way you have it set up now, none of the radio buttons have a name at all, and some have a value and some have an id.Edit: I'm retarded, they do all have a name. But they each need a value, delete the ids.

  2. There's still something missing, which might be the problem. In the edit challenges function, you have a list of global variables at the top. One of the global variables is $cid, which is the id number of the challenge that was clicked on. But I don't see the section where $cid is being saved from the previous page (when you click on it). I see it getting passed along to the next page, but I don't see it being retrieved anywhere. Do a search in the console.php page, and search for $cid. Look for a line where you see $cid on the left side of the equals:$cid = xxxxxor something similar. Or maybe a function call likegetvalue("cid", $cid);Another thing you can do to verify that $cid is actually storing a value is echo $cid right after the function starts. After the global line in the editchallenges function, write this:

    echo "<script type=\"text/javascript\">alert(\"cid: {$cid}\");</script>";

    Click on one of the links and make sure the value matches what you see in the address bar. If the address bar says "console.php?p=EditChallenges&cid=13", then the value of cid you see should also be 13.

  3. Well, the CID is unique. The code you originally gave doesn't get the CID though, it is using a global variable. Post the console.php or whichever section gets the CID, it might be overwritten by something else, or it might not be getting retrieved correctly in the first place.

  4. I need more info, what happens when you try it? What do you mean it doesn't work.This is an easy problem, it's not complex. You want to click on a link with an ID in the querystring, and load some information about the ID on the next page. There 3 parts to this problem.The first one is the database. You need an ID column that is unique (I assume you have that set up correctly).The second one is the page to output all of the items, where you click. That's like this:

    $result = mysql_query("SELECT id, name FROM items ORDER BY id ASC");while ($row = mysql_fetch_assoc($result)){  echo "<a href=\"page.php?id={$row['id']}\">{$row['name']}</a><br>";}

    The third one is the lookup page that receives the ID and displays the item. That's like this:

    $id = $_GET['id'];$row = mysql_fetch_assoc(mysql_query("SELECT * FROM items WHERE id={$id}"));echo $row['name'] . " " . $row['info'] . "<br>"; //etc

    Your original problem stated that you always get the info for id2, meaning that you are either outputting id2 for all links, or you always set the id to id2 before you get the info.Post what code you are using now, and detail what the problem is (and any error messages) and I'll do what I can.

  5. You didn't actually say what the problem was. There aren't any details about which DDL commands, what the program does, what tables you are creating, what specifically you do that causes an error, or what the error is.Also, I think people tend to react negatively when you say your request is urgent. It's not urgent to us, it's urgent to you, I think people tend to brush those things off.

  6. Sure man, you can do whatever you want. But it will take two queries (one for the first sum and one for the second).Select Sum(Amount) from table where RDate between '01-07-2006' and '08-07-2006'Select Sum(Amount) from table where RDate between '09-07-2006' and '20-07-2006'Is there some reason you need them both in the same query?

  7. There are several differences between postgreSQL and MySQL, but most of them are relatively minor things that most people don't get involved with, like triggers and views. The newest versions of MySQL have added a lot of the features that were missing. The different databases also handle different data sizes better or worse, but there are people on both sides who will argue which one is better. Both of them are free, both are open source, both of them are fast, both of them are stable. There's little difference to which one you use in most situations, if you are using a database wrapper like Pear or something you build yourself you can basically switch between them without having to change your code.And yes, PHP also supports postgres:http://us2.php.net/manual/en/ref.pgsql.phpAlso, that link above that is pro-postgreSQL is obviously biased:

    ... is a RDMBS that has grown alone, instead of MySQL which is a hack of several tools "glued" together (MSQL, Berkeley DB). This lead to weird things like ISAM, MYISAM, BerkeleyDB, InnoDB, HEAP, MERGE, and Gemini table types (!?!) and other hybrid designs on MySQL's core..
    Calling your competition a hack and using the punctuation "!?!" anywhere tells you that these guys are out to pimp postgres. In all actuality, you can pretty much use whichever one your server supports (or flip a coin if you want) and not see much of a difference, unless maybe you're building the next amazon.com or something. BTW, I think both amazon and yahoo use PHP/MySQL.Edit: here's a comparison of the two:http://www.databasejournal.com/features/my...cle.php/3288951I'm not sure about Amazon, but I know that places like Google, Slashdot, LiveJournal, etc use MySQL. Here is their customer list:http://www.mysql.com/customers/And here it is for postgres:http://www.postgresql.org/about/usersI think this is funny:LAMP (Linux/Apache/Middleware(Perl,PHP,Python,Ruby)/PostgreSQLApparently now the 'M' is middleware, and the 'P' is postgres. I thought it was Linux/Apache/MySQL/PHP.
  8. Well you're just selecting tblRating.Count, you aren't calculating it. You are calculating RatingCount by adding up the the number of times you see AIM_ACHIEV.RATING.I took the liberty to format this thing, all the inline inner joins make it difficult to read. And there are a lot of parentheses in there you don't need. What are you trying to do, get the number of times each distinct description appears?

    SELECT DISTINCT tblRating.Description, Count(AIM_ACHIEV.RATING) AS RatingCount, tblRating.CountFROM (  AIM INNER JOIN   (    (      (        (          AIM_ACHIEV INNER JOIN            AIM_OBJ_DELIV ON AIM_ACHIEV.OUTPUT_ID = AIM_OBJ_DELIV.ID        ) INNER JOIN          tblRating ON AIM_ACHIEV.RATING = tblRating.Rating      ) INNER JOIN        AIM_OBJ ON AIM_OBJ_DELIV.STRATEGY_ID = AIM_OBJ.ID    ) INNER JOIN      KEYCOUNCIL ON AIM_OBJ.KCID = KEYCOUNCIL.ID  ) ON AIM.ID = KEYCOUNCIL.AIM_ID) INNER JOIN   CSF ON AIM.CSF_ID = CSF.IDWHERE  (    ((FinYearQuarter([QTRDATE]))=[Quarter]) AND    ((AIM_OBJ_DELIV.STATUS)=-1) AND    ((AIM_OBJ.CORPORATEPLAN)=-1)  ) OR  (((AIM_OBJ.AIPLAN)=-1))GROUP BY tblRating.Description, tblRating.Count, CSF.IDHAVING (((CSF.ID)=[ThemeID]))ORDER BY tblRating.Count;

  9. What are you trying to do? What is the relationship between text1 and text2? Are you saying you want to get all text fields that have the same label?

  10. Here's one example of what I'm talking about:sshd: Authentication Failures: root (218.188.2.148 ): 7 Time(s) root (103-mo5-2.acn.waw.pl ): 2 Time(s) unknown (218.188.2.148 ): 268 Time(s) admin (200.242.79.172 ): 1 Time(s) unknown (200.242.79.172 ): 2 Time(s) unknown (bsn-95-249-239.dsl.siol.net ): 1 Time(s) lp (218.188.2.148 ): 1 Time(s) root (218.63.200.199 ): 8 Time(s)We can see where some of these IPs are located:IP: 218.188.2.148Country: Hong KongCity: Hong Kong, Hong Kong (Sar)IP: 200.242.79.172Country: BrazilCity: UnknownIP: 218.63.200.199Country: ChinaCity: Yunnan, Yunnansiol.net is located in Slovenia, and waw.pl is obviously Polish. I doubt you want to let these people access your self-configured Windows machine. Some script kiddie from HK trying to log in under 268 different accounts isn't looking to do me any good. Server admins make very good money, and the reason they make good money isn't because servers are easy to lock down, let alone home Windows machines.If you DO install a test server at your home, it is a good idea to start up the server, and from the same machine, go to grc.com and run a Shields UP test. If your computer responds on port 80 (or really any port for that matter), shut down the server immediately and reconfigure your firewall before running the server again.This isn't something you want to be naive about.

  11. EasyPHP is not designed to be used as a production server, but as developing server to test your pages offline before moving them on the hosting server. Indeed, Apache for Windows is a test version, and is not guaranteed for an optimal operation (reliability, load rising, ...) contrary to Unix/Linux based platforms.Using EasyPHP as a "production" server, that can be reached through an intranet or internet is therefore at your own risks.
    EasyPHP is a development tool, it should not be used to host or support anything online. That's what actual webservers are for. If you intend on hosting internet content on your home computer, the first thing you need is a static IP address. Most ISPs charge considerably more for a static IP address (such as a T1; cable, DSL, modems etc are generally not static), but that depends on where you live.EasyPHP is intended to make installing and setting up a development server easy (hence the name). The alternative to this is something like I have running at home. My computer there is running Microsoft's webserver software (IIS), and I manually installed and configured PHP, MySQL, and phpMyAdmin. It takes a bit of work to do, which is why EasyPHP exists. But even so, I wouldn't even think of opening up my network to incoming internet traffic, a quick look at the server logs at work that show hundreds of login requests from China and South America tells me that I want to worry about development, not securing my server against foreign hackers that I have no legal recourse against.
  12. According to the XSL functions description on the PHP home site, the extension is built in, but it requres the libxslt to be installed and to add the argument --with-xsl[=DIR] to my configure line. I downloaded the library, but how do I install it? And where the heck is that configuration line? Is it somewhere in the php.ini file? If so, where?

    Configuration options like that are compiler options, you include that when compiling PHP from source code. I believe that the zip package of PHP available on php.net is compiled with support for all of the extensions on php.net, but the Windows installer is not. If you already have a binary of the PHP engine, you don't use those configuration options.Similarly, you only need to have the libxslt library available at compile time, not runtime. Libraries like that are compiled into the PHP binary. If you go to the libxslt site, you will see that it is called the The XSLT C library, it is for the C language and is linked to during compilation. That is why the zip distribution of PHP is so much larger than the Windows installer, because all of those libraries have been included. If you are running off the zip binary (or off a commercial webserver), then you probably already have support. If this code executes, you have support:
    $xsl = new XSLTProcessor();

    Also, try this for performing your transformation:

    $xsl = new XSLTProcessor();$doc->load($xsl_filename);$xsl->importStyleSheet($doc);$doc->load($xml_filename);echo $xsl->transformToXML($doc);

    More help is on the php.net pages for XSL functions, although there is no versioning information. Due to the fact that this is an object-oriented extension, it might only work in PHP5.

  13. Checkboxes can take any value. In the "value" attribute of a checkbox, you specify which value you want sent to the server if the checkbox is selected. If the checkbox is not selected, no value is sent (i.e. the variable name is not even part of the request). In the example here, if the checkbox is clicked the server receives a variable called "delbox" with a value of "1". If the checkbox is not clicked, the server doesn't receive the "delbox" variable at all.Now for the code. As Selacius said, you need to give each checkbox a unique name. Hopefully you have an 'id' field or something in the database (using $i alone isn't reliable, in case the list of players changes between the time you view the page and the time you submit it).

    <form action="url/members_delete.php" method="post" name="members_del"><?php$sql->QueryRow("SELECT * from members ORDER BY player");for ($i = 0; $i < $sql->rows; $i++) {   $sql->Fetch($i);   $id = $sql->data[0];      //I'm not sure of the index, if any, of your ID column  $player = $sql->data[2];   $class = $sql->data[3];  $profone = $sql->data[4];  $proftwo = $sql->data[5];  $delbox = $sql->data[6];?>  <tr>    <td width="20%"> <input type="checkbox" value="1" name="delbox_<?php echo $id; ?>"> --------------></td>

    That will attach the id to the name of each checkbox, so they all have different names.The rest of the HTML is the same.For your PHP page, you need to do something similar.

    <?phprequire("url/php/db.inc.php");$sql->QueryRow("SELECT id from members");$affected_rows = 0;for ($i = 0; $i < $sql->rows; $i++) {   $sql->Fetch($i);  $id = $sql[0];  $delbox = $_POST["delbox_" . $id];  if ($delbox == "1")  {    $sql2 = new MySQL_class;    $sql2->Create("mydb");    $sql2->Delete("DELETE FROM members WHERE id={$id}");    $affected_rows++;  }}?>

    With this, you don't need a page in the middle that updates the value. If you want to delete them, there's no need to update the database, just go ahead and delete them. But this way requires one query per deletion, if you want to group all of them into a single query you could make a list like this:

    <?phprequire("url/php/db.inc.php");$sql->QueryRow("SELECT id from members");$ids_to_delete = "";for ($i = 0; $i < $sql->rows; $i++) {   $sql->Fetch($i);  $id = $sql[0];  $delbox = $_POST["delbox_" . $id];  if ($delbox == "1")  {    if ($ids_to_delete != "")      $ids_to_delete .= ",";    $ids_to_delete .= $id;  }}if ($ids_to_delete != ""){  $sql = new MySQL_class;  $sql->Create("mydb");  $sql->Delete("DELETE FROM members WHERE id IN ({$ids_to_delete})");}?>

  14. You can also use PHP to create an image that shows the email address, but it wouldn't be able to be clicked on to email unless you still have javascript that obfuscates the address.

  15. NONE of the members or the moderators have any direct control over the configuration of the w3school site and the w3school forum
    I wasn't sure about that when I asked, I thought that maybe the operators also looked at the forum, or even just the suggestions area. I already emailed Hege Refsnes, so hopefully she can take a second to log into Network Solutions and make the change.
    We can only ask that you understand and respect the decision that has been made.
    Done and done. My suggestion was about the DNS, I just threw in the 1 line about guest accounts because I didn't want to create a forum account just to ask someone to update the DNS server. I didn't realize that would cause what it did, but it's not a big deal to me. It's your forum, you run it how you want.
  16. You could also just configure the server to send html files to the PHP engine, but that would slow down response times slightly for html pages. But you wouldn't have to rename anything.You can also use:include()include_once()require()require_once()Depending on what your requirements are (no pun intended).

  17. Wow, I missed a glaring step. Here's your query:

    $sql = "UPDATE page SET `sortorder` = '$insert' ORDER BY `id` DESC";

    You are missing your WHERE clause, so all rows get updated with the same value (whatever the last value was, all rows will have that value). UPDATE queries also do not have an ORDER BY clause. Here you go:

    $sql = "UPDATE page SET `sortorder` = '{$insert}' WHERE id = '{$row['id']}'";

  18. You can't use fopen to write a file over http. The http protocol doesn't support that. One thing you can do is to create the file locally first, save it and everything, and then open a ftp connection to the subdomain and transfer it across.Here are the FTP functions:http://us2.php.net/manual/en/ref.ftp.phpYou will use functions in this order:ftp_connect (connect to the server)ftp_login (login to the server)ftp_chdir (change to the subdomain folder)ftp_put (upload the file)ftp_close (close the connection)

  19. There are a few things I would change. First, in your html you call the variable 'sortorder', and in the php you just say 'order'. That's an error.One thing I would change is not to use an array to pass post variables, just separate it with an underscore:

    echo "<td class='alt2'><input type='text' name='sortorder_{$row['id']}' value='{$row[sortorder]}'></td></tr>";

    Which makes this part easy (there are a few changes):page.php?action=order:

    $sql = "SELECT * FROM `page` ORDER BY `id` DESC";$result = mysql_query($sql) or die(mysql_error());while ($row = mysql_fetch_assoc($result)){  $insert = $_POST["sortorder_" . $row['id']];  $sql = "UPDATE page SET `sortorder` = '$insert' ORDER BY `id` DESC";   mysql_query($sql) or die(mysql_error());  echo "<script type=\"text/javascript\">location.href=\"page.php?show=all\";</script>";}

×
×
  • Create New...