Jump to content

Inserting a php variable into MySQL Inserto INTO command.


phpfreakjav

Recommended Posts

Notice in the mysql query it says, values, how to I insert variables here.

<?php

// Get the PHP file containing the DbConnector class
require_once('DbConnector.php');
// Create an instance of DbConnector
$connector = new DbConnector();

// Use the query function of DbConnector to run a database query
// (The arrow -> is used to access a function of an object) in other words to grab the variables in the Methods


//$result = $connector->query('SELECT x FROM coordinates where x >0');//MySQL query goes here
$result = $connector->query('INSERT INTO coordinates (x,y,t) VALUES(1,2,3)');
//coordinates is the table name, xyt are the //columns, and values are the values recorded by the mouse 
//script. 


// Get the result
$row = $connector->fetchArray($result);



?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.