RON_ron
-
Posts
370 -
Joined
-
Last visited
Posts posted by RON_ron
-
-
the182guy: Typical asian answers! Thanks!
-
Typical asian answers! Thanks!
-
I need to get the 2nd code working. Please help.
This works
$query = "SELECT DISTINCT addressz FROM abs WHERE statez = 'AZ'"; $results = mysql_query($query);
But this dosen't.
$SomeVar = $_POST['disloc']; $query = "SELECT DISTINCT addressz FROM abs WHERE statez = '".$SomeVar."' ORDER BY addressz ASC"; $results = mysql_query($query);
-
Thanks. One more thing, How can I add a condition to it.
E.g. Retun the data using DISTINCT only when "YES" is found in field AVAILABILITY?
-
How do I pull data by ignoring duplicate records?
E.g. I've got 100 types of books and a field in mysql saying 'category'. In the books I've got 20 books as history, 5 books as agriculture, etc...
I need the data displayed only the types of categories.
history
agriculture
etc...
$SomeVar = $_POST['finco']; $query = "SELECT * FROM abcs WHERE typesz = '".$SomeVar."' ORDER BY typesz ASC"; $results = mysql_query($query); $returnS=""; while($line = mysql_fetch_array($results)) {
-
NO data was shown.
-
No luck as yet!!
-
I want to pull the mysql data in an alphabetical order suburbz. This code is not getting the results in an alphabetical order. Please help.
$SomeVar = $_POST['disloc']; $query = "SELECT * FROM books WHERE statez = '".$SomeVar."' ORDER BY suburbz ASC"; $results = mysql_query($query);
-
Awesome!!! It works a treat! (I was so excited and I did not change the 'n' in my first attempt)
Thanks a million mikosiko.
-
Thanks mikosiko. Do I have to do any adjustments to make it working? or just a cut and paste would do it? (I'm not a php person)
Did not work though.
-
I'm using this to pull in data in to my flash website. I need to get the COUNT value of each state as separated/ as individual outputs. Because I need to load the values in separate text boxes in several locations.
E.g.
Assume the echo gives the following results.
STATE A - 12
STATE B - 30
STATE C - 41
STATE D - 11
I need php to send them individually in several echos.
echo $line["number_of_friends_in_state_1"].",,";
echo $line["number_of_friends_in_state_2"].",,";
echo $line["number_of_friends_in_state_3"].",,";
etc...
-
IS it possible to split the results in to several echos?
$query = "SELECT statez, COUNT(statez) AS Tstate FROM abs GROUP BY statez"; $results = mysql_query($query) or die( "Query Error: " . mysql_error()); while($line = mysql_fetch_array($results)) { // here you can display your record in any format that you want probably in a html table echo $line['Tstate1'] . " ----- " . $line['statez1'].",,"; echo $line['Tstate2'] . " ----- " . $line['statez2'].",,"; echo $line['Tstate3'] . " ----- " . $line['statez3'].",,"; echo $line['Tstate4'] . " ----- " . $line['statez4'].",,"; echo $line['Tstate5'] . " ----- " . $line['statez5'].",,"; } mysql_close($link); ?>
-
I'm getting the number of friends in each STATE. How do I split the results in $returnS?
$query = "SELECT statez, COUNT(statez)FROM abs GROUP BY statez"; $results = mysql_query($query); $returnS=""; while($line = mysql_fetch_array($results)) { $returnS.= $line['COUNT(statez)'].",,".$line['statez'].",,,"; } echo $returnS; mysql_close($link); ?>
-
I'm pulling 10 records here. How do I split the results in to several echos?
$query = "SELECT statez, COUNT(statez)FROM mylist GROUP BY statez"; $results = mysql_query($query); $returnS=""; while($line = mysql_fetch_array($results)) { $returnS.= $line['COUNT(statez)'].",,".$line['statez'].",,,"; } echo $returnS; mysql_close($link); ?>
I need the code to look like this by showing the (COUNT) number for each state.
$results = mysql_query($query); while($line = mysql_fetch_array($results)) { echo $line["number_in_state1"].",,"; echo $line["number_in_state2"].",,"; echo $line["number_in_statee3"].",,"; echo $line["number_in_state4"].",,"; echo $line["number_in_state5"].",,"; echo $line["number_in_state6"].",,"; //etc.... }
-
That's it. - Thanks!
-
I want to modify a record in my mysql. But this code doesn't seem to work. Could you please help?
$SomeVar = $_POST['finco']; mysql_query("UPDATE distributors SETsuburbz='$addressx', addressz='$suburbx', statez='$statex', postalz='$postalx', countryz='$countryx', telephonez='$telephonex', emailz='$emailx', companyz='$companyx' WHERE codez = '".$SomeVar."'"); $result = mysql_query($query); $sentOk = "Edit Successful!"; echo "sentOk=" . $sentOk; ?>
-
Perfect! Thanks.
-
my mysql has got a field called statez where it stores the STATE. How do I amend the code below by adding $SomeVar = $_POST['Hamburg']; to count the number of records of a particular state? ($SomeVar will represent the state)
$query = "SELECT statez, COUNT(statez)FROM distributors GROUP BY statez"; $results = mysql_query($query); $returnS=""; while($line = mysql_fetch_array($results)) { $returnS.= $line['COUNT(statez)'].",,".$line['statez'].",,,"; } echo $returnS;
-
Thanks Mr.Adam.
-
statez : I need to sort the results from the high score to the low score.
$query = "SELECT statez, COUNT(statez)FROM distributors GROUP BY statez"; $results = mysql_query($query); $returnS=""; while($line = mysql_fetch_array($results)) { $returnS.= $line['COUNT(statez)'].",,".$line['statez'].",,,"; } echo $returnS; mysql_close($link); ?>
-
varchar
-
How do I get the number as pairs? (i.e. 05, 20, 01, 70)
$query = "SELECT statez, COUNT(statez)FROM distributors GROUP BY statez";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo $row['COUNT(statez)'] ." Distributors in ". $row['statez'];
echo "<br />";
}
?>
-
I need to pull data in an alphabatical order based on a certain field.
I'm trying to display the results, sorted according to the alphabatical order of the data in addressz... The my code dosen't do that, it pulls the data according to the order which I've entered the data.
$SomeVar = $_POST['sta']; $query = "SELECT * FROM shops WHERE statez = '".$SomeVar."' ORDER BY addressz ASC"; $results = mysql_query($query);
-
...The field is a DATETIME field, and the values are in there as YYYY-MM-DD HH:MM:SS, right?
Can you post any errors, and whatever part of it looks weird?
$query = "SELECT subjectz, DATE_FORMAT(timestampz, '%d/%m/%Y') AS timez, Newsz, linksz FROM news_homez ORDER BY timestampz DESC";
Hi Pickachu...
yes it is YYYY-MM-DD HH:MM:SS.
I'm getting ONLY THE DATE and NO other data. It seems only 2 lines are the idfference between the working code and the not working code. That's weird!
Works alright (without the required date format from the date field).
$date =date('d-m-Y'); $query = "SELECT * FROM news_homez ORDER BY timestampz DESC"; $results = mysql_query($query); $returnS=""; while($line = mysql_fetch_array($results)) { $returnS.= $line["subjectz"].",,".$date.",,".$line["Newsz"].",,".$line["linksz"].",,,"; } echo $returnS; mysql_close($link); ?>
Pulls ONLY the date.
$query = "SELECT DATE_FORMAT(timestampz, '%d/%m/%Y') AS timez FROM news_homez ORDER BY timestampz DESC"; $results = mysql_query($query); $returnS=""; while($line = mysql_fetch_array($results)) { $returnS.= $line["subjectz"].",,".$line["timez"].",,".$line["Newsz"].",,".$line["linksz"].",,,"; } echo $returnS; mysql_close($link); ?>
COUNT in a given sequence
in MySQL Help
Posted
How can I get the count value in a sequence? (first count AZ then MI then WD tec...) and then echo it in the same seuence. Please help. This is what I've done so far.