使用PHP查询更改表,列名未显示在phpMyAdmin中 [英] Alter Tabled using PHP Query, Column Name doesn't show up in phpMyAdmin

查看:112
本文介绍了使用PHP查询更改表,列名未显示在phpMyAdmin中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的第一篇文章,这里也有类似的文章: phpMyAdmin不显示添加的列-堆栈溢出

This is my first post, and there is a similar post here: phpMyAdmin doesn't show added columns - Stack Overflow

但由于没有人回答,因此我将在此处询问并提供更多详细信息,以期解决此问题.我的数据库中有一个表,需要向其中添加其他列.我使用以下查询完成了此操作:

But since no one has answered, I will ask here and provide more details in hoping to resolve this issue. I have a table in my database that I needed to be able to add additional columns to. I've done this using the following query:

$sql = "ALTER TABLE tablename ADD columnname INT(11)";  //Run the query....

这在第一天就完美了,但是在第二天,当我试图通过此php脚本添加其他列时,它似乎在phpMyAdmin结构视图中起作用.该列在其中具有正确的列名和数据类型.但是,当我切换到浏览"视图时,没有列名,只有空白列中填充了空"值.但是,如果单击单个行,它将显示正确的列名和一个值(如果该行存在一个值).

This worked perfect on day one, however on day two when I tried to add an additional column via this php script, it appears to work from the phpMyAdmin Structure view. The column is in there with the correct columnname and datatype. However when I switch to the Browse view, there is no Column Name, just blank columns filled with "null" values. But, if you click on an individual row, it shows the correct column name, and a value (if one exists for that row).

我尝试运行Analyze Table,因为我在某处读到会更新Schema的内容.但是,在修复它方面没有取得任何成功.我希望不必删除表并重新启动,尤其是当我再次遇到此问题时.由于这是我的第一篇文章,所以我尝试了正确格式化所有内容,但如果没有,请原谅我.另外,如果有人在理解我的问题时遇到问题,我也可以抓取屏幕截图.

I've tried running Analyze Table, as I read somewhere that that would update the Schema. However, I haven't had any success with that fixing it. I'd prefer to not have to delete the table and restart, especially if I run into this issue again. As this is my first post, I've tried to format everything correctly, but please forgive me if I didn't. Also, I can grab screenshots if anyone is having issues understanding my question.

推荐答案

如果可以,请重新启动mysql,它将刷新所有内容,包括phpmyadmin可能正在使用的mysql缓存.

if you can, restart mysql, it should flush everything, including mysql caches phpmyadmin may be using.

这篇关于使用PHP查询更改表,列名未显示在phpMyAdmin中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