Jump to content

Maq

Administrators
  • Posts

    9,363
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Maq

  1. strlen(html_entity_decode($string));
  2. Maq

    Screen resolution

    Why don't you use relative size, like percentages?
  3. I don't have an environment to test in right now... This should work, although the error is pretty obvious. if(isset($_POST['create_db'])) { $create="CREATE TABLE users (user_id int(6),first_name varchar(15),last_name varchar(15),PRIMARY KEY (user_id),UNIQUE id (user_id),KEY id_2 (user_id))"; // Insert some data into users $insert = "INSERT INTO users VALUES ('1','John','Smith');INSERT INTO users VALUES ('2','Gordon','Brown');INSERT INTO users VALUES ('3','Hack','Me');INSERT INTO users VALUES ('4','Pablo','Picasso')"; mysql_query($total) or die(mysql_error()); mysql_query($insert) or die(mysql_error()); mysql_close(); } ?> </pre> <form action="<?php%20echo%20%24_SERVER%5B'PHP_SELF'%5D;%20?>" method="post"> <
  4. I personally use a products_to_cats table. With just 2 fields. Product_id and cat_id. But you could have the cat_id in the products table although I think that wouldn't be fully normalized. So you have 3 tables (I think this is normalized:
  5. Easy enough. You should submit the page to itself in the action. If the button isset (clicked) then it executes the PHP code. Try this code: if(isset($_POST['create_db']) { // Create table users $_POST[create_db]=$create; $create="CREATE TABLE users (user_id int(6),first_name varchar(15),last_name varchar(15),PRIMARY KEY (user_id),UNIQUE id (user_id),KEY id_2 (user_id))"; // Insert some data into users $insert = "INSERT INTO users VALUES ('1','John','Smith');INSERT INTO users VALUES ('2','Gordon','Brown');INSERT INTO users VALUES ('3','Hack','Me');INSERT INTO users VALUES ('4','Pablo','Picasso')"; mysql_query($total) or die(mysql_error()); mysql_query($insert) or die(mysql_error()); mysql_close(); } ?> </pre> <form action="<?php%20echo%20%24_SERVER%5B'PHP_SELF'%5D;%20?>" method="post"> <
  6. What do you mean help? Could you give more detail? You should read up on database normalization. So far, all I can help you with is what the categories table should look like: categories -------------- cat_id => auto_increment cat_name => var_char(50)
  7. Do you get any errors? Does anything happen? Do you want to submit to the same page, or a different page (SQL.php)? Your PHP code should look like this: // Create table users $_POST[create_db]=$create; $create="CREATE TABLE users (user_id int(6),first_name varchar(15),last_name varchar(15),PRIMARY KEY (user_id),UNIQUE id (user_id),KEY id_2 (user_id))"; // Insert some data into users $insert = "INSERT INTO users VALUES ('1','John','Smith');INSERT INTO users VALUES ('2','Gordon','Brown');INSERT INTO users VALUES ('3','Hack','Me');INSERT INTO users VALUES ('4','Pablo','Picasso')"; mysql_query($total) or die(mysql_error()); mysql_query($insert) or die(mysql_error()); mysql_close();
  8. What do you want to rename them to? A script for this would be quite simple depending on the format.
  9. If you're unsure of the amount or what name the variables are, you can use a foreach loop to retrieve all of them: foreach($_GET as $key => $value) { echo "key: " . $key . " value: " . $value . " "; }
  10. Mchl is right. It should be: if ($row['enddate']
  11. if (strtotime($row['enddate'])==strtotime($current_day)) {
  12. Donations. It goes to PHPFreaks. Read above to get details.
  13. I think you need to use html_entities_decode()
  14. $result = mysql_query($check_query) or die(mysql_error()) needs to be: $result = mysql_query($check_query) or die(mysql_error());
  15. Oops here you go (supposed to be $num_rows = mysql_num_rows($result); ) include 'header.php'; $horseid = $_POST['horseid']; $userid = $_POST['userid']; $classtype = $_POST['classtype']; $classname = $_POST['classname']; $check_query = "SELECT * FROM winterfest WHERE id = $userid"; $result = mysql_query($check_query) or die(mysql_error()) $num_rows = mysql_num_rows($result); if($num_rows >= 1) { echo "You have enter 2 or more times."; } else { $sql="INSERT INTO winterfest (horseid, userid, classname, classtype) VALUES ('$horseid','$userid','$classname','$classtype')"; mysql_query($sql) or die(mysql_query()); echo "Success! You have entered Winterfest!"; } ?>
  16. Sorry thank you for the corrections guys, I don't have an environment to test this in right now ;/ @PFMaBiSmAd You have an extra ')' in the second line you corrected. My revised code (that should work ): include 'header.php'; $horseid = $_POST['horseid']; $userid = $_POST['userid']; $classtype = $_POST['classtype']; $classname = $_POST['classname']; $check_query = "SELECT * FROM winterfest WHERE id = $userid"; $result = mysql_query($check_query) or die(mysql_error()) $num_rows = mysql_num_rows($check_query); if($num_rows >= 1) { echo "You have enter 2 or more times."; } else { $sql="INSERT INTO winterfest (horseid, userid, classname, classtype) VALUES ('$horseid','$userid','$classname','$classtype')"; mysql_query($sql) or die(mysql_query()); echo "Success! You have entered Winterfest!"; } ?>
  17. Yes, she certainly did. Thanks revraz
  18. $filename = 'test.txt'; if (is_writable($filename)) { echo 'The file is writable'; } else { echo 'The file is not writable'; }
  19. If you're willing to spend some money use Interspire Email Marketer. It has a great interface, easy to use, comes with support for the first 3 months, for free and has online support like forums. I have not had a problem with them thus far.
  20. Yes. The best way to check if the user exists is via database. 1) If the folder does not exist than the user does not exist? 2) This is the only way you check to see if a user is registered? You should keep track of this through a database. Have the folders named the same as the user/userid whatever is unique. That way you can check to see if they exist in the database, if they do redirect them to there folder, "/root/users/$userid/", that way it's easy to redirect the user to their folder. If they don't exist in the database then do what you want. If they register than enter them into the database and create a folder for them. If you use this method than you can link folders with unique id's (username or userid). IMO, this would be the easiest and most efficient approach.
  21. Not tested but should work. If the user has 2 or more records than it won't let them insert, are there any other restrictions? include 'header.php'; $horseid = $_POST['horseid']; $userid = $_POST['userid']; $classtype = $_POST['classtype']; $classname = $_POST['classname']; $check_query = "SELECT * FROM winterfest WHERE id = $userid"; $num_rows = mysql_num_rows($check_query) or die(mysql_error()); if($num_rows > 1) { echo "You have enter 2 or more times."; } else { $sql="INSERT INTO winterfest (horseid, userid, classname, classtype) VALUES ('$horseid','$userid','$classname','$classtype')"; mysql_query($sql) or die(mysql_query()); echo "Success! You have entered Winterfest!"; } ?>
  22. Post your current query...
  23. Brought a tear to my eye :'(
×
×
  • 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.