|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Hi there.
First of all thank you for taking you the time to read this post ![]() I have a few problems setting up a table in MySql to Sort the entries by the "Userid" is that possible? if so plz tell me how! mysql> CREATE TABLE userinfo ( -> userid VARCHAR (20), -> username VARCHAR (15), -> userpass VARCHAR (15) -> useremail VARCHAR (80) ); Another Question is: ------------- The lines that sends the info to the table from a Html page: ------------- $query = "INSERT INTO userinfo VALUES('$userid', '$username', '$userpass', '$useremail')"; $result = MYSQL_QUERY($query); How do I make the user update the Entries if the Userid allready exsists and dont make a new entry? ![]() |
|
#2
|
||||
|
||||
|
I don't really understand your first question, are you talking about the results from a query being sorted by userid? If so, you'd use
select * from userinfo group by userid asc|desc use asc for ascending, desc for descending alpabetical order. if you're not talking about sorting queries, then i'm confused. you don't set up a table to sort anything, that's what you use the queries for. that's what make databases so beautiful, you can stick information into it in any order you want, and use the query to pull it out however you want it formatted... on question number to, use update instead of insert. $query = "UPDATE userinfo SET username='$username', userpass='$userpass', useremail='$useremail' WHERE userid='$userid'"; you don't have to set userid because the WHERE clause makes sure that it only updates the userid that matches what was passed to it. Hope that helps... ---John Holmes... |
|
#3
|
|||
|
|||
|
Ohh yes it did thx alot
Im a bit new to MySql so forgive my first question! |
|
#4
|
||||
|
||||
|
I think I messed up my first answer, it should be
select * from userinfo ORDER by userid asc|desc read through the manual. there are a lot of different functions you can use to format the data coming out of mysql in any manner.... ---John Holmes... |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > A little problem with a Table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|