|
|
|
ช่วยหน่อยคับ NO DATABASE SELECT (ผมเพิ่งหัดทำครั้งแรกอ่ะะคับ) |
|
|
|
|
|
|
|
ผมต้องบอกข้อมูลอะไรมั่งอ่ะคับถึงจะช่วยได้
dbproduct.php
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_dbproduct = "localhost";
$database_dbproduct = "dbproduct";
$username_dbproduct = "root";
$password_dbproduct = "1234";
$dbproduct = mysql_pconnect($hostname_dbproduct, $username_dbproduct, $password_dbproduct) or trigger_error(mysql_error(),E_USER_ERROR);
?>
<?php require_once('Connections/dbproduct.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_dbproduct, $dbproduct);
$query_product = "SELECT * FROM product ORDER BY `no` ASC";
$product = mysql_query($query_product, $dbproduct) or die(mysql_error());
$row_product = mysql_fetch_assoc($product);
$totalRows_product = mysql_num_rows($product);
mysql_select_db($database_dbproduct, $dbproduct);
$query_product2 = "SELECT * FROM product2 ORDER BY `no` ASC";
$product2 = mysql_query($query_product2, $dbproduct) or die(mysql_error());
$row_product2 = mysql_fetch_assoc($product2);
$totalRows_product2 = mysql_num_rows($product2);
?>
ผมต้องทำยังไงดีคับ ช่วยที ขอบคุณคับ
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2011-02-22 10:21:44 |
By :
jhannn |
View :
727 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$dbproduct = mysql_pconnect($hostname_dbproduct, $username_dbproduct, $password_dbproduct) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($dbName);
mysql_query("set names utf8");
|
|
|
|
|
Date :
2011-02-22 10:47:14 |
By :
chineji |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ทำได้แล้วคับ ขอบคุณมากมายเลยคับ
|
|
|
|
|
Date :
2011-02-22 11:34:05 |
By :
jhannn |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|