[Solved] How to provide dynamic HTML in PHP?

You could use include and ob_get_contents to get the html as string and do some str_replace or preg_replace on that. Your HTML: <html> <body> <img src=”https://stackoverflow.com/questions/10533622/{IMAGE_SRC}” width=”512″ height=”512″ name=”image” /> </body> </html> Your PHP: ob_start(); include ‘your_file.html’; $buffer = ob_get_contents(); ob_end_clean(); $buffer = str_replace(“https://stackoverflow.com/questions/10533622/{IMAGE_SRC}”, ‘your_image.png’, $buffer); print $buffer; 1 solved How to provide dynamic HTML … Read more

[Solved] How do I displayed in the table this array, with for?

<table border=”1″><?php foreach ($ex[‘Product’] as $row) { echo ‘<tr>’; echo ‘<td>’.$row[‘item_id’].'</td><td>’.$row[‘product_name’].'</td>’; echo ‘</tr>’; } ?></table> solved How do I displayed in the table this array, with for?

[Solved] Or statement in PHP

try this : code: <span class=”subnav2″ <? if(($page == ‘a’) || ($page == ‘b’)): echo “id=\”active\”” endif ?>> 1 solved Or statement in PHP

[Solved] show results with same username php

you have two mistakes 1- SQL syntax error, correct syntax is $sql = “SELECT id, name, description FROM all_scores WHERE username=””.$username.”””; 2- the variable $username is overwritten by the username of the database try this: $sql = “SELECT id, name, description FROM all_scores WHERE username=””.$_SESSION[“username’].”‘”; 0 solved show results with same username php

[Solved] clear all php sessions by clicking on link

<a href=”https://stackoverflow.com/questions/30121039/index.php?clearsession=true”>Back</a> php on top of page: <?php if($_GET[‘clearsession’]){ session_start(); session_unset(); session_destroy(); session_write_close(); } 1 solved clear all php sessions by clicking on link

[Solved] Turning a SQL row into an array

If you only want specific associative properties from all columns queried from the MySQL call, just set them in an array with their respective properties: $categoriesTest = array(); $sql = “SELECT * FROM `respondent_data` WHERE `respondent_firstname` = ‘John'”; $result = mysqli_query($conn, $sql); while($row = mysqli_fetch_assoc($result)) { $categoriesTest[] = array( ‘respondent_sdo’ => $row[‘respondent_sdo’], ‘respondent_dcto’ => $row[‘respondent_dcto’], … Read more

[Solved] i am not getting dropdown with this code [duplicate]

