-
Posts
24,566 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
What is the form method of the form that contains your username2 input? Is it POST?
-
Not able to increment in foreach loop to get the values of an array
Barand replied to narutofan's topic in PHP Coding Help
-
Does this simple script work? <?php echo file_put_contents("ValidationsRedeemed.txt", 'This is a test' . "|", FILE_APPEND); ?> (It should output 15 to the browser and add "This is a test|" to your file)
-
Personally, I'd go with file_put_contents('filename', 'content', FILE_APPEND); So much easier than fopen(), fwrite(), fclose().
-
Echoing out variable in a table cell doesn't work
Barand replied to makamo66's topic in PHP Coding Help
Alas, {}s are part of the variable variable syntax edit: $a = 'foo'; $$a = 'bar'; echo $$a; //--> bar echo ${$a}; //--> bar echo $foo; //--> bar -
Echoing out variable in a table cell doesn't work
Barand replied to makamo66's topic in PHP Coding Help
@ginerjm those currency symbols need escaping otherwise they are interpreted as variable variables ($$price, $$number) <td>\${$price}</td> <td>\${$number}</td> -
Echoing out variable in a table cell doesn't work
Barand replied to makamo66's topic in PHP Coding Help
Which variable doesn't echo out. They all do for me once I put something in them. (BTW, You should've learnt to use code tags by now.) -
A single = is an assignment operator, so if ($validation = "true") assigns the string "true" to $validation. In your second code example you are checking equality correctly but your are checking if it is equal to the string value "true". This will suffice... if ($validation) { as this means "if validation is true"
-
Echoing out variable in a table cell doesn't work
Barand replied to makamo66's topic in PHP Coding Help
Sounds like you're not doing it correctly. -
SELECT school , city , TRIM(REPLACE(school, city, '')) as new_school FROM school;
-
If you have a syntax error elsewhere in the script (and it sounds like you have) then it will not run at all, so your error reporting statement cannot be executed. Error reporting needs to be defined in the php.ini file.
-
Not able to increment in foreach loop to get the values of an array
Barand replied to narutofan's topic in PHP Coding Help
As I obviously cannot run the script to see for myself, perhaps you would be kind enough to give me an example of the data being passed. My main concern is the structure of your code. You are running a query to get an array of ids and then looping through that resulting array to run queries based on those ids. Running queries within loops is extremely inefficient. You should be running a single query which joins the tables on those ids to get the data you require. -
Not able to increment in foreach loop to get the values of an array
Barand replied to narutofan's topic in PHP Coding Help
OK, so ff() returns an array of the user's friend ids. The next uncommented line is foreach ($update_id1 as $i => $v) { What does $update__id1 contain (there doesn't appear to be a prior reference)? -
Not able to increment in foreach loop to get the values of an array
Barand replied to narutofan's topic in PHP Coding Help
in the code foreach ($array as $i => $v) $i = index of the current element $v = value of the current element You use a function ff() as in $ids= ff($f, $project); but I can't see it defined anywhere. What does it do? Then I'll have some idea of what the data in $ids looks like. -
Not able to increment in foreach loop to get the values of an array
Barand replied to narutofan's topic in PHP Coding Help
What incrementing feature? -
Not able to increment in foreach loop to get the values of an array
Barand replied to narutofan's topic in PHP Coding Help
Please use the "code" icon for code, not the "quote" -
Not able to increment in foreach loop to get the values of an array
Barand replied to narutofan's topic in PHP Coding Help
Then tell us what the code you posted is supposed to do. -
Not able to increment in foreach loop to get the values of an array
Barand replied to narutofan's topic in PHP Coding Help
Why don't you post your actual code (that code won't execute past the first line) and tell us what you are trying to achieve, not just how you are failing to do whatever it is. -
You also need to output the value into the html from php <FORM METHOD="POST" ACTION="SCAction.php/?cmd= set&var1=<?=$SC2?>">
-
The values in the forms input fields get sent to the action php file, so put it in one. Use a hidden field if you don't want it visible.
-
New problem. All images from iphone rotate when I upload them.
Barand replied to imgrooot's topic in PHP Coding Help
Why don't you simplify things and rotate and compress in one single operation? -
He's testing for 0 or 1. 0! and 1! both equate to 1, so no need to calculate any further. Every recursive function needs a stop condition otherwise you quickly overflow the stack with an infinite recursion.
-
I was assuming that a report_filed meant they attended. But, yes, you could mysql> SELECT weekofyear(start_time) as wkno -> , SUM(is_no_show=0 AND is_cancelled=0) as attended -> , SUM(is_no_show=1) as no_shows -> , SUM(is_cancelled=1) as cancellations -> FROM heartstring -> GROUP BY wkno; +------+----------+----------+---------------+ | wkno | attended | no_shows | cancellations | +------+----------+----------+---------------+ | 40 | 2 | 0 | 0 | | 41 | 0 | 1 | 1 | | 42 | 1 | 0 | 0 | | 43 | 0 | 1 | 0 | +------+----------+----------+---------------+
-
Weird! When I ran this based on https://imgur.com/a/kYwmuO1 I got +------+----------+----------+---------------+ | wkno | attended | no_shows | cancellations | +------+----------+----------+---------------+ | 40 | 2 | 0 | 0 | | 41 | 0 | 1 | 1 | | 42 | 1 | 0 | 0 | | 43 | 0 | 1 | 0 | +------+----------+----------+---------------+
-
Oh great! I love pictures. Where? You're not giving many clues if you want help.