Jump to content

AyKay47

Members
  • Posts

    3,281
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by AyKay47

  1. no, I meant primary key, you can combine fields in a primary key definition. No, you would them a unique key. You can only have one primary key. Edit: yeah I see what you are saying now Adam, since `id` is already the PK, yeah you would have to make any others unique keys.
  2. no, I meant primary key, you can combine fields in a primary key definition. No, you would them a unique key. You can only have one primary key.
  3. funster's reply sums it up nicely. But to add, when thinking about what field(s) to make a PK, ask yourself what fields must be unique in the table. typically the auto_incrementing field would be the PK because it must be unique, but as funster stated, you can also use compound PK's if a group of fields must be unique. e.g. if there can be multiples of the member_id and question_id fields separately, but there can only be one unique paring of the two fields, assign the pair a PK.
  4. yes, just don't store sensitive data in them like a user id or password, they can be hijacked.
  5. AyKay47

    Overflow

    you would have to calculate the width needed and set that to #container using something like JS yes.
  6. *pseudo code* if($('#email') == '') alert("blank email"); put this wherever you check the values of the inputs in JS.
  7. than getextension() does not exist at the time that it is called.
  8. AyKay47

    Overflow

    need to have a fixed width set.
  9. AyKay47

    Overflow

    this has to do with the width of #container; http://jsfiddle.net/9LsEs/1/
  10. why not use sessions?
  11. this line should be the problem: if ((($_POST['username'])&&($_POST['password']))=="admin") the parenthesis are a little out of whack. should read: if (($_POST['username'] == 'admin') && ($_POST['password'])) but, what exactly is supposed to equal 'admin'? Both fields? learn to space your code out to make it more readable. If this does not solve your issue, post any errors that you are receiving.
  12. instead of saying "i'm getting an error", please post the error and the line(s) that it refers to.
  13. echo '<tr><td><input type="checkbox" name="uid[]" value="'.$row['ID'].'" /></td><td>"'.$row['filename'].'"</td><td>"'.$row['title'].'"</tr>';
  14. well then the html is being removed by something in your script. Can you post the relevant code please.
  15. double quotes don't need escaped when the string is wrapped in single quotes, the backslashes will be interpolated as literal backslashes. echo '<input type="submit" name="formSubmit" value="Submit" />';
  16. nice
  17. field values are not wrapped in back-ticks, they are wrapped in quotes. $query = mysql_query("UPDATE `home` SET `welcometitle`= '$welcometitle', `welcomesection`= '$welcomesection', `infotitle`='$infotitle', `infosection`= '$infosection',`videotitle`= '$videosection'") or die(mysql_error());
  18. make sure the checkbox input names are in array format. Post the relevant code please.
  19. if(isset($welcometitle && $welcomesection)) && !empty($welcometitle && $welcomesection)) should read: if(isset($welcometitle, $welcomesection) && !empty($welcometitle) && !empty($welcomesection))
  20. There is an error in your SQL, if you had proper error handling established you would know this. The only way that double quotes can be used as an identifier quoting character is when the SQL mode include ANSI_QUOTES. Either way you are using single quotes to encase the field `id`. Use either back-ticks or none at all. Also, to use the IN clause here, $ids would need to be a comma delimited list of values, which I doubt it is. $ids = $_POST['uid']; $con = mysql_connect("localhost","root",""); mysql_select_db("product", $con); $ids = intval($ids); //sanitize data $sqlout = mysql_query("SELECT * FROM product2 WHERE ID = '$ids'") or die(mysql_error()); //select only the fields that you are going to use while ($sqlres = mysql_fetch_assoc($sqlout)) { echo $sqlres['filename'] . " " . $sqlres['title']; } mysql_close($con);
  21. thanks, :-) I'm following w3schools... don't. Use a resource like tizag or books. The PHP Manual has tuts as well.
  22. well, whatever reference told you to add $_POST values into a query like that (if any), throw it out.
  23. 1. never insert $_POST values directly into a query, this makes the script vulnerable to SQL injection. Run the values through mysql_real_escape_string if the values are strings, and either cast them to type int or use intval for integers. 2. To answer your actual question, this is a concatenation error, the line in question should read: $sql = "INSERT INTO sample (id,firstname,lastname,bio,gender) VALUES ('{$_POST['ID_']}','{$_POST['firstname']}','{$_POST['lastname']}','{$_POST['bio']}','{$_POST['gender']}')";
  24. if($variable >= number) { echo '<img src="/path/to/img" />'; }
×
×
  • 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.