Search found 622 matches

by NigelRen
Tue Oct 04, 2016 10:35 pm
Forum: PHP Scripts
Topic: PHP syntax
Replies: 1
Views: 1275

Re: PHP syntax

Depends on the type of call and the need to get through to the person, but trying to automate something like this is more a problem of how the call is handled and not the technical problems. The main thing with any type of solution would be the fact that you seem to give a call pause_seconds and the...
by NigelRen
Tue Oct 04, 2016 11:51 am
Forum: PHP coding => General
Topic: LIKE Operator not working with wild card parm
Replies: 4
Views: 1177

Re: LIKE Operator not working with wild card parm

The problem with the version you created was...

Code: Select all

$sql = "SELECT student_id, fullname FROM carver_class_1967 WHERE lastname LIKE '%($name) %' OR firstname LIKE '%($name)%' ORDER BY lastname, firstname";
It should be {} and not () round the variables.
by NigelRen
Tue Oct 04, 2016 12:12 am
Forum: PHP Scripts
Topic: PHP syntax
Replies: 1
Views: 1275

Re: PHP syntax

Just in case - global variables are not persistent across script executions, they are simply available to any method/class in that particular running instance of the script. If you want to have something which remembers values across instances, you will need to look into some form of caching. You ca...
by NigelRen
Tue Oct 04, 2016 12:00 am
Forum: PHP coding => General
Topic: LIKE Operator not working with wild card parm
Replies: 4
Views: 1177

Re: LIKE Operator not working with wild card parm

Shouldn't you be using $sql = "SELECT student_id, fullname FROM carver_class_1967 WHERE lastname LIKE '%{$name}%' OR firstname LIKE '%{$name}%' ORDER BY lastname, firstname"; As you are currently using 'name' as a hard coded value. You should also do some sanitising of this data as well to stop any ...
by NigelRen
Mon Oct 03, 2016 11:57 pm
Forum: PHP coding => General
Topic: tables and joins?
Replies: 3
Views: 973

Re: tables and joins?

You probably want to do something like... (pseudo code) SELECT category_id, category_name FROM category ORDER BY category_id For each row (all data needs to be retrieved) output category_name SELECT thread_name FROM threads WHERE thread_category = ? Execute query with category_id from first select f...
by NigelRen
Sun Oct 02, 2016 6:25 am
Forum: PHP General
Topic: Converting Website to PHP
Replies: 0
Views: 987

Re: Converting Website to PHP

The only thing I can say for now is: Have a look at the code, see how it is currently structured, try and get a feel for the various components they have used. BUT also remember that the current code may be the biggest pile of s**t that's ever been created - do not assume it's a useful reference to ...
by NigelRen
Sun Oct 02, 2016 6:12 am
Forum: PHP General
Topic: Is anyone interested in cloud-based PHP code quality checker?
Replies: 0
Views: 1065

Re: Is anyone interested in cloud-based PHP code quality checker?

It's a useful tool to be able to do some static analysis of your code, but a quick Google for php static analysis produces a set of existing tools which provide various forms of code checking. I've not used them, but it would be interesting to use them on some code I've been developing. Will have a ...
by NigelRen
Tue Sep 27, 2016 3:00 am
Forum: PHP coding => General
Topic: PHP + OCI + ORACLE. Error get OUTPUT parameter from procedure package
Replies: 0
Views: 663

Re: PHP + OCI + ORACLE. Error get OUTPUT parameter from procedure package

Do you need the double $ in front of:

Code: Select all

$$payments = $paymentsfraccionado->getElem($i);   //INCORRECT RETURN NULL!
by NigelRen
Mon Sep 26, 2016 11:42 am
Forum: mySQL & php coding
Topic: How do I read the whole database?
Replies: 2
Views: 1233

Re: How do I read the whole database?

I think that closing the connection isn't meant to happen until all the data has been read.

So

Code: Select all

mysqli_close($conn);
Should be at the very end.
by NigelRen
Sun Sep 25, 2016 6:27 am
Forum: mySQL & php coding
Topic: UPDATE Sql Statement changing all records
Replies: 2
Views: 1014

Re: UPDATE Sql Statement changing all records

You have a semi-colon in $sql = "UPDATE `events` SET `event_title`=:title, `event_desc`=:description, `event_start`=:start, `event_end`=:end; WHERE `event_id`=$id"; After the field :end - this is making it think that this is the end of the statement.
by NigelRen
Sat Sep 24, 2016 10:57 pm
Forum: mySQL & php coding
Topic: syntax error?
Replies: 1
Views: 1046

Re: syntax error?

The error your getting isn't about the syntax of the SQL, it's more about some variable isn't defined. In your link, you show that there is an else statement, can you show the code around that so that we can see what the various routes through the code are.
by NigelRen
Tue Sep 20, 2016 11:26 am
Forum: Other Database Engines
Topic: PHP and MS Access
Replies: 3
Views: 6243

Re: PHP and MS Access

It's not about the user that is running the web page, it's about the user that the PHP process is running as. After all, we are both using this forum to make posts - it doesn't mean we have access to do anything with the database directly. So (on Linux) I log in as 'nigel:nigel', but if I ran a PHP ...
by NigelRen
Mon Sep 19, 2016 9:58 am
Forum: PHP coding => General
Topic: How does table_in_process get populated?
Replies: 0
Views: 791

