[Solved] PHP MySQL query not returning a result [closed]

//Try This <?php // Some inputvalues (those are correct) $user = “”; $pass = “”; $host = “”; $db = “”; $conn = mysqli_connect($host, $user, $pass, $db) or die(“Het is niet gelukt om te verbinden met de database!”); // Vaststellen wat je wil weten $grab = $_GET[‘grab’]; $query = “SELECT * FROM informaticaproject WHERE id=1”; … Read more

[Solved] preg_replace/string_replace symbol – or * to space

A few ways to do this. String replace, as mentioned by Ashish. $input = “-**abcd1234-*—“; $output = str_replace(array(‘-‘, ‘*’), ”, $input); echo $output; If you have a large number of characters to strip though, maybe this would be a little easier. $input = “-**abcd1234-*—“; $remove = “-*”; $output = str_replace(str_split($remove), ”, $input); echo $output; And … Read more

[Solved] preg_replace/string_replace symbol – or * to space

Introduction The preg_replace/string_replace symbol – or * to space is a useful tool for replacing certain symbols with a space in a string. This can be useful for formatting text, removing unwanted characters, or making a string easier to read. This tutorial will explain how to use the preg_replace/string_replace symbol – or * to space … Read more

[Solved] Ηow can I implement a clone of Digg? [closed]

You have to pass parameter between two pages So first of all your have to edit add link on it <?php try { $pdo = new PDO(‘mysql:host=localhost;dbname=informal’,’vad’,’6989′); $pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); $pdo->exec(‘SET NAMES “utf8″‘); } catch(PDOException $e) { echo $e->getMessage(); } $sql=”SELECT title,content FROM postID”; $result = $pdo->query($sql); while($row = $result->fetch()) { echo “<a href=anotherpage.php?id=”.$row[‘id’].”>”.$row[‘title’] . “</a><br />”; … Read more

[Solved] Making function with brackets [closed]

You’re overthinking it. function my_test($var1, $var2){ global $privileges; $var3 = $var1+$var2; if($var3 != $privileges){ return false }else{ return true; } } if( my_test(‘var1’, ‘var2’) ) { // true – do code } else { //false – don’t } Assuming that that is just example code, because that really just condenses down to: if ( $var1+$var2 … Read more

[Solved] get image from hexa string

The solution (in collaboration with OP) is: import PIL from binascii import unhexlify import zlib from cStringIO import StringIO sdata = “789C9D953D56C52010856363696D49E90AAC73ECDD4396C25228B210CE711B2CC2CAC622CECC9D0C0321313A27E411123EEEFCC07B7BFF7A9CC45EA9BD507BD6F620F769CAF4FEE3096DB76DDACEAEE9865D4CF79C6DAB34F46D441F7F23F88F6F728E6AD794724EDD5CBB9B790EF53FBF1595D9524C517E93CDEA3A433D984E83440327B318B633BF867A4C12734A5654CE26F24F29AB28704A067685363C665B0582D30ADF0F39A2717F3979C9412A6108A1D731C6992C04BD96252ECB9A2AC4A60F2B07904AA8166C84B51545D172C3C8D02B4CA3D51D841F7584B5CD2E17E2698A5DDE991302AD6240189666558242122D68F1C0F19F99475104D0F7C6216D5A6665AFAED62F8A27730A57E3BC4858669D25716B387BA04E39B41059BCC7E99CEAF4B05F971C75AAB0181AE938111CA9DB9A71C9B5443EA000D4231183A4F8ECEF79E7E5B40E2DEF647BDEA9AB6250EA59F70B6AC90E9FAABFB7D040E43C010107D4F1086A4ADA6D8DA66C8AEDD9C10E3514196A0F060220B59825C843883F5D71A67586809FEDF17FFCD75C4CFC012B43550B” fh = StringIO(zlib.decompress(unhexlify(sdata))) image = PIL.Image.open(fh) PIL is the Python Imaging Library, and using StringIO, I pretend to have a file-like object. 1 solved get image from hexa string

[Solved] Warning on using strtotime in php? [closed]

If you look at the documentation for mysql_result you’ll see that it expects the query resource as the first parameter, the row number as the second parameter, and (optionally) the field name or offset as the third parameter. You’re not using the function in anyway that even resembles its purpose. Edit: Based on your comment … Read more

[Solved] Add values to complex array

What I commented is how to do it. I assume you’re storing this array in a cache/session where it’s semi-persistent right? What you want to do is append the item to the array. Say your array looks like this: $modules = array( ‘Forums’ => array(‘file’ => ‘link/to/file.php’, ‘enabled’ => TRUE), …..etc ); All you need … Read more

[Solved] Generating JSON with PHP [closed]

You can encode an array thus: $cars = [ ‘ALFA’ => [ ‘title’ => ‘Alfa Romeo’, ‘models’ => [ … ] ], ‘ACURA’ => [ ‘title’ => ‘Acura’, ‘models’ => [ … ] ], ]; This can then be run through json_encode(). solved Generating JSON with PHP [closed]