Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. To determine the duplicate primary key just do a simple select query before the update, but you should not be changing the primary key with an update. The nothing changed, well the rows affected means nothing changed. So yea. Either post up the actual update query with 2 or 3 rows of test data so we can see what is going on or hope that someone can understand you
  2. *premiso slaps hackalive around a bit with a large trout
  3. What platform is your server on? As with Linux / Debian the SSL is actually really simple and I am sure you can find many tutorials on this. I have never done this on Windows, which may be a bit more intuitive from what I have heard. Doing it with Debian goes like: apt-get install openssl Modify apache proxy list to include 443 (if it is not in there) Create a self-signed cert (or get a digital signed one from a site) modify vhosts of site, add a <VirtualHost IP:443> add the items to turn the SSL Engine on and link to your certificate. Restart apache and viola. Like I said, there are a bit of tutorials on how to do this widely available. Given that you did not state your platform, you will want to search for platform / server (as you failed to state whether you are using apache or not as well).
  4. Well it is obvious that phlegm is just being "hard" because it simply does not care. I mean it is not like it has emotions or anything.
  5. It is used with objects to access a property or method of an object. See OOP for more information on Object Oriented Programming. Basically $this means it is being used inside the context of an object (generally a class) so it calls itself. db is a property of the object and safeQuery is a method inside of the db property (which is probably an object itself).
  6. What? The message is only appended if the if statements have been ran. So only if one of those fields (or both) are empty, the message will be populated. That is the point of me encasing them in an if statement. Did you test the code? if (!empty($_SESSION['message'])) { header("Location: register.php"); exit(); } That portion of the code I posted sees if the message has been filled in (meaning that one of the fields were empty) if it has been filled in, then it will redirect. Else it continues on with the code.
  7. Update is a bit more complicated, probably the easier way to do it would be: foreach ($checkBoxes as $key) { $val = isset($_POST[$key])?trim($_POST[$key]):''; $data[] = $key . " = '" . $val . "'"; } $query = "UPDATE table SET " . implode(", ", $data) . " WHERE blah = blah";
  8. Just so you understand why it does not display them in a line, you do a redirect after each error. If you want to notify someone of all empty, you should collect the messages and then do a redirect if the message variable is not empty. include($config["paths"]["resources"] . '_library/login.php'); $_SESSION['message'] = ""; if (empty($_POST['email'])) $_SESSION['message'] .= "A email address is required.<br />"; if (empty($_POST['password'])) $_SESSION['message'] .= "A Password is required.<br />"; if (!empty($_SESSION['message'])) { header("Location: register.php"); exit(); } // moved this below, as there is no need to try and escape empty data $email = mysql_real_escape_string($_POST['email']); $password = mysql_real_escape_string($_POST['password']); // rest of the processing Should do what you want.
  9. There is. $checkBoxes = array("name", "changemx". "traceaddy"); // etc.... foreach ($checkBoxes as $key) { $data[$key] = isset($_POST[$key])?trim($_POST[$key]) : ''; } $query = "INSERT INTO product_features (" . implode(", ", $checkBoxes) . ") VALUES (" . implode("', '", $data) . ")"; Something like that should make life a bit easier.
  10. Is this declaration <VirtualHost http://localhost/domain.com> Still in your httpd.conf file at all? If so remove it. Other then that check your file and make sure that your links are not setup to that location.
  11. Not sure if this is it, but try removing the "s around the Document Root, you should also try and use the apachectl tool which you can run via command line with the -f path/to/vhosts/file to determine where the syntax error is. You may also try removing domain.dev from the server alias, it should not matter, but may.
  12. The only way to do that, afaik, is to handle it on the php end: $result = mysql_query("SELECT * FROM tablename WHERE primarykey IN(".implode(",",$randoms).")"); while ($row = mysql_fetch_assoc($result)) { $rows[$row['primarykey']] = $row; } foreach ($randoms as $key) { print_r($rows[$key]); } Something like that would work.
  13. Look into mysql_real_escape_string as that will escape any information going into the database properly.
  14. You would not "have" to have a review for the same game on multi-platforms. necessarily. You could if you want, but instead you could just do "Reviewed on Platform" then just do not link the reviews via category wise to a platform, if that makes sense...
  15. There are many different ways to do this, one check if $_POST['zip'] is isset and not empty if it is either, do not run the query and just display an error. Method 2, which is easier but not as intuitive as an error message would be is add single quotes around the zip value like below. $sql="SELECT * FROM shows WHERE zip = '". $_POST['zip."'"; Either should work.
  16. table reviews( id unsigned int not null auto-increment primary key, title varchar(45) not null, permalink varchar(45) not null, content text not null, genre_id unsigned int not null foreign key (genres) platform_id unsigned int not null foreign key (platforms) ) table platforms( id auto_inc primary, platform varchar(45) Would be what I would do. EDIT: If you have a games table, that would be the spot to put the platform_id or the pivot table. Either or should work.
  17. First up, why did you remove the error reporting portion? As it can be useful and if done right will not cause any dismay. Second, you are using $sql and not $result for the mysql_num_rows. $sql="SELECT * FROM shows WHERE zip = ".$_POST['zip'].""; $result=mysql_query($sql) or trigger_error("MySQL Failed: " . mysql_error()); $count = mysql_num_rows($result); As a side note, that code is possibly prone to SQL Injection. Before going public with it I would suggest looking into mysql_real_escape_string.
  18. Ok, just to make sure settings took place, try and reboot the computer. This should ensure that apache gets the new settings as well as the gpupdate. Also make sure that in the httpd.conf the vhosts include is uncommented out. I would comment out or remove the dummy vhosts from the vhosts file as well. Give those a try and see what comes of it.
  19. str_split will put the string into an array by characters. If you want to add a line break after each character do an implode on the variable you set it to with "\n" being the glue portion.
  20. $result = mysql_query ("SELECT * FROM shows WHERE zip = '75034' ") or trigger_error("MySQL Error: " . mysql_error()); The or section needs to be outside of the mysql_query function.
  21. Sorry, I may have mis-done the vhosts file. Modify it like so: <VirtualHost *:80> DocumentRoot "D:\zend_server_ce\Apache2\htdocs\domain.dev" ServerName domain.dev ServerAlias www.domain.dev *.domain.dev domain.dev Remember to do an apache reload after that has been done.
  22. QFT Not to mention that wireless keyboards/mice can have "lag times" and be a bit flaky at times and do sporadic movements. If you do go wireless, do not get bluetooth. Nothing worse then a bluetooth keyboard/mouse.
  23. Not really sure what you are asking, but depending on your PHP version, you can convert a JSON encoded array to a PHP array using the json_decode function. Which may make it easier to display / test data from that array.
  24. Ah. The issue is that you are using "localhost" whose documentroot is what you just posted above. To fix it, why not access your content via domain.dev here is an example vhost directory: <VirtualHost *:80> DocumentRoot "D:\zend_server_ce\Apache2\htdocs\domain.com" ServerName domain.dev www.domain.dev *.domain.dev CustomLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\access.log" combined ErrorLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\error.log" <Directory "D:\zend_server_ce\Apache2\htdocs\domain.dev\"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> Then you will need to modify your hosts file. For windows it is located: C:\Windows\system32\drivers\etc\hosts Add this to it: 127.0.0.1 domain.dev Reload apache, perhaps do a Start->Run-> gpupdate /force Then open up your browser type in domain.dev and it should work just fine, with the correct document_root.
×
×
  • 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.