doukao2180 2013-07-25 10:11
浏览 189

MySQL我无法将数据写入数据库

Hello guys i have problem with inserting data in mysql database.I accepted a project that my friend worked.

I make simple php test file and try to insert in table _content_city. query is successfully executed bu no records in database column when i check in phpmyadmin.

$handler = mysql_connect($server, $user, $pass);
$database = mysql_select_db($dbname);

if(!$handler) :
    die("Faild connect to MySQL :" . mysql_error());
endif;

if(!$database) :
   die("DB with name ". $dbname . " no exists " . mysql_error());
endif;

 mysql_query("INSERT INTO _content_grad (wishlist) VALUES('BlaBlaBla') ") or die(mysql_error());  

 printf ("Inserterd records: %d
", mysql_affected_rows());

When i execute this code in browser i have message Inserterd records: 1 But when i check in phpmyadmin that data no exist in column. I dont know whay.

You guys can see image and u will see column wishlist is empty.

http://img710.imageshack.us/img710/1852/5hfw.png

I check foreign_keys and remove all foreign_keys and again dont work.

Like test i make new database with name new_test_base and make table albums and column title and like test i execute my php code and all data is successfully inserted when i check in phpmyadmin. So problem is only in that database, i have full access and privilegies i use root (ALL)

Any solution to fix this. Thanks

  • 写回答

1条回答 默认 最新

  • doutuo7609 2013-07-25 10:14
    关注

    The MySQL_* range of functions have been depreciated and are no longer reccomened for use. Use the MySQLi_* range of functions instead.

    In your code, put the following line echo mysql_errno($handler) and it should display the latest error retuned by MySQL, a MySQLi version of this function is also available.

    评论

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c