Jump to content

CaraRota

Members
  • Posts

    6
  • Joined

  • Last visited

CaraRota's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Let me see if we understand each others; what i mean is, i dont care because I AM the one who is going to "upload" the matches, and i, as human, can use a - or a / or whatever y want; that won't bother me at all! So basically, i can make it explode as a dash (-), like i posted in the other reply, and i will upload the matches like that The other code i just don't understand it.. im not that expert on php (not even close!). Im trying to get some help from a friend, see what we can do. Thanks for all your help!
  2. Hi psycho, Thanks for your answer, but honestely i know very little php and im trying to understand what you've said. First of all, i really don't care if the input is divided by a - or a space, or 4 spaces; i can sort that out as soon as my explode() works Second, i though that inserting the value $res would give me as many records as i type in the textarea (for example, 1 2 3 4 5 6 7 8 should be working on that code.. im guessing). So, to state a ground base, let's say i want to post this into the textarea: 2013/04/03 21:00-Bolivar-The Strongest-2.20-3.20-2.88-1-LFP 2013/04/03 21:00-La Paz-Oriente Petrolero-4.33-3.50-1.73 1-LFP 2013/04/03 21:00-Wilstermann-Universitario-1.91-3.40-3.60-1-LFP That'd be an 8 input data with a - in the expode(); $a=explode('-',$text); foreach($a as $res){ and then execute the query normally (without the $res=mysql_real_escape_string($_POST['res']) $sql="INSERT INTO events (hometeam, awayteam, ratiohome, ratioaway, ratiox, sportid, starttime, liga) VALUES ('$res')"; $sql_result=mysql_query($sql,$link) or die(mysql_error()); Would this be right then? Because it continues giving me the same error... Thanks a lot for your help!
  3. I've got this so far: if($_POST['agendar']) { // Verificamos que no haya ningun dato sin rellenar. if(!empty($_POST['local'])) { // Pasamos los datos de los POST a Variables, y le ponemos seguridad. $text=""; $a=explode(' ',$text); foreach($a as $res){ // Configuracion de la base de datos. $dbhost = ""; // Servidor $dbuser = ""; // Usuario $dbpass = ""; // ContraseƱa $dbname = ""; // Tabla // Creando conexion. $link = mysql_connect($dbhost,$dbuser,$dbpass); mysql_select_db($dbname,$link); $res=mysql_real_escape_string($_POST['res']); $sql="INSERT INTO events (hometeam, awayteam, ratiohome, ratioaway, ratiox, sportid, starttime, liga) VALUES ('$res')"; $sql_result=mysql_query($sql) or die(mysql_error()); } } else { // Si hay un dato sin rellenar mostramos el siguiente texto. $msg = "Falta rellenar algun dato."; } } But it doesn't seem to work; here's the error: "Column count doesn't match value count at row 1" Even though i write, for example: 1 2 3 4 5 6 7 8 in the textarea..
  4. Hi Jessica, I have looked at it, but i do not understand that guys coding and i certainly need something different.. It'd be: Line1 Line2 Line3 Line4 Line5 Line6 .. LineX LineY LineZ Altough i found this code much easier to me: http://forums.phpfreaks.com/topic/84395-solved-is-there-any-way-to-separate-lines-in-a-textarea-into-seperate-variables/ I have posted a question over there too. Thanks for your reply!
  5. Im sorry but what if i want also to separate them into /n? How would be the explode()? I want it like this: line1 line2 line3 line4 line5 line6 line7 line8 line9 line10 Thanks a lot!
  6. Hello there; i'd like to make it possible to write all the inputs i write with this text fields but make it in a single row (on a textarea), and make it possible to add multiple "events" in my website instead of one! For example: FIRST ROW IN TEXTAREA: Date - Local Team - Away Team - RatioLocal - Draw - RatioAway - SportID - League SECOND ROW IN TEXTAREA: Date - Local Team - Away Team - RatioLocal - Draw - RatioAway - SportID - League This would be a textarea example: 2013/04/03 21:00 Bolivar The Strongest 2.20 3.20 2.88 1 LFP 2013/04/03 21:00 La Paz Oriente Petrolero 4.33 3.50 1.73 1 LFP 2013/04/03 21:00 Wilstermann Universitario 1.91 3.40 3.60 1 LFP Here are the files i use; you will get my idea as soon as you see them Agregar.php: http://pastebin.com/xeTyjrX8 Config.php: http://pastebin.com/Tyb8SXuQ Please if you need more information ask me about it! Thanks a lot for your help!
×
×
  • 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.