$sql="INSERT INTO prescription
(username,phone,procedure,address,emailid,reviews,followups,nextappointment)
VALUES
("$username","$phone","$procedure","$address","$emailid","$reviews",$followups,"$nextappointment")";
答案 0 :(得分:2)
我认为你的问题在引号中,你在双引号内有双引号,你应该转义引号或使用单引号。
简单易用的是使用准备好的陈述。
我不确定您使用PDO / MSQLI的哪个API
如果您在PDO中:
SELECT z.zip AS [ZIP] ,
z.city AS [City] ,
z.state AS [State] ,
z.county AS [County] ,
lp.value AS [Geomarket Short] ,
lp2.value AS [Geomarket Long]
FROM world.dbo.zip z
LEFT OUTER JOIN [lookup.prompt] lp ON lp.index = z.zip
AND lp.key = 'geomarket_zip'
LEFT OUTER JOIN [lookup.prompt] lp2 ON lp.value = lp2.index
AND lp2.key = 'geomarket'
ORDER BY z.zip;
如果你在mysqli上,那么:
<?php
$sql =$databaseConnectionVar->prepare("INSERT INTO prescription(username,phone,procedure,address,emailid,reviews,followups,nextappointment)VALUES(?,?,?,?,?,?,?,?)")
->execute(array($username,$phone,$procedure,$address,$emailid,$reviews,$followups,$nextappointment));
if(!$sql){
print_r($databaseConnectionVar->errorInfo());
}else{
echo "data inserted";
}
?>
然后您需要查看重要的链接:
答案 1 :(得分:-1)
您应该更改“”是否知道应该更改单引号''。
例如下面:
$sql = 'INSERT INTO prescription(username,phone,procedure,address,emailid,reviews,followups,nextappointment)
VALUES("$username","$phone","$procedure","$address","$emailid","$reviews",$followups,"$nextappointment")';
希望它会帮助你
答案 2 :(得分:-1)
你的引号错了, 在值中使用单引号(''), 您的IDE出错了。或者如果你只是复制并运行数据库。
mTitle = mDrawerTitle = getTitle();
mPlanetTitles = getResources().getStringArray(R.array.planets_array);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerList = (ListView) findViewById(R.id.left_drawer);
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
// set up the drawer's list view with items and click listener
mDrawerList.setAdapter(new ArrayAdapter<String>(this,
R.layout.drawer_list_item, mPlanetTitles));
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
// enable ActionBar app icon to behave as action to toggle nav drawer
/*getActionBar().setDisplayHomeAsUpEnabled(false);
getActionBar().setHomeButtonEnabled(true);*/
mDrawerToggle = new ActionBarDrawerToggle(
this, /* host Activity */
mDrawerLayout, /* DrawerLayout object */
R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
R.string.drawer_open, /* "open drawer" description for accessibility */
R.string.drawer_close /* "close drawer" description for accessibility */
) {
public void onDrawerClosed(View view) {
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
public void onDrawerOpened(View drawerView) {
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
selectItem(position);
}
//}
private class DrawerItemClickListener implements ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
selectItem(position);
System.out.println("&&&&&position"+position);
switch(position){
case 0:
startActivity(new Intent(home.this, ChangeActivity.class));
// finish();
case 1:
startActivity(new Intent(home.this, home.class));
//finish();
case 2:
startActivity(new Intent(home.this, info_values.class));
// finish();
default:
break;
}
}
答案 3 :(得分:-1)
检查您的插入信息:
$sql = "INSERT INTO prescription (username,phone,procedure,address,emailid,reviews,followups,nextappointment)
VALUES('$username','$phone','$procedure','$address','$emailid','$reviews',$followups,'$nextappointment')";