Search found 388 matches

by landi
Mon Jun 05, 2017 10:50 am
Forum: Other Database Engines
Topic: PHP Lighttpd submit button issue Raspberry pi GPIO
Replies: 3
Views: 1448

Re: PHP Lighttpd submit button issue Raspberry pi GPIO

Hi, One way is to store the state of each switch within a hidden field e.g. <?php // See if hidden input had a value last time, and if so, store it if (isset($_REQUEST["switch1"])) { $sSwitch1 = $_REQUEST["switch1"]; } else { $sSwitch1 = 'OFF'; } ... // Now add some code to change the state if (isse...
by landi
Mon Jun 05, 2017 2:44 am
Forum: Other Database Engines
Topic: PHP Lighttpd submit button issue Raspberry pi GPIO
Replies: 3
Views: 1448

Re: PHP Lighttpd submit button issue Raspberry pi GPIO

Hi, Welcome to PHP! I love the [idea of] the Pi, and I've owned a few, I just haven't got round to using it for anything, so I'm afraid my Pi knowledge is scant :) You probably won't get many answers to your post in this section which is the 'alternate db' section - it might be better off in the gen...
by landi
Sat Mar 04, 2017 6:14 am
Forum: Other Database Engines
Topic: PHP and Postgres: Why would I get “Error : Unable to open database ” when the credentials are correct?
Replies: 4
Views: 1498

Re: PHP and Postgres: Why would I get “Error : Unable to open database ” when the credentials are correct?

Sorry, I left a couple of brackets off the 'isset' line. The corrected code is here: <?php error_reporting(E_ALL); ini_set('display_errors', 1); $host = "host=127.0.0.1"; $port = "port=5432"; $dbname = "dbname=foobar"; $credentials1 = "user=jdoe password=jdoe@so.com"; // ### if (isset($_REQUEST["nam...
by landi
Fri Mar 03, 2017 6:15 am
Forum: Other Database Engines
Topic: PHP and Postgres: Why would I get “Error : Unable to open database ” when the credentials are correct?
Replies: 4
Views: 1498

Re: PHP and Postgres: Why would I get “Error : Unable to open database ” when the credentials are correct?

Hi, I see you're trying to be logical - and that's good! I can't see anything obviously wrong, and I'm not an postgres person, but in my experience, if the connect doesn't work, it's because one or more of the credentials are wrong! You could try the following: I've changed the 'stand alone' version...
by landi
Mon Jun 13, 2016 3:17 am
Forum: Other Database Engines
Topic: PHP + ORACLE Database Select Statement, Help Me
Replies: 2
Views: 2665

Re: PHP + ORACLE Database Select Statement, Help Me

Your query is too complex to review. Post an example of a query using just one table and one column. If that works, we can go from there. If it fails, we can try to fix it.
by landi
Sun Jun 12, 2016 5:13 am
Forum: Other Database Engines
Topic: PHP + ORACLE Database Select Statement, Help Me
Replies: 2
Views: 2665

Re: PHP + ORACLE Database Select Statement, Help Me

Hi, I don't understand your query, and the code you posted cannot produce the error you posted. However, it is worth noting that while mysql can use lowercase column names, with oracle you MUST use UPPERCASE to retrieve the column values from the row. For example: // You can use lowercase for the co...
by landi
Mon Apr 11, 2016 7:02 am
Forum: PHP coding => General
Topic: If else statement
Replies: 5
Views: 997

Re: If else statement

Sorry, I think we're not communicating. Good luck.
by landi
Mon Apr 11, 2016 5:21 am
Forum: PHP coding => General
Topic: If else statement
Replies: 5
Views: 997

Re: If else statement

Hi, As chorn says, you have not framed a good question. I suggest you post the results of the following code: <?php echo 'x1'; var_dump($priceTo); $priceTo = 37; if($priceTo != '' ){ echo 'x2£'.$priceTo.''; }else if ($rentTo != ''){ echo 'x3£'.$rentTo.''; }else { echo 'x4£'.$price.''; } ?> <br><br> ...
by landi
Wed Feb 17, 2016 8:38 am
Forum: Other Database Engines
Topic: Data Conversion (String to varchar(32))
Replies: 1
Views: 1202

Re: Data Conversion (String to varchar(32))

Ultimately, I don't think it is the select statements that are the issue here, I get the feeling that it is more about the way PHP stores the data. The value retrieved from the first SQL statement In general, I've never had to manipulate varchar data in and out of php variables. So I expect your ex...
by landi
Wed Feb 17, 2016 2:22 am
Forum: Other Database Engines
Topic: Data Conversion (String to varchar(32))
Replies: 1
Views: 1202

Re: Data Conversion (String to varchar(32))

Hi, I don't do SqlServer, but in other databases such as oracle, Varchar can be bytes or chars, where chars are unicode (2 bytes per char). Char causes Microsoft Access all sorts of headaches. I don't know if you can, or if you need to declare your varchar as byte, but if you can it is worth a shot....
by landi
Sat Feb 13, 2016 6:58 am
Forum: Other Database Engines
Topic: mssql_connect not working
Replies: 1
Views: 1121

Re: mssql_connect not working

extension=php_sqlsrv_56_ts.dll So, have I been attempting the wrong command this whole time? Yes. Notice how the phrase 'sqlsrv' relates the extention name 'php_sqlsrv_56_ts.dll' to the function call prefix for 'sqlsrv_connect'. This is quite common in php. This extension requires the Microsoft ODB...
by landi
Fri Feb 12, 2016 4:47 pm
Forum: Other Database Engines
Topic: mssql_connect not working
Replies: 1
Views: 1121

