MySQL连接和循环 [英] MySQL Connection and loop

查看:74
本文介绍了MySQL连接和循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我是php的新手,我需要一些帮助,我有一个网页,它将从数据库中绘制所有内容,用户可以登录并修改该字段的值。


在数据库中,我有两个字段id和content。对于每一行,我想要一个变量,例如pageContent1用于第二行pageContent2,依此类推。


我写了下面的代码,但是这对任何人都无法帮助吗?


谢谢


Tom

Hi all I am new to php and i need a little help, I have a webpage which is going to draw all the content from a database were the user can login and amend the values of the field.

Within the database I have two fields id and content. For each row I want an variable such as pageContent1 for the second row pageContent2 and so on.

I have wrote the below code but this does not work can anyone help?

Thank You

Tom

展开 | 选择 | 换行 | 行号

推荐答案

我不明白 - 你的代码有什么问题吗?


[php]

//制作一个MySQL连接

mysql_connect(&#;#"," ###"," ###")或die(mysql_error());

M ysql_select_db(" cbags")或die(mysql_error());


//从示例中获取所有数据表
i dont get it - is there anything wrong with your code?

[php]
// Make a MySQL Connection
mysql_connect("###", "###", "###") or die(mysql_error());
mysql_select_db("cbags") or die(mysql_error());

// Get all the data from the "example" table


result = mysql_query(" SELECT * FROM home_content")

或die(mysql_error());


//你可以尝试这种方式(但它不会改变任何方式)
result = mysql_query("SELECT * FROM home_content")
or die(mysql_error());

//well you can try this way (but it wont change anythinhg)


pageContent [0] = 0;

while(
pageContent[0]=0;
while(


这篇关于MySQL连接和循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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