Jump to content

FraanXT

Members
  • Posts

    20
  • Joined

  • Last visited

FraanXT's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It works, ty bro, and sorry cuz I assumed that it check if its numerical only
  2. But I want to check if they are integer, if you know how?
  3. Hello guys, I have a form where you can select a score between 0 and 10(only integers). I want to check if the value that I recive, is integer. Im using this code(exemple): $integer = intval($_POST["p1"]); if(is_int($integer)){ echo 'INT'; } else { echo 'NO INT'; } My problem is that if it recive letters, the conversion converts it to 0, and it says that it is integer. So with this method I should discard the 0. You guys know a method to avoid that? Thank you guys
  4. You can use that too: die("<script>location.href = 'path_that_you_want.file_extension'</script>");
  5. I will do as you say next time don't worry , ty for help guys!
  6. I'm getting this mysql error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Like INT,Score CHAR(30))' at line 1 Tried some things but still getting the error TT, Im nubie in mysql
  7. Can you guys tell me where is the error please... $sql2= ('CREATE TABLE `'.$pub_unik.'` (ID SERIAL,ID_Use CHAR(30),Comment TEXT,Like INT,Score CHAR(30))'); I can't find... Thank you guys
  8. Ow thank you so much Psycho! I wanted the second one and it's exactly what I was looking for.
  9. Hello everybody, I want to obtain from the database the rows that have been inserted in the last seven days. Every time that I insert a row, I add a date with this format: $today = date("Y-m-d H:i:s"); So it should be like: $lastweek = date("Y-m-((d)-7) H:i:s"); SELECT * FROM pub WHERE data BETWEEN('$today' AND '$lastweek') Is it possible? which is the method to do that? Thank you all
  10. Hello everybody, I have a form like that: <form method="post" action="x.php"> <input type="hidden" name="pubid" value="<?php echo $_SESSION["public_id"][$a]; ?>" /> <input type="submit" name="update" /> The public id is an id that every user have and that I use for get and post, imagine that this form is in a php "for" that print all this forms with public_id. Then I have a code like that: if(isset($_POST["update])){ if($_POST["pubid"]!==(There are some checks to avoid mysql injection)){ mysql_query=update from xxx set x=1 where pubid=$_POST["pubid"])(EXEMPLE) }} I want to avoid any change of form, because if someone change the value of the hidden input can modify information of mysql, someone know any method to do that? A friend told me to use js to compare form fields, but the user can modify js too I think, then I need to check it with php I think, correct me if Im wrong. Someone help me please.
  11. I can't find the error, someone help me please. $conn = mysql_connect("localhost","root","Pass"); $err_db = mysql_select_db('bd_amics'); $sql = ("INSERT INTO `'".$_SESSION["use"][14]."'` (ID,Amic,PubID) VALUES ('".$_SESSION["person"][14]."', "1", '".$_SESSION["person"][15]."')"); mysql_query("SET NAMES utf8"); mysql_query($sql, $conn); mysql_close(); $conn3 = mysql_connect("localhost","root","Pass"); $err_db3 = mysql_select_db('bd_amics'); $sql3 = ("UPDATE `'".$_SESSION["person"][14]."'` SET Amic="2" WHERE ID='".$_SESSION["use"][14]); mysql_query("SET NAMES utf8"); mysql_query($sql3, $conn3); mysql_close();
  12. Thank you bro, helped me a lot.
  13. I mean which differences have of rand()? I will need to check the database for coincidents anyways right?
×
×
  • 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.