Search found 543 matches

by hyper
Fri Jan 19, 2018 12:36 pm
Forum: PHP Scripts
Topic: Trying to update the global value from a hooked function
Replies: 1
Views: 23

Re: Trying to update the global value from a hooked function

In general using global variables means that there is a logic problem in your script: in your script you are returning a global variable, which makes no sense. <?php $xyz = 0; function change_it ($variable) { $variable++; return $variable; } $xyz = change_it($xyz); There are cases for using global v...
by hyper
Fri Jan 19, 2018 12:18 pm
Forum: PHP coding => General
Topic: Problem with selecting radio buttons based on previous choice
Replies: 2
Views: 26

Re: Problem with selecting radio buttons based on previous choice

Yes it's possible using JavaScript, Ajax or PHP. Of concern is the UI - is this choosing 1st, 2nd, 3rd and 4th preference?
by hyper
Thu Jan 11, 2018 11:12 am
Forum: PHP General
Topic: remove expired tag in PHP cookie
Replies: 3
Views: 74

Re: remove expired tag in PHP cookie

Are you talking about sessions or cookies?
by hyper
Wed Jan 10, 2018 10:11 am
Forum: PHP General
Topic: remove expired tag in PHP cookie
Replies: 3
Views: 74

Re: remove expired tag in PHP cookie

Is there any reason that you can't just delete the cookie or am I missing something?
by hyper
Mon Jan 08, 2018 11:00 am
Forum: PHP coding => General
Topic: not displaying new code (wordpress)
Replies: 2
Views: 69

Re: not displaying new code (wordpress)

How are you trying to (and how did you make) the changes? (or with what are you trying to make the changes: cms, editor, ide ?)
by hyper
Sat Jan 06, 2018 12:28 pm
Forum: PHP coding => General
Topic: PHP - Update query failed but successful message is returned
Replies: 3
Views: 102

Re: PHP - Update query failed but successful message is returned

Somehow, the update did not work but it returned 'UPDATED' alert. That might be this line: echo "UPDATED DATA"; PS : There is no need to worry about SQL Injection though, this is just a coding practice... I'm not worried about SQL injection, but you should be. Since "this is just a coding practice"...
by hyper
Sat Jan 06, 2018 6:38 am
Forum: PHP coding => General
Topic: Replace (translate) valvue in PHP script result
Replies: 1
Views: 53

Re: Replace (translate) valvue in PHP script result

Grtz, the first thing that you need to do is get an understanding of databases and connecting to them, in this case through PHP. Your code is using two methods of connecting to your database and you are not taking advantage of the security that they were designed to put in place. When PHP connects t...
by hyper
Wed Jan 03, 2018 4:14 pm
Forum: mySQL & php coding
Topic: Retaining value after refresh
Replies: 2
Views: 72

Re: Retaining value after refresh

You'll need to post some code or at least give us a clue.
by hyper
Wed Jan 03, 2018 4:11 pm
Forum: PHP coding => General
Topic: Dice
Replies: 3
Views: 62

Re: Dice

You can either create a form or use JavaScript or Ajax.

I would use JavaScript to do all of it.
by hyper
Tue Jan 02, 2018 2:52 pm
Forum: PHP coding => General
Topic: display number and square root
Replies: 1
Views: 57

Re: display number and square root

