Ok I researched EVERYWHERE on the Internet and I just can't get this to work. In my php.ini under my WAMP php folder, I have this (enabling the extensions): [CODE];extension=php_mssql.dll extension=php_mysql.dll extension=php_mysqli.dll ;extension=php_oci8.dll ;extension=php_oci8_11g.dll ;extension=php_openssl.dll[/CODE] Error: [CODE]Fatal error: Class 'mysqli' not found in C:\wamp\www\Elvonica\class\Database.php on line 11[/CODE] I have both the .dll's enabled. And then there is this crazy libmysqli.dll or something you're suppose to put somewhere.. I searched my whole C:/ directory for that file and it didn't find anything. I even searched for "lib" "mysql". Nothing. :/ Then they said phpinfo(); should have a MySqlI section and I …

Member Avatar
Member Avatar
+0 forum 13

That is my query. I am trying to select the item details for the items the user has in their inventory, but I DO NOT want to select the ones that are in their collection. So I'm trying to say where item_id IS NOT in the user_collection with their user id.. But this is returning an empty result when it should be returning around 5 rows.. it works fine when they have nothing in their collection, but as soon as I put one item in their collection, this query returns nothing. Help? :) SELECT i.item_img, i.item_id, i.item_name FROM item i …

Member Avatar
Member Avatar
+0 forum 2

[CODE]$(document).ready(function() { $(".alert").click(function() { { var id = $(this).attr("id"); alert(id); $(id).dialog(); return false; } }); });[/CODE] Ok it's alerting the id AFTER it alerts an undefined.. so it alerts "undefined" and then "5" or whatever the number may be. What am I doing wrong?

Member Avatar
Member Avatar
+0 forum 1

