# Beginners - Learning PHP

**URL:** https://www.phphelp.com/c/beginners-learning-php/9.md?page=1

[Latest](https://www.phphelp.com/latest.md) · [Categories](https://www.phphelp.com/categories.md)

**Page:** 2

---

## [Shows script in browser](https://www.phphelp.com/t/shows-script-in-browser/35748)

<div class="topic-metadata">

**Author:** [@lewmur](https://www.phphelp.com/u/lewmur)\
**Replies:** 10\
**Last updated:** [December 4, 2023, 7:27pm UTC](https://www.phphelp.com/t/shows-script-in-browser/35748 "2023-12-04T19:27:36Z")

</div>

I just install PHP on a Windows 11 box. I set the environment system path to C:\\php, which is where I installed PHP. When I type “php --version” from the command prompt, it shows the version. But when I run a script i…

---

## [Sessions Issues](https://www.phphelp.com/t/sessions-issues/35885)

<div class="topic-metadata">

**Author:** [@Sonnyy](https://www.phphelp.com/u/Sonnyy)\
**Replies:** 5\
**Last updated:** [December 4, 2023, 11:27am UTC](https://www.phphelp.com/t/sessions-issues/35885 "2023-12-04T11:27:53Z")

</div>

Hello, I’m trying to make a page in php, and since this is my first complete page in php I’ve run into a problem and I have no idea what it could be. It’s a session. I have a login on the page, where when everything goe…

---

## [Hit counter does not work](https://www.phphelp.com/t/hit-counter-does-not-work/35857)

<div class="topic-metadata">

**Author:** [@phpdummy1](https://www.phphelp.com/u/phpdummy1)\
**Replies:** 0\
**Last updated:** [November 23, 2023, 2:51pm UTC](https://www.phphelp.com/t/hit-counter-does-not-work/35857 "2023-11-23T14:51:07Z")

</div>

Hello everyone, I try to use a hit counter which used to work years ago. However my transfer to a new file fails. My trial: I renamed the functioning html code (whose hits shall be counted) to “filetocount.php”. It is…

---

## [Generate Crypto wallet address, private key, public key, mnemonic, extended public key xpub, API, PHP](https://www.phphelp.com/t/generate-crypto-wallet-address-private-key-public-key-mnemonic-extended-public-key-xpub-api-php/35854)

<div class="topic-metadata">

**Author:** [@Jeewer](https://www.phphelp.com/u/Jeewer)\
**Replies:** 0\
**Last updated:** [November 22, 2023, 7:03am UTC](https://www.phphelp.com/t/generate-crypto-wallet-address-private-key-public-key-mnemonic-extended-public-key-xpub-api-php/35854 "2023-11-22T07:03:09Z")

</div>

To generate Bitcoin BTC wallet address, private key, public key, extended public key xbup. Visit https://jeewer.com to generate all other crypto wallets. This code work. PHP CODE \<?php $json = file\_get\_contents("http…

---

## [Help with rewriting, keeping up with latest php](https://www.phphelp.com/t/help-with-rewriting-keeping-up-with-latest-php/35088)

<div class="topic-metadata">

**Author:** [@degarb](https://www.phphelp.com/u/degarb)\
**Replies:** 13\
**Last updated:** [November 16, 2023, 3:08pm UTC](https://www.phphelp.com/t/help-with-rewriting-keeping-up-with-latest-php/35088 "2023-11-16T15:08:22Z")

</div>

Why is php updates changing variables? I pay for hosting, and run a tiny personal weather website that uses phonifier v. 2.1 which is a very old script that allows me to see national weather service ftp text weather pro…

---

## [Editing php class to php 8 version](https://www.phphelp.com/t/editing-php-class-to-php-8-version/35827)

<div class="topic-metadata">

**Author:** [@Adem](https://www.phphelp.com/u/Adem)\
**Replies:** 3\
**Last updated:** [November 13, 2023, 7:15pm UTC](https://www.phphelp.com/t/editing-php-class-to-php-8-version/35827 "2023-11-13T19:15:07Z")

</div>

Hello, What should be changed in the code below to make it compatible with PHP 8.2 version? class treeview { private $files; private $folder; function \_\_construct( $path ) { $files = array(); if( file\_…

---

## [PHP 8.2 - MySQL query returns row count of 7 but only 6 are displayed](https://www.phphelp.com/t/php-8-2-mysql-query-returns-row-count-of-7-but-only-6-are-displayed/35778)

<div class="topic-metadata">

**Author:** [@DecentGuy](https://www.phphelp.com/u/DecentGuy)\
**Replies:** 3\
**Last updated:** [October 25, 2023, 3:39pm UTC](https://www.phphelp.com/t/php-8-2-mysql-query-returns-row-count-of-7-but-only-6-are-displayed/35778 "2023-10-25T15:39:30Z")

</div>

Here’s my code -what am I doing wrong? $result = mysqli\_query($con, "SELECT \* FROM comments WHERE comid = $id "); $rowcount=mysqli\_num\_rows($result); echo "\<h3\>". $rowcount . " Comments\</h3\>"; $row = mysqli\_fetch\_array…

---

## [PHP blank white page](https://www.phphelp.com/t/php-blank-white-page/35776)

<div class="topic-metadata">

**Author:** [@timmy12s](https://www.phphelp.com/u/timmy12s)\
**Replies:** 1\
**Last updated:** [October 24, 2023, 11:49pm UTC](https://www.phphelp.com/t/php-blank-white-page/35776 "2023-10-24T23:49:51Z")

</div>

Good evening everyone, I’m a beginner in PHP programming and I downloaded a file to study. The file in question is a website that needs to install the database through the url. But when I try to start using the website…

---

## [Running foreach is causing duplicate results](https://www.phphelp.com/t/running-foreach-is-causing-duplicate-results/35766)

<div class="topic-metadata">

**Author:** [@Jeffw](https://www.phphelp.com/u/Jeffw)\
**Replies:** 5\
**Last updated:** [October 20, 2023, 5:57am UTC](https://www.phphelp.com/t/running-foreach-is-causing-duplicate-results/35766 "2023-10-20T05:57:57Z")

</div>

On my crud website the homepage displays all published posts and just above that I’m putting the various categories as links that the posts are attributed to. so that the user can click the category link and display only…

---

## [Trying to copy image file name to another](https://www.phphelp.com/t/trying-to-copy-image-file-name-to-another/35723)

<div class="topic-metadata">

**Author:** [@John-VA3MSV](https://www.phphelp.com/u/John-VA3MSV)\
**Replies:** 3\
**Last updated:** [September 24, 2023, 9:33pm UTC](https://www.phphelp.com/t/trying-to-copy-image-file-name-to-another/35723 "2023-09-24T21:33:09Z")

</div>

I am definitely a beginner. Here is what I am attempting to do. I am a ham (amateur) radio operator involved with other local ham radio operators that operate using a special event call sign at least twice a year. I h…

---

## [Is joining tables necessary](https://www.phphelp.com/t/is-joining-tables-necessary/35702)

<div class="topic-metadata">

**Author:** [@Jeffw](https://www.phphelp.com/u/Jeffw)\
**Replies:** 4\
**Last updated:** [September 16, 2023, 5:13pm UTC](https://www.phphelp.com/t/is-joining-tables-necessary/35702 "2023-09-16T17:13:46Z")

</div>

I was wondering if working with multiple tables requires joining in the sql query or if there is a more rudimentary way? For example i’m trying to figure out how a user can load an image to a post they create and have th…

---

## [Show a cell from Google Sheets on WordPress using PHP](https://www.phphelp.com/t/show-a-cell-from-google-sheets-on-wordpress-using-php/35710)

<div class="topic-metadata">

**Author:** [@christa13](https://www.phphelp.com/u/christa13)\
**Replies:** 1\
**Last updated:** [September 18, 2023, 4:01pm UTC](https://www.phphelp.com/t/show-a-cell-from-google-sheets-on-wordpress-using-php/35710 "2023-09-18T16:01:16Z")

</div>

I found this code through a blog. I am attempting to return a single cell from Google Sheets. Forms will be completed on my WordPress website. The cell sums these forms. I want to return the sum from the Google Sheet…

---

## [PHP 7.3 UPDATE values with apostrophe creates an error](https://www.phphelp.com/t/php-7-3-update-values-with-apostrophe-creates-an-error/35688)

<div class="topic-metadata">

**Author:** [@DecentGuy](https://www.phphelp.com/u/DecentGuy)\
**Replies:** 4\
**Last updated:** [September 7, 2023, 10:37pm UTC](https://www.phphelp.com/t/php-7-3-update-values-with-apostrophe-creates-an-error/35688 "2023-09-07T22:37:31Z")

</div>

I have no problem inputing data that has an apostrophe using INSERT However, I use that data to populate a form for amendments. If the comments section originally had apostrophes then it will not save any amendments. I …

---

## [Preventing duplicate entries when updating editing a post](https://www.phphelp.com/t/preventing-duplicate-entries-when-updating-editing-a-post/35684)

<div class="topic-metadata">

**Author:** [@Jeffw](https://www.phphelp.com/u/Jeffw)\
**Replies:** 1\
**Last updated:** [September 3, 2023, 1:45am UTC](https://www.phphelp.com/t/preventing-duplicate-entries-when-updating-editing-a-post/35684 "2023-09-03T01:45:54Z")

</div>

I created a link for the user to be able to edit one of their posts, so they change the post details and decide to make the post active or draft. I’m at the point where when the user clicks edit the form populates the f…

---

## [Securing when using $\_GET](https://www.phphelp.com/t/securing-when-using-get/35678)

<div class="topic-metadata">

**Author:** [@Jeffw](https://www.phphelp.com/u/Jeffw)\
**Replies:** 1\
**Last updated:** [August 27, 2023, 4:54pm UTC](https://www.phphelp.com/t/securing-when-using-get/35678 "2023-08-27T16:54:22Z")

</div>

I created a delete page so the user can delete their posts they no longer want and wanted to see if this looks solid or if there improvements needed. this is what they click to delete on their dashboard \<td\>\<a href="use…

---

## [Adding session id to sql insert](https://www.phphelp.com/t/adding-session-id-to-sql-insert/35663)

<div class="topic-metadata">

**Author:** [@Jeffw](https://www.phphelp.com/u/Jeffw)\
**Replies:** 1\
**Last updated:** [August 19, 2023, 4:55pm UTC](https://www.phphelp.com/t/adding-session-id-to-sql-insert/35663 "2023-08-19T16:55:59Z")

</div>

i’m trying to do a pdo sql insert where some form data is inserted into the database, but along with the standard form data like the posts title I wanted to insert the users session\[‘id’\] which would go into the member\_i…

---

## [Problem with PHP code in latest PHP version](https://www.phphelp.com/t/problem-with-php-code-in-latest-php-version/35433)

<div class="topic-metadata">

**Author:** [@cocodoobster](https://www.phphelp.com/u/cocodoobster)\
**Replies:** 1\
**Last updated:** [August 5, 2023, 5:39pm UTC](https://www.phphelp.com/t/problem-with-php-code-in-latest-php-version/35433 "2023-08-05T17:39:47Z")

</div>

I am helping out a friend on his website and there are problems upgrading to the latest version of PHP… I feel like the problem is in the code below… I can’t seem to work it out. Any suggestions? Thank you in advance! \<…

---

## [Need if-then-else ... I think (revised)](https://www.phphelp.com/t/need-if-then-else-i-think-revised/35454)

<div class="topic-metadata">

**Author:** [@CreativeRaven](https://www.phphelp.com/u/CreativeRaven)\
**Replies:** 1\
**Last updated:** [August 5, 2023, 5:21pm UTC](https://www.phphelp.com/t/need-if-then-else-i-think-revised/35454 "2023-08-05T17:21:47Z")

</div>

I have a PHP snipped which generates a membership number, whether the person is registering for a membership or ordering a workshop through WooCommerce. I need only members - if( pmpro\_hasMembershipLevel()) - to receiv…

---

## [Php reading a text file in Linux unbutu](https://www.phphelp.com/t/php-reading-a-text-file-in-linux-unbutu/35615)

<div class="topic-metadata">

**Author:** [@PHPJames](https://www.phphelp.com/u/PHPJames)\
**Replies:** 4\
**Last updated:** [August 5, 2023, 4:10pm UTC](https://www.phphelp.com/t/php-reading-a-text-file-in-linux-unbutu/35615 "2023-08-05T16:10:16Z")

</div>

I have built this piece of code using my Windows test rig and works fine but moving it onto my ubuntu web server i just get a white screen and nothing else. My Code: \<?php // full path to text file define("TEXT\_FILE", …

---

## [PHP To Read a Text file](https://www.phphelp.com/t/php-to-read-a-text-file/35584)

<div class="topic-metadata">

**Author:** [@PHPJames](https://www.phphelp.com/u/PHPJames)\
**Replies:** 3\
**Last updated:** [August 3, 2023, 8:01am UTC](https://www.phphelp.com/t/php-to-read-a-text-file/35584 "2023-08-03T08:01:28Z")

</div>

Hi, I am wanting to read a text file located on a NAS device \\hg-nas01\\Logs\\Test\\Test.txt The file has times and dates of Windows Updates and i would like to get a few items from it this file is always being written to…

---

## [Parsing/syntax error](https://www.phphelp.com/t/parsing-syntax-error/35581)

<div class="topic-metadata">

**Author:** [@MikeCalo](https://www.phphelp.com/u/MikeCalo)\
**Replies:** 2\
**Last updated:** [July 31, 2023, 7:08pm UTC](https://www.phphelp.com/t/parsing-syntax-error/35581 "2023-07-31T19:08:41Z")

</div>

I am getting a parsing/syntax error on the 4th line of the following script; it says “unexpected identifier “function\_construct”, expecting 'function” or “const”… class Paint\_1 { private string $color ; function\_con…

---

## [Php routing is not working anymore](https://www.phphelp.com/t/php-routing-is-not-working-anymore/35569)

<div class="topic-metadata">

**Author:** [@The\_Sad\_Coder](https://www.phphelp.com/u/The_Sad_Coder)\
**Replies:** 2\
**Last updated:** [July 29, 2023, 3:06pm UTC](https://www.phphelp.com/t/php-routing-is-not-working-anymore/35569 "2023-07-29T15:06:23Z")

</div>

\<?php use Illuminate\\Support\\Facades\\Route; Route::get('/', function () { return view('welcome'); }); Route::view("login",'user'); Above here are the routes that I have in web.php I try to type http://127.0.0.…

---

## [Pdo fetching data based on current logged in user](https://www.phphelp.com/t/pdo-fetching-data-based-on-current-logged-in-user/35519)

<div class="topic-metadata">

**Author:** [@Jeffw](https://www.phphelp.com/u/Jeffw)\
**Replies:** 5\
**Last updated:** [July 13, 2023, 4:54am UTC](https://www.phphelp.com/t/pdo-fetching-data-based-on-current-logged-in-user/35519 "2023-07-13T04:54:54Z")

</div>

I’m stuck trying to figure out how to display the currently logged in users posts, but only their posts in their profile page. They are able to log in and the session appears to work, but i’m struggling trying to pull on…

---

## [Links security with variables](https://www.phphelp.com/t/links-security-with-variables/35518)

<div class="topic-metadata">

**Author:** [@Neelix](https://www.phphelp.com/u/Neelix)\
**Replies:** 1\
**Last updated:** [July 11, 2023, 12:51am UTC](https://www.phphelp.com/t/links-security-with-variables/35518 "2023-07-11T00:51:39Z")

</div>

Hi, I need som help, please… I’m using links with variables like this: \<a href="accueil.php?page=Equalizer"\>Equalizer\</a\> With an associative area to secure them: $checkPage = array('Series\_Index' =\> 'series/series\_i…

---

## [Survey / Voting](https://www.phphelp.com/t/survey-voting/35500)

<div class="topic-metadata">

**Author:** [@uqp](https://www.phphelp.com/u/uqp)\
**Replies:** 1\
**Last updated:** [July 1, 2023, 7:39pm UTC](https://www.phphelp.com/t/survey-voting/35500 "2023-07-01T19:39:55Z")

</div>

I would like to know if what I am looking for can be solved. maybe someone already did it, thanks for your time I have approximately 300 users and only they can vote. I would like to have 1 general group and 7 subgroup…

---

## [I know oops PHP what next](https://www.phphelp.com/t/i-know-oops-php-what-next/35496)

<div class="topic-metadata">

**Author:** [@kokwo.com](https://www.phphelp.com/u/kokwo.com)\
**Replies:** 3\
**Last updated:** [June 29, 2023, 11:14pm UTC](https://www.phphelp.com/t/i-know-oops-php-what-next/35496 "2023-06-29T23:14:14Z")

</div>

Hello, Background: I am not a computer science student. I only started learning php from a brother. I started with procedural and now I can programe in object oriented style. Problem: I keep on hearing about several ph…

---

## [File open error](https://www.phphelp.com/t/file-open-error/35494)

<div class="topic-metadata">

**Author:** [@thallstd](https://www.phphelp.com/u/thallstd)\
**Replies:** 4\
**Last updated:** [June 24, 2023, 10:15am UTC](https://www.phphelp.com/t/file-open-error/35494 "2023-06-24T10:15:24Z")

</div>

Hi, the fopen in the below code excerpt takes the FALSE path after confirming that the file exists. I’ve confirmed I don’t have it opened and it has 0644 permissions. Anything else I can look at to zero in on the erro…

---

## [Image sizing using imagick](https://www.phphelp.com/t/image-sizing-using-imagick/35492)

<div class="topic-metadata">

**Author:** [@Jeffw](https://www.phphelp.com/u/Jeffw)\
**Replies:** 2\
**Last updated:** [June 23, 2023, 1:47pm UTC](https://www.phphelp.com/t/image-sizing-using-imagick/35492 "2023-06-23T13:47:58Z")

</div>

I was wondering if imagick can be used to dynamically resize images. For example the home page shows a list of posts with an image, i wanted those images to be a certain size, then when the user clicks on one of the post…

---

## [Pass php variable as page details in a header:location call](https://www.phphelp.com/t/pass-php-variable-as-page-details-in-a-header-location-call/35467)

<div class="topic-metadata">

**Author:** [@Waspman](https://www.phphelp.com/u/Waspman)\
**Replies:** 1\
**Last updated:** [May 29, 2023, 11:19pm UTC](https://www.phphelp.com/t/pass-php-variable-as-page-details-in-a-header-location-call/35467 "2023-05-29T23:19:41Z")

</div>

This is probably very simple, but it is driving me crazy! I create the variable to be used in the header statement containing page and variable to be passed, based on a couple of PHP variables if ($var === "A"){ $bac…

---

## [Pulling Data from database using PDO](https://www.phphelp.com/t/pulling-data-from-database-using-pdo/35457)

<div class="topic-metadata">

**Author:** [@olaoyesunday](https://www.phphelp.com/u/olaoyesunday)\
**Replies:** 7\
**Last updated:** [May 23, 2023, 8:44pm UTC](https://www.phphelp.com/t/pulling-data-from-database-using-pdo/35457 "2023-05-23T20:44:53Z")

</div>

Dear All, I am trying to pull data from the database using PDO, is the code below safe from an attack or do I need to bind anything? global $connection; if(isset($\_GET\['p\_cat'\])){ $p\_cat\_id = $\_…

[Previous page](https://www.phphelp.com/c/beginners-learning-php/9.md)

[Next page](https://www.phphelp.com/c/beginners-learning-php/9.md?page=2)
