| Author |
Topic |
|
seanghatch
Starting Member
6 Posts |
Posted - 2004-11-11 : 12:25:58
|
| Hello, I am an sql n00b, but I'm pretty good with the PHP side of things.My question is: How can I make PHP do something once for every row of my table there is. What I'm trying to do is list out all the entries in my table. Could I set this up in a while( ) loop? I'm not sure. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-11-11 : 13:43:15
|
| No need for a loop. Looping will cause performance problems. To do something for each row, you need to think set-based. Please post your table structure and explain what you want to do with some sample data and the expected result set, then we'll be able to help you out better.Tara |
 |
|
|
seanghatch
Starting Member
6 Posts |
Posted - 2004-11-11 : 13:59:17
|
| Deal.I have a table called visits, with 3 fields: name, email, times. I'd like to print them out something like thisName: Kevinemail: Kevin@Kevin.comTimes Visited: 6<hr>I'd also like to include some css elements, but if you could just help me with this, I think I could figure that out. |
 |
|
|
seanghatch
Starting Member
6 Posts |
Posted - 2004-11-11 : 14:00:40
|
| Oops, forgot to mention that I'd like to do what I did in the above example for all rows of the table. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-11-11 : 14:03:58
|
| Your PHP code would handle how to display it, but here's the code to get the data:SELECT Name, email, TimesFROM VisitTara |
 |
|
|
seanghatch
Starting Member
6 Posts |
Posted - 2004-11-11 : 15:02:10
|
| Alright Thanks, but could you show me how to output it? I thought I knew but I'm having troubles. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-11-11 : 15:26:04
|
| I'm not familiar with PHP. I'd try a PHP site for specific coding questions.Tara |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2004-11-11 : 15:29:11
|
| Seeing that you are using PHP, I assume it is relevant to ask:Are you trying to connect to a MySQL database or a Microsoft SQL Server database ?- Jeff |
 |
|
|
seanghatch
Starting Member
6 Posts |
Posted - 2004-11-11 : 15:42:41
|
| mysql |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-11-11 : 15:46:31
|
| You've reached an MS SQL Server site. Try the mysql forum over at dbforums.com. I believe they even have a PHP forum there.Tara |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2004-11-11 : 15:48:01
|
Ha! I knew it !!!! Damn, I'm good.- Jeff |
 |
|
|
seanghatch
Starting Member
6 Posts |
Posted - 2004-11-11 : 15:53:37
|
Sorry dudes |
 |
|
|
|