Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Count A Specific Column And Print Out Contents


I use PHPMyAdmin and there i can browse, and count a specific column and print out contents of that column and also count how many rows with that value. This is what PHPMyAdmin gives as php code:

$sql = 'SELECT COUNT(*) AS `Rows` , `column` FROM `table` GROUP BY `column` ORDER BY `column`'




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
New Record:Column Count Doesn't Match Value Count At Row 1
I get this error when I try to add a new record to my MySQL Database.

"Column count doesn't match value count at row 1"

So after searching through this forum it seems the problem is that the number of columns in my query doesnt match up to the number of columns in my table. Seems fairly easy to fix doesnt it. However my query has exactly the same number of columns as my table, they are also in the same order. Code:

View Replies !   View Related
Column Count Doesn't Match Value Count At Row 1 Error
I keep getting the error: Column count doesn't match value count at row 1

My table has 10 fields, and as far as i can see the only one i am not entering any data into is the vid field, which auto_increment. Code:

View Replies !   View Related
Count() - Retreive A Count Of A Column.
I'm performing a select statement against my database

SELECT *, COUNT(column)
FROM blah blah blah
WHERE blah blah blah
GROUP BY member

what i'm trrying to do is retreive a count of a column.

i.e.
$variable1 = $record->variable1;
$variable2 = $record->variable2;
$variable3 = $record->variable3;
$variable4 = $record->COUNT($variable3);

I keep getting the white screen of death, caused by the $variable4 line. How do I retrieve a count? the SQL is correct as I've ran it against the database itself in the sql window. but this has me beat.

View Replies !   View Related
Search A Row Rather Than A Specific Column?
Heres the situation, my client wants a search facility on the site. I can do this OK, but the problem that I am finding is that as I am searching a database, I have to type every single field in.

eg "SELECT * FROM table WHERE name LIKE '%$search%' OR comment LIKE '%$search%'";

However, there are 25 fields on this table, and many more thousands on the other tables, so is it possible to search a row rather than a specific column?

View Replies !   View Related
Delete Column Contents
Is there a way, through PHP, to delete the contents of a column without deleting the actual column. I know I could do it by deleting the column and adding it again but just wondering if there's a more efficient way.

View Replies !   View Related
Print Contents Of Webpage
I am trying to print contents within the webpage. I leaning to not use JavaScript. Now, I read a discussion about linking a webpage and then printing it out or something similar to that but I could not find that forum anymore.

View Replies !   View Related
Print The Array Contents?
I am new to PHP as such, and am trying to create an nusoap web service. I have created the following array on a server side script. On the client on receipt of $schedule, how can I go through and print the array contents? Code:

View Replies !   View Related
Column Count
I am getting this error when I am inserting into a table of 124 fields only 64 fields..
from what knowledge I have. i can do that if i explicitely mention the column names. which I do.

View Replies !   View Related
Count Specific Records In DB
I am making a private messaging script as an addon for a script I have already made and was wondering how I would go about counting the number of messages in a table that are to a certain user.... eg... the database

+--------------------+
|todj | message |
--------------------- |
|User 1 | Blah blah... |
|User 2 | Blah blah... |
|User 1 | Blah blah... |
+--------------------+

Now what query would I use to ask it how many messages are there for User 1 and then echo it in text form? Something like this maybe?

