-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add fixtures missing to fix full ParameterTest and solve issue GH-274
- Loading branch information
Showing
30 changed files
with
409 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php // @link https://www.php.net/manual/en/function.fputcsv.php | ||
|
||
$list = array ( | ||
array('aaa', 'bbb', 'ccc', 'dddd'), | ||
array('123', '456', '789'), | ||
array('"aaa"', '"bbb"') | ||
); | ||
|
||
$fp = fopen('file.csv', 'w'); | ||
|
||
foreach ($list as $fields) { | ||
fputcsv($fp, $fields); | ||
} | ||
|
||
fclose($fp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php // @link https://www.php.net/manual/en/function.fputcsv.php | ||
|
||
|
||
$list = array ( | ||
array('aaa', 'bbb', 'ccc', 'dddd'), | ||
array('123', '456', '789'), | ||
array('"aaa"', '"bbb"') | ||
); | ||
|
||
$fp = fopen('file.csv', 'w'); | ||
|
||
foreach ($list as $fields) { | ||
fputcsv($fp, $fields, '-'); | ||
} | ||
|
||
fclose($fp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php // @link https://www.php.net/manual/en/function.imagepng.php | ||
|
||
$im = imagecreatefrompng("test.png"); | ||
|
||
header('Content-Type: image/png'); | ||
|
||
imagepng($im); | ||
imagedestroy($im); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php // @link https://www.php.net/manual/en/function.imagepng.php | ||
|
||
$im = imagecreatefrompng("test.png"); | ||
|
||
header('Content-Type: image/png'); | ||
|
||
$file = 'image.png'; | ||
|
||
imagepng($im, $file); | ||
imagedestroy($im); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php // @link https://www.php.net/manual/en/function.mb-eregi-replace.php | ||
|
||
function do_translit($st) { | ||
$replacement = array( | ||
"й"=>"i","ц"=>"c","у"=>"u","к"=>"k","е"=>"e","н"=>"n", | ||
"г"=>"g","ш"=>"sh","щ"=>"sh","з"=>"z","х"=>"x","ъ"=>"\'", | ||
"ф"=>"f","ы"=>"i","в"=>"v","а"=>"a","п"=>"p","р"=>"r", | ||
"о"=>"o","л"=>"l","д"=>"d","ж"=>"zh","э"=>"ie","ё"=>"e", | ||
"я"=>"ya","ч"=>"ch","с"=>"c","м"=>"m","и"=>"i","т"=>"t", | ||
"ь"=>"\'","б"=>"b","ю"=>"yu", | ||
"Й"=>"I","Ц"=>"C","У"=>"U","К"=>"K","Е"=>"E","Н"=>"N", | ||
"Г"=>"G","Ш"=>"SH","Щ"=>"SH","З"=>"Z","Х"=>"X","Ъ"=>"\'", | ||
"Ф"=>"F","Ы"=>"I","В"=>"V","А"=>"A","П"=>"P","Р"=>"R", | ||
"О"=>"O","Л"=>"L","Д"=>"D","Ж"=>"ZH","Э"=>"IE","Ё"=>"E", | ||
"Я"=>"YA","Ч"=>"CH","С"=>"C","М"=>"M","И"=>"I","Т"=>"T", | ||
"Ь"=>"\'","Б"=>"B","Ю"=>"YU", | ||
); | ||
|
||
foreach($replacement as $i=>$u) { | ||
$st = mb_eregi_replace($i,$u,$st); | ||
} | ||
return $st; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php // @link https://www.php.net/manual/en/function.mb-eregi-replace.php | ||
|
||
function do_translit($st) { | ||
$replacement = array( | ||
"й"=>"i","ц"=>"c","у"=>"u","к"=>"k","е"=>"e","н"=>"n", | ||
"г"=>"g","ш"=>"sh","щ"=>"sh","з"=>"z","х"=>"x","ъ"=>"\'", | ||
"ф"=>"f","ы"=>"i","в"=>"v","а"=>"a","п"=>"p","р"=>"r", | ||
"о"=>"o","л"=>"l","д"=>"d","ж"=>"zh","э"=>"ie","ё"=>"e", | ||
"я"=>"ya","ч"=>"ch","с"=>"c","м"=>"m","и"=>"i","т"=>"t", | ||
"ь"=>"\'","б"=>"b","ю"=>"yu", | ||
"Й"=>"I","Ц"=>"C","У"=>"U","К"=>"K","Е"=>"E","Н"=>"N", | ||
"Г"=>"G","Ш"=>"SH","Щ"=>"SH","З"=>"Z","Х"=>"X","Ъ"=>"\'", | ||
"Ф"=>"F","Ы"=>"I","В"=>"V","А"=>"A","П"=>"P","Р"=>"R", | ||
"О"=>"O","Л"=>"L","Д"=>"D","Ж"=>"ZH","Э"=>"IE","Ё"=>"E", | ||
"Я"=>"YA","Ч"=>"CH","С"=>"C","М"=>"M","И"=>"I","Т"=>"T", | ||
"Ь"=>"\'","Б"=>"B","Ю"=>"YU", | ||
); | ||
|
||
foreach($replacement as $i=>$u) { | ||
$st = mb_eregi_replace($i,$u,$st,"i"); | ||
} | ||
return $st; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php // @link https://www.php.net/manual/en/function.mb-eregi-replace.php | ||
|
||
function do_translit($st) { | ||
$replacement = array( | ||
"й"=>"i","ц"=>"c","у"=>"u","к"=>"k","е"=>"e","н"=>"n", | ||
"г"=>"g","ш"=>"sh","щ"=>"sh","з"=>"z","х"=>"x","ъ"=>"\'", | ||
"ф"=>"f","ы"=>"i","в"=>"v","а"=>"a","п"=>"p","р"=>"r", | ||
"о"=>"o","л"=>"l","д"=>"d","ж"=>"zh","э"=>"ie","ё"=>"e", | ||
"я"=>"ya","ч"=>"ch","с"=>"c","м"=>"m","и"=>"i","т"=>"t", | ||
"ь"=>"\'","б"=>"b","ю"=>"yu", | ||
"Й"=>"I","Ц"=>"C","У"=>"U","К"=>"K","Е"=>"E","Н"=>"N", | ||
"Г"=>"G","Ш"=>"SH","Щ"=>"SH","З"=>"Z","Х"=>"X","Ъ"=>"\'", | ||
"Ф"=>"F","Ы"=>"I","В"=>"V","А"=>"A","П"=>"P","Р"=>"R", | ||
"О"=>"O","Л"=>"L","Д"=>"D","Ж"=>"ZH","Э"=>"IE","Ё"=>"E", | ||
"Я"=>"YA","Ч"=>"CH","С"=>"C","М"=>"M","И"=>"I","Т"=>"T", | ||
"Ь"=>"\'","Б"=>"B","Ю"=>"YU", | ||
); | ||
|
||
foreach($replacement as $i=>$u) { | ||
$st = mberegi_replace($i,$u,$st); | ||
} | ||
return $st; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php // @link https://www.php.net/manual/en/function.mb-eregi-replace.php | ||
|
||
function do_translit($st) { | ||
$replacement = array( | ||
"й"=>"i","ц"=>"c","у"=>"u","к"=>"k","е"=>"e","н"=>"n", | ||
"г"=>"g","ш"=>"sh","щ"=>"sh","з"=>"z","х"=>"x","ъ"=>"\'", | ||
"ф"=>"f","ы"=>"i","в"=>"v","а"=>"a","п"=>"p","р"=>"r", | ||
"о"=>"o","л"=>"l","д"=>"d","ж"=>"zh","э"=>"ie","ё"=>"e", | ||
"я"=>"ya","ч"=>"ch","с"=>"c","м"=>"m","и"=>"i","т"=>"t", | ||
"ь"=>"\'","б"=>"b","ю"=>"yu", | ||
"Й"=>"I","Ц"=>"C","У"=>"U","К"=>"K","Е"=>"E","Н"=>"N", | ||
"Г"=>"G","Ш"=>"SH","Щ"=>"SH","З"=>"Z","Х"=>"X","Ъ"=>"\'", | ||
"Ф"=>"F","Ы"=>"I","В"=>"V","А"=>"A","П"=>"P","Р"=>"R", | ||
"О"=>"O","Л"=>"L","Д"=>"D","Ж"=>"ZH","Э"=>"IE","Ё"=>"E", | ||
"Я"=>"YA","Ч"=>"CH","С"=>"C","М"=>"M","И"=>"I","Т"=>"T", | ||
"Ь"=>"\'","Б"=>"B","Ю"=>"YU", | ||
); | ||
|
||
foreach($replacement as $i=>$u) { | ||
$st = mberegi_replace($i,$u,$st,"i"); | ||
} | ||
return $st; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php // @link https://www.php.net/manual/en/function.mysqli-escape-string.php | ||
|
||
$link = mysqli_connect("localhost", "my_user", "my_password", "world"); | ||
|
||
$city = "'s Hertogenbosch"; | ||
$city = mysqli_escape_string($link, $city); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php // @link https://www.php.net/manual/en/function.mysqli-escape-string.php | ||
|
||
$link = mysqli_connect("localhost", "my_user", "my_password", "world"); | ||
|
||
$city = "'s Hertogenbosch"; | ||
$city = mysqli_escape_string($link, $city); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php // @link https://www.php.net/manual/en/mysqli.query.php | ||
|
||
$link = mysqli_connect("localhost", "my_user", "my_password", "world"); | ||
|
||
/* check connection */ | ||
if (mysqli_connect_errno()) { | ||
printf("Connect failed: %s\n", mysqli_connect_error()); | ||
exit(); | ||
} | ||
|
||
/* Create table doesn't return a resultset */ | ||
if (mysqli_query($link, "CREATE TEMPORARY TABLE myCity LIKE City") === TRUE) { | ||
printf("Table myCity successfully created.\n"); | ||
} | ||
|
||
mysqli_close($link); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php // @link https://www.php.net/manual/en/mysqli.query.php | ||
|
||
$link = mysqli_connect("localhost", "my_user", "my_password", "world"); | ||
|
||
/* check connection */ | ||
if (mysqli_connect_errno()) { | ||
printf("Connect failed: %s\n", mysqli_connect_error()); | ||
exit(); | ||
} | ||
|
||
if ($result = mysqli_query($link, "SELECT Name FROM City LIMIT 10", MYSQLI_ASYNC )) { | ||
printf("Select returned %d rows.\n", mysqli_num_rows($result)); | ||
|
||
/* free result set */ | ||
mysqli_free_result($result); | ||
} | ||
|
||
mysqli_close($link); |
6 changes: 6 additions & 0 deletions
6
tests/fixtures/references/mysqli_real_escape_string.18881d.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php // @link https://www.php.net/manual/en/mysqli.real-escape-string.php | ||
|
||
$link = mysqli_connect("localhost", "my_user", "my_password", "world"); | ||
|
||
$city = "'s Hertogenbosch"; | ||
$city = mysqli_real_escape_string($link, $city); |
6 changes: 6 additions & 0 deletions
6
tests/fixtures/references/mysqli_real_escape_string.18881o.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php // @link https://www.php.net/manual/en/mysqli.real-escape-string.php | ||
|
||
$link = mysqli_connect("localhost", "my_user", "my_password", "world"); | ||
|
||
$city = "'s Hertogenbosch"; | ||
$city = mysqli_real_escape_string($link, $city); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php // @link https://www.php.net/manual/en/function.openssl-decrypt.php | ||
|
||
$data = 'string-to-crypt'; | ||
|
||
$key = hex2bin('5ae1b8a17bad4da4fdac796f64c16ecd'); | ||
$iv = hex2bin('34857d973953e44afb49ea9d61104d8c'); | ||
|
||
$output = openssl_decrypt($data, 'AES-256-CBC', $key); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php // @link https://www.php.net/manual/en/function.openssl-decrypt.php | ||
|
||
$data = 'string-to-crypt'; | ||
|
||
$key = hex2bin('5ae1b8a17bad4da4fdac796f64c16ecd'); | ||
$iv = hex2bin('34857d973953e44afb49ea9d61104d8c'); | ||
|
||
$output = openssl_decrypt($data, 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php // @link https://www.php.net/manual/en/function.openssl-encrypt | ||
|
||
$plaintext = "message to be encrypted"; | ||
$cipher = "aes-128-gcm"; | ||
if (in_array($cipher, openssl_get_cipher_methods())) | ||
{ | ||
$ivlen = openssl_cipher_iv_length($cipher); | ||
$iv = openssl_random_pseudo_bytes($ivlen); | ||
$ciphertext = openssl_encrypt($plaintext, $cipher, $key, $options=0, $iv, $tag); | ||
//store $cipher, $iv, and $tag for decryption later | ||
$original_plaintext = openssl_decrypt($ciphertext, $cipher, $key, $options=0, $iv, $tag); | ||
echo $original_plaintext."\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php // @link https://www.php.net/manual/en/function.openssl-encrypt | ||
|
||
$plaintext = "message to be encrypted"; | ||
$cipher = "aes-128-gcm"; | ||
if (in_array($cipher, openssl_get_cipher_methods())) | ||
{ | ||
$ivlen = openssl_cipher_iv_length($cipher); | ||
$iv = openssl_random_pseudo_bytes($ivlen); | ||
$ciphertext = openssl_encrypt($plaintext, $cipher, $key, $options=0, $iv, $tag); | ||
//store $cipher, $iv, and $tag for decryption later | ||
$original_plaintext = openssl_decrypt($ciphertext, $cipher, $key, $options=0, $iv, $tag); | ||
echo $original_plaintext."\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php // @link https://www.php.net/manual/en/function.openssl-open.php | ||
|
||
$fp = fopen("/src/openssl-0.9.6/demos/sign/key.pem", "r"); | ||
$priv_key = fread($fp, 8192); | ||
fclose($fp); | ||
$pkeyid = openssl_get_privatekey($priv_key); | ||
|
||
// decrypt the data and store it in $open | ||
if (openssl_open($sealed, $open, $env_key, $pkeyid)) { | ||
echo "here is the opened data: ", $open; | ||
} else { | ||
echo "failed to open data"; | ||
} | ||
|
||
// free the private key from memory | ||
openssl_free_key($pkeyid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php // @link https://www.php.net/manual/en/function.openssl-open.php | ||
|
||
$fp = fopen("/src/openssl-0.9.6/demos/sign/key.pem", "r"); | ||
$priv_key = fread($fp, 8192); | ||
fclose($fp); | ||
$pkeyid = openssl_get_privatekey($priv_key); | ||
|
||
// decrypt the data and store it in $open | ||
if (openssl_open($sealed, $open, $env_key, $pkeyid)) { | ||
echo "here is the opened data: ", $open; | ||
} else { | ||
echo "failed to open data"; | ||
} | ||
|
||
// free the private key from memory | ||
openssl_free_key($pkeyid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php // @link https://www.php.net/manual/en/function.openssl-seal.php | ||
|
||
$fp = fopen("/src/openssl-0.9.6/demos/maurice/cert.pem", "r"); | ||
$cert = fread($fp, 8192); | ||
fclose($fp); | ||
$pk1 = openssl_get_publickey($cert); | ||
// Repeat for second recipient | ||
$fp = fopen("/src/openssl-0.9.6/demos/sign/cert.pem", "r"); | ||
$cert = fread($fp, 8192); | ||
fclose($fp); | ||
$pk2 = openssl_get_publickey($cert); | ||
|
||
// seal message, only owners of $pk1 and $pk2 can decrypt $sealed with keys | ||
// $ekeys[0] and $ekeys[1] respectively. | ||
openssl_seal($data, $sealed, $ekeys, array($pk1, $pk2)); | ||
|
||
// free the keys from memory | ||
openssl_free_key($pk1); | ||
openssl_free_key($pk2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php // @link https://www.php.net/manual/en/function.openssl-seal.php | ||
|
||
$fp = fopen("/src/openssl-0.9.6/demos/maurice/cert.pem", "r"); | ||
$cert = fread($fp, 8192); | ||
fclose($fp); | ||
$pk1 = openssl_get_publickey($cert); | ||
// Repeat for second recipient | ||
$fp = fopen("/src/openssl-0.9.6/demos/sign/cert.pem", "r"); | ||
$cert = fread($fp, 8192); | ||
fclose($fp); | ||
$pk2 = openssl_get_publickey($cert); | ||
|
||
// seal message, only owners of $pk1 and $pk2 can decrypt $sealed with keys | ||
// $ekeys[0] and $ekeys[1] respectively. | ||
openssl_seal($data, $sealed, $ekeys, array($pk1, $pk2)); | ||
|
||
// free the keys from memory | ||
openssl_free_key($pk1); | ||
openssl_free_key($pk2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php // @link https://www.php.net/manual/en/function.pg-fetch-all.php | ||
|
||
$conn = pg_pconnect("dbname=publisher"); | ||
if (!$conn) { | ||
echo "An error occurred.\n"; | ||
exit; | ||
} | ||
|
||
$result = pg_query($conn, "SELECT * FROM authors"); | ||
if (!$result) { | ||
echo "An error occurred.\n"; | ||
exit; | ||
} | ||
|
||
$arr = pg_fetch_all($result); | ||
|
||
print_r($arr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php // @link https://www.php.net/manual/en/function.pg-fetch-all.php | ||
|
||
$conn = pg_pconnect("dbname=publisher"); | ||
if (!$conn) { | ||
echo "An error occurred.\n"; | ||
exit; | ||
} | ||
|
||
$result = pg_query($conn, "SELECT * FROM authors"); | ||
if (!$result) { | ||
echo "An error occurred.\n"; | ||
exit; | ||
} | ||
|
||
$arr = pg_fetch_all($result, PGSQL_ASSOC ); | ||
|
||
print_r($arr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php // @link https://www.php.net/manual/en/function.pg-last-notice | ||
|
||
$pgsql_conn = pg_connect("dbname=mark host=localhost"); | ||
|
||
$res = pg_query("CREATE TABLE test (id SERIAL)"); | ||
|
||
$notice = pg_last_notice($pgsql_conn); | ||
|
||
echo $notice; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php // @link https://www.php.net/manual/en/function.pg-last-notice | ||
|
||
$pgsql_conn = pg_connect("dbname=mark host=localhost"); | ||
|
||
$res = pg_query("CREATE TABLE test (id SERIAL)"); | ||
|
||
$notice = pg_last_notice($pgsql_conn, PGSQL_NOTICE_ALL ); | ||
|
||
echo $notice; |
Oops, something went wrong.