-
Posts
24,563 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
Let's start with code I mentioned in #4 where you are using the while() loop. Here's your code - as you can see the d_name is echoed after the loop finished $comp = $_GET['comp']; $sql="SELECT complain FROM complaint c WHERE c.d_name = '" . mysql_real_escape_string($comp) . "'"; //-run the query against the mysql query function $result=mysql_query($sql); //-count results $numrows=mysql_num_rows($result); echo "<p>" .$numrows . " results found "; while($debtor=mysql_fetch_array($result)) { echo "<tr>"; echo "<td>".$debtor['complain']."</td>"; } echo "<tr>"; echo "<tr>"; echo "<td><a href=\"companydetails.php?company={$debtor['d_name']}\">See more details</a></td>"; mysql_close($db); Change to $comp = $_GET['comp']; $sql="SELECT d_name, complain FROM complaint c WHERE c.d_name = '" . mysql_real_escape_string($comp) . "'"; //-run the query against the mysql query function $result=mysql_query($sql); //-count results $numrows=mysql_num_rows($result); echo "<p>" .$numrows . " results found </p>"; echo "<table>"; while($debtor=mysql_fetch_array($result) { echo "<tr>"; echo "<td>".$debtor['complain']."</td>"; echo "<td><a href=\"companydetails.php?company={$debtor['d_name']}\">See more details</a></td>"; echo "</tr>"; } echo "</table>"; mysql_close($db); Also your HTML code is terrible (being polite here). You have table rows that aren't inside <table>..</table> tags You are not using end tags (such as </p>, </tr> The piece of code above should be inside the html <body>..</body> tags and not after the closing </html> tag.
-
In that case you still haven't fixed the problem I pointed out in reply #4 above
-
For the Pick_Up list SELECT l.locid, l.locname as pickuploc FROM locations l INNER JOIN journeys j ON l.locid = j.pickup ORDER BY l.locname Once the pickup location has been chosen, say $pickup, you can select destinations where there is a journey from that pickup SELECT l.locid, l.locname as destloc FROM location l INNER JOIN jouneys j ON l.locid = j.destination WHERE j.pickup = $pickup ORDER BY l.locname You would probably use AJAX to populate the destination list once the pickup ($pickup) has been selected
-
$sql="SELECT d_name, complain FROM complaint c WHERE c.d_name = '" . mysql_real_escape_string($comp) . "'"; And a good place to check $_GET value would be in a page that is using it and isn't working correctly
-
I'd like to chat with a experienced web design guy
Barand replied to dannerz's topic in Miscellaneous
http://www.phpfreaks.com/page/irc-live-chat -
If you use the version that returns false return empty($trimValue) ? false : $trimValue; you can then $f = fieldExists($row['soundPath']); echo "\t<soundPath>" . ($f ? "www.some url.com/somefolder/$f" : "No") . "</soundPath>\n";
-
Adjust search so it only finds rows with all words?
Barand replied to liamdawe's topic in PHP Coding Help
... AGAINST ( '+apple +iPad') must contain both apple and iPad -
In the code where it works, the reference to $debtor['d_name'] is inside the while() loop. In the one that fails, it isn't. $debtor is set to false at the end of the loop so the reference to it after then is invalid. Turn error reporting on! And as I said before, and you ignored, check the value of $_GET['company']. Had you done these you might have found what the problem was.
-
Have you checked to see what $_GET['company'] contains?
-
Might be worth checking if you can open files using https <?php $w = stream_get_wrappers(); echo '<pre>'; echo 'openssl: ', extension_loaded ('openssl') ? 'yes':'no', "\n"; echo 'http wrapper: ', in_array('http', $w) ? 'yes':'no', "\n"; echo 'https wrapper: ', in_array('https', $w) ? 'yes':'no', "\n"; echo 'wrappers: ', print_r($w,1); echo '</pre>'; ?>
-
rename it as .txt instead of .csv I'll also need your table structure from SHOW CREATE TABLE a_playerRank
-
selecting from multiple tables mysql php code
Barand replied to Lone_Ranger's topic in PHP Coding Help
Sounds like you need UNIONS, not JOINS -
Guess I'll need that dump file after all before I go any further.
-
nm. I set up some test data. You are only interested in the region in grouping 0 You are only interested in the rankPos in grouping 2 so discard those values in the other groups so you have a query like this SELECT grouping , CASE WHEN grouping <> 0 THEN 0 ELSE region END as region , CASE WHEN grouping <> 2 THEN 0 ELSE rankPos END as rankPos , nameFirst , nameLast , feet , inches FROM a_playerRank WHERE year="2014" and position="2" and grouping<4 ORDER BY grouping DESC,rankPos,region,nameLast
-
A dump file of your data would help us to help you
-
Unfortunately, if you strip out the comma at that point, the last part of the code does not find any matched as 1,234.56 != 1234.56. However you should strip out the commas at the earliest opportunity as numbers do not behave correctly as strings EG echo min('1,234.56', '23.45'); //--> 1,234.56 ??? echo min(1234.56, 23.45); //--> 23.45
-
Where did the 1,862.08 get formatted with the comma in the first place? You need to go back to change the earlier processing so it stays as 1862.08 until you output the results to the screen or the printed page (ie only when it's going to be seen by human eyes).
-
Why are you using number_format() on strings that are already formatted? Why are you processing formatted numbers at all? You should only format numbers on final output.
-
When converting a string to a number PHP will only consider those characters up to the the first non-numeric character, which in that case is the comma. (The decimal period is taken to be a numeric character when converting). For this reason, and others, numbers should always be stored unformatted in data and not as formatted strings.
-
Sorry, uppercase"V". Change to return empty($trimValue) ? 'No' : $trimValue; If you use the version that returns false return empty($trimValue) ? false : $trimValue; you can then $f = fieldExists($row['soundPath']); echo "\t<soundPath>" . ($f ? "www.some url.com/somefolder/$f" : "No") . "</soundPath>\n";
-
If you are going to use DateTime class then use DatePeriod class to make the array $dt = new DateTime('2013-11-01'); $di = new DateInterval('P1D'); $dp = new DatePeriod($dt,$di,70); foreach ($dp as $d) echo $d->format('Y-m-d').'<br>'; results 2013-11-01 2013-11-02 2013-11-03 2013-11-04 . . . 2014-01-07 2014-01-08 2014-01-09 2014-01-10
-
$xml .= "\t<soundPath>www.some url.com/somefolder/" . fieldExists($row['soundPath']) . "</soundPath>\n";
-
If it helps, the last notification I received was 12 Dec 2013 13:16 GMT
-
Why have email notifications stopped? I should get them for new posts in some forums and for replies to all topics that I have replied to. I am getting none.