|
 |
|
Codewalkers Forums
> PHP Related
> PHP Coding
|
Script is not updating database... no error.
Discuss Script is not updating database... no error. in the PHP Coding forum on Codewalkers. Script is not updating database... no error. Having problems with a PHP script you are coding? This is the place to get help!
|
|
|
|
 |
|
|
|
|

Codewalkers Forums Sponsor:
|
|
|

November 11th, 2012, 03:47 PM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 5
Time spent in forums: 1 h 6 m 20 sec
Reputation Power: 0
|
|
|
Script is not updating database... no error.
This is the script:
PHP Code:
<?php
$description = "Switchblade"; /*$_REQUEST['Description'];*/
$userid = "1"; /*$_REQUEST['userid'];*/
$mysqli = new mysqli("localhost", "****", "****", "****");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT username FROM phpbb_users WHERE user_id = '$userid'";
$username = mysqli_query($mysqli,$query);
$name = $username->fetch_array(MYSQLI_NUM);
$query = "SELECT lat, lng, alt FROM uwl_userlocation WHERE user_id = '$userid'";
$location = mysqli_query($mysqli,$query);
$coords = $location->fetch_array(MYSQLI_NUM);
$query = "SELECT * FROM uwl_items WHERE Description = '$description' AND user_id = '0'";
echo "$query";
$items = mysqli_query($mysqli,$query);
$item = $items->fetch_array(MYSQLI_NUM);
print_r ($item);
$query = " INSERT INTO `uwl_items`
(
`Owner`,
`Description,
`Amount`,
`lat`,
`lng`,
`alt`,
`Health`,
`Strength`,
`Dexterity`,
`Intelligence`,
`Range`,
`Duration`,
`Reliability`,
`Start`,
`Health Req`,
`Strength Req`,
`Dexterity Req`,
`Intelligence Req`,
`Time Req`
)
VALUES
('$userid',
'$item[2]',
'$item[3]',
'$coords[0]',
'$coords[1]',
'$coords[2]',
'$item[7]',
'$item[8]',
'$item[9]',
'$item[10]',
'$item[11]',
'$item[12]',
'$item[13]',
'$item[14]',
'$item[15]',
'$item[16]',
'$item[17]',
'$item[18]',
'$item[19]'
)";
mysqli_query($mysqli,$query);
?>
What am I missing here?
|

November 13th, 2012, 09:13 AM
|
 |
Contributing User
|
|
Join Date: Apr 2007
Location: Galway
Posts: 1,369

Time spent in forums: 1 Month 4 h 23 sec
Reputation Power: 8
|
|
echo your insert query and see what it says?
I also saw
the quotes are not needed
__________________
When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.
|

November 13th, 2012, 01:27 PM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 5
Time spent in forums: 1 h 6 m 20 sec
Reputation Power: 0
|
|
|
Better I should paste my query into phpmyadmin and see what it says... BINGO! error around description...
Thank you for your interest!
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|