More actions
imported>linflus No edit summary |
imported>linflus No edit summary |
||
| Line 36: | Line 36: | ||
echo($obj->name); | echo($obj->name); | ||
?> | ?> | ||
---- | |||
[[2010PHP]] | |||
Revision as of 16:46, 4 August 2010
<?php
$link = mysql_connect('mysql5.hosting.paran.com', 'linflus', );
if (!$link) {
die('Could not connect: ' . mysql_error());
}else{
echo("Connect Succesful.<br/>");
}
$db = mysql_select_db("linflus_db");
/*
$sql = "CREATE TABLE guest
(no integer not null,
name char(10),
contents text(2000),
password char(4),
status integer,
date date)";
$result = mysql_query($sql);
if(!$result){
die('Can not create table');
}else{
echo($result);
}
*/
$sql = "INSERT INTO guest
values(1, 'ksh', 'hello', '1234', 1)";
$result = mysql_query($sql);
$sql = "SELECT * FROM guest";
$result = mysql_query($sql);
$obj = mysql_fetch_object($result);
echo($obj->name);
?>