วิธีที่ให้ผลเป็น object ครับ คือ mysql_fetch_object
วิธีการใช้ก็เช่น
$row = mysql_fetch_object($result);
echo $row->column1;
echo $row->column2;
วิธีการใช้ก็เช่น
$row = mysql_fetch_object($result);
echo $row->column1;
echo $row->column2;
$resource = mysql_query($sql);
$count_row = mysql_num_rows($resource);
if($count_row > 0) {
while($result =mysql_fetch_array($resource)){
$name = $result['name'];
$birthday =$result['birthday'];
$age = $result['age'];
$message = "Happy birthday ".' '.$name." in ".' '.$birthday;
echo '<iframe src="bot.php?message='.$message.' "></iframe>';
***********************************************************
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
printf ("ID: %s Name: %s", $row[0], $row["name"]);
}
mysql_free_result($result);
?>
*******************************************************************
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
printf ("ID: %s Name: %s", $row[0], $row["name"]);
}
mysql_free_result($result);
?>
*******************************************************************
<?php mysql_connect("localhost", "mysql_user", "mysql_password") or die("Could not connect: " . mysql_error()); mysql_select_db("mydb"); $result = mysql_query("SELECT id, name FROM mytable"); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { printf("ID: %s Name: %s", $row[0], $row[1]); } mysql_free_result($result
?>
wget -q -O /dev/null "https://YOUR-DOMAIN/line-bot/curl" > /dev/null 2>&1
ไม่มีความคิดเห็น:
แสดงความคิดเห็น