-
Posts
24,563 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
try $sql = "SELECT DISTINCT id,phonemodel FROM iphone";
-
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.
-
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.
-
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.
-
That does absolutely nothing. You're supposed to be assigning a value to it.
-
Are you sure it is exactly the same error message? Try echo mysql_error(); after the query and tell us what that gives
-
Let's be less subtle and try the spoonfeeding approach should be
-
You don't assign a value to $_SESSION['loggedIn'] "==" is not an assignment operator.
-
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
-
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>';
-
$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%' "; }
-
Display data in tabular format by year and month
Barand replied to mythri's topic in PHP Coding Help
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 -
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.
-
Not a coder needs help with formatting to send email message
Barand replied to caliray's topic in PHP Coding Help
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 .... "; -
Not a coder needs help with formatting to send email message
Barand replied to caliray's topic in PHP Coding Help
Your single quotes and commas need to be inside the double quotes, not outside. -
It's a check to ensure you don't output a footer before the first header (when $group is still null)
-
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
-
Prepared Delete Statement with Subquery in mysql table
Barand replied to BuildMyWeb's topic in PHP Coding Help
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)'); -
You may want to read up on clustered indexes http://lmgtfy.com/?q=mysql+clustered+index
-
Keeping randomly generated numbers and checking the sum
Barand replied to cenalt's topic in PHP Coding Help
Sorry, my fault. Missing " at the end of echo "<form name = \"myfirstform\" action = \"formprocess.php\" method = \"POST\">"; -
Keeping randomly generated numbers and checking the sum
Barand replied to cenalt's topic in PHP Coding Help
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>"; -
echo substr('Local/567@context-0000461d;1', 6, 3); //--> 567