Jump to content

Barand

Moderators
  • Posts

    24,563
  • Joined

  • Last visited

  • Days Won

    822

Everything posted by Barand

  1. Click the [ Best Answer ] button on the post that answered your question
  2. try $sql = "SELECT DISTINCT id,phonemodel FROM iphone";
  3. When I created a maze program I used an image to define the maze. Samples attached. Not very complex, I was using it to experiment with the mathematics of creating 3D maze with perspective views.
  4. To get a page to show something you have to output something. All you are doing is defining a string variable. You also need to get into the habit of checking for errors.
  5. The reason you get the error message Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/cello10/public_html/display.php on line 10 is because the query failed for some reason. What that reason is will be given by the contents of mysql_error(). If you don't want to tell us what that it is, then fine, you sort it because we cannot see it for ourselves. Bye.
  6. That does absolutely nothing. You're supposed to be assigning a value to it.
  7. Are you sure it is exactly the same error message? Try echo mysql_error(); after the query and tell us what that gives
  8. Let's be less subtle and try the spoonfeeding approach should be
  9. You don't assign a value to $_SESSION['loggedIn'] "==" is not an assignment operator.
  10. Testing too [ m ]printf[ / m ] : printf [ nobbc ][ m ]printf[ / m ][ /nobbc ] : printf EDIT: Well, the "m" tags worked OK this time but "nobbc" has no effect
  11. IMHO the easiest method is a form with checkboxes. The value of each checkbox would be the set (eg value='6,6,5,4,3,2'); // SAVE 'KEPT' SETS TO DATABASE if (isset($_GET['set'])) { $uId = $db->real_escape_string($_GET['uid']); foreach ($_GET['set'] as $set) { $set = $db->real_escape_string($set); DB_Insert($uId, $set, $TimeStamp); } } echo '<form> <table border="1" cellpadding="4"> <tr><th>Set</th><th>Set Values</th><th>Keep</th></tr>'; echo "<input type='hidden' name='uid' value='$uId'>"; for($i=1; $i<=$Sets; $i++){ $Stat_Results = GenStats($uId, $StartSet, $SetOption); $set = join(',', $Stat_Results); echo "<tr><td>$i</td><td>$set</td><td> <input type='checkbox' name='set[]' value='$set'> </td></tr>"; } echo '</table><input type="submit" name="btnSub" value="Submit"></form>';
  12. $query = "SELECT * FROM asterisk_cdr WHERE calldate BETWEEN '$calldate' AND '$calldate2' AND clid LIKE '%$clid%'"; if (!empty($_GET['channel'])) { $channel = $mysqli->real_escape_string($_GET['channel']); $query .= " AND channel LIKE '%$channel%' "; }
  13. store the data in arrays as you process the query results expense[year][month] = exp_total income[year][month] = inc_total Then it's a matter of looping through the arrays to output. Because you want Apr as month 0 and March as month 11 then the month index in the arrays will be (month + 8 ) % 12 and you will have to check the month to see if it goes in this year or the next
  14. Try $location = DB::getInstance()->query("SELECT country, COUNT(country) as countCountry FROM users GROUP BY country ORDER BY count DESC"); while ($locations = $location->fetch_object()) { echo "<tr><td>"; echo $locations->country; echo "</td><td>"; echo $locations->countCountry; echo "</td></tr>"; } edit : Plus what Ch0cU3r said.
  15. Precisely that. EG $message_m ="'" . $_POST['fname'] . "', with RefCode '" . $RefC . "', and .... "; Alternatively, don't use concatenation if it's confusing you $message_m = "'{$_POST['fname']}', with RefCode '$RefC', and .... ";
  16. Your single quotes and commas need to be inside the double quotes, not outside.
  17. It's a check to ensure you don't output a footer before the first header (when $group is still null)
  18. Like this $rowKitCharges = [ [ 'SubCategory' => 'A', 'HireID' => 123 ], [ 'SubCategory' => 'A', 'HireID' => 124 ], [ 'SubCategory' => 'B', 'HireID' => 125 ], [ 'SubCategory' => 'C', 'HireID' => 126 ], [ 'SubCategory' => 'C', 'HireID' => 127 ], [ 'SubCategory' => 'C', 'HireID' => 128 ] ]; $group = null; $count = 0; for($i=0;$i<count($rowKitCharges);$i++){ if($rowKitCharges[$i]['SubCategory'] != $group) { if ($group) { echo "<b>TOTAL ITEMS: $count</b><br><br>"; // FOOTER } //echo the group header echo "<br><b>" . $rowKitCharges[$i]['SubCategory'] . "</b><br>"; $group = $rowKitCharges[$i]['SubCategory']; $count = 0; } echo $rowKitCharges[$i]['HireID'] . " " . $rowKitCharges[$i]['SubCategory']; ++$count; echo "<br>"; } // OUTPUT FINAL FOOTER echo "<b>TOTAL ITEMS: $count</b><br><br>"; // FOOTER
  19. As you aren't using a variable you don't need a prepared statement $db_connect->query('DELETE FROM table WHERE owner=0 AND owner NOT IN (SELECT owner FROM table ORDER BY dob DESC LIMIT 10)');
  20. You may want to read up on clustered indexes http://lmgtfy.com/?q=mysql+clustered+index
  21. Sorry, my fault. Missing " at the end of echo "<form name = \"myfirstform\" action = \"formprocess.php\" method = \"POST\">";
  22. First, store the random numbers that you generate echo "<html><head><title>calculation game!</title></head><body>"; $n1 = rand(100, 450); $n2 = rand(100, 5000); echo "<h1>first number is</h1>"; echo $n1; echo "<h1>and the next number is</h1>"; echo $n2; Then put those values in hidden form fields so they get sent with the sum echo "<form name = \"myfirstform\" action = \"formprocess.php\" method = \"POST\"> echo "Enter data<br>"; echo "<input type = \"text\" name = \"firstdata\">"; echo "<input type='hidden' name='n1' value='$n1'>"; // hidden form field echo "<input type='hidden' name='n2' value='$n2'>";; // hidden form field echo "<br> <input type= \"submit\" value = \"Let's check!\">"; echo "</form>";
  23. echo substr('Local/567@context-0000461d;1', 6, 3); //--> 567
  24. I suppose that somewhere in there a query is being executed to get the records for John but no way to see what it is and, therefore, no way to know how to change it. All I can do then is point you towards Sql SUM() function and GROUP BY clauses
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.