[PHP] Help Insert Into Mysql
#1

Hey guys for my ucp i'm using insertinto. But the issue is that i have 160 varibles per player. Now can get PhpMyAdmin to generate this
Код:
INSERT INTO `members`(`playerLevel`, `memberName`, `playerPassword`, `playerEmail`, `playerMoney`, `playerBanned`, `playerPublicProfile`, `playerAdminLevel`, `playerRegistrationDate`, `playerSkin`, `playerPosX`, `playerPosY`, `playerPosZ`, `playerBankMoney`, `playerHealth`, `playerArmour`, `playerAccent`, `playerSeconds`, `playerInterior`, `playerVirtualWorld`, `playerJob`, `playerWeapon0`, `playerWeapon1`, `playerWeapon2`, `playerWeapon3`, `playerWeapon4`, `playerWeapon5`, `playerWeapon6`, `playerWeapon7`, `playerWeapon8`, `playerWeapon9`, `playerWeapon10`, `playerWeapon11`, `playerWeapon12`, `playerJobSkill1`, `playerJobSkill2`, `playerMaterials`, `playerGroup`, `playerGroupRank`, `playerHours`, `playerWarning1`, `playerWarning2`, `playerWarning3`, `playerHospitalized`, `playerAdminName`, `playerFirstLogin`, `playerGender`, `playerPrisonID`, `playerPrisonTime`, `playerPhoneNumber`, `playerPhoneBook`, `playerIP`, `playerHelperLevel`, `playerDropCarTimeout`, `playerRope`, `playerAdminDuty`, `playerCrimes`, `playerArrests`, `playerWarrants`, `playerPasswordToken`, `playerCarModel`, `playerCarMod0`, `playerCarMod1`, `playerCarMod2`, `playerCarMod3`, `playerCarMod4`, `playerCarMod5`, `playerCarMod6`, `playerCarMod7`, `playerCarMod8`, `playerCarMod9`, `playerCarMod10`, `playerCarMod11`, `playerCarMod12`, `playerCarPosX`, `playerCarPosY`, `playerCarPosZ`, `playerCarPosZAngle`, `playerCarColour1`, `playerCarColour2`, `playerAge`, `playerCarPaintJob`, `playerCarLock`, `playerStatus`, `playerBiography`, `playerFightStyle`, `playerVIP`, `playerExpireVIP`, `playerCarWeapon1`, `playerCarWeapon2`, `playerCarWeapon3`, `playerCarWeapon4`, `playerCarWeapon5`, `playerCarTrunk1`, `playerCarTrunk2`, `playerPhoneCredit`, `playerWalkieTalkie`, `playerAdminTitle`, `playerCarLicensePlate`, `playerAdminPIN`, `id_member`, `member_name`, `date_registered`, `posts`, `id_group`, `lngfile`, `last_login`, `real_name`, `instant_messages`, `unread_messages`, `new_pm`, `buddy_list`, `pm_ignore_list`, `pm_prefs`, `mod_prefs`, `message_labels`, `passwd`, `openid_uri`, `email_address`, `personal_text`, `gender`, `birthdate`, `website_title`, `website_url`, `location`, `icq`, `aim`, `yim`, `msn`, `hide_email`, `show_online`, `time_format`, `signature`, `time_offset`, `avatar`, `pm_email_notify`, `karma_bad`, `karma_good`, `usertitle`, `notify_announcements`, `notify_regularity`, `notify_send_body`, `notify_types`, `member_ip`, `member_ip2`, `secret_question`, `secret_answer`, `id_theme`, `is_activated`, `validation_code`, `id_msg_last_visit`, `additional_groups`, `smiley_set`, `id_post_group`, `total_time_logged_in`, `password_salt`, `ignore_boards`, `warning`, `passwd_flood`, `pm_receive_from`) VALUES ([value-1],[value-2],[value-3],[value-4],[value-5],[value-6],[value-7],[value-8],[value-9],[value-10],[value-11],[value-12],[value-13],[value-14],[value-15],[value-16],[value-17],[value-18],[value-19],[value-20],[value-21],[value-22],[value-23],[value-24],[value-25],[value-26],[value-27],[value-28],[value-29],[value-30],[value-31],[value-32],[value-33],[value-34],[value-35],[value-36],[value-37],[value-38],[value-39],[value-40],[value-41],[value-42],[value-43],[value-44],[value-45],[value-46],[value-47],[value-48],[value-49],[value-50],[value-51],[value-52],[value-53],[value-54],[value-55],[value-56],[value-57],[value-58],[value-59],[value-60],[value-61],[value-62],[value-63],[value-64],[value-65],[value-66],[value-67],[value-68],[value-69],[value-70],[value-71],[value-72],[value-73],[value-74],[value-75],[value-76],[value-77],[value-78],[value-79],[value-80],[value-81],[value-82],[value-83],[value-84],[value-85],[value-86],[value-87],[value-88],[value-89],[value-90],[value-91],[value-92],[value-93],[value-94],[value-95],[value-96],[value-97],[value-98],[value-99],[value-100],[value-101],[value-102],[value-103],[value-104],[value-105],[value-106],[value-107],[value-108],[value-109],[value-110],[value-111],[value-112],[value-113],[value-114],[value-115],[value-116],[value-117],[value-118],[value-119],[value-120],[value-121],[value-122],[value-123],[value-124],[value-125],[value-126],[value-127],[value-128],[value-129],[value-130],[value-131],[value-132],[value-133],[value-134],[value-135],[value-136],[value-137],[value-138],[value-139],[value-140],[value-141],[value-142],[value-143],[value-144],[value-145],[value-146],[value-147],[value-148],[value-149],[value-150],[value-151],[value-152],[value-153],[value-154],[value-155],[value-156],[value-157],[value-158],[value-159],[value-160])
but how can i generate it with the default fields? such as 0 and etc.
Reply
#2

To set a default value:

PHP код:
ALTER TABLE `table_nameCHANGE `column_name` `column_nameTYPE DEFAULT `default_value`; 
So, for example, you want "score" to be set to 0 on default nd the table is called "users", you need to do:

PHP код:
ALTER TABLE `usersCHANGE COLUMN `score` `scoreINT DEFAULT 0
Reply
#3

Quote:
Originally Posted by Sinner
Посмотреть сообщение
To set a default value:

PHP код:
ALTER TABLE `table_nameCHANGE `column_name` `column_nameTYPE DEFAULT `default_value`; 
So, for example, you want "score" to be set to 0 on default nd the table is called "users", you need to do:

PHP код:
ALTER TABLE `usersCHANGE COLUMN `score` `scoreINT DEFAULT 0
When you insert a new row, if you don't set the columns that are integers it will automatically set them to 0
Reply
#4

If you don't specify a value for a column that doesn't have a default value it will return an error.
Reply
#5

When no value is given it will set the field's value to NULL, which isn't the same as 0. It's true that in SA-MP NULL becomes 0 once you try to get data from the field though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)