一個(gè)簡單的自動發(fā)送郵件系統(tǒng)(三)_PHP教程
Jul 21, 2016 pm 04:05 PM
一個(gè)簡單的自動發(fā)送郵件系統(tǒng)(三)
????這里介紹php和mysql結(jié)合起來實(shí)用。如何從mysql數(shù)據(jù)庫中提取數(shù)據(jù)。
????好,我們已經(jīng)成功的完成了我們的要求,很多的數(shù)據(jù)已經(jīng)存在了數(shù)據(jù)庫中,現(xiàn)在的問題是,如何查詢這些數(shù)據(jù),得到有用的結(jié)果呢?
在下面的程序中,我們將選擇"apple"的用戶輸出。
--------------------------------------------------------
/* 聲明一些必須的變量*/
$hostname = "yourhostname";
$username = "yourusername";
$password = "yourpassword";
$userstable = "information";??/* 使用MySQL建立的數(shù)據(jù)表存取信息??*/
$dbName = "yourdbname";
/* 與數(shù)據(jù)庫連接*/
MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database");
@mysql_select_db( "$dbName") or die( "Unable to select database");??
/* 選擇所有“apple”用戶*/
$query = "SELECT * FROM $userstable WHERE (preference LIKE 'Apples') ";
$result = MYSQL_QUERY($query);
/* 統(tǒng)計(jì)有多少這樣的用戶*/
$number = MYSQL_NUMROWS($result);
/* 輸出結(jié)果*/
$i = 0;
IF ($number == 0) :
????PRINT "
Nobody in the database prefers Apples!
ELSEIF ($number > 0) :
????PRINT "
Users preferring Apples: $number
";
????WHILE ($i
????????$name = mysql_result($result,$i,"name");
????????$email = mysql_result($result,$i,"email");
????????PRINT "Visitor $name likes Apples.
";
????????PRINT "Email address: $email.";
????????PRINT "
";
????????$i++;
????ENDWHILE;
????????PRINT "
ENDIF;
?>
--------------------------------------------------------
將他存為apples.php3
解釋說明:一些新用到的函數(shù):
1、$number = MYSQL_NUMROWS($result);
語法:int mysql_num_rows(string result);
·result???從函數(shù)mysql_query中返回的數(shù)組記錄。
·返回存在$result中的行數(shù)。
2、$name = MYSQL_RESULT($result,$i,"name");?????
語法: int mysql_result(int result, int i, column);
這個(gè)函數(shù)將分離記錄,將每一條賦值給變量。
·$result是指中的數(shù)組結(jié)果。
·$i是指數(shù)據(jù)的行。
·column是指mysql數(shù)據(jù)表中列的名字。也可以使用變量。
???因此使用一個(gè)簡單的while循環(huán),我們就能很容易的將數(shù)據(jù)輸出給瀏覽器。

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

PhpisstillRelevantinmodernenterpriseenvironments.1. Modernphp (7.xand8.x)? ??? ??, ??? ??, jitcompilation ? modernsyntax, mateitsuilableforlarge-scalepplications

N 1 ?? ??? ??? ?? ???? ?????? ?????? ?? ?? ????. 2. ???? ???? ???? ?? ??? ???????? ??? ??? ?? ? ??????. 3. ??? 2 ? ?? ?? Redis ?? ??? ?? ??? ?? ?? ??? ????? ??????. 4. ??? ????? ????? ????? Clear ()? ???? ???? ?????? ??? ????? ?????. 5. ?????? ??? ????? ???? ???? ? ??? ??? ?? ?? ? SQL ?? ??????. 6. ?? ??? ???? ?? ?????? ?? ?? ??? ?????? ?? ?? ?? ??? ???? ??? ??????. ORM? ???? ????? ?? ??? ????? ?? ???? ??? ???? ?? SQL ????, ??, ?? ?? ? ??? ???? ???????.

??? PHP ???? ???? ????? RabbitMQ? ???? ??? ??? ???? 1. ????? ??? ??? ?? ??? ???? ?? ???? ???????. 2. ???? ???? ?? ???? ???, ???? ???, ?? ? ?? ACK? ?????. 3. ?? ? ?? ? ??, TTL ? ?? ?? ? ?? ?? ??? ??????. 4. Supervisord? ?? ??? ???? ??? ????? ???? ??? ??? ???? ?? ?? ?? ????? ???????. ??? ????? ???? ??? ????? ???? ??? ?????.

??? PHP ?? ???? ???? ???? ?? ??? ? Docker ??? ???? ?? ?? ????? ?????. 1. PHP : 8.3-fpm-alpine? ?? ???? ???? ?? ??? ??? ??? ??????. 2. ??? ?? php.ini? ?? ??? ??? ??????, ?? ??? ??, Opcache ? JIT? ????? ?? ? ??? ??????. 3. Nginx? ??? ???? ???? ??? ??? ?? ???? ???? PHP ??? PHP-FPM?? ???? ?????. 4. ??? ??? ???? ???? ?? ???? ???? ????? ????? ??? ?? ???? ??????. 5. CRON? ?? ?? ????? ?????? ??? ?? ??; 6. ?? ?? ??? ?? ??? ??? ??????

settings.json ??? ??? ?? ?? ?? ?? ?? ??? ??? VSCODE ??? ??? ???? ? ?????. 1. ??? ?? ?? : Windows? C : \ Users \\ AppData \ Roaming \ Code \ User \ Settings.json, MacOS IS /users//library/applicationsupport/code/user/settings.json, linux? /home//.config/code/user/settings.json; 2. Workspace ?? ?? : .vscode/settings project root ????

PHP? ??? ?? ????? ?? ??? ??????????? ?? ??? ???? ?? ?? ??? ????????. 1. ?? ??? ??? ?? ??? ?? ? ?? ???? ?????. 2. ?? ???? ???? ???? ?? ? ? ???? GC? ?? ????? ???? ?????. 3. "??? ??"zval? ?? ?? ????? ???? GC_COLLECT_CYCLES ()? ?? ? ? GC? ??????. 4. ?? ?? PHP ?? ????? ??? ??? ??? ?? GC_STATUS ()? ?????? GC_COLLECT_CYCLES ()? ? ??? ???????. 5. ?? ???? ?? ??? ??? GC_DISABLE ()? ???? ?? ? ??? ????? ORM? CLER () ???? ?? DeReeference ??? ?????.

BREF? ?? PHP ???? ??? ???? ?? ?? ???? ?? ???? ?? ????? ?? ? ? ????. 1. Bref? ??? ? PHP ??? ???? ???? PHP8.3 ? ?? ??? ???? Laravel ? Symfony? ?? ??? ??? ???? ???? PHP? Awslambda? ?????. 2. ?? ???? ??? ????? : Composer? ???? BREF ??, HTTP ?? ??? ? ?? ??? ?? ?? ? ???? ???? ?? Serverless.yml ??; 3. ServerlessDeploy ??? ???? ??? ???? APIGINGWARE? ???? ???? ??? URL? ?????. 4. Lambda ??? ?? Bref? ???? ?????.

readOnlyPropertiesInphp8.2CanonlyBeassignedOnedOneDonceIntheConstructorAratDeclarationandCannotBemodififificificificifified
