Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8279975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:30:22+00:00 2026-06-08T09:30:22+00:00

I am stuck with this. Here is the code: This is how I call

  • 0

I am stuck with this.

Here is the code:

This is how I call the function,

$res = DataManager::agregarPropiedad($_POST);

here is the function that generate the query and send it,

public static function agregarPropiedad($datos){
  $sql = "INSERT INTO propiedades (id_propiedad, nombre, tipopropiedad, descripcion, dormitorios, baños, direccion, localidad, provincia, fecha_alta, sup_cubierta, sup_total)
  VALUES (null, '" . $datos['nombre'] . "', '" . $datos['tipo'] . "', '" . $datos['descripcion'] . "', '" . $datos['dormitorios'] . "', '" . $datos['baños'] . "', '" . $datos['direccion'] . "', '" . $datos['localidad'] . "', '" . $datos['provincia'] . "', CURRENT_TIMESTAMP, '" . $datos['supcubierta'] . "', '" . $datos['suptotal'] . "')";
  //$sql = "insert into prueba values(null,'".$datos['nombre']."')";
  echo $sql; 
  return DataManager::consulta($sql);

}

When I copy the echo$sql and paste in phpMyAdmin works fine, but when I try to send my function is not inserting anything, but I have no errors. mysql_erros() its empty too.

U can see that, there is a commented $sql. I use that just for test with another table which is much simpler and query the function “consulta” which works fine too.

This is maybe the 40 function that insert things in mysql database, but the first with which I have problems, and I don’t know why =(

helppppp…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:30:23+00:00Added an answer on June 8, 2026 at 9:30 am

    From personal experience, MySQL queries that work when dumped / copied / pasted into PhPMyAdmin that don’t work in code are caused by:

    • autoincrement / unique field issues
    • unexpected characters in unprocessed form data
    • duplicate POST values ( like an array )
    • mismatched field count
    • encoding / character set issues

    It may well be that if you address the second issue the problem might fix itself. In any case at a minimum you should process you POST(ed) data with strip_tags and add_slashes, but for MySQL mysql_real_escape_string() is strongly recommended.

    http://php.net/manual/en/function.mysql-real-escape-string.php
    http://www.adminsehow.com/2010/03/prevent-mysql-injection-in-php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am stuck here and i spend last 2 days resolving this issue but
i know this is basic but somehow i have been stuck here for some
This is probably a simple one to answer, but I'm stuck, so here goes.
I try to override this method and stuck with some problem public boolean onKeyDown(int
I've tried this a bunch of different ways, stuck on the call to XML
here is my js code <script type='text/javascript'> // Browser safe opacity handling function function
So I have this library code, see... class Thing { public: class Obj {
Here is the code: try { $result = Model_User::update_user($_POST); // message: save success Message::add('success',
Not sure if this is the correct Stack Exchange website but here goes.. A
What could cause this? Here's the stack trace: #0 0x0645c0f5 in std::_Rb_tree_increment (__x=0x83ee5b0) at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.