home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

PHP / MySQL coding help

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2651
Discussions: 200,999, Posts: 2,380,009, Members: 246,368
Old February 22nd, 2005, 11:37 PM   Digg it!   #1 (permalink)
Member
 
Join Date: May 2004
Posts: 184
Arrow
PHP / MySQL coding help

Is there any way to have PHP return the number of cols (entries) in a row?

Here's what I'm trying to do...

I have a page that lists all the entries in my database by using a for loop...

for ($i = 0; $i < [whatever code goes here]; $i++) {
//um... a bit more advanced than this... but I'll just use print to show you what I'm trying to do
print [entry at column $i];
}

So hopefully $i will print by however many entries are in the database.
VillageIdiot906 is offline   Reply With Quote
Old February 22nd, 2005, 11:43 PM     #2 (permalink)
Did you try Google yet?
 
Siliconjunkie's Avatar
 
Join Date: Feb 2003
Location: Buckhannon, WV
Posts: 3,468
Send a message via AIM to Siliconjunkie
So you want to do a count?

count from 'table' where 'field' like "phrase";
__________________
My computer is bigger than yours!
Siliconjunkie is offline   Reply With Quote
Old February 22nd, 2005, 11:50 PM     #3 (permalink)
Member
 
Join Date: May 2004
Posts: 184
Aha. Thanks, but I figured out an easy way to do it. I just used an if statement asking if the column at $i was existant or not. If so, execute the code; if not, break the for loop.

But here's another question... how do you delete columns from a table?
VillageIdiot906 is offline   Reply With Quote
Old February 22nd, 2005, 11:54 PM     #4 (permalink)
Did you try Google yet?
 
Siliconjunkie's Avatar
 
Join Date: Feb 2003
Location: Buckhannon, WV
Posts: 3,468
Send a message via AIM to Siliconjunkie
ALTER

http://dev.mysql.com/doc/mysql/en/alter-table.html

ALTER [IGNORE] TABLE tbl_name DROP [COLUMN] col_name
Siliconjunkie is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
MYsql - Mandrake9.1 Crap_at_Lunix Applications and Operating Systems 0 October 10th, 2003 05:19 PM
Configuring Mysql, Apache and PHP AirmanRules Webmastering and Programming 5 May 25th, 2003 11:20 AM
mySQL error BlueIce Applications and Operating Systems 17 April 14th, 2003 11:48 PM
Difficulty with PHP SysRq Webmastering and Programming 13 March 9th, 2002 03:50 PM
PHP/mySQL Puzzler DeafScribe Webmastering and Programming 10 January 12th, 2002 10:25 AM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (3111)
‘Rogue’ or ‘Rouge’? (9)
Charges against non-tippers dropped.. (22)
Foxconn Blackops x48 MoBo (5)
Nvidia GTX 260 problem (14)
Delete an OS (18)
Laptop with wireless problem. (13)
Wireless Televisions. (12)
CPU fan stops spinning randomly (11)
Regular Build (11)
Point and Shoot Camera Suggestions. (9)
windows vista security holes (19)
[F@H SPAM 11/16/09] ! 1/2 months to.. (41)
windows 7 problem (7)
Recent Discussions
add ram to existing (4)
Computer shutting down on its own (6)
EVGA 9800 gtx help with finding a goo.. (13)
"Documents and Settings" fo.. (7)
Delete an OS (18)
Outputing 1080p from my PC to my 720p.. (0)
panasonic dmr ez48veb recorder (0)
Need help getting speakers to work (2)
Nvidia GTX 260 problem (14)
Laptop with wireless problem. (13)
Point and Shoot Camera Suggestions. (9)
Is the PSU I received dead? (16)
FreeAgent drive software not x64 comp.. (1)
Intel 5100 AGN issues fixed yet? (28)
Foxconn Blackops x48 MoBo (5)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (41)
Print spooler problem (17)
Q9650 vs. Q9550 (2)
Desktop Calendar Application (2)
Looking for new motherboard (1)
soundmon.exe (8)
Jedi Academy Problem (3)
Can a page file be "too big".. (1)
Size after cutting 700Mb file is 2.5 .. (0)
windows vista security holes (19)


All times are GMT -4. The time now is 02:33 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28