Jump to content

Search the Community

Showing results for tags 'undefined method'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I am trying to run the following: $sqlErrors = ""; $query = "SELECT `name` FROM company WHERE id=".$_POST['companyID']; $result = $mysqli->query($query); $row = $result->fetch_assoc(); $company = $row['name']; $sqlErrors = $mysqli->error ? "Selecting company, id: ".$_POST['companyID'].". Error: ".$mysqli->error : ""; And am getting the following output: Fatal error: Call to undefined method mysqli::SELECT `name` FROM company WHERE id=3() I have no idea where the trailing brackets are coming from, and even tried $result = $mysqli->query("SELECT `name` FROM company WHERE id=3"); ... but get the same result. The questionable piece of code is contained within the following, in the "what company are we regestering the agent to?" section. $all_query_ok = true; $sqlErrors = ""; /* connect to the db */ $mysqli = new mysqli('localhost','riski296_dbuser','7FJTCJyMARer90oCKmyek5Cw36wXYG1etWJcOGjYONn53liYEHkTb0v74WqpVV3O', 'riski296_taxi_pim') or die('Cannot select the DB'); /* * what company are we regestering the agent to? */ $query = "SELECT `name` FROM company WHERE id=".$_POST['companyID']; $result = $mysqli->query($query); $row = $result->fetch_assoc(); $company = $row['name']; $sqlErrors = $mysqli->error ? "Selecting company, id: ".$_POST['companyID'].". Error: ".$mysqli->error : ""; /* grab the first available agnet for that company */ $agentID = -1; if ($result = $mysqli->query("SELECT id FROM agent WHERE is_active=0 AND companyID=".$_POST['companyID']." LIMIT 1")) { if($result->num_rows == 1){ /* fetch object array */ $row = $result->fetch_assoc(); $agentID = $row['id']; } else { echo "There is no agents currently entered for ".$company; exit(); } $sqlErrors .= $mysqli->error ? ". Getting agent, company id: ".$_POST['companyID'].". Error: ".$mysqli->error : ""; } /* determine what kind of connection device is being used */ $connectionDeviceID = -1; switch($_POST['connectionDeviceType']) { case "Cellular": $connectionDeviceID = $_POST['cellularConnectionDeviceID']; break; case "LAN": $connectionDeviceID = $_POST['lanConnectionDeviceID']; break; } $mysqli->autocommit(FALSE); /* * INSERT connection device being used with this PIM */ $mysqli->$query(" INSERT INTO connection_device (idDevices, device_type, idPlan) VALUES (".$connectionDeviceID.", ".$_POST['connectionDeviceType'].", ".$_POST['planID'].")") ? null : $all_query_ok = false; $sqlErrors .= $mysqli->error ? ". Inserting connection_device, connection device id: ".$connectionDeviceID.", Connection device type: ".$_POST['connectionDeviceType'].", and Plan ID: ".$_POST['planID'].". Error: ".$mysqli->error : ""; /* * INSERT PIM and associate the connection device with the PIM */ $mysqli->$query(" INSERT INTO device (idDevices, idAgent, idConnectionDevice) VALUES (".$_POST['pimID'].", NULL, ".$mysqli->insert_id.")") ? null : $all_query_ok = false; $sqlErrors .= $mysqli->error ? ". Inserting PIM, PIM id: ".$_POST['pimID'].", agent ID: NULL, and Plan ID: ".$_POST['planID'].". Error: ".$mysqli->error : ""; /* * associate the device with the company. make note of install date */ $install_date = date("Y-m-d H:i:s"); $mysqli->$query(" INSERT INTO compay_device_relation (idCompany, idDevice, install_date, location, removal_date) VALUES (".$_POST['companyID'].", ".$mysqli->insert_id.", ".$install_date.", NULL, NULL)") ? null : $all_query_ok = false; $sqlErrors .= $mysqli->error ? ". Inserting company_device_relation, idCompany: ".$_POST['companyID'].", idDevice: ".$mysqli->insert_id.", install_date: ".$install_date.", location: NULL, and removal_date: NULL. Error: ".$mysqli->error : ""; /* * check for any pre-existing errors */ if($sqlErrors != "") { echo $sqlErrors; exit(); } /* * update agent - this makes sure that the agent is still available */ $mysqli->query("UPDATE agent SET is_active=1 WHERE id=".$agentID) ? null : $all_query_ok = false; $mysqli->affected_rows == 1 ? null : $all_query_ok = false; $all_query_ok ? $mysqli->commit() : $mysqli->rollback(); $mysqli->autocommit(TRUE); $mysqli->close(); echo $all_query_ok ? "Agent added to ".$company : "failure:"; Any help is most appreciated! Thanks, Dave.
×
×
  • 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.