[Solved] Display checkbox after select combo box

Give your select list an ID. Using jQuery: $(document).ready(function(){ $(“#mySelect”).change(function(){ var selectValue = $(“#mySelect”).val(); switch(selectValue){ case “someValue”: var checkbox = ‘<input type=”checkbox” name=”something” value=”something” />’ $(“#someDiv”).append(checkbox); break; case “someOtherValue”: var checkbox = ‘<input type=”checkbox” name=”something” value=”something” />’ $(“#someDiv”).append(checkbox); break; } }); }); And so on. Hopefully, you get the idea. 5 solved Display checkbox after … Read more

[Solved] Symfony sub domain routing

This solution will intercept the REQUEST_URI and add the subdomain as a root folder if not already used. Meaning app.example.com and app.example.com/app will both access the same page. if(substr($_SERVER[‘HTTP_HOST’], 0, strlen(‘app.’)) === ‘app.’ && substr($_SERVER[‘REQUEST_URI’], 0, strlen(‘/app’)) !== ‘/app’) { $_SERVER[‘REQUEST_URI’] = ‘/app’.$_SERVER[‘REQUEST_URI’]; } The benefit of this is being able to put all your … Read more

[Solved] php username that checks on database “username already taken” [duplicate]

Please use below code to fix your problem <?php if(empty($_POST[‘username’])){ $username_error = “Please Input Username”; }else{ if( 6 > mb_strlen($_POST[‘username’]) || 20 < mb_strlen($_POST[‘username’])){ $username_error = “username must be at least 6 characters.”; }else{ $username = $_POST[‘username’]; $sql = “SELECT members.username FROM members WHERE username=””. $username.”””; $res = mysql_query($sql); if($res && mysql_num_rows($res) > 0){ $username_exists … Read more

[Solved] How can I get access to service variables?

public function pages($slug, PagesGenerator $pagesGenerator) { $output = $pagesGenerator->getPages($slug); // here is your error: $page is not defined. $id = $page->getId(); // something like this? $id = $output[‘page’]->getId(); return $this->render(‘list.html.twig’, [ ‘output’ => $output, ‘id’ => $id]); } solved How can I get access to service variables?

[Solved] Math Results Inaccurate PHP [closed]

In the line $open = fopen(“http://quote.yahoo.com/d/quotes.csv?s=$symbol&f=sl1d1t1c1ohgv&e=.csv”, “r”); You need to substitute the actual symbol, not leave it as a string in the query. Maybe something like this: $open = fopen(“http://quote.yahoo.com/d/quotes.csv?s=”.$symbol.”&f=sl1d1t1c1ohgv&e=.csv”, “r”); to concatenate the symbol will help. If you have an invalid request, you are probably looking at garbage. Also – you need to make … Read more

[Solved] How can the current time be used as a conditional value in php?

Try this $time = strtotime(“now”); // You will get the current time in UNIX timestamp.. if(($time%2)==0){ header (‘Location: http://www.misitio1.com’); }else{ header (‘Location: http://www.misitio2.com’); } If you want to work on the value of the current hour or minute, $hr = date(“H”); //Change it depending on your wish, 12 hr or 24 hr time. This will … Read more

[Solved] Accessing another class’ method from within a standalone function [closed]

$db is not available within the function scope, you could Pass $db as an argument function func($db, $query, $params){ return $db->db_control($query, $params); } $results = func($db, $query, $params); Or function func($query, $params){ global $db; return $db->db_control($query, $params); } $result = func($query, $params); Use global to make it available within the function, there’s probably other solutions … Read more

[Solved] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘)’ at line 5

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘)’ at line 5 solved You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near … Read more

[Solved] How to add query to my URL? [closed]

@lily … saw your message before I left. This code will create a file. Hope this sorts you out 🙂 <form action=”#” method=”post”> Number start:<br> <input type=”text” name=”num_start” value=”1″> <br> Number end:<br> <input type=”text” name=”num_end” value=”5″> <br><br> <input type=”submit” value=”Submit”> </form> <?php try{ if (isset($_POST[‘num_start’]) && isset($_POST[‘num_end’])){ $i = $_POST[‘num_start’]; $e = $_POST[‘num_end’]; while ($i … Read more

[Solved] change mysql to pdo and store result in variable

Try this: <?php $games_sql = “SELECT id,col1,col2,now FROM tblname ORDER BY now ASC LIMIT 9”; $sth = $conn->query($games_sql); $sth->setFetchMode(PDO::FETCH_ASSOC); $gn=0; while ($game_get = $sth->fetch()) { $id = $game_get[‘id’]; $col1 = $game_get[‘col1’]; $col2 = $game_get[‘col2’]; $now = $game_get[‘now’]; $gametimeanddate = jdate(“l d M y time G:i”,$now); $gamedate = jdate(“l d M y”,$now); $gametime = jdate(“G:i”,$now); //SAVE … Read more

[Solved] Compressing a string PHP [closed]

function line_encoding($e){ $s = preg_split(“//”,$e); $s[-1] = “”; $o = 1; $f = “”; for($c=0;$c<strlen($e);$c++){ if($s[$c]==$s[$c-1]){ $o++; }else{ $f .= $o==1?$s[$c-1]:($o.$s[$c-1]); $o=1; } } return $f; } Check if this works 7 solved Compressing a string PHP [closed]