묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
[php]mysql_query()함수 부분인데 잘 안돼네요..
2002.08.14 18:47
솔찍히 전체적으로 어느 부분이 잘못되었는지 모르겠네요..
답변좀 부탁 드립니다.
<?
$host_name = "localhost";
$user_name = "root";
$user_password = "****";
$db_name = "kobukii";
$connect = mysql_connect(localhost,root,****) or mysql_error();
mysql_select_db($db_name, $connect ) or mysql_error();
$que = "CREATE TABLE Human_info (
id int(11) DEFAULT '0' NOT NULL auto_increment,
name varchar(10),
age int(3),
tel_num varchar(20),
address text,
PRIMARY KEY (id))";
mysql_query( $que, $connect ) or mysql_error();
$que = "INSERT INTO Humna_info VALUES (
'',
'+ '+ '아무개',
24,
'000-000-0000',
'아무시
아무구 아무동'
)";
mysql_query( $query, $connect ) or mysql_error();
$que = "SELECT * FROM Human_Info";
$data = mysql_query( $que, $connect );
$total = mysql_affected_rows();
echo $total;
mysql_data_seek($data,'0');
$human = mysql_fetch_array( $data );
echo"이름 : $human[1], 나이 : $human[2]살 ";
?>
Warning: Offset 0 is invalid for MySQL result index 2 in c:apachehtdocsindex.php on line 38
이름 : , 나이 : 살
이렇게 에러가 뜨네요..
답변좀 부탁 드립니다.
<?
$host_name = "localhost";
$user_name = "root";
$user_password = "****";
$db_name = "kobukii";
$connect = mysql_connect(localhost,root,****) or mysql_error();
mysql_select_db($db_name, $connect ) or mysql_error();
$que = "CREATE TABLE Human_info (
id int(11) DEFAULT '0' NOT NULL auto_increment,
name varchar(10),
age int(3),
tel_num varchar(20),
address text,
PRIMARY KEY (id))";
mysql_query( $que, $connect ) or mysql_error();
$que = "INSERT INTO Humna_info VALUES (
'',
'+ '+ '아무개',
24,
'000-000-0000',
'아무시
아무구 아무동'
)";
mysql_query( $query, $connect ) or mysql_error();
$que = "SELECT * FROM Human_Info";
$data = mysql_query( $que, $connect );
$total = mysql_affected_rows();
echo $total;
mysql_data_seek($data,'0');
$human = mysql_fetch_array( $data );
echo"이름 : $human[1], 나이 : $human[2]살 ";
?>
Warning: Offset 0 is invalid for MySQL result index 2 in c:apachehtdocsindex.php on line 38
이름 : , 나이 : 살
이렇게 에러가 뜨네요..
댓글 2
-
이호한
2002.08.14 20:00
mysql_data_seek($data,'0'); >> mysql_data_seek($data,0); -
ZipShin
2002.08.16 04:02
$connect = mysql_connect("localhost","root","****") or mysql_error(); 하던데..^^