[Solved] What is wrong about this SQL statement? [closed]

[ad_1] You can’t use IF as a statement in a query, it can only be used in a stored procedure. To do what you want, you need two separate queries. Try this: $del_query = “DELETE FROM favoritebills WHERE userid = ‘$userid’ and billid = ‘$billid'”; $ins_query = “INSERT INTO favoritebills (userid,billid) VALUES($userid,$billid) “; $res = … Read more

[Solved] MYSQL/PHP SELECT DISTINCT

[ad_1] Looks like the query is actually pulling 3 results as it should. You are just letting one of them go: function adminnav (){ $pagewcoms = mysql_query(…); // HERE YOU FETCH ONE ROW BUT DO NOTHING WITH IT $idnavrow = mysql_fetch_row($pagewcoms); while ($itest = mysql_fetch_row($pagewcoms)) { echo “$itest[0] <br />”; } } If you just … Read more

[Solved] How I can convert this function to php?

[ad_1] This should do the trick: <?php function hash_data($data) { $data = mb_convert_encoding($data, ‘UTF-16LE’, ‘UTF-8’); $hash = hash(‘sha512’, $data, true); return base64_encode($hash); } $user=”admin”; $password = ‘secret’; $key = “7f9facc418f74439c5e9709832;0ab8a5:OCOdN5Wl,q8SLIQz8i|8agmu¬s13Q7ZXyno/yv.XSN1DsgKq9zi]XrE^gx8vPC^Av8=e/bF4pX1Oe hfqGb#JK~RONkS1wx5w=RE0$” . “DxZSu7evPfshBw7p5Gb&suEkw=RE0DxZSu7e´vPfshBw7p+5GbsuEkw=H1fTWFXfsXo}z0fOd{KTt[IdDG2y6E=”; $data = $user . $password . $key; // 6xecArT38JVtGKH2yQs/T6btOUF41vW5ptaPjgrd8hTaZZKnbJed5551LuYV7vR/Dr3Jb873JMvX0je+8XUpxw== echo hash_data($data); [ad_2] solved How I can convert this function to php?

[Solved] undefined index: postevent….solved it but that created other problems [closed]

[ad_1] Situation before: $citylink_view = “view=$targetview&postevent=$_GET[postevent]”; which is the same as: $citylink_view = “view=$targetview&postevent=” . $_GET[‘postevent’]; Which can be written as: $foo = $_GET[‘postevent’]; $citylink_view = “view=$targetview&postevent=” $foo; You wrote: $posteventview = $_GET[‘postevent’]; $citylink_view = “view=$targetview&”.$posteventview; Can you spot the difference? Aside, you are possible vulnerable to XSS. Sanitize the input and urlencode. Use filter_* … Read more

[Solved] PHP Vertical String to Horizontal String [closed]

[ad_1] This is almost a duplicate of: How to restructure multi-dimensional array with columns as rows? and Combining array inside multidimensional array with same key This can be done with foreach loops, but I like the condensed variadic method (PHP 5.6+). You can research the aforementioned links to see the other techniques if your version … Read more

[Solved] Echo radio button value without using submit button in php

[ad_1] Here is your solution…. <script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script>//jQuery Plugin <?php if(!empty($_GET[‘a1’])){ $selected = $_GET[‘a1’];} else{ $selected = ‘home’;} ?> <form action=”” method=”post”> <label> <input type=”radio” name=”a1″ value=”home” /> Home </label></br> <label> <input type=”radio” name=”a1″ value=”site1″ /> Site 1 </label></br> <label> <input type=”radio” name=”a1″ value=”site2″ /> Site 2 </label></br> </form> <span class=”r-text”><?php echo $selected;?></span> <script> $(‘input[type=radio]’).click(function(e) {//jQuery … Read more

[Solved] Cannot modify header information – headers already sent by (output started at 22 [duplicate]

[ad_1] header(“Location: login.php”); is called after you send content (maybe an error in your includes), you should put this one before any showed contents. I see you do that : echo $Nama; It’s the kind of thing that makes a headers already sent by error… 2 [ad_2] solved Cannot modify header information – headers already … Read more