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);



?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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