-
Posts
24,563 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
I'm like you then if it it isn't a decimal. Perhaps some kind of vector notation, but if it is I don't know what the hell to do with it
-
We (UK) use the period but mainland europe (eg Germany) use the comma.
-
Do you want $x = 5 * M_PI**2.7 - 5 * (M_PI - 1)**2.7;
-
Most of us don't accept links from strangers. Post your problem.
-
No, you really don't want to do that - use a single query which joins the two tables on the user_id. SELECT users_username FROM users u JOIN planets p ON u.users_id = p.planets_ownerid WHERE planets_galaxy = $testowanaGalaktyka AND planets_starsystem = $testowanySystem AND planets_planet = $testowanaPlaneta";
-
You don't need the SVG. I used it to skew the container but not the text. Using just html/css you can convert to by adding transform:rotate(-45deg) skewX(45deg); to its styling. It will still need some positioning adding though.
-
If, in your form html, you name your input fields customer[fname], customer[lname] etc. when inserting you can then $stmt = $pdo->prepare("INSERT INTO customer (first_name, last_name) VALUES (:fname, :lname)"; $stmt->execute($_POST['customer']);
-
Here's an example to get you started <?php function svgHead($txt) { $svg = "<svg class='longhead' width='150' height='100'> <style type='text/css'> .headtext { font-size: 11pt; fill: orange; } </style> <path d='M 0 100 l 40 0 l 100 -100 l -40 0 Z' fill='black' /> <text x='35' y='95' class='headtext' transform='rotate(-45, 35, 95 )'>$txt</text> </svg> "; return $svg; } ?> <style type='text/css'> div.outer { border: 1px solid black; height: 105px; } svg.longhead { margin: -50px; position: relative; top: 35px; left: 50px; } </style> <div class='outer'> <?= svgHead('Long Heading 1')?> <?= svgHead('Long Heading 2')?> <?= svgHead('Long Heading 3')?> <?= svgHead('Long Heading 4')?> <?= svgHead('Long Heading 5')?> <?= svgHead('Long Heading 6')?> </div> output
-
The picture you attached is too difficult to see but it sounds like you could use a rotation transform
-
image gallery instering with condition on update page
Barand replied to sambhu's topic in PHP Coding Help
Note that my suggested file inputs contain the id in the input name From those two, $FILES array will look something like this, showing those ids as keys in the array. Use those when updating the table. $_FILES = Array ( [myimages] => Array ( [name] => Array ( [2] => ab4567.jpg [4] => bc5678.jpg ) [type] => Array ( [2] => image/png [4] => image/jpeg ) [tmp_name] => Array ( [2] => C:\Windows\Temp\php9A0A.tmp [4] => C:\Windows\Temp\php9A2A.tmp ) [error] => Array ( [2] => 0 [4] => 0 ) [size] => Array ( [2] => 32769 [4] => 13741 ) ) ) -
image gallery instering with condition on update page
Barand replied to sambhu's topic in PHP Coding Help
Join your tables in q query, matching content with image. Where there is no image (denoted by NULL) output a file input to upload an image. english_version english_gallery +----+---------+--------------+ +------------+----------+------------+ | id | title | content | | gallery_id | image_id | image | +----+---------+--------------+ +------------+----------+------------+ | 1 | Ttile 1 | aaaaaaaa | | 1 | 1 | ab1234.jpg | | 2 | Title 2 | bbbbbb | | 2 | 3 | ab2345.jpg | | 3 | Title 3 | cccccccc | | 3 | 5 | ab3456.jpg | | 4 | Title 4 | dddddd | +------------+----------+------------+ | 5 | Title 5 | eeeeeeeeeeee | +----+---------+--------------+ SELECT v.id , v.title , v.content , g.image FROM english_version v LEFT JOIN english_gallery g ON v.id = g.image_id ORDER BY v.id; query results +----+---------+--------------+------------+ | id | title | content | image | +----+---------+--------------+------------+ | 1 | Ttile 1 | aaaaaaaa | ab1234.jpg | | 2 | Title 2 | bbbbbb | NULL | <input type='file' name='myimages[2]'> | 3 | Title 3 | cccccccc | ab2345.jpg | | 4 | Title 4 | dddddd | NULL | <input type='file' name='myimages[4]'> | 5 | Title 5 | eeeeeeeeeeee | ab3456.jpg | +----+---------+--------------+------------+ -
-
Bullsh*t. Have you even tried it? Example... $strings = [ "Joe has 5 large apples", "Joe has 5.25 large apples", "Joe has 500 large apples" ]; foreach ($strings as $str) { $number = current( array_filter(explode(' ', $str), 'is_numeric' ) ) ; echo "$str | $number<br>"; }
-
Try my solution with 5.25
-
One way <div> <div style='width: 30%; background:#FFC0C0; display: inline-block; padding:8px;'> Div 1 </div> <div style='width: 50%; background:#C0FFFF; display: inline-block; padding: 8px;'> Div 2 </div> </div>
-
Alternative "sans-regex" solution... $str = "Joe has 5 large apples"; echo current( array_filter(explode(' ', $str), 'is_numeric' ) ) ; // 5
-
Here is a simple example of what I was trying to explain. The elements to be output are created in the php section and stored in variables. Because they are now stored, they can be output to the page in any order you want (in this case completely different from the order they were calculated) Code <?php $votes = [ 'Archie' => 203, 'Ben' => 406, 'Carol' => 584, 'David' => 398, 'Emily' => 259 ]; $tdata = ''; $total_votes = 0; foreach ($votes as $candidate => $tot) { $tdata .= "<tr><td>$candidate</td><td>$tot</td></tr>"; $total_votes += $tot; } $max_votes = max($votes); $winner = array_keys($votes, $max_votes)[0]; $win_pcent = number_format($max_votes/$total_votes*100, 0); $result = "Winner is $winner with $win_pcent% of the votes"; ?> <!DOCTYPE html> <html lang='en'> <head> <title>sample</title> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> <script type='text/javascript'> </script> <style type='text/css'> body { background-color: #fbf7e9; } </style> </head> <body> <h2><?= $result ?></h2> <h3>Total votes cast was <?= $total_votes ?></h3> <table style='width: 300px;'> <tr><td><b>Candidate</b></td><td><b>No of votes</b></td></tr> <?= $tdata ?> </table> </body> </html> Output
-
Are those functions in functions.php used by other scripts or are are they just for this page?
-
Yes. Arrange your page so all php code comes first followed by the html section which does all the output <?php // call function to populate $statusCounts array // store anything that requires outputting in variables ?> <html> <body> <h2>Completed: <?=$statusCounts['Completed']?></h2> etc </body> </html>
-
Trying to pull URL from DB and use in <IFRAME>
Barand replied to endorush85's topic in PHP Coding Help
-
This, I think https://dev.mysql.com/downloads/installer/
-
php image scaler, (supporting "gif", "png" and "jpeg")
Barand replied to oz11's topic in PHP Coding Help
Remove those echo "jpeg"; etc. You can't have output before a header(); -
Xavier - PHP Login Script & User Management Admin Panel ->translation
Barand replied to Tanja's topic in Third Party Scripts
It would appear that the variable $username_already_used is empty.