ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I'm new to PHP and mySQL and I'm finding both thoroughly interesting.
Though, I'm having issues while using mySQL functions in a PHP script on my Fedora 6 machine.
This is something that I wish to run:
mysql_connect(“localhost”, “username”,”password") or
die (“Could not connect to database”);
die (“Could not select database”);
And strangely, when I try to, the browser page goes completely blank and looking in the error log tells me that PHP is not recognizing the mysql functions in the script. I'm not able to run any of the mysql functions in php.
(The error log is:
[Wed May 02 17:52:19 2007] [error] [client ::1] PHP Fatal error: Call to undefined function mysql_connect() in /var/www/work/dbconnect.php on line 2, referer: http://ashesh.homeip.net/work/sign.php
My php version is 5.1.6.
Can anyone tell me how to rectify this?
Many thanks in advance.
Last edited by ashesh0326; 05-01-2007 at 07:25 AM.
Well, I just had another question.
It seems like I'm having trouble passing variables from forms to my php scripts.
For example, this is an extremely rudimentary script and yet it refuses to work in my case. No matter how many things I try, it's giving me the same, 'form data incomplete message'
if (isset($submit) && $submit=="yes")
echo "Thank you for submitting your form.";
<h3>form data incomplete</h3>
<form action=mypage.php method = post>
<input type=text name = email>
<input type=text name=first_name>
<input type=submit name=submit value=yes>
And it refuses to work. I had the same problem with a more complex form, and I had decided that I'd resolve the issue later.
As it seems now, I don't think I have any idea as to what's wrong with what.
Can anyone please help? Thanks in advance.
This is what I got when I checked apache's error_log:
Hi guys, I'm sorry about the double post.
It now seems like the problem was not with the code, but with the php.ini file. I checked and saw that the global variables had not been enabled, and since I enabled them, and restarted apache, there have been no problems.
The reason global variables is disabled is because of security reasons, the way to code it without globals being set is by using the $_POST super global variable. It is a good idea to use this because almost all web hosts will have it disabled and so you code will then be portable, and it gets you in to the practice of using this technique. Also I believe that the global variables directive is due to be phased out in the next major release of PHP.
Thank you Graemef. I had seen in the php.ini file that it had been mentioned that the global variables have been disabled for security issues, and I did not know about the $_POST or the $_GET arrays. Thank you so much for letting me know. I'll disable the global variables and use these arrays from now on. They look like more fun too.
By the way, speaking of security issues, can you please elaborate as to what kind of issues can be caused by using global variables? I'm just curious.
Anyways, thank you so much for your time. I really learnt something
There is a section that covers this in the manual under the part on security (in my copy it is chapter 29)
Essentially it will allow a cracker to try and manipulate your site by setting variable values that shouldn't be set. The help file chapter on Using Register Globals has a few example of how this can happen by sending the data in as a GET variable (that is include the data on the URL: In the example with the $authorized variable the URL might be tweaked as follows: www.mysite.org/results.php?authorized=true, with register globals on $authorized would be set to true, otherwise it would be $_GET['authorized'] that is set to true)