Jump to content

FraanXT

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by FraanXT

  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?
  14. Hello guys, I have a php page that inserts some data in a table, example: Name, email, password. Every line have an identificator(ID) that have autoincrement, so when I insert some data it generates the following number(exemple if last line have id 13, id 14 will be the next(as always). I want to continue using this method but without using this id type, I want to use random ids like 1234567890 and the next line 4324234234(exemple), but always a new and unique id, pretty simple. Would have to make it creating a random number, checking in table if it exists and then insert it? or I can make it with mysql or any fastest method? Sorry for my english, I don't know how to explain that. If someone can help me please.
  15. Thank you all, finally It's working, the error was `'$_SESSION["use"][0]'`, the right one: `$_SESSION["use"][0]`. Im using set names to utf-8 because I got some problems with database, no problems now since I use that. I have another problem and I made a new post, please check that guys: http://forums.phpfreaks.com/topic/288728-php-my-sql-concade-problem/
  16. Im having problems with this line, i don't know where is the error, can you guys help me please? mysql_query('SELECT * FROM `users` WHERE CONCAT(Nom, CONCAT( " ", Cognoms)) like %'.$_POST["busca"].'%'); I want to select from table users only the rows that contains $_POST["busca"] in columns Nom + " " + Cognoms. Help me please! Thank you all!
  17. Hey guys, this is my first post here(not going to be the last one, Im sure), im trying to insert in mysql from session array, i don't know where is my error, I leave the code below, if someone can help me please . $conn = mysql_connect("localhost","root","Password"); $err_db = mysql_select_db('bd_amics'); $sql = ('INSERT INTO `'.$_SESSION["use"][0].'` (ID,Amic) VALUES (`'.$_SESSION["person"][0].'`, `"1"`)'); mysql_query("SET NAMES utf8"); mysql_query($sql, $conn); mysql_close(); Im trying to insert in table $_SESSION["use"][0] the values $_SESSION["person"][0] and 1. Thank you guys.
×
×
  • 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.