• Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Balderick

  • Rank

Recent Profile Visitors

3,578 profile views
  1. sorry, I have not been able to solve it already. i got results and the output was that related to 3 different fields in table one; the record in table 2 was printed 3 times. When I added a record to table 2 this one was also 3 times printed so I bascially got six results. Is it possible anyway to have 1 columns like a unique number (unique_nr) in both tables and then as a result have f.i. multiple records for table 1 and only 1 for table 2? And is JOIN the right query or should I use something different. or (as I'm getting a bit impatient) should I just select the unique number first in table 2 and then use a second separate query to find the record values of table 1?
  2. Is it necessary to open the 2 different databases or not? How is this done in 1) phpmyadmin, 2) mysql console, 3) php script? with select database() in the console only 1 database is shown.
  3. I get an error message (error message 1054) : unknown column w.title in field list. What should I do to open 2 databases? I work now in the mysql console, but I'm not sure wether it is possible or not.
  4. Its not clear what is meant with the w and the c. Are this the tables? And what is client then in database1.client or writers in database2.writers? Is that also a table?
  5. Hi all, I have a question about join or inner join; not sure in what way it should be used. I now use 2 queries in 2 different databases (made in phpmyadmin). SELECT `title` FROM `writers` WHERE id ='qwert58efedd1979f'; SELECT `name`, `lastname`, `str`, `nr`,` place` FROM `client` WHERE id ='qwert58efedd1979f'; I would like to make one mysql query and use join to search in 2 tables in 2 different databases. Can anyone tell how mysql does this?
  6. Wait ................ I saw the light after adding brackets to $array_of_val1 thanks for the help .
  7. I added this code in the loop : while ($stmt->fetch()) { $array_of_val1 = array($val1); var_dump($array_of_val); } but the result is that the both the offsets appear to be 0 and not 0 and 1 .
  8. why should the output be called from within the function?
  9. Hi All, I'm looking for a solution in using a function. The function fetches data from a database. In a column multiple results are found. I want to have all the records outisde the function. Inside the function all records are shown, but outside only the last record. I thought I could use return array, but it only returns multiple variables and not multiple rows. Not sure if fetch() is the solution for arrays. example: <?php function test_func($val4) { global $val1; global $val2; global $val4; $servername = "host"; $username = "johndoe"; $password = "admin"; $dbname = "dbase_db"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // if ($stmt = $conn->prepare("SELECT col1, col2 FROM table WHERE col4 = ? ; ")) { $stmt->bind_param("s", $val4); $stmt->execute(); $stmt->store_result(); $num_of_rows = $stmt->num_rows; var_dump($num_of_rows); $stmt->bind_result($val1, $val2); if ($num_of_rows > 0){ while ($stmt->fetch()) { // managed to output multiple rows here, but that's not the goal } return array ($val1, $val2); } } } $val4='form_value'; test_func($val4); // return multiple rows here, outside the function How should I solve this?
  10. Ingolme thank you A LOT for this answer it really solves my problem.
  11. <html> <head> <script type="text/javascript"> function CheckColors(val){ var element=document.getElementById('color-test'); if(val=='pick a color'||val=='others')'block'; else'none'; } </script> </head> <body bgcolor='lime'> <div style="margin-left: 400px; margin-top:100px; width: 200px; height: 200px; border: solid blue 1px; display: inline-block; float: left;"> <p style=""> name </p> <p style=""> ball </p> <p style=""> color </p> </div> <div style="margin-left: 50px; margin-top:100px; width: 200px; height: 200px; border: solid blue 1px; display: inline-block; float: left;"> <p><input type ="text" ></p> <p><input type ="text" ></p> <select name="color" onchange='CheckColors(this.value);'> <option>pick a color</option> <option value="red">RED</option> <option value="blue">BLUE</option> <option value="others">others</option> </select> <p><input type="text" name="color" id="color-test" style='display:none;'/></p> </div> </body> </html> I created an example script of a situation I would like to solve. There are 2 divs. The right div receives an extra input field when onChange detects an event. In the left div there should also be a new html element like <p>. How can I program this with javascript?
  12. yes, thank you dsonesuk that worked very well.
  13. Hi I would like to customize a specific toggle slider. I managed to make the example larger, but now the toggle moves only a little and not across the entire switch. ( I set width to 160 in the .switch class) example: <!DOCTYPE html> <html> <head> <style> .switch { position: relative; display: inline-block; width: 160px; height: 34px; } .switch input {display:none;} .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; -webkit-transition: .4s; transition: .4s; } .slider:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; background-color: white; -webkit-transition: .4s; transition: .4s; } input:checked + .slider { background-color: #2196F3; } input:focus + .slider { box-shadow: 0 0 1px #2196F3; } input:checked + .slider:before { -webkit-transform: translateX(26px); -ms-transform: translateX(26px); transform: translateX(26px); } /* Rounded sliders */ .slider.round { border-radius: 34px; } .slider.round:before { border-radius: 50%; } </style> </head> <body bgcolor='teal'> <center><br><br> <h2>Toggle Switch</h2> <label class="switch"> <input type="checkbox"> <div class="slider"> Tekst</div> </label> <br><br> </center> </body> </html> So anyone any suggestions how to slide the toggle over the entire switch?
  14. I would like to create a a random number with random_bytes(). Can I just store the random_bytes output in the database field? Is that for instance more secure? And, regarding to sending it by email, what is the advantage above sending a code like uniqid() or md5($_POST['var'] + microtime() ? I see the screen output is a bit uncommon (with ? in a diamond ) does that have to do with the encryption? And is that the reason why reason bin2hex is used to decrypt? this is the code I would like to use: <html> <center> <br><br><br> the output of the function random_bytes is: <br><br> <?php $num = random_bytes(15); echo '<br><br>' . $num ; echo '<br><br> var dump of random_bytes with bin2hex: ' ; echo bin2hex($num); ?> </center></html>
  15. what do bind_param and execute do actually? How should the parameters for these functions be used? I'm looking for good and extended tutorial info online, but about this subject there's not much, a lot of tuts seem to be outdated, use other coding not related to OOP. This is rather sad but for programmers but good info (especially for security matters) would be welcome.