<?php
$result = mysql_query("COUNT to WHERE to="$_SESSION['username']");
?>

The table also contains a subject, date, and fromdj field if it makes any difference.

View Replies !   View Related
Search The Contents Of My Field For Specific Keyword Phrases
I'm designing an application and have field defined in a table as Text where
I store Articles. I need to search the contents of my field for specific
keyword phrases for all the rows (5000+ rows). What is the best method to
do this? Should I use indexes or FullText? Also with indexes what would be
the best Key size?

View Replies !   View Related
How Do I Open A Dir And Print The Contents Of Each File?
i can do it in perl with this

$dirtoopen = "./database/";
opendir(DIR, "$filetoopen") or die "cannot open";
@files = readdir(DIR);
closedir(DIR);

foreach $file(@files){
$filetoopen = "./database/$file";
open(FILE, "$filetoopen") or die "cannot open";
$contents = <FILE>;
close(FILE);
($addonname, $description, $submitter) = split(//, $contents);
print "$addonname | $description";
}

but how would i with php?

View Replies !   View Related
Count Rows Containing A Specific Word
How do I make a select statement that counts the total number of rows containing a specific word, lets say the word "sfp".

$totalfinished_sql    = "SELECT auction FROM winners WHERE auction = 'sfp'";
$totalfinished_qry    = mysql_query($totalfinished_sql) or die(mysql_error() . "<br>" . $totalfinished_sql);
$totalfinished  = mysql_num_rows($totalfinished_qry);

The table looks like this:

ID----auction
1-----sfp
2-----ace
3-----meg
4-----sfp
5-----box

View Replies !   View Related
Specific Word Count From A File
I need to count how many time each specifics words appear in a specific file:
Example file content (.menu): Code:

View Replies !   View Related
Using PHP To Parse Emails And Print To Specific Printer
We're trying to write a script that will monitor 6 email addresses and
if an email arrives it will print to a specific network printer based
on the email address. So if the address is 'department1@domain.com' it
will print to 'dept1ptr'. Each printer can be setup either on a
network print server or printed to directly via IP address... they're
all HP printers.

Any suggestions on a route to go with this? I'm very familiar with PHP
but I've never written a script to do something like this... and if PHP
isn't the right avenue to take, I'd love other options.

View Replies !   View Related
"Column Count Doesn't Match Value Count At Row 1"
I'm trying to fix this login script, but I always get the error Column count doesn't match value count at row 1. Can you see any errors in the code/database structure or do you know another way of doing it? Code:

View Replies !   View Related
MySQL Count() Print In PHP
I would like this sql query to print in a table to get a number count of each type, here's my query:

SELECT type, count(*) FROM computers GROUP BY type;

I would like PHP to display it in this manner,

TYPE1 - count
TYPE2 - count

For example:
Cisco Routers - 18
Nortel Switches - 6

View Replies !   View Related
Preg Match Problem - Print Out The Contents Of The Array
PHP Code:

$gettotal = "<span class='totalpages'>";
$fine = preg_match("/^<span class='totalpages'>/", $gettotal, $matches);

When I print out the contents of the array though, it appears empty.

View Replies !   View Related
INSERT/SELECT With Differing Column Count
I just need a little help with an INSERT statement. I have 2 tables, one for confirmed users and one for temporary. I'm using an INSERT query to transfer data between the 2 once a user validates their registration by Email: Code:

View Replies !   View Related
Count The Number Of Times A Field Equals A Specific Value
Is it possible to count the number of times, for example, the field 'result' equals "won"?

View Replies !   View Related
Using A Count Variable To Determine When To Print The Next Row.
I've got this simple problem I'm trying to resolve. Basically what I am trying to achieve is to display 4 categories on one row of the table and then the next four on the next row. I'm using a count variable to determine when to print the next row. code:

<table cellspacing="4" cellpadding="4" border=1>
<?
$result=mysql_query("select cat_name
from quiz_category
where parentid=1
order by cat_name");
$cnt=0;
while (list($DBcat_name)=mysql_fetch_row($result))
{
?>
<tr> .....

View Replies !   View Related
Fill Out A Form And Check A Box And IF The Box Is Checked Then Print Specific Text
I am trying to modify a form he made for me. I want to be able to have users fill out a form and check a box and IF the box is checked then print specific text, if it is not then continue to next if statement.

<? $zone=$_POST['zone']; if($zone == "") { print " stuff, stuff

" }
{ ; die(); } ?>


<? $zone2=$_POST['zone2']; if($zone2 == "")
{ print "blahblah blah" }
{ ; die(); } ?>

View Replies !   View Related
Read And Print The Contents A Text File Which Resides In A Remote Location Via PHP?
Is it possible to read and print the contents a text file which resides in a remote location via PHP? For instance, this is how I am currently reading a text file that is my local server (and it works great, but unfortunately the text file my client will need to have read is outputted to a remote location):

<?php
$currentSong = "/home/medusa/sun/accounts/username/public_html/ticker/current-song.txt";
$fh = fopen($currentSong, 'r');
$theData = fread($fh, filesize($currentSong));
fclose($fh);
echo "<p>".$theData."</p>";
?>

View Replies !   View Related
How Do I Make Php/mysql Count The Number Of "e" In A Column.
I'm good at php but haven't coded anything in mysql/php for overa month now. I hope you can help me. What I essentially want to do, is calculate the number of "e" / "u" / "p" in each column. I don't need helping echoing the results, I just need help in the mysql coding part. How do I make php/mysql count the number of "e" in a column.

View Replies !   View Related
Count The Number Of "Y" 's In Column Brunch.
Mysql:

ID | brunch | dance | game

Id is auto increment.

Brunch, dance and game have only the choose of "N" or "Y", null is not present in this case.

I would like to count the number of "Y" 's in column brunch.
Count the number of "y" 's in column dance, same for game.

How do I do this?

database = wwpknights
table = homecoming

View Replies !   View Related
Read Contents Of An External XML Page And Then Parse Its Contents
I have a URL that generates an XML page. I'm trying to read its contents and parse the information. But, I keep receiving these error messages: Code:

View Replies !   View Related
How To Tell To Send A Specific E-mail At A Specific Time
How to tell PHP to send a specific e-mail at a specific time (newsletter).

View Replies !   View Related
Echo To A Specific Div On A Specific Page
Is it possible to echo something from a php file to a specific div in a different specific html file?If so, can you let me know how to specify where the data should displayed.

$myName="john";

echo '$myName'//but i want to echo to a different page on a certain part of that page.

View Replies !   View Related
Merge The Contents Of One Array Into The Contents Of Another.
There are many times when I need to merge the contents of one array into the contents of another. Below is how I make this happen now. Do you know of a better or quicker way to do this? The main reason I am concerned is that the arrays I'm merging now have 40,000+ items in each array. I want to streamline the process if possible.

$arrayA = array('item0', 'item1','item2');
$arrayB = array('item3', 'item4', 'item5');

for($i=0;$i<count($arrayB);$i++) {
     $arrayA[] = $arrayB[$i];
}

print_r($arrayA);

View Replies !   View Related
How To Query From One Column Then Sort Using Another Column
I am trying to get the last 100 albums I entered into my database using the album_id (Highest being the latest entry) then sort them alphabetically using the album_title column.

I can get the latest 100 easily but cannot figure out how to also sort the results by the album_title before I display them.

This is what I have so far which gets what I want but not in alphabetical order.

<?php
$sqlquery = mysql_query("SELECT * FROM albums ORDER BY album_id desc limit 100", $db);

while ($result = mysql_fetch_row($sqlquery))
{
echo "<a href='music_info.php?album_id=$result[0]'><span style='text-decoration: none'>$result[1]</span><br></a>";
}
?>

I have been trying to add a second ORDER BY to the query like so.

$sqlquery = mysql_query("SELECT * FROM albums ORDER BY album_id desc limit 100 ORDER BY album_title", $db);

but this obviously isn't the way I should be doing it.

View Replies !   View Related
Paging And Sorting Column By Column Name?
I am using below code to paging my data. I want to sort my data by Column time. Not getting where i do changes. Code:

View Replies !   View Related
Functino That Can Use To Print Instead Of Using Javascript, Window.print()??
is there a php functino tat can use to print instead of using javascript, window.print()??

View Replies !   View Related
Print Function To Print Text
Perl has a print function that'll allow you to print text without having to comment out Perl interperated characters. For example:

print<<EOF;
Text goes here, blah blah blah blah, """,... $$&$&$,
EOF

Does PHP have a similiar feature?

View Replies !   View Related
Sending People To Specific Pages That Are Coming From Specific Pages...
I want to show some specific pages to people that comes to my site from
specific urls, I know the variable $_SERVER['HTTP_REFERER'] will be
used but how?

For ex if the visitor comes from a site that is like:

I want to send this person a specific.php . I used below code but not
worked:

<?php

if($_SERVER['HTTP_REFERER'] == "www.cominghost.com" ||
$_SERVER['HTTP_REFERER'] == "cominghost.com" ||
$_SERVER['HTTP_REFERER'] == "www2.cominghost.com"){

// Specific page html goes here

}
else
{
header("Location: index.php");
}
?>

This code not worked for some cases like if the visitor comes from
http://www.cominghost.com/account/targeturl.php or
http://cominghost.com/account/targeturl.php Ok I know the if statement
not working but How?

View Replies !   View Related
Print Function Won't Print?
I have been using echo in PHP but I saw most examples use the print function so I tried it, but It wouldn't display anything on the page, I am trying this on a localhost. I used echo instead and it works...so I was just wondering what is it that I haven't setup that the print function isn't working.

This was the code i using:

session_start();
print($counter);
$counter++;
session_register("counter");

View Replies !   View Related
Specific IF/Then...
I have a code that displays a value from a row in a mysql db. The code is this:

echo "<td>" . $row['year'] . "</td>";

When the user submits their information, there is an option that says "hide the year I was born." Since the row for "year" is set it INT, if they choose that option it returns "0."

I was wondering if there was a way to do something like if $row['year'] = "0"{
echo"hidden by request"
}
else{
echo "<td>" . $row['year'] . "</td>";
}

but still have it work with my existing code.

View Replies !   View Related
Same Contents
i have an array that i have created by exploding a string that is comma seperated

(for example my string was 1,2,3,4,5,6,7,8,9 and now i have this as array[0] = 1 etc etc)

What i am wondering, is if my string was more like 1,2,3,5,6,7,1,1,1,8,9,3,3,2,2 could i search the array and find what appears most frequently in the values (in the above case 1)? So if 1 has 4 occurences, then i echo this value first,then 3 which has 3 occurrences (etc etc)

I am trying to make a basic tagging system for my website,and i want the tags that appear most to be displayed first or in a bigger font or something.

View Replies !   View Related
Contents Through Php
i think declered it self as a zip archive. now in the php script it wrote files and generated the zip file for download. He did this when i had this php file genberate a txt file and then after the user clicked on download theyed click on delet file link and it would delet the file. But with that script it never really wrote or deleted anything. It was just generated for that one dl.

View Replies !   View Related
How To Add An SPECIFIC Array
sorry if the subject isint really good to understand, now i will try to explain my best. I recently installed a hack in phpbb and that particular hack allows only 1 variable, but i want to add more than one, and i thought the best thing to do it is in an ARRAY, but i dont know how to do it in an array, the code looks something like this:

View Replies !   View Related
Getting Specific Fields From A CSV
I've been using fgetcsv to populate an HTML table with CSV data and so far it has been working great. But now I'm looking to call specific data from the table (ie: row 3, column 5), and I'm not sure fgetcsv can be used for this. Every online example of its use involves getting all the CSV data from a file as my table has done.

What function should I use to get specific fields from my CSV? My table doesn't use unique ids, at least not like mysql, with a unique number identifying each row in the leftmost column. What then should I use to identify each row from which I'd like to get data?

I'm making a page that describes a person based on the query string and the information in the database, in which each person has a row. So example.com/example.php?christopher+walken would bring up a page where Walken's information is listed. So I guess the ideal way to do what I want is to query the CSV for the name in the query string (Christopher Walken), then get and print the other information in the row (tall, great guy, etc). Any suggestions on this query?

View Replies !   View Related
How To Redirect With Specific Value ..?
I want that when i recieve different values from "form page" i will mail myself all the details and redirect the user to another site for CR Card payment. What i need is redirect the user to another site along with the value of total amount of package .How can I do that. I have done the first part of mailing but dont know how to do the redirection in PHP ..

View Replies !   View Related
Selecting Specific Tag
I am making a script which displays an RSS feed on my website. To do
this I would like to take all the <div class="blabla"><img src="bla.jpg"
alt="bla"> </div> tags and put them in front of my text. So the
following string:

<p>This is text blah blah blah</p>
<div class="blabla"><img src="bla.jpg" alt="bla"> </div>
<p>this is another text</p>

should give as output:

<div class="blabla"><img src="bla.jpg" alt="bla"> </div>
<p>This is text blah blah blah</p>
<p>this is another text</p>

I tried using regular expressions, but I do not really get it done. Here
is the code I use:

while(ereg('/<DIV class="blabla"*>(.*?)</DIV>/i',$content, $matches)){
$img=$img.$matches[0];
$content=ereg_replace('/<DIV
class="imgbar50"*>(.*?)</DIV>/i',"",$content,1);
}
what do i do wrong?

View Replies !   View Related
PHP Editor, Vim Specific.
Does anyone have a really good php indent file for vim? I'm working on
my first really sizeable project and I'd like it to be kept as clean as
possible while I'm working.

View Replies !   View Related
Country Specific
Any idea for a regular expression including all chars (all country
specific letters)?

View Replies !   View Related
Specific Record From DB
I have a form which updates customer information and as default this gets started on record 1. I would like to be able to post a clientname from a previous form and then get the specific data for that customer.

I am fine with the posting to seperate pages stuff but how could I get the update form to start on this record? Code:

View Replies !   View Related
Delete Specific Row Out Of 3
Say i have three rows:

row1
row2
row3

How do i make a mysql query to delete a specific row out of the 3 only? So say i wanted to delete row2 from the 3.. ?

View Replies !   View Related
Specific Pagination !
I've got some regular joe schmoe queries running ... now the totally result of these queries goes well over 2,000 records. Im looking to paginate these in a certain fashion :

<< Prev 1   2   3   4   5   6   7   8   9  10  Next >>

Each # obviously will display the page ! but Prev and Next will jump to either previous 10 or next 10... so if im on page 4 and i hit next ! i dont want to go to page 5 but rather page 11 and display:

<< Prev 11   12    13   14   15  16  17   18   19  20  Next >>

I hope this is doable ! if not please give me a better suggestion, a more effective and/or efficient way to be able to browse through all these records.

View Replies !   View Related
Specific Lines
I have the text file 'text.txt' and the contents of it are:

CodingForums.com
is not
cool

and i want to change only the 2nd line so the contents of text file is:

CodingForums.com
is very
cool
how would I do that?

also how would I read just the 1st line?the contents text file would be:

CodingForums.com
is very
cool

View Replies !   View Related
Specific Characters
i want to match some specific character set 10 odd characters in a user input string.
i want to find all occurences of the any of such characters. i am using preg_match_all for this.the string pattern that i am giving is a regular expression having those characters i.e "ch1|ch2|ch3" but i am getting only first occurence of the the char which is there in the regular expression. where i am goin wrong and how can capture all occurences of those chars.

e.g  pattern-  "x|y|z"

string to search "this is the X string for test Z and Y are at end and are not detected" in above case the character that is matched is only X at 13th position and z and y are not matched. i want to detect presence of all 3 chars. i.e x,y as well as z.
how can i achieve this.

View Replies !   View Related
Specific Include
I have read a lot of posts about the include statement and understand the majority but there is one small thing missing for me. Maybe you could help enlighten me.

I read that I can include htm files or php files. Therefore I have two senarios. 1. If I include using a htm within a htm page, how much do I need to write in that htm file that will be included. Code:

View Replies !   View Related
Go To Specific Page
I have a search box, then I put in search criteria, got a returned result. When I click on to view that result, I got a page that says "you have to login first". After I login, I want my page to go to that "result page" instead of the member page. Is there a way to do that?

View Replies !   View Related
Getting Specific User
I have my login script, and I have it setup so that if they are not logged in it shows the login box, and if they are, it shows a welcome message. But how I can I get the specific username of the person who logged in, from the database? Here is my code:

<?php
if (!isset($_SESSION['authenticated'])) {
echo "<form id="form1" name="form1" method="post" action="">
        <label for="username">Username:</label>
        <input type="text" name="username" id="username" />
        <label for="textfield">Password</label>
        <input type="password" name="pwd" id="pwd" />
        <input name="login" type="image" src="images/login_button.jpg" id="login" value="Log in" />
</form>";
exit;
  }
echo "Hey, welcome back $username!";
?>

View Replies !   View Related
Get Specific Query
theres a set of links that derive from a database

when a link is clicked

you are fowarded to a page called list.php

in this page

i want to get certain information out of the database based on what link is clicked

so this is how it works PHP Code:

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved