[Solved] how make duplicate of an specific file in wordpress media library programatically [closed]

finally solved my problem by this code: require_once( ABSPATH . ‘wp-admin/includes/image.php’ ); $wp_upload_dir = wp_upload_dir(); $imgMeta = wp_get_attachment_metadata( $wordpress_media_attachment_id ); $imgMime = $imgMeta[‘sizes’][‘thumbnail’][‘mime-type’]; $absolutePath = “$wp_upload_dir[basedir]/$imgMeta[file]”; $name = basename($imgMeta[‘file’]); do{ $rnd = mt_rand(); $name2 = “_$rnd$name”; $path2 = “$wp_upload_dir[path]/$name2”; } while (file_exists($path2)); @copy($absolutePath,$path2); $attachment = array( ‘guid’=> “$wp_upload_dir[url]/$name2”, ‘post_mime_type’ => $imgMime, ‘post_title’ => $name2, ‘post_content’ … Read more

[Solved] storing user_id in session variable

Debug. Where do you store the value in the session state?: $_SESSION[‘user_ID’] = $userID; Ok, so where does $userID come from?: function selectUser($conn, $username, $password, $userID) { //… Ok, so where does the function parameter come from?: selectUser($conn,$username,$password) Nowhere. You never supplied a value to be stored in session, so no value was stored in … Read more

[Solved] $row[‘column’] in PHP

That is called bracket notation. $row is an array, which has properties. In this case, it has named properties, so it is an associative array. An associate array has key/value pairs. It looks like this: $myArray = [ ‘key’ => ‘value’ ]; To echo the value of the property above, you would use echo $myArray[‘key’]; … Read more

[Solved] How to install LARAVEL 5

Since you have SSH access do this: Filesystem SSH into the server Change directory to the project root cd /home/< username > delete the public_html folder rm -rf public_html create a symbolic link from public to public_html ln -s /home/< username >/public /home/< username >/public_html Install Laravel dependencies composer install Change permissions chmod -R 755 … Read more

[Solved] Access text on click

So you want to know on what value you’ve clicked on, but the binding remains on the row? Perfectly possible: $(document).ready(function(){ $(“.x”).click(function(event){ console.log(event.target); //Log where you clicked console.log($(event.target).text()); }); }); Why should this work? In the event handler that we add to the clicking event when we click the elements with class x (every row), … Read more

[Solved] array_push() expects parameter 1 to be array, null given php error message

You get the error : Warning: array_push() expects parameter 1 to be array, null given because your $_SESSION[‘messages’] variable is never set. When this part of your code gets executed, session_start(); if (session_status() == PHP_SESSION_NONE) { $_SESSION[‘messages’] = array(); } The first line starts a new session. So session_status() == PHP_SESSION_NONE will never be true … Read more

[Solved] A list of php error [closed]

Error #2 and #3: You have written a bit nonsense to the if() statement, mixed parts of what you intended to do. replace these two lines if(mysqli_num_rows((int)$sql_login>0)){ $result = mysqli_fetch_array($sql_login); with this one line if( $result = mysqli_fetch_array($sql_login) ){ Description of said one line code: If there is a record, $result will become an array, … Read more

[Solved] pull Else if from SQL [closed]

You need to learn the PHP from the basics. Learn about operators, PHP and HTML secion, etc.. Anyway, i fixed your code. The condition is if $vehicle->sold is not equal to 1. But i think, (in your OP you mentioned it should be 0) you want this: $vehicle->sold == 0 //Use sytnax like this. See … Read more

[Solved] style PHP error message [closed]

Your id’s must be unique throughout the form. Only give an id to the ul <ul id=”myUL”> and use css like: <style type=”text/css”> #myUL { style_att: style_att_val; } #myUL li { style_att: style_att_val; } </style> or put it in a css file and link to it. 0 solved style PHP error message [closed]

[Solved] how to make htdocs folder accessible over internet [closed]

You will need to portforward your Apache Port (typically 80 unless specified different use: http://www.portforward.com for information how to portforward with a router. Access your router settings? If you do not know: Open Command prompt Issue ipconfig You should be presented with: Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : Link-local IPv6 Address … Read more