Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Everything posted by justsomeguy

  1. 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.
  2. justsomeguy

    SQL Help

    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?
  3. 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: 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.
  4. justsomeguy

    query problem

    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;
  5. justsomeguy

    SQL Help needed

    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?
  6. justsomeguy

    easyphp help

    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.
  7. justsomeguy

    easyphp help

    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.
  8. 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.
  9. 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})");}?>
  10. 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.
  11. 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. 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.
  12. Interesting. Just for clarity, surround your variable with curly brackets (and add the single quotes): $insert = $_POST["sortorder{$row['id']}"];
  13. OK, let's back up. Post the relevant HTML and PHP code again.
  14. You can always just use a multidimensional array.$values[$x][$y][$z];Where 0 <= $x <= 80 <= $y <= 80 <= $z <= 3
  15. 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).
  16. 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']}'";
  17. 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)
  18. 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>";}
  19. Is there a question there somewhere that I missed?
  20. It should be safe to change this option.I'm not entirely sure how webservers execute PHP (and each host I'm sure can do it however they want), but changing this should not affect others on the shared host. For security risks, there is only a risk if you make the directory world-readable. Make sure that only your account can access it, not the anonymous web account. Also browse to the directory (in a web browser) and make sure it does not show the contents. If it does, you can always add an empty index.php.You need to change the option every time you use sessions, it will not carry over from one execution of PHP to the next. Each time PHP executes, it loads the options from php.ini, so you will have to change it each time. If you have an include file with configuration options that you use on every page, that would be a good place for it.
  21. Wow.All I can say is this:http://us2.php.net/manual/en/install.windows.manual.phpThere's an entire section of the PHP website devoted to this, it's not something that can be listed in 1 post in a forum.
  22. Well, you can actually dynamically set where session info is stored. This is the ini option:session.save_pathYou can use the ini_get function to see the current value (ini_get("session.save_path")), and you can also use session_save_path to get/set this option:http://us2.php.net/manual/en/function.session-save-path.php (see the comments on that page as well)Just make sure you set the save path before any calls to session_start are made.
  23. Dan is correct, you are sending the javascript code before you send the actual page. You will want to send all of the page information, and display the javascript last (ideally, you will want the javascript to appear before the closing </body> tag, so you may need to indicate an error in message_rep.php, but have message.php or index.php check if an error occurred and actually send the javascript). This is the reason why both the page is blank and the content is misaligned - the browser doesn't know how to handle the javascript code coming first. If you want the popup over the page with the content already on it (not a blank page), send the page first, then send the javascript code.
  24. Hmm.. well, depending on what kind of access you have to the server, you could probably locate the directory where PHP is storing the session information (specified in php.ini), and simply delete all the files. You can go one step further, and get your own session ID, and delete all other files, so that you stay logged in. Of course, you can also just manually delete the files.
×
×
  • Create New...