Jump to content

Barand

Moderators
  • Posts

    24,563
  • Joined

  • Last visited

  • Days Won

    822

Everything posted by Barand

  1. 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
  2. We (UK) use the period but mainland europe (eg Germany) use the comma.
  3. Do you want $x = 5 * M_PI**2.7 - 5 * (M_PI - 1)**2.7;
  4. Most of us don't accept links from strangers. Post your problem.
  5. 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";
  6. 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.
  7. 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']);
  8. 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
  9. The picture you attached is too difficult to see but it sounds like you could use a rotation transform
  10. "SQL select statement" would be a better start. Select statements are not PHP.
  11. 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 ) ) )
  12. 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 | +----+---------+--------------+------------+
  13. I'll send you a
  14. It works if your screen width is >= 775
  15. 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>"; }
  16. Try my solution with 5.25
  17. 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>
  18. Alternative "sans-regex" solution... $str = "Joe has 5 large apples"; echo current( array_filter(explode(' ', $str), 'is_numeric' ) ) ; // 5
  19. 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
  20. Are those functions in functions.php used by other scripts or are are they just for this page?
  21. 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>
  22. You can't just switch to HTML in the middle of PHP code. Use the code @Phi11W gave you
  23. This, I think https://dev.mysql.com/downloads/installer/
  24. Remove those echo "jpeg"; etc. You can't have output before a header();
  25. It would appear that the variable $username_already_used is empty.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.