<?php
$conn = new mysql('localhost', 'root', 'adm1ns');
$sq1 ="INSERT INTO data VALUES(?,?,?);
$stmt = $conn->stmt_init();
$stmt->prepare($sql);
$stmt->bind_param("sss",$instance,$instance,$instance);
$stmt->execute();
$stmt->fetch();
?>


i use this code to store the data in mysql given by user...

in sixth line i am getting a error "unexpected T_STRING" i cant cant this error pls help me

Recommended Answers

All 2 Replies

<?php
$conn = new mysql('localhost', 'root', 'adm1ns');
$sq1 ="INSERT INTO data VALUES(?,?,?);
$stmt = $conn->stmt_init();
$stmt->prepare($sql);
$stmt->bind_param("sss",$instance,$instance,$instance);
$stmt->execute();
$stmt->fetch();
?>


i use this code to store the data in mysql given by user...

in sixth line i am getting a error "unexpected T_STRING" i cant cant this error pls help me

<?php
$conn = new mysql('localhost', 'root', 'adm1ns');
$sq1 ="INSERT INTO data VALUES(?,?,?);
$stmt = $conn->stmt_init();
$stmt->prepare($sql);
$stmt->bind_param("sss",$instance,$instance,$instance);
$stmt->execute();
$stmt->fetch();
?>


Hey you have done mistake in your line 2.
look
$sq1 ="INSERT INTO data VALUES(?,?,?);
Close it like
$sq1 ="INSERT INTO data VALUES(?,?,?)";

ok
http://www.jagadishwor.com.np

thanks jagadish...

i found the problem.....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.