Re: mssql_connect not working

Hi, Sound likes there is no driver loaded. I'm not familiar with the requirements of mssql, but a quick google shows that you might want to be using the newer sqlsrv_xxx function (e.g. sqlsrv_connect instead of mssql_connect). If you are getting 'undefined function' then you haven't got that extensi...
by landi
Tue Apr 28, 2015 12:33 pm
Forum: PHP coding => General
Topic: PHP dev and permissions
Replies: 13
Views: 1913

Re: PHP dev and permissions

So I tried getting the include file to run directly from the browser (not through the /web calling script) and it could not find the file Exactly. Only files under the /web folder are accessible via a url. If so, does that mean the folder structure as you suggested makes my /web folder files safe a...
by landi
Tue Apr 28, 2015 8:04 am
Forum: PHP coding => General
Topic: PHP dev and permissions
Replies: 13
Views: 1913

Re: PHP dev and permissions

Hi, So you could create private and data folders like this: (/web added for context) /private /data /web then your include files go into /private where they cannot be read by the browser but you can include them with: require('../private/myIncludeFile.php'); and your data goes in /data which needs e...
by landi
Mon Apr 27, 2015 11:58 pm
Forum: PHP coding => General
Topic: PHP dev and permissions
Replies: 13
Views: 1913

Re: PHP dev and permissions

Hi public_html is a common name for the PUBLIC part of your website. If you can see this shortcut, it must be IN a folder. Why not show us your folder structure (not files, just folders)
by landi
Mon Apr 27, 2015 1:51 pm
Forum: PHP coding => General
Topic: PHP dev and permissions
Replies: 13
Views: 1913

Re: PHP dev and permissions

Do you have to use this ISP? It's unusual not to have a web root and a private folder in the same 'user root'. You can get the apache user from a script by making the script directory world writable (undesirable to leave it like this!) and doing: $myfile = fopen("newfile.txt", "w"); Then look at the...
by landi
Mon Apr 27, 2015 10:01 am
Forum: PHP coding => General
Topic: PHP dev and permissions
Replies: 13
Views: 1913

Re: PHP dev and permissions

Some ISPs have a 'file manager' area via http that gives you chown and chmod, but if you haven't got that, then you will need to use world rw privileges.
-A
by landi
Mon Apr 27, 2015 2:06 am
Forum: PHP coding => General
Topic: PHP dev and permissions
Replies: 13
Views: 1913

Re: PHP dev and permissions

Hi, As far as I can tell from your description, there are only two 'users' in this scenario: you and the web server. You need rw permission on each .php file so you can overwrite it / edit it / ftp. You need rwx on each folder because folders need x to allow them to be used. You will probably be the...
by landi
Tue Mar 24, 2015 12:31 pm
Forum: PHP coding => General
Topic: user/admin login not working
Replies: 2
Views: 1069

Re: user/admin login not working

What is with escaping and not using prepared statements?
Yeah, you're right. Assuming all these sites are 'real', then it is frightening how many of them are going to be vulnerable once they go live. If I recall, one user said he would 'fix it later' as though security were somehow difficult.
-A
by landi
Fri Mar 13, 2015 3:26 am
Forum: PHP coding => General
Topic: Can I display a string literal and expression in a single statement?
Replies: 1
Views: 1386

Re: Can I display a string literal and expression in a single statement?

Hi,
Brackets around your maths expressions also works (I suspect because of operator precedence)

Code: Select all

echo('2 + 3 = ' . ($var1 + $var2) .'<br>');// 2 + 3 = 5
echo("2 + 3 = ".($var1 + $var2).'<br>');// 2 + 3 = 5
echo('2 /+ 3 /= '.($var1 + $var2).'<br>');// 2 /+ 3 /= 5
-A
by landi
Thu Mar 12, 2015 10:17 pm
Forum: PHP coding => General
Topic: PHP, open new window, to prevent BACK or REFRESH
Replies: 3
Views: 968

Re: PHP, open new window, to prevent BACK or REFRESH

I am new to these forum please how do i post my questions
Go to the top of any forum, and press the 'New Topic' button.
-A
by landi
Wed Mar 11, 2015 11:08 am
Forum: PHP General
Topic: need a help ...
Replies: 9
Views: 2427

Re: need a help ...

Hi, 1) When you need a new help, start a new topic :) Also, give the topic a good name like 'How to read file', and not 'need help'. This makes it easier for others to read your topic. 2) You get the error because the explode() did not work. Usually you use explode to seperate values like this: <?ph...
by landi
Mon Mar 09, 2015 2:24 am
Forum: PHP General
Topic: need a help ...
Replies: 9
Views: 2427

Re: need a help ...

Hi, You've solved the first problem. Now it looks like your connection is failing. I suggest you try the mysqli_ functions instead of mysql_. To test: create a simple program. Here is an example from the manual at: http://php.net/manual/en/mysqli.construct.php <?php $link = mysqli_connect('localhost...
by landi
Sun Mar 08, 2015 12:27 pm
Forum: PHP General
Topic: need a help ...
Replies: 9
Views: 2427

Re: need a help ...

Hi,
Do post your code inside of [ code ] tags so we can read it :)
This line of code has an error:
if (mysql_num_rows($query, $sql)=1)
It should use == e.g.:

Code: Select all

if (mysql_num_rows($query, $sql)==1)
-A
by landi
Thu Mar 05, 2015 2:25 am
Forum: PHP General
Topic: T_CONSTANT_ENCAPSED_STRING ?
Replies: 0
Views: 626

Re: T_CONSTANT_ENCAPSED_STRING ?

Yup, I've seen this sort of thing before with hidden characters.
- A