Re: How does table_in_process get populated?

If this file in 'included' in some other script, this may be populated in the enclosing script. Try debugging it and set a break-point on this line of code and see what it's set to.
by NigelRen
Mon Sep 19, 2016 6:21 am
Forum: Other Database Engines
Topic: PHP and MS Access
Replies: 3
Views: 6243

Re: PHP and MS Access

The other thing which may happen with files is the file permissions. When you run things interactively - you will of course be using your current users permissions, run as a background process (like PHP) and this may run as a different user. As a first thing - try setting file permissions for anyone...
by NigelRen
Mon Sep 19, 2016 2:00 am
Forum: Other Database Engines
Topic: PHP and MS Access
Replies: 3
Views: 6243

Re: PHP and MS Access

Have you checked that the ODBC extension in PHP is loaded? ( have a look at https://www.sitepoint.com/using-an-acce ... -with-php/ ).
by NigelRen
Sun Sep 18, 2016 11:22 pm
Forum: mySQL & php coding
Topic: Calculating the Average of Scores across a variable number of rows.
Replies: 1
Views: 1089

Re: Calculating the Average of Scores across a variable number of rows.

I'm not a MySQL expert - so the only thing I can think of is to do it long hand. Adding all values together and dividing by ones that are not null or 0. You can use IFNULL to make sure each value contains something averageable - so ifnull(round1,0) would make sure each value would at least be 0. You...
by NigelRen
Sun Sep 18, 2016 10:58 pm
Forum: PHP coding => General
Topic: Unknow error in code validation.
Replies: 1
Views: 656

Re: Unknow error in code validation.

Not sure how the db:: bit works (would need to know what framework or library your using) BUT there is no error checking that the select actually returns a row. The second time you try and fetch data - you do check the number of rows before trying to use the results (if ( db::num_rows( ) == 0 )) so ...
by NigelRen
Sun Sep 18, 2016 6:46 am
Forum: PHP coding => General
Topic: What wrong with this code?
Replies: 2
Views: 805

Re: What wrong with this code?

If you look at the manual for mktime - it shows that the 3rd, 4th and 5th parameters are month, day and year respectively. So depending on the format of the $date coming in, you need to use the various components of the $date array coming out of the previous line (the explode bit). So if the date co...
by NigelRen
Sat Sep 17, 2016 11:34 pm
Forum: PHP coding => General
Topic: FRAMEWORK
Replies: 1
Views: 656

Re: FRAMEWORK

I've been playing with writing a database library for a while, mainly around making the whole thing easier to manage than using PDO. My plan is to create a set of classes which work across multiple databases without having to change end user stuff. Also thinking about how this could be extended to X...
by NigelRen
Tue Sep 13, 2016 11:40 am
Forum: PHP coding => General
Topic: Hover message displaying data from mysql
Replies: 0
Views: 802

Re: Hover message displaying data from mysql

You can set hover text by using the title attribute of HTML - something like

Code: Select all

<div title="Hover text">hover me</div>
So you just need to create something like this with 'Hover text' from the database.
by NigelRen
Mon Sep 12, 2016 10:53 pm
Forum: PHP coding => Images
Topic: JPEG compression library for PHP
Replies: 2
Views: 1995

Re: JPEG compression library for PHP

Have you tried http://php.net/IMagick? Not something I've tried, but may be worth a try.
by NigelRen
Mon Sep 12, 2016 7:02 am
Forum: PHP coding => General
Topic: Like operator help!
Replies: 3
Views: 847

Re: Like operator help!

That won't work in a loop. The place I suggested putting the where clause is only added in the first iteration of the loop. The main reason why I suggested it this way was that if the 'WHERE ' was added as part of the original string and this loop didn't have anything to add - you'd end up with a h...
by NigelRen
Mon Sep 12, 2016 1:02 am
Forum: PHP General
Topic: Use PHP Variable as Button Name Issue
Replies: 0
Views: 1089

Re: Use PHP Variable as Button Name Issue

Firstly - relying on the number of the image is easily a potential problem. What if others are doing the same thing - files can be deleted from several places. Secondly - you use images/*.* to list the files and folder1/*.jpg* later on - not sure if they are directly related, but this could cause al...
by NigelRen
Mon Sep 12, 2016 12:49 am
Forum: PHP coding => General
Topic: "require_once" does not accept absolute pathing
Replies: 1
Views: 669

Re: "require_once" does not accept absolute pathing

Can you check the permissions of the file which it is failing to find, try making it readable by anyone. The process which is running the server may not be running with the same access as you have. It is a bit of a pain with directories, but once you find a method, it makes life a lot easier. Using ...
by NigelRen
Mon Sep 12, 2016 12:40 am
Forum: PHP coding => General
Topic: Like operator help!
Replies: 3
Views: 847

Re: Like operator help!

In case there are no terms used (so no like is generated) it would be better to put the where in...

Code: Select all

$query = " WHERE keywords LIKE '%$each%' ";
as it will only be added in when at least one clause is added.