base64_encode $my_source_text = ‘{ Blah Blah ] }’; $my_base64_encoded_doc = base64_encode($my_source_text);
All posts by
Upload A File From A Form
Basic Upload With Page Hanging Until Upload Completes <?php include_once('config.php'); require 'awssdk/aws.phar'; //<SDK so we can access S3 storage global $AwsS3BucketName; global $AwsS3AccessKeyId; global $AwsS3AccessSecretKey; $sdk = new Aws\Sdk([ 'version' => 'latest', 'region' => 'eu-west-1', //<<<<< REGION 'credentials' => [ 'key' => $AwsS3AccessKeyId, //<<<<< S3 ACCESS KEY ID 'secret' => $Aw if (isset($_POST[‘submit’])) { //—– […]
Adding Message To PHP Error Log
bool error_log (“Some message”, 0);
Querying Across Tables
This is PHP4 Code! Using IN Within A Normal SELECT Query You can select from within another tables results really easily like this: SqlCommand1->CommandText = "SELECT ProjectId \ FROM tblMyTable1 \ WHERE ProjectIsActive='TRUE' AND ProjectId IN (SELECT ProjectId FROM tblMyTable2 WHERE ProjectUsersAll='TRUE' OR UserId=@UserId) \ ORDER BY ProjectStartDate DESC"; Simple Find Name From Another Table […]
Searching An Entire Database
To search every row in every table in a database for a value Use the phpmyadmin ‘Search’ feature. Select your database (be sure you do have a DB selected and not a table) Click ‘Search’ tab Choose the search term you want Choose the tables to search
LIMIT Results
WHERE
Where value is in an array
ORDER BY
Sorting Results Use this To Sort On Multiple Values ORDER BY With $wpdb->prepare ORDER BY and %s does not work with $wpdb->prepare, in our tests the following order by gets ignored: Whereas this works as expected. So it seems that $wpdb->prepare() adding single quotes around the inserted name field causes it to break. Date Order […]
Using Strings-Verifying Strings
Is String Numeric Is String A Date Time Is String Within An Array Of Strings Check Entered Web Address This isn’t right – the first test rejects doamins with a hyphen in them Verify Email Address A thorough version from this article here
Differences To C and C++
=== and !=== PHP is a loosly typed language. For instance this is true because PHP converts to the requried types before the compare: if (1000 == “+1000”) To perform an exact comparison you can use this instead, which is false if (1000 === “+1000”) For does not equal you can also use !== Break […]