This sounds like homework and looks to be an exercise in variables, loops, functions and acting on the contents of a form (unless you're using the command line). You should of learned how to assign variables: <?php $a = 4737 * 36; and learned a basic for loop for ($i = 1; $i < 365; $i++) { ... } and...
by hyper
Wed Dec 27, 2017 9:22 am
Forum: mySQL & php coding
Topic: Updating mysql to mysqli - Queries No Longer Work
Replies: 1
Views: 64

Re: Updating mysql to mysqli - Queries No Longer Work

Does the query structure change? No. The function calls have changed though. It's not just a case of adding an 'i' to the end of the function call name; some are completely different. The point of changing to MySQLi was to write more secure code, you are not taking advantage of this and simply usin...
by hyper
Wed Dec 27, 2017 9:10 am
Forum: PHP General
Topic: Configure nginx+php+mysql+phpmyadmin in Ubuntu
Replies: 1
Views: 85

Re: Configure nginx+php+mysql+phpmyadmin in Ubuntu

It would help if you stated what version of Ubuntu this is for, and it would also help if you stated that this is using an old version of PHP. On top of this you have errors.

All in all, this is a very un-helpful post.
by hyper
Mon Dec 25, 2017 3:23 am
Forum: PHP coding => General
Topic: how to change the ID to value when inert to database
Replies: 3
Views: 144

Re: how to change the ID to value when inert to database

Double check that you have copied it exactly, simple punctuation marks make all the difference - it would seem as though you have mixed up your variables. Go through each line and understand what is going on and that it still makes sense. Failing that post your code using the code button </> and sho...
by hyper
Wed Dec 20, 2017 4:39 pm
Forum: PHP Scripts
Topic: Insert to mysql database
Replies: 1
Views: 95

Re: Insert to mysql database

Your error is caused by line 11 which is where your problems start

Code: Select all

$link = mysql_connect($hostname, $username, $password) 
as you open the database as MySQL and try to use it as MySQLi.

As said, that's just the start of the problems in your code, have a read of this.
by hyper
Sun Dec 17, 2017 7:05 pm
Forum: mySQL & php coding
Topic: What's wrong here?
Replies: 4
Views: 124

Re: What's wrong here?

I assume from your response that you didn't read the link I provided, I'm afraid that it's going to involve a lot of reading and re-writing on your part. I'm willing to help, but not willing to do all the work for you - if you want someone to do all the translation for you you might have to consider...
by hyper
Sun Dec 17, 2017 4:21 pm
Forum: PHP General
Topic: Insert a converted php array in a JS Object
Replies: 1
Views: 65

Re: Insert a converted php array in a JS Object

You'll need to provide more code; from what you have shown, you're mixing JavaScript and PHP.

Use the code blocks button </> when posting code.
by hyper
Sun Dec 17, 2017 4:12 pm
Forum: mySQL & php coding
Topic: What's wrong here?
Replies: 4
Views: 124

Re: What's wrong here?

What version of PHP are you running?

I suspect that it has been upgraded to PHP 7, if so you will have to re-code your scripts since the database function calls you are using have been deprecated for several years and have now been removed from PHP 7.
by hyper
Thu Dec 14, 2017 8:06 am
Forum: PHP coding => General
Topic: php header function seems to replace # character
Replies: 2
Views: 120

Re: php header function seems to replace # character

Something is converting your hash into an ascii code, I suspect that this is a safety / security thing. PHP doesn't do that unless you tell it explicitly, the server software on the other hand might in an .htaccess file. I don't use Wordpress, but this would seem to me to be the culprit, in which ca...
by hyper
Mon Dec 11, 2017 4:20 pm
Forum: PHP General
Topic: Encoding Issue?
Replies: 2
Views: 101

Re: Encoding Issue?

Where's the code you used?
by hyper
Sun Dec 10, 2017 11:36 am
Forum: PHP coding => Mail
Topic: Contact form not working
Replies: 6
Views: 196

Re: Contact form not working

Was the blank page with the error checking? I've been trying to avoid saying the following, but it might be your best bet rather than trying to fix what you have: It may be worth you looking at using PHPMailer (there are some youtube videos which may help) or SwiftMailer . And it wouldn't hurt to re...
by hyper
Sun Dec 10, 2017 9:38 am
Forum: mySQL & php coding
Topic: Insert data to database using loop that separated by comma
Replies: 3
Views: 113

Re: Insert data to database using loop that separated by comma

I was under the impression you wanted some help, if you had said from the start that you wanted someone to spend a lot of time and effort asking more questions about what you wanted and then expecting them to write a script to do it, I could have ignored your post completely. The simple way to do it...
by hyper
Sun Dec 10, 2017 1:23 am
Forum: PHP coding => General
Topic: Having problems reading from a mysql table in php
Replies: 1
Views: 93

Re: Having problems reading from a mysql table in php

SQL does more than just: SELECT * FROM All your posts indicate that you are jumping from one thing to another because it "does not work" or you don't understand it; take your time and learn something before moving on to the next instead of trying to make hard work of everything. Try this for starter...
by hyper
Sat Dec 09, 2017 10:39 am
Forum: PHP coding => Mail
Topic: Contact form not working
Replies: 6
Views: 196

Re: Contact form not working

Put these two lines at the start of your script:

Code: Select all

error_reporting(E_ALL);
display_errors = on;
then read what is displayed.
by hyper
Sat Dec 09, 2017 10:20 am
Forum: PHP coding => Mail
Topic: Contact form not working
Replies: 6
Views: 196

Re: Contact form not working

eregi was removed in PHP 7 having been deprecated since version 5.3.