[Solved] PHP regex to replace words starting with @ end ending with 2 spaces [closed]

[ad_1] Match a word beginning with a @, reset matching output, match more than one whitespace afterwards then do a replacement: preg_replace(‘~@\w+\K\s{2,}~’, ‘ ‘, $input_string); Regex explanation: @\w+ # Match a `@` fowlling a word \K # Reset matching process output \s{2,} # Match double or more whitespaces PHP live demo [ad_2] solved PHP regex … Read more

[Solved] Output last 5 rows in database [CakePHP] [closed]

[ad_1] You have to use find() Other way is to use query() $alltext = $this->Text->find(‘all’, array(‘limit’ => 5,’order’=>array(‘id DESC’))); <?php foreach ($alltextext as $text): ?> // format as necessary <td><?php echo $text[‘Text’][‘id’]; ?></td> // add others here <?php endforeach; ?> 3 [ad_2] solved Output last 5 rows in database [CakePHP] [closed]

[Solved] Value from a url using php [closed]

[ad_1] Here’s a more fool proof way than using regex. <?php $url = “http://www.youtube.com/watch?v=N22qGmYIUVU&feature=g-logo”; $parts = parse_url($url); parse_str($parts[‘query’], $query); print_r($query); // $query[‘v’] is what you want ?> 1 [ad_2] solved Value from a url using php [closed]

[Solved] Dynamically fetch content inside accordion from database in php [closed]

[ad_1] You need to use something unique in your accordion id E.G. <div class=”accordion” id=”accordionExample”> <?php $i = 1; $user = $_SESSION[‘auth_user’][‘user_id’]; $query = “SELECT * FROM task WHERE user_id = ‘$user’ ORDER BY datetime DESC”; $query_run = mysqli_query($con, $query); while ($res = mysqli_fetch_array($query_run)) { ?> <div class=”card”> <div class=”card-header” id=”headingOne<?php echo $i ?>”> <h4 … Read more

[Solved] Can I store query result of one field into different variables? if not then what should I do for that?

[ad_1] $query = mysql_query(“select `subject` from `markssub1` where `sname`=’$user’ AND `sid`=’$id'”); $subjects = []; while($row = mysql_fetch_array($query)) { $subjects[] = $row[‘subject’]; } foreach($subjects as $subject){ echo $subject . ‘\n’; } 3 [ad_2] solved Can I store query result of one field into different variables? if not then what should I do for that?

[Solved] how to send data from html form to php using ajax using upload also

[ad_1] function dataSubmit(formid){ //alert(formid); // $(‘.result’).html(‘<p style=”display:block; text-align:center;”><i class=”fa fa-refresh fa-spin fa-fw” aria-hidden=”true”></i><span class=”sr-only”>Process…</span> Processing</p>’); var action = $(formid).attr(‘action’); var fd = new FormData(); var file_data = $(‘input[type=”file”]’)[0].files; // for multiple files for(var i = 0;i<file_data.length;i++){ fd.append(“file_”+i, file_data[i]); } var other_data = $(‘form’).serializeArray(); $.each(other_data,function(key,input){ fd.append(input.name,input.value); }); $.ajax({ url: action, data: fd, contentType: false, processData: false, … Read more

[Solved] First echo database row doesn’t show PHP [duplicate]

[ad_1] Replace the for loop with this: while($row=mysqli_fetch_array($result)){ echo “<td><strong>From:</strong>”.$row[“fra”].” <br><strong>To:</strong> “.$row[“til”].” <br><strong>Date:</strong> “.$row[“dato”].” <br><strong>Clock: </strong> “.$row[“klokkeslett”].”</td>”; echo “<td></td>”; echo “<td></td>”; } You are telling you program to keep looping through mysql_fetch_array($result) and assign the fetched record to $row. Also, do not forget to take out this line $countRows=mysqli_affected_rows($db); as you no longer need it. … Read more

[Solved] 3 checkboxes different names and only select one

[ad_1] Based on this answer by D.A.V.O.O.D, you can use jQuery for this. Just add a class (for example “abc”) to your checkboxes like: <label><input type=”radio” name=”selling” value=”1″ class=”abc” />Parduodu</label><br> <label><input type=”radio” name=”trade” value=”1″ class=”abc” />Keičiu</label><br> <label><input type=”radio” name=”gift” value=”1″ class=”abc” />Dovanoju</label> and use the following jQuery: $(“.abc”).each(function() { $(this).change(function() { $(“.abc”).prop(‘checked’,false); $(this).prop(‘checked’,true); }); }); … Read more

[Solved] Syntax error: unexpected ‘:’

[ad_1] Try this. Your starting quote is incorrect it should be ‘ $checkout->setReturnUrl( ‘http://www.fruitfulfarm.net/fundraiser/thank-you.html?action=checkedout’ ); [ad_2] solved Syntax error: unexpected ‘:’

[Solved] Stock keeping System [closed]

[ad_1] You would need at the very least two tables. One for storing stores and other for products. One table for each store makes little sense to me. 2 [ad_2] solved Stock keeping System [closed]

[Solved] $.ajax to call php function not working

[ad_1] Thanks everyone for your input, they were all good ideas, but in the end, the issue ended up being an IDE issue with codeLobster. I removed the src=”” line from <script type=”text/javascript” src=”https://stackoverflow.com/questions/34077625/js/jquery.js”></script> and let the intellisense fill in the src=”https://stackoverflow.com/questions/34077625/js/jquery.js” I finally got it to see the script but I was still getting … Read more