Jump to content

lostinthemessycode

New Members
  • Posts

    3
  • Joined

  • Last visited

lostinthemessycode's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. What I was trying to execute is the sql query, as I said above, that can be seen in the first code. The button is working fine, but it's connected to the case I'm showing, which wasn't working. And the question I thought it was obvious, sorry, was to help me get out of the mess of those three codes in three different files that weren't comunicating between each other properly. I somehow managed yesterday to get it to work. Not perfectly and not what I need yet, but at least executing the query well. So if there's a way to close this thread, I would appreciate it.
  2. *My code is in my native language, I translated it to post it here and made a mistake here: <h1>Selected Citizen succesfully: <br>'.$ciudadano.' <br></h1> So please read it as $citizen instead of $ciudadano. I can't seem to edit the post now, sorry. Please don't count it as a mistake in the code. I have 99 problems, but that's not one of them 😅
  3. Hi people. I'm a total beginner trying to put together a small project, required to be done in MVC. I have a dropdown (in fact I have two, but I'm trying to tackle down this one first). This dropdown gets its options from the database (which I've managed to get it working just fine). So, the idea is to execute an sql query when the button is pressed... nothing fancy really, but since I have all this code scattered through all these files, it's just a mess altogether. This is the code I have now related to this: This function it's inside class TCars from cars.php file: public function selectCitizen() { $this->abd->query("UPDATE car SET nCitizen = '1000' WHERE ID = (SELECT MIN(ID) FROM car)"); $this->abd->close_query(); } This function it's in the class TControl, in the controller.php file: public function selectCitizen($citizen) { echo "please work"; $citizen = new TCitizen("", "", "", "", "", $citizen, $this->host, $this->user, $this->pass, $this->db); } And this is the case for this particular submit button in view.php: case "Rent": if (isset($_POST["citizen"])) { $ciudadano = $_POST["citizen"]; $c = new TControl(); $res = $c->selectCitizen($citizen); if ($res) { echo ('<html> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <body> <center> <h1>Selected Citizen succesfully: <br>'.$ciudadano.' <br></h1> <br> <br>'); echo ($res); echo ('<br><a href="index.html"> Back to index </a></center></body></html>'); } else { showError("Citizen couldn't be selected: $ciudadano"); } } break; The more I've managed until now has been to get showError to show, beyond that it's just a lot of undefined, fatal and warning errors, as expected. I'd really appreciate any insight on this. Thank you for reading me.
×
×
  • 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.