
PeoMachine
Members-
Posts
52 -
Joined
-
Last visited
Everything posted by PeoMachine
-
You talking about the PHP validation, right? If yes, when your department is not valid, you didnt use the errors variable. So, even you have and invalid department you will send, because the sending is been wrapper by a if testing just the error variable.
-
What did you mean? I can't understand your point. Can you give us some example?
-
Try to use something like: $userId = end(explode('/', 'site/user/39')); It will explode the Uri and returns the last element of the array, in this case, the Id you wanted. You can get the URI on the SERVER global.
-
How do you know who is Admin and who doesnt ?
-
Custom CMS with SQL and PHP > Error
PeoMachine replied to Mitchell Ransom's topic in PHP Coding Help
Give us the "execQuery" method. Maybe youre not returning the MySQL resource. -
The button will be created in HTML, but you can echo him with the php. Try something like that <?php function authenticate() { // Your authentication logic here } // If user is loged in if(authenticate()) { echo '<a href="/user-acount">My account</a>'; } // If user need to login else { echo '<a href="/login">Log in</a>'; } It will prints out a link. You can customize the link with CSS and an image, if you want to.
-
Try to use a Apache, MySQL, PHP distribution, like XAMPP, WAMP, LAMPP, etc.
-
On the second question... i think the second way you did that is the better way to do. i think it improve the reading and the sense of the code.
-
User have to login twice to get logged in - why? :/
PeoMachine replied to Zola's topic in PHP Coding Help
When you try to login on the first time, you get redirect to where? -
What PHP Errors you get?
-
I'm sry about that... Well, look if your directive "file_uploads" on the php.ini file is On.
-
Set on your errors... maybe the path to the files is incorrect.
-
Try to put a enctype on your form.... <form method="post" action="" enctype="multipart/form-data"> </form>
-
Verify if search was performed. If yes, you show your results, else you show your form. Something like: if(isset($_GET['search'])) include 'search_results_page.php'; else include 'search_form.php';
-
You can use a loop (like foreach or for) to scan the array $_FILES, and testing the field you need with the empty function
-
You're testing the var "$results_num" to know if you have any record, but this var is not receiving any value... You need to fetch the result to know if you have any record. You just need to know if you have records in the database?
-
You're calling the search_funtion twice. When you use it in "else if (search_results($keywords) === false)", it echoes too.
-
Try to use the SQL: SELECT COUNT(*) FROM table WHERE itemA = 'foo' and itemB = 'bar';
-
What you really need? You will fetch it only one time or more? If you need to count it on the same column everytime, use the SQL Count.
-
The variable $userid has a value? From where it came? And why you set the values two times? $data2 = array("text"=>"$response" , "user_id"=> "$userid"); $data2["text"] = "$response"; $data2["user_id"] = "$userid"; You dont need to use the " too.
-
I'm not sure if i understand what you need... you need to count how much times these values repeat on the array fetched from the database, right? you can use: array_search('foo', $yourArray); http://php.net/array_search
-
Changing field name when MySQL information is dumped into a CSV
PeoMachine replied to skateme's topic in PHP Coding Help
Why not modify the database table? ... -
Well, it depends of the error... sometimes the adapter give an error (like connection errors), and sometimes you have to find him (like this case).
-
For development you can set display_errors = on, on the php.ini, or use ini_set('display_errors', 'on') on the files you wanted. In this case, a little echo on the return of $db->execute() could give you the answer.
-
INSERT INTO users (username,pass,email) ... show me the table creating SQL...