?> <script> <?php while($rowss = mysql_fetch_array($result2, MYSQL_ASSOC)){ ?> var str=”<?=$rowss[“ingredient”]?>”; var str_array = str.split(‘,’); for(var i = 0; i < str_array.length; i++) { // Trim the excess whitespace. str_array[i] = str_array[i].replace(/^\s*/, “”).replace(/\s*$/, “”); // Add additional code here, such as: var opt = document.createElement(‘option’); opt.innerHTML = str_array[i]; opt.value = str_array[i]; sel.appendChild(opt); } <?php } ?> … Read more

[Solved] How to separate $_POST values in two two parts and insert it in database [closed]

Use arrays! Very small example: for($i=1; $i<=$iday; $i++){ echo “Day-$i<br />”; echo ‘<input type=”text” name=”i[‘.$i.’]” />’; echo ‘<textarea name=”d[‘.$i.’].'”></textarea>’; } Now you can loop through them when you post: foreach($_POST[‘i’] as $key=>$val ){ $sql2 = “INSERT INTO sight VALUES(”,'”. $_POST[‘i’][$key] .”‘,'”. $_POST[‘d’][$key] .”‘)”; } I’ve also changed the quotes. You should wrap attribute values in … Read more

[Solved] Echo Arrays in Array between [ ]

Ok, editing now that you supplied valid data. Look here: <?php $json = ‘[{“endpoint”:”127.0.0.1″,”id”:27,”identifiers”:[“steam:11000011190e09d”,”license:bc7e7c16b4c762c0c2a67160ec68db4559b4c03b”],”name”:”Nicro Scaro”,”ping”:73},{“endpoint”:”127.0.0.1″,”id”:25,”identifiers”:[“steam:110000105b1c9bd”,”license:ba7eb97475632e190bb366d61f97411e2006132e”],”name”:”Paolo Gillet”,”ping”:25},{“endpoint”:”127.0.0.1″,”id”:20,”identifiers”:[“steam:110000101facefb”,”license:425097d969f377ca9b916412893f5c55b9a1c282″],”name”:”Genaro Savastano”,”ping”:33},{“endpoint”:”127.0.0.1″,”id”:29,”identifiers”:[“steam:1100001083dff7d”,”license:6610bb9fd154d505d29f29ca3319473e4da34ee0″],”name”:”Steven Stifler”,”ping”:55},{“endpoint”:”127.0.0.1″,”id”:21,”identifiers”:[“steam:1100001041335a7″,”license:f28c54417b5487064076061e5078fb784ee66912″],”name”:”Samuel Vegas”,”ping”:41},{“endpoint”:”127.0.0.1″,”id”:26,”identifiers”:[“steam:110000105f5b25c”,”license:f6cf282a0a543d923f4c81cab9c7d157343f81e6″],”name”:”Thomas Shelby”,”ping”:36},{“endpoint”:”127.0.0.1″,”id”:23,”identifiers”:[“steam:110000117812da2″,”license:50dd53775bccb021c5bbb6a142c5961d2f07a43d”],”name”:”Thomas Delome”,”ping”:40},{“endpoint”:”127.0.0.1″,”id”:31,”identifiers”:[“steam:110000104b8adb2″,”license:65f99a4c62163d6e7cb002defc55c03854e2a7ac”],”name”:”Bobby Sicouleur”,”ping”:29},{“endpoint”:”127.0.0.1″,”id”:11,”identifiers”:[“steam:110000104481335″,”license:cd2b817c6655280c34bd1f41f8ae168804ec7ed2″],”name”:”Paolo Garcia”,”ping”:16},{“endpoint”:”127.0.0.1″,”id”:24,”identifiers”:[“steam:110000101450e74″,”license:8139d095f9bf5de832171f07bf60dba5e9665ed3″],”name”:”Mohammed Latifi”,”ping”:163},{“endpoint”:”127.0.0.1″,”id”:28,”identifiers”:[“steam:1100001097c401b”,”license:9fdcc12449270e6528bdf19b2edb7eef1ab1011f”],”name”:”Marcel Delahé”,”ping”:27},{“endpoint”:”127.0.0.1″,”id”:30,”identifiers”:[“steam:11000010285a33f”,”license:019951830b346c77571d90df9b6a96f580c1358d”],”name”:”Gérard Leblanc”,”ping”:30}]’; $array = json_decode($json, true); foreach ($array as $row) { echo $row[‘identifiers’][0].”\n”; } Which will echo out all the steam identifiers. var_dump($row) to see everything it has. See the code … Read more

[Solved] GET request as directory [duplicate]

If you are going to build a social network solution, it is strongly recommended to use an established framework like Laravel, Yii2 etc. Why? Because it has tons of out of the box functionality you can use. That said, you need to learn how to use routing. Here is one solution. http://blogs.shephertz.com/2014/05/21/how-to-implement-url-routing-in-php/ Here is another … Read more

[Solved] Parse comma separated string, split array into chunks, then transpose

So long as the number of rows is known, it only takes: a regex to split the string on comma-spaces which immediately follow a one-or-more digits or a word starting with an uppercase letter, a call of array_chunk() and array_map() (with a null callback and data spreading) to “transpose” the data. Code: (Demo) $string = … Read more

[Solved] replace specific link to ******* [closed]

I’m assuming you mean something like (in Javascript): var links = document.getElementsByTagName(‘a’); for (var i = 0; i < links.length; i++) { if (links[i].href == “http://www.google.com/”) links[i].href = “http://www.blather.blorg/” } Tested and works on Firefox 3. 4 solved replace specific link to ******* [closed]

[Solved] MySQL Query LEFT JOIN 5 tables

SELECT users.ID, ownership_company_managers.*, company_user.*, phonebook_list.*, ownership_phonebook.* FROM users LEFT JOIN phonebook_list ON users.ID = ownership_company_managers.USER_ID LEFT JOIN ownership_phonebook ON … , LEFT JOIN … LEFT JOIN … WHERE users.ID=’4′ solved MySQL Query LEFT JOIN 5 tables