This code will not insert OR update. But on the other ones it will.. but for this one, I'm doing an extra step to say that they can claim the item or not. From adding that extra step, it won't insert or update. [code]$rand = rand(1,3); if ($rand == 1) { $rand = rand(1,3); if($rand == 1) { $sql = "SELECT * FROM randomevents WHERE rarity = '1'"; $result = mysqli_query($cxn, $sql); while ($row = mysqli_fetch_assoc($result)) { $event[] = $row['phrase']; } //This will pick a random event and show it $renum = rand(0,count($event)-1); $display = $event[$renum]; if ($display == "") …

Member Avatar
Member Avatar
+0 forum 1

I am trying to add a border around the base they select and then when they select another one, I want the previous one to go away and then high light that one. This is my PHP code that outputs the bases: [code]$gender = $_GET['gender']; // SQL Injection here? $sql = "SELECT * FROM habases WHERE gender='".$gender."'"; $result = mysqli_query($cxn, $sql) or die(mysqli_error($cxn)); $baseCount = 0; while ($row = mysqli_fetch_assoc($result)) { $baseimage = $row['image']; $basesOutput .= "<input type=\"image\" id=\"".$baseCount."\" src=\"http://www.elvonica.com/".$baseimage."\" onclick=\"baseBorder(".$baseCount.");return false;\" value=\"".$baseimage."\" name=\"base\">"; $baseCount++; }[/code] I have a baseCount so each image ID is unique. The baseBorder() is the …

Member Avatar
Member Avatar
+0 forum 1

I'm trying to SELECT * FROM table WHERE gender='whatever they clicked on'; WITHOUT refreshing the page. I am showing the gender table and then after the click a gender, I hide that table and then show the next, etc. It's working fine, but whenever I start using the AJAX to grab the "POST" value of gender, it stops showing/hiding things.. BUT it IS grabbing the gender correctly. It just stops showing/hiding for some odd reason. Here is my javascript code: [CODE]<script> function chooseGender() { // we want to store the values from the form input box, then send via ajax …

Member Avatar
Member Avatar
+0 forum 3

I think this belongs here, but my $_POST['gender'] won't grab the gender that was submitted through a form. I am using AJAX so the page doesn't have to reload so it can go in a smooth transition, but the AJAX is grabbing the value perfectly fine. I have a feeling the $_POST isn't grabbing the value because the page isn't reloading.. but I don't want to reload it. These codes are all on the same page. Here is my Javascript: [CODE]<script> function chooseGender() { var gender = $('input[name=gender]:checked', '#submitgender').val(); if(gender) { $.ajax( { type: "POST", url: window.location.pathname, data: "gender=" +gender, …

Member Avatar
Member Avatar
+0 forum 9

Ok, I have a variable ($incubation) set as 04:00:00. Then I have another variable ($starttime) set to the current time. Both are printing out fine. But I'm trying to get an $endtime from adding the incubation time to the start time. [CODE]$incubation = $row['incubation']; //IM GRABBING THIS TIME FROM THE DATABASE. It prints 04:00:00 $starttime = date("H:i:s"); //prints 16:23:39 $endtime = date("H:i:s", $starttime+$incubation); //prints 20:00:00 when it's suppose to print 20:23:39[/CODE]

Member Avatar
Member Avatar
+0 forum 2

It's only displaying the first result and not the others. What am I doing wrong? I'm selecting the items the user occupies. Then I'm selecting the name and image of that item from the item table. [CODE]echo "<table cellspacing=\"0\" class=\"news\" align=\"center\">"; echo "<tr>"; $sql = "SELECT * FROM useritems WHERE userid='".$_SESSION['userid']."' LIMIT $offset, $rowsperpage"; //selects all the users items to whoever is logged in $result = mysqli_query($cxn,$sql) or die(mysqli_erro($cxn)); $imagecount = 0; while ($row = mysqli_fetch_assoc($result)) //while there are still results { extract($row); $quantity = $row['quantity']; $itemid = $row['itemid']; $sql = "SELECT * FROM items WHERE itemid='".$itemid."'"; //selecting the name …

Member Avatar
Member Avatar
+0 forum 1

Here is my code for the login script. Everything works perfectly, but everytime I enter everything CORRECTLY into the forum, it says "The username, ____, and password do not match!". When they do match. If I leave the areas blank, they say "You must enter a username!" or "You must enter a password!". All the error messages work good, but whenever I fill the form in correctly, it displays my first error message "The username, ____, and password do not match!". Does anyone see what's wrong with it? [CODE]<?php session_start(); include("config.php"); $username = $_POST['username']; $usernamefinal = ucfirst(strtolower($username)); $password = $_POST['password']; …

Member Avatar
Member Avatar
+0 forum 2

Alright, I have a random thing going on. Works perfectly fine. This is the code: [code]<?php include("config.php"); //To change the odds, change the second number in the rand() function. $rand = floor(rand(0,1)); if($rand == 1) { $sql = "SELECT * FROM randomevents WHERE rarity <= '10'"; $result = mysqli_query($cxn, $sql); while ($row = mysqli_fetch_assoc($result)) { $event[] = $row['phrase']; if ($row['type'] == 'gainsp') { $rand = rand(200,500); $sql = "UPDATE members SET starpoints = starpoints+$rand WHERE userid='".$_SESSION['userid']."'"; mysqli_query($cxn, $sql) or die("Query died: updating starpoints"); } } //This will pick a random event and show it $renum = floor(rand(0,count($event))); $eventdisplay = $event[$renum]; …

Member Avatar
Member Avatar
+0 forum 3

It's working great, but at some points after one of the random events goes through, I reload the page and it either gives me or takes away some starpoints without showing the message.. but it shows the message all the other times. Could someone help me debug this and see why it's doing that? [code]<?php include("config.php"); //To change the odds, change the second number in the rand() function. $rand = rand(1,3); if($rand == 1) { $sql = "SELECT * FROM randomevents WHERE rarity <= '10'"; $result = mysqli_query($cxn, $sql); //Write the events in here with the opener: $event[] = "#your …

Member Avatar
Member Avatar
+0 forum 1

I am having huge trouble with this Mysql_real_escape_string to prevent SQL Injection. I have tried everywhere possible to input it in my code. My code looks a lot different than most peoples. I mean my login/registration system works PERFECT.. besides that it's not protected from SQL Injection yet which is why I'm trying to secure it. [CODE=PHP]$cxn = mysqli_connect($host,$user,$password,$database) or die("Query died: connect"); $sql = "SELECT username FROM Member WHERE username='$_POST[fusername]'"; $result = mysqli_query($cxn,$sql) or die("Query died: fusername"); $num = mysqli_num_rows($result);[/CODE] Okay now I know you input it in username=... after that. But I tried everything with the stupid quotation …

Member Avatar
Member Avatar
+0 forum 21

Wow, I have no clue what I'm doing.. I'm trying to make a random game and if you roll a 6, you will win 500 rp and I'm trying to insert the 500 rp into the user who is logged in ($_SESSION['username'). But I... just don't know where to begin. Here is my crappy coding that I just.. am stumped on: [CODE]<p><?php $dice = rand(1,6); if($dice == 1){ echo "You rolled a <br><b>1</b>"; }if($dice == 2){ echo "You rolled a <br><b>2</b>"; }if($dice == 3){ echo "You rolled a <br><b>3</b>"; }if($dice == 4){ echo "You rolled a <br><b>4</b>"; }if($dice == 5){ …

Member Avatar
Member Avatar
+0 forum 3

Alright, the register/login system is fully working with sql injection, BUUUT now I want to store their IP Address. WHOLE new function that I've never dealt with before. So I need some help. Am I doing something wrong? I have the IPadd in the database as INT(10) and then I went down to another drop down list and hit unsigned. I feel like I'm doing something wrong with the field in the database.. [CODE]{ $_SERVER['REMOTE_ADDR'] = $IPadd; $sql = "INSERT INTO Member (username,createDate,password,firstName,email,IPadd) VALUES ('$username',NOW(),md5('$password'),'$firstName','$email',inet_aton('$IPadd'))"; mysqli_query($cxn,$sql); $_SESSION['auth']="yes"; $_SESSION['username'] = $username; header("Location: testing.php"); }[/CODE]

Member Avatar
Member Avatar
+0 forum 5

Ok I don't understand why the update statement only works once.. and after it rolls another 6, it wont add another 500 to the RP amount. [CODE]<?php session_start(); include("logincheck.php"); ?> <?php include_once("header.php"); ?> <td width='100%' valign='top' align='center'> <center><?php $dice = rand(1,6); echo "You rolled a<br /><b>{$dice}</b>\n"; if($dice == 6) { include("haha.php"); $cxn = mysqli_connect($dbhost,$dbuser,$dbpassword,$dbdatabase); $winnings = "500"; $username = $_SESSION['username']; $sql = "UPDATE `Member` SET `rp` = 'rp' + '$winnings' WHERE `username` = '$username'"; mysqli_query($cxn,$sql); } ?></center> </td></p> <?php include_once("footer.php"); ?>[/CODE] Can anyone figure out why? I mean it works one time...

Member Avatar
Member Avatar
+0 forum 7

Ok, I have my username set as 1 under admin and this other account set as 0 under admin. But it's not showing the page to any of the accounts and only showing the else statement. Does anyone know whats the problem? Im so confused and I have been staring at this code for a while now. [CODE]<?php include("haha.php"); $cxn = mysqli_connect($dbhost,$dbuser,$dbpassword,$dbdatabase) or die("Couldn't connect to server"); $sql = "SELECT `admin` FROM `Member` WHERE `username`='{$_SESSION['username']}'"; $result = mysqli_query($cxn,$query) or die(mysqli_error($cxn)); $row = mysqli_fetch_array($result); if($row['admin'] == 1) { There is code here that shows the page, but that works fine and …

Member Avatar
Member Avatar
+0 forum 3

Ok, I have all my functions working along with the real_escape_string(). Now I just need to find out WHY the password check isn't working properly. Whenever I try to login with the username: Dyl and the password it was signed up with, it says "Dyl is an existing username, but it's not the right password" when it is.. Can anyone see what I'm doing wrong? [CODE]<?php session_start(); switch (@$_POST['Button']) { case "Log in"; include("haha.php"); $cxn = mysqli_connect($host,$user,$password,$database); $fusername = $cxn->real_escape_string($_POST['fusername']); $sql = "SELECT `username` FROM `Member` WHERE `username`='$fusername'"; $result = mysqli_query($cxn,$sql) or die("Query died: fusername"); $num = mysqli_num_rows($result); if($num > …

Member Avatar
Member Avatar
+0 forum 4

The End.