| Sponsored Links |
| | #1 |
![]() Join Date: Jul 2008 Location: Seaton Canoe
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 | PHP Code: |
| |
| | #2 |
![]() Join Date: Feb 2008 Location: East Sussex
Posts: 153
Thanks: 12
Thanked 17 Times in 14 Posts
Rep Power: 5 | Try adding the "." in to the queary then you will construct the string correctly $query5 ="INSERT INTO hardware VALUES('',' . $departmentid .',' .$roomid .',' . $equiptmenttype . ',' . $serialnumber . ',' . $suppilername .',' . $price .',' .$present')"; |
| |
| | #3 |
![]() Join Date: Jul 2006 Location: South Yorkshire
Posts: 2,652
Thanks: 101
Thanked 92 Times in 73 Posts
Rep Power: 28 | PHP Code: I've setup the code as an example as you haven't listed the tables column headers/labels so you need to edit the PHP Code: It'll also provide you with an error as to why it didn't like it which is good debugging practice. The suggestion re: the dots, etc... isn't necessary as you're using double quotes to enclose the $query5 string.. You would need to if you were using single quotes. Last edited by contink; 23-07-2008 at 03:55 PM.. |
| |
| | #4 |
![]() Join Date: Aug 2005 Location: Alton, Hampshire
Posts: 1,376
Thanks: 119
Thanked 91 Times in 86 Posts
Rep Power: 28 | You'll have to tell us what the problem you are having is. Do you get a PHP syntax error, or an SQL syntax error? Does the data go in to the database, just in the wrong way or a way you weren't expecting? [quote]$query5 ="INSERT INTO hardware VALUES('','$departmentid','$roomid','$equiptmentty pe','$serialnumber','$suppilername', '$price', '$present')"; mysql_query("INSERT INTO hardware VALUES("",'$departmentid','$roomid','$equiptmentty pe','$serialnumber','$suppilername', '$price', '$present')";[/QUOTE You construct the query string twice? Probably you meant to do something like: $query5 = ... print $query5; # For debugging purposes - does the SQL query string look like you expected? mysql_query($query5); -- David Hicks |
| |
| | #5 |
![]() Join Date: Aug 2005 Location: London
Posts: 1,100
Thanks: 1
Thanked 113 Times in 98 Posts
Rep Power: 29 | Not sure what you're doing here, but if the data could already exist then this will either end up with duplicate records (bad :-() or just fail. What I always do is try to delete the record based on key field and then do an insert. |
| |
| | #6 |
![]() Join Date: Oct 2007
Posts: 1,020
Thanks: 93
Thanked 30 Times in 16 Posts
Rep Power: 10 | comon chris, lets see it up and running |
| |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP on IIS 6 | Ryan | Windows | 1 | 27-05-2008 01:32 PM |
| PHP Help! | Cravon | Coding | 2 | 20-11-2007 06:05 PM |
| CMS - PHP problems | wesleyw | How do you do....it? | 6 | 12-07-2007 09:22 AM |
| Help with PHP | Gatt | Web Development | 1 | 14-11-2006 10:01 PM |
| php help | beeswax | Windows | 33 | 14-10-2005 04:51 PM |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search Thread |
|
|






