473,383 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

msql C API

38
Hi Guys,

I would like to insert into my database the character stored inside the variable t. How do I do that?
This is my code.
Expand|Select|Wrap|Line Numbers
  1. /*#include <my_global.h>
  2. #include <mysql.h>
  3. #include<time.h>
  4. #include<stdio.h>
  5. int main(int argc, char **argv)
  6. {
  7. char t="alpha"; 
  8. MYSQL *conn;
  9.  
  10. conn = mysql_init(NULL);
  11. mysql_real_connect(conn, "localhost", "root", "", "testdb2", 0, NULL, 0);
  12. mysql_query(conn, "CREATE TABLE csetech_test (id int not null auto_increment,name varchar(20), password int,time varchar (20),sensor varchar(10), primary key(id))");
  13. mysql_query(conn, "INSERT INTO csetech_test(name,password,time, sensor) VALUES(&t,1701,now(),'0')");
  14.  
  15. mysql_close(conn);
  16.  
  17. }
  18.  
Jan 14 '09 #1
0 1325

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: lance | last post by:
Hi Is there any way with a php to find out if a table is locked before using a mysql_query on the table?
1
by: Dinesh Garg | last post by:
Hi All, I want to use MS sql server edition 2000. I have installed the server. Now i want to create the database on this server with tables and triggers. Can please someone suggest me how to do...
0
by: anthony | last post by:
Hi. I am attempting to get msql3 installed with php. Using php version php5.1-200604070430 and msql-3.7. I am getting the following error on compile. ...
11
by: refugeedeveloper | last post by:
Im trying to use the mysql_connect command to connect to the mysql server from a php file. What is the HOST name I should use? The tutorial book I have uses "localhost" but Im installing the...
2
by: longtone | last post by:
Now and again I just don't get something that's so obvious it's not even in the instructions. The first step in any php or mysql tutorial is to run a php script containing my username and password...
0
by: Gathuka | last post by:
i have more than enough reserved space and would like to re-claim part of it to the operating system.
0
by: MatchSQL | last post by:
When we want to save the database schema and SQL statement , we use the backup of SQLServer provide, but it always content the running data, now a new tool named MatchSQL, it can just save...
1
by: jf39 | last post by:
Hi, Im just new in this stuff, does anyone know how to fill up a combobox in html using javascript? The info to retrieve is in a table in mysql It would be great if someone could me how to do... ...
1
by: ABITECH | last post by:
hi guys I am working on a project in databases using the wamp software. So how do i connect msql to php. Pliz help mi Because i badly nid the code for my project. bye
2
by: chazzy69 | last post by:
Ok this may seem a little strange but what i Im trying to add an altered version of information already stored in my database. Basically i have a colum that has strings of numbers and characters,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.