techker Posted December 2, 2010 Share Posted December 2, 2010 hey guys im going nuts with this and i cant find the error why it does not work?? $connection = mysql_connect($dbhost, $dbusername, $dbpass); $SelectedDB = mysql_select_db($dbname); //Writes the information to the database $query =("INSERT INTO `APPLICATIONS` (PERS_L_NAME, PERS_F_NAME, PERS_DATE_BIRTH, PERS_SSN, PERS_DRIVERS_L, PERS_ADD, PERS_CITY, PERS_CODE, PERS_ADD_2, PERS_CITY_2, PERS_CODE_2, PERS_NUMBER, PERS_CELL, PERS_FAX, EMPL_E, EMPL_ADD, EMPL_CITY, EMPL_CODE, EMPL_TYPE, EMPL_SINCE, EMPL_P, EMPL_N, EMPL_SUP, EMPL_GS, EMPL_2_E, EMPL_2_ADD, EMPL_2_CITY, EMPL_2_CODE, EMPL_2_TYPE, EMPL_2_SINCE, EMPL_2_P, EMPL_2_N, EMPL_2_SUP, EMPL_2_GS, OTHER_OWN_RENT, OTHER_OWN_RENT_D, OTHER_OWN_RENT_V, OTHER_OWN_RENT_AM, OTHER_OWN_RENT_MP, OTHER_CC_REER, OTHER_CC_REER_D, OTHER_CC_REER_V, OTHER_CC_REER_AM, OTHER_CC_REER_MP, OTHER_INV_CAR, OTHER_INV_CAR_D, OTHER_INV_CAR_V, OTHER_INV_CAR_AM, OTHER_INV_CAR_MP, OTHER_OTHER_L, OTHER_OTHER_L_D, OTHER_OTHER_L_V, OTHER_OTHER_L_AM, OTHER_OTHER_L_MP, EMAIL, ACCEPT, STATUS, DATE) ". "VALUES ( '$PERS_L_NAME','$PERS_F_NAME','$PERS_DATE_BIRTH','$PERS_SSN','$PERS_DRIVERS_L','$PERS_ADD','$PERS_CITY','$PERS_CODE','$PERS_ADD_2','$PERS_CITY_2', '$PERS_CODE_2','$PERS_NUMBER','$PERS_CELL','$PERS_FAX','$EMPL_E','$EMPL_ADD','$EMPL_CITY','$EMPL_CODE','$EMPL_TYPE','$EMPL_SINCE','$EMPL_P', '$EMPL_N','$EMPL_SUP','$EMPL_GS','$EMPL_2_E','$EMPL_2_ADD','$EMPL_2_CITY','$EMPL_2_CODE','$EMPL_2_TYPE','$EMPL_2_SINCE','$EMPL_2_P','$EMPL_2_N', '$EMPL_2_GS','$OTHER_OWN_RENT','$OTHER_OWN_RENT_D','$OTHER_OWN_RENT_V','$OTHER_OWN_RENT_AM','$OTHER_OWN_RENT_MP','$OTHER_CC_REER', '$OTHER_CC_REER_D','$OTHER_CC_REER_V','$OTHER_CC_REER_AM','$OTHER_CC_REER_MP','$OTHER_INV_CAR','$OTHER_INV_CAR_D','$OTHER_INV_CAR_V', '$OTHER_INV_CAR_AM','$OTHER_INV_CAR_MP','$OTHER_OTHER_L','$OTHER_OTHER_L_D','$OTHER_OTHER_L_V','$OTHER_OTHER_L_AM','$OTHER_OTHER_L_MP', '$EMAIL','$ACCEPT','$STATUS','$DATE')"); Link to comment https://forums.phpfreaks.com/topic/220424-query-not-working/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 2, 2010 Share Posted December 2, 2010 The code you posted does not contain a mysql_query() function call and if you just forgot to show that in your post, you can find out why the query is failing by echoing mysql_error() on the next line after the line with your mysql_query() statement. Link to comment https://forums.phpfreaks.com/topic/220424-query-not-working/#findComment-1142072 Share on other sites More sharing options...
techker Posted December 2, 2010 Author Share Posted December 2, 2010 this is the rest if (!$query) { die('Invalid query: ' . mysql_error()); } $id= mysql_insert_id(); echo "<p>This file has the following Database ID: <b>$id</b>"; echo "You'll be redirected to Home Page after (2) Seconds"; echo "<meta http-equiv=Refresh content=2;url=FILL.php>"; ?> [code=php:0] Link to comment https://forums.phpfreaks.com/topic/220424-query-not-working/#findComment-1142196 Share on other sites More sharing options...
fenway Posted December 3, 2010 Share Posted December 3, 2010 Great -- so what's the error? Link to comment https://forums.phpfreaks.com/topic/220424-query-not-working/#findComment-1142483 Share on other sites More sharing options...
techker Posted December 3, 2010 Author Share Posted December 3, 2010 i needed to go tru one by one to notice that i was missing a table associated with the values.. and a space like this ' me' i hate doing big query's like this..thx! Link to comment https://forums.phpfreaks.com/topic/220424-query-not-working/#findComment-1142561 Share on other sites More sharing options...
fenway Posted December 5, 2010 Share Posted December 5, 2010 Then don't write queries manually. Link to comment https://forums.phpfreaks.com/topic/220424-query-not-working/#findComment-1143276 Share on other sites More sharing options...
techker Posted December 5, 2010 Author Share Posted December 5, 2010 so how then? Link to comment https://forums.phpfreaks.com/topic/220424-query-not-working/#findComment-1143372 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.