-
Posts
24,605 -
Joined
-
Last visited
-
Days Won
831
Everything posted by Barand
-
yes
-
When the user logs in, store their id in $_SESSION variable. Then you uses a WHERE clause to get that users data SELECT e.emp_id , e.emp_name , t.task_id , t.description , t.status FROM employee e JOIN assignment a ON e.emp_id = a.emp_id JOIN task t ON a.task_id = t.task_id WHERE e.emp_id = $loggedInUser
-
You join table on the matching fields. So join employee to assignment using the emp_id fields and join task to assignment using the task_id fields. SELECT e.emp_id , e.emp_name , t.description FROM employee e JOIN assignment a ON e.emp_id = a.emp_id JOIN task t ON a.task_id = t.task_id
-
Not a difficult problem. It's basically maintaining three tables +-------------+ +--------------+ | employee | | task | +-------------+ +--------------+ | emp_id (PK) | | task_id (PK) | | empname | | description | +-------------+ | status | | +--------------+ | | | | | | | +----------------+ | | | assignment | | | +----------------+ | +---------------------<| assign_id (PK) |>------------------+ | emp_id | | task_id | +----------------+ Use the assignment table to find the tasks assigned to an employee
-
It should have. That's THE PHP MANUAL. What have you been reading?
-
http://php.net/manual/en/function.file.php Parameter section flags subsection
-
Creating/getting a url to a dynamically created file...
Barand replied to enveetee's topic in PHP Coding Help
Store your pdf file locations relative to the root, not relative to your application. Then it doesn't matter which folder the application runs from -
As I pointed out before, you input lines ($r) have eol at the end, so the second "0" will be at beginning of next line. Take out the newlines when you read. $readin=file('proverb_load.txt', FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES ); $handle = fopen("proverb_load.txt", 'a'); foreach($readin as $r){ $num=0; $count=0; fwrite($handle,$num.$r.$count.PHP_EOL); } fclose($handle); Input jkhkjj jkhlkhjljk your word for the day we wish you a merry christmas good tightings to you i love football After processing jkhkjj jkhlkhjljk your word for the day we wish you a merry christmas good tightings to you i love football 0jkhkjj0 0jkhlkhjljk0 0your word for the day0 0we wish you a merry christmas0 0good tightings to you0 0i love football0
-
The lines in your input already have EOL at the end. You are adding an extra when you write. Also, open the output file before the loop, write records in the loop, close file after the loop
-
How can I get client timezone using PHP/JS
Barand replied to aHMAD_SQaLli's topic in PHP Coding Help
Javascript Date class has getTimezoneOffset() method;- 4 replies
-
- 1
-
-
- php
- javascript
-
(and 1 more)
Tagged with:
-
try using $readin=file('proverb_load.txt', FILE_SKIP_EMPTY_LINES );
-
Try a bit of debugging. Examine the content of the error message given by mysqli_error() after executing the delete query
-
A new argument is the last thing you need, you are already passing too many. The third argument is the ID of the one you want selected. You effectively have two third parameters. Instead of passing 27 after the $_GET() parameter, pass it instead of the $_GET().
-
Yes, where did you get this from VALUES (?,?,NOW(),?,?) when you need to put values into 14 columns? And here, when you bind, you specify 14 variables but only define types ('ssi') for 3, none of which is an integer. And where, in the examples in the manual, did you see VALUES() in a bind statement syntax?
-
It counts them while it is processing and outputting them. If you want the list afterwards then it needs to be stored then printed after the counts are printed. $data = explode("\n", $stream); $fail=0; $failed = ''; foreach ($data as $line) { $arr = str_getcsv($line,',', "'"); if ($arr[5] != 'OK') { $failed .= $line.'<br>'; // store failures ++$fail; } } $tot = count($data); printf("%d sensors tested<br>%d OK<br>%d failed (listed below)<hr>%s", $tot, $tot-$fail, $fail, $failed);
-
In that case, writing it for you isn't going to help you understand either. The manual should be available in different languages. Go to the site and select your native one.
-
like this $data = explode("\n", $stream); $fail=0; foreach ($data as $line) { $arr = str_getcsv($line,',', "'"); if ($arr[5] != 'OK') { echo $line.'<br>'; ++$fail; } } $tot = count($data); printf("<hr>%d sensors tested<br>%d OK<br>%d failed", $tot, $tot-$fail, $fail);
-
Then look at the examples, and see how they differ from yours
-
http://uk1.php.net/manual/en/mysqli-stmt.bind-param.php
-
does this do it? $data = explode("\n", $stream); foreach ($data as $line) { $arr = str_getcsv($line,',', "'"); if ($arr[5] != 'OK') { echo $line.'<br>'; } }
-
buildSelectOptions() takes 3 arguments, you are passing 4.
-
The answer is clearly "Yes"
-
Look again! before: ID: 14 Cover:1 after: ID: 14 Cover:0 Both the image and cover are changed. If your objective is to switch which is the main image, just change cover and not the image name (or vice versa)
-
if it's in a file, fgetcsv() would be my weapon of choice.
-
OK, so what you told us in the first post was just a small part of the whole story. Is that "unformatted output" held in a text file?