aaricwon Posted February 12, 2008 Share Posted February 12, 2008 I am VERY new to php & mysql. Today I created a form that updates a database. I then created this page: http://www.bjjnews.org/TUF/fighterdb/formatting.php for viewing it. There is alot of info. Is there a better way to view it? to format it? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 12, 2008 Share Posted February 12, 2008 We can't help you unless you post the relevant code here between tags. Ken Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted February 12, 2008 Share Posted February 12, 2008 This is related to HTML. But you can use Table tag with width. For mysql Retreive that rows which you need. For example: select name,last_name,address from users The rest all upto you,what type of format you like and which rows you want to pull out. Simple example is: <table width='95%'> <tr> <td width='30%'>Name</td> <td width='30%'>Last Name</td> <td width='35%'>Address</td> </tr> <?php while($row=mysql_fetch_array($query)){ echo "<tr>"; echo "<td align='center'>$row['name']</td>"; echo "<td align='center'>$row['last_name']</td>"; echo "<td align='center'>$row['address']</td>"; echo "</tr>"; } ?> </table> Hope this will help. Quote Link to comment Share on other sites More sharing options...
priti Posted February 12, 2008 Share Posted February 12, 2008 I am VERY new to php & mysql. Today I created a form that updates a database. I then created this page: http://www.bjjnews.org/TUF/fighterdb/formatting.php for viewing it. There is alot of info. Is there a better way to view it? to format it? The output on this page is very much scattered . 1.Give proper heading to your columns like you have given for your First name,Last name 2.the better would be acc. to me -> First list the all the student by their teams -> The names of students should be clickable link i.e when you click 'Steve Kinnison ' It should take you to a Steve Kinnison 's profile page and on the profile page you can nicely provide all the needed details. regards Quote Link to comment Share on other sites More sharing options...
aaricwon Posted February 12, 2008 Author Share Posted February 12, 2008 I am VERY new to php & mysql. Today I created a form that updates a database. I then created this page: http://www.bjjnews.org/TUF/fighterdb/formatting.php for viewing it. There is alot of info. Is there a better way to view it? to format it? The output on this page is very much scattered . 1.Give proper heading to your columns like you have given for your First name,Last name 2.the better would be acc. to me -> First list the all the student by their teams -> The names of students should be clickable link i.e when you click 'Steve Kinnison ' It should take you to a Steve Kinnison 's profile page and on the profile page you can nicely provide all the needed details. regards What I would like is similar to what you suggest. I'd like to have First Name, Last Name, Weight, State I'd like the name to be clickable and when clicked it'd go to a page that displays First Name, Last Name, Email, Weight, City, State, Telephone, Record etc... Quote Link to comment Share on other sites More sharing options...
priti Posted February 12, 2008 Share Posted February 12, 2008 Thats gr8 then start and if you get in to problem post here :-) Quote Link to comment Share on other sites More sharing options...
aaricwon Posted February 12, 2008 Author Share Posted February 12, 2008 Thats gr8 then start and if you get in to problem post here :-) Can you point me towards a tutorial? I am already lost... I just don't know where to start. Quote Link to comment Share on other sites More sharing options...
haku Posted February 12, 2008 Share Posted February 12, 2008 Kind of a side point, but if those are real names and email addresses that you posted on that form, you are dispersing people's private information on this site, which they may not be very happy about if they knew. At the very least posting someone's email address is a likely way for spiders to log their email address and spam them with junk mail. Someone could also steal their identity and rack up debts under their name. If they are fake names and addresses, no worries. Quote Link to comment Share on other sites More sharing options...
priti Posted February 12, 2008 Share Posted February 12, 2008 Thats gr8 then start and if you get in to problem post here :-) Can you point me towards a tutorial? I am already lost... I just don't know where to start. php-mysql tutorial you will get in article section of phpfreaks.Let me find if i have some dummy example with me Quote Link to comment Share on other sites More sharing options...
GameYin Posted February 12, 2008 Share Posted February 12, 2008 If you are just outputting raw data, then you might want to have a look at XML Quote Link to comment Share on other sites More sharing options...
jd307 Posted February 12, 2008 Share Posted February 12, 2008 Just as a thought. If you are trying to improve the way that the information looks then you could always add some HTML tags to the page to make it look at a CSS file. You could then define in the CSS file formatting for the table. This will allow you to make the information looks somewhat neater. Of course you will still need to add the hyperlinks in to display user information when you click on it. If you want to create the user pages you could make PHP read the url so when you display then entire list you could do something like: <?php while($row=mysql_fetch_array($query)){ echo "<tr>"; echo "<td align='center'><a href=\"pagename.php?member=" . $row['name'] . "\"$row['name']</a></td>"; echo "<td align='center'>$row['last_name']</td>"; echo "<td align='center'>$row['address']</td>"; echo "</tr>"; } ?> (The syntax of this may not be correct but it's just to give you an idea) Then you could have some code on the page that says something like (note this is only pseudo style code): $query = mysql_query(SELECT * FROM table WHERE first_name == member); I don't know exactly how to code this which is why you shouldnt use this code. But can you see what I am saying? When you create the main page, get it to insert the members name into an <a href=...> tag so it loads the same page again but with a string on the end so you would have for example pagename.php?member=Dave. When you click this it goes to 'pagename.php' and some code within the page will see that you are after Dave's information therefore will add that to the SQL query and pulls out all the information for that one user. If there is no string there stick an ELSE statement in that will pull all information (like an index page). I think this is what you are trying to do. I hope this helps somewhat with somewhere to look (or what to look for). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.