|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Help--why cant i write
using PHP/mysql in windows
can read from database but can't write (i.e insert). i am using root as user here is my code.. $db = mysql_connect("localhost", $dbuser, $dbpass); $dbb =mysql_select_db("database03",$db); $query = "INSERT INTO employees VALUES($num,$first,$last)"; $result = mysql_query("SELECT * FROM employees",$db); printf("First Name: %s n", @ mysql_result($result,2,"first")); printf("Last Name: %s n", @ mysql_result($result,2,"last")); |
|
#2
|
|||
|
|||
|
RE: Help--why cant i write
Try using mysql_error after your INSERT statement, to see what the problem is...
|
|
#3
|
|||
|
|||
|
RE: Help--why cant i write
Check your query for inserting. Does your table only have 3 columns? I think you're missing declaring which columns your data matches with and you might want to single quote the data. For example:
FROM $query = "INSERT INTO employees () VALUES($num,$first,$last)"; TO $query = "INSERT INTO employees (empnum, firstname, lastname)VALUES('$num', '$first', '$last')"; Here I assume your column names are empnum, firstname and lastname. HTH -bcyde |
|
#4
|
|||
|
|||
|
RE: Help--why cant i write
Just looked at the code again,
it also doesn't look like you're actually doing a mysql_query($query) after initializing your query. -bcyde |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Help--why cant i write |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|