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
        JOIN user_item u ON u.item_id = i.item_id
        WHERE i.item_function='M' AND u.item_id NOT IN (SELECT u.item_id FROM user_collection WHERE u.user_id=6)

[QUOTE=veedeoo;1773508]Another suggestion, you can use xampp which is already pre-configured to run mysqli, pdo.

Xampp can and will also run from portable drive..

A simple portable drive xampp installation

  1. Download xampp for your OS
  2. Extract zip file contents to your portable drive.
  3. Open portable drive, look for the xampp_start.exe to start the service.

That's all you need to do. Everything are pre-configured for you. Just dump your php script in the htdocs directory.[/QUOTE]

Do you know if it's possible to do that with EasyPHP as well? EasyPHP looks like a good local web server. Or is Xampp better?

The loaded configuration file is like so:

[QUOTE]Loaded Configuration File C:\wamp\bin\apache\Apache2.2.21\bin\php.ini[/QUOTE]

I have the extension_dir like this:
[QUOTE]extension_dir = "c:/wamp/bin/php/php5.3.9/ext/"[/QUOTE]

Which that leads to the mysqli and mysql dll files.

I have these enabled by deleting the ";":

[QUOTE]extension=php_mysql.dll
extension=php_mysqli.dll[/QUOTE]

Is there anything else I would need to change in there?

[QUOTE=ardav;1771365]How do you know if there is another php.ini in the way?...

search for php.ini or variants thereof. I've seen php5.ini and I think php-win.ini Stuff like that. Try renaming them one at a time to see if the problem resolves itself.[/QUOTE]

No there isn't. I checked all php.ini in my whole C: drive and it's all related to WAMP inside of that folder.

Do I need to change the Windows include_path to something specific in php.ini?

[QUOTE=pritaeas;1768271]Here's an [URL="http://stackoverflow.com/questions/547224/wamp-cannot-load-mysqli-extension"]SO thread[/URL] with some tips. What version of WAMP are you using? Is there perhaps an another PHP.INI getting in the way?[/QUOTE]

I'm using 5.3+. And it's wamp 2.0. I know I don't need that file for the version that I have. Buuut everytime I view the Apache error logs, it throws this:
[QUOTE][Thu Mar 01 12:31:57 2012] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico[/QUOTE]

Which has nothing to do with the mysqli class.
How do you know if there is another php.ini in the way?...

Are you including an html file with the template?
If so, that could throw it off because you can't release the html header before the header() function in PHP. You should do your PHP at the very top of the page before all those includes (unless it's your database connection one).
I'm assuming logincheck is with the variable you need? You can do that before. But you should always release your html header after using header() functions in php.

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 can't find any so I have a feeling I don't even have mysqli extension or something. But when I look under the ext folder in the php folder of WAMP, both files are there and I have them enabled in the php.ini.

So what am I doing wrong? Thank you soooo much for anyone who can help me solve this!!

[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?

Ok sorry got it to work. Just can't get the unhighlight and highlight the other one now.
Here is my code:
[code]var prevId;
function baseBorder(count)
{
if (prevId)
{
document.getElementById(count).style.border="none";
}
else
{
document.getElementById(count).style.border="2px solid #E8272C";
prevId = count;
}
}[/code]

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 function that will change the border.

Here is the baseBorder() function:
[code]var prevId;
function baseBorder(count)
{
if (prevId)
{
$("#prevId").style.border="none";
}
else
{
$("#count").style.border="2px solid #E8272C";
prevId = count;
}
}[/code]

Can anyone help me out since it's not working?

So there is no possible way to do it the way I'm doing it?
You have to reload the page to get stuff from the database?
So they have to chose their gender and insert into the database and then go from there?..
I don't get the point of AJAX then since I wanted it to load into a smooth transition.

Ok so sorry. Edited my post.
Thank you so much for helping me! You're the only one who has been willing to try.

Do you recommend any specific one?

Here is my entire code:
[CODE]<?php
session_start();
include("/home1/elvonica/public_html/includes.php");
?>
<?php include("/home1/elvonica/public_html/header.php"); ?>

function chooseGender() { var gender = $('input[name=gender]:checked', '#submitgender').val(); if(gender) { $.ajax( { type: "POST", url: window.location.pathname, data: "gender='" + gender, success: function() { alert("You have chosen to be a " + gender); $("#submitgender").hide(); $("#rest").fadeIn(); selectGender.innerHTML = "Gender: "+ gender +""; } }); } else { alert('Select a gender.'); } } $(function tabs() { $( "#tabs" ).tabs(); });

<?php
echo $eventdisplay; ?>

Human Avatar

<?php
echo $error;
$sql = "SELECT * FROM userhas WHERE userid='".$_SESSION['userid']."'";
$result = mysqli_query($cxn, $sql);
$num = mysqli_num_rows($result);
if ($num > 0)
{}
else
{
?>

[QUOTE=almostbob;1573789]its not an input, its not posted[/QUOTE]

What do you mean?
How would I get this to work then?

But it is submitting because there is a submit button in a form using the POST method.

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]
function chooseGender()
{
var gender = $('input[name=gender]:checked', '#submitgender').val();
if(gender)
{
$.ajax(
{
type: "POST",
url: window.location.pathname,
data: "gender=" +gender,
success: function()
{
alert("You have chosen to be a " + gender); //It's grabbing it perfectly fine!
$("#submitgender").hide(); //It hides the gender table so they can't choose a gender since they already have chosen one.
$("#rest").fadeIn(); //Shows the other table that's labeled "rest" as it's ID so they can choose what base, eyes, etc for that specific gender they've chosen.
}
});
}
else
{
alert('Select a gender.');
}
}
[/CODE]

But here is the PHP inside the #rest table:
[ICODE]<?php
$gender = $_POST['gender'];

                        $sql = "SELECT * FROM habases WHERE gender='".$gender."'";
                        $result = mysqli_query($cxn, $sql) or die(mysqli_error($cxn));
                        print_r($sql);
                        while ($row = mysqli_fetch_assoc($result))
                        {
                        $baseimage = $row['image'];
                        $baseskin = $row['skin'];

                        echo "<img src=\"http://www.elvonica.com/".$baseimage."\" value=\"".$baseskin."\">";
                        }
                        ?>[/ICODE]

And this is what I'm getting for the print_r:
[QUOTE]SELECT * FROM habases WHERE gender=''[/QUOTE]

Alright so now here is how my javascript looks:
[CODE]
function chooseGender()
{
var gender = $('input[name=gender]:checked', '#submitgender').val();
if(gender)
{
$.ajax(
{
type: "POST",
url: window.location.pathname,
data: "gender="+ gender,
success: function()
{
$("#submitgender").hide();
$("#rest").show();
}
});
}
else
{
alert('Select a gender.');
}
}
[/CODE]

It IS working. Thank you soooo much!
BUT now, my table that pops up won't read the gender they selected. Here is my table that holds that PHP:

[CODE]

Eyes here.

Mouths here.

Noses here.

Hairs here.

[/CODE]

This is what my print_r statement is coming up as:
[QUOTE]SELECT * FROM habases WHERE gender='' [/QUOTE]

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]
function chooseGender()
{
// we want to store the values from the form input box, then send via ajax below
var gender = document.getElementsByName("gender");

    if (gender.checked)
    {
        var selectGender = gender.value;
    }
    $("#submitgender").hide();
    $("#rest").show();
}
</script>[/CODE]

Then here is my Javascript code that won't work:
[CODE]
function chooseGender()
{
// we want to store the values from the form input box, then send via ajax below
var gender = document.getElementsByName("gender");

    if (gender.checked)
    {
        var selectGender = gender.value;
    }

    $.ajax(
    {
        type: "POST",
        url: "ajax.php",
        data: "gender="+ Selectgender,
        success: function()
        {
            $("#submitgender").hide();
            $("#rest").show();
        }
    });
}
</script>[/CODE]

Then here is my HTML/PHP:
[CODE]

Click on your gender:
Male Female ...

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]

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 "";
$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 and image of the item that is displaying
    $result = mysqli_query($cxn, $sql) or die(mysqli_error($cxn));
    $row = mysqli_fetch_assoc($result);

    $name = $row['name'];
    $image = $row['image'];

    if ($imagecount%5 == 0) //after 5 items have been listed, start a new line
    {
        echo "</tr>";
        echo "<tr>";
    }
}

echo "<td width=\"120px\" align=\"center\">";
echo "<img src=\"http://www.elvonica.com/".$image."\"><br>";
echo $name." (".$quantity.")";
echo "</td>";

$imagecount++; //after one item has been displayed, redo the loop if there are still results
}
echo "</table>";[/CODE]

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 == "")
    {
        $eventdisplay = "";
    }
    else
    {
        $sql = "SELECT * FROM randomevents WHERE phrase='".mysqli_real_escape_string($cxn,$display)."'";
        $result = mysqli_query($cxn, $sql) or die("Query died: select everything from randomevent table");
        $row = mysqli_fetch_array($result);

        $itemid = $row['itemid'];
        $image = $row['image'];

        if ($row['type'] == "itemgain")
        {
            $sql2 = "SELECT name, image FROM items WHERE itemid='".$itemid."'";
            $result2 = mysqli_query($cxn, $sql2) or die(mysqli_error($cxn));
            $row2 = mysqli_fetch_assoc($result2);

            $itemname = $row2['name'];
            $itemimage = $row2['image'];

            $eventdisplay = "<table cellspacing=\"0\" class=\"events\" align=\"center\">
                <tr>
                <td width=\"350px\"><center><b><h1>Random Event</h1></b></center></td>
                </tr>
                <tr>
                <td><img src=\"http://www.elvonica.com/".$image."\" style=\"position:relative;float:left;\">
                <p><center>".$display."</center></p>
                <p>
                <form action=\"".$_SERVER['SCRIPT_NAME']."\" method=\"post\">
                <input type=\"submit\" name=\"claimitem\" value=\"Claim Egg!\" />
                </form>
                </p>
                </td>
                </table><br>";

            if (isset($_POST['claimitem']))
            {
                $sql = "SELECT * FROM useritems WHERE itemid='".$itemid."' AND userid='".$_SESSION['userid']."'";
                $result = mysqli_query($cxn, $sql) or die(mysqli_error($cxn));
                $num = mysqli_num_rows($result);
                if ($num == 0)
                {
                    $sql = "INSERT INTO useritems (userid, itemid, name, image, quantity) VALUES ('".$_SESSION['userid']."', '".$itemid."', '".$itemname."', '".$itemimage."', '1')";
                    mysqli_query($cxn, $sql) or die("Query died: insert for itemgain");
                }
                else
                {
                    $sql ...

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 event#";
while ($row = mysqli_fetch_assoc($result))
{
$event[] = $row['phrase'];
}

//This will pick a random event and show it
$renum = rand(0,count($event));
$display = $event[$renum];

if ($display == "")
{
    $eventdisplay = "";
}
else
{
    $eventdisplay = "<table cellspacing=\"0\" class=\"events\" align=\"center\"><br>
    <tr><br>
    <td><center><b><h1>Random Event</h1></b></center></td><br>
    </tr><br>
    <tr><br>
    <td><img src=\"".$_SERVER['SCRIPT_NAME']."\">
    <p><center>".$display."</center></p><br>
    </td><br>
    </table><br>";

    $sql = "SELECT type FROM randomevents WHERE phrase='".$display."'";
    $result = mysqli_query($cxn, $sql);
    $row = mysqli_fetch_assoc($result);
    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");
    }
    elseif ($row['type'] == "losesp")
    {
        $rand = rand(50,100);
        $sql = "UPDATE members SET starpoints = starpoints-$rand WHERE userid='".$_SESSION['userid']."'";
        mysqli_query($cxn, $sql) or die("Query died: updating starpoints");
    }
    else
    {}
}

}
else
{
$eventdisplay = "";
}
?>[/code]

What do you mean a placeholder? Is that under the field type?..
I'm trying to do random events and they come out as a string.
How do I format that variable to.. output the string?
The value changes for every single user since it's a random number.

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];

}
?>[/code]

In the database, I have the phrases set as:
"You have gained {$rand} starpoints!".
How do you make that variable echo out as the $rand I'm generating on this page?
It just keeps posting as is. When I went the {$rand} to display as the number I'm generating to set their starpoints to.
So I guess how do you hold a variable in the database?

Does anyone understand what I'm asking?
Here as an image to help understand:

[img]http://i370.photobucket.com/albums/oo149/TenaciousMug/databasevariables.png[/img]

Try this:

[CODE]<?php
$id = $_POST['clientid'];
$fname = $_POST['clientfname'];
$lname = $_POST['clientlname'];

$dbc = mysql_connect('ip', 'login', 'password', 'dbname')
    or die('Error connecting to MySql server.');

$query = "SELECT * FROM CLIENT WHERE id = '$id'";   

$result = mysql_query($dbc, $query)
    or die('Error querying database.');

$rownum = mysql_num_rows($result);

if ($rownum > 0)
{
    $i = 0
    while (mysqli_fetch_row($rownum))
    {
        $rid = mysql_result($result, $i, "id");
        $rfname = mysql_result($result, $i, "fname");
        $rlname = mysql_result($result, $i, "lname");
        $rmphone = mysql_result($result, $i, "mphone");
        $rhphone = mysql_result($result, $i, "hphone");
        $raddress = mysql_result($result, $i, "address");
        $remail = mysql_result($result, $i, "email");
        $rtech_level = mysql_result($result, $i, "tech_level");

        echo $rid."<br />";
        echo $rfname." ".$rlname."<br />";
        echo $rmphone."<br />";
        echo $rhphone."<br />";
        echo $raddress."<br />";
        echo "$remail."<br />";
        echo $rtech_level."<br />";

        $i++;   
    }
}

mysql_close($dbc);

?>[/CODE]

May I see the error message that is popping up?
Let's look error message by error message while going through the script.
For what you have now, what is the exact error message that is popping up?

Ok I have the variables output after the form is submitted.
The password is what's wrong.

It's suppose to be this:
7da293f88d6e3bffc85a5e86e

And it's coming out like this:
7da293f88d6e3bffc85a5e86ee836fca

Do you have any clue why it is doing that? It's adding 7 extra characters onto it.

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'];

if (isset($_POST['submit']))
{
if(!empty($username))
{
if (!empty($password))
{
$sql = "SELECT username FROM members WHERE username='$usernamefinal'";
$result = mysqli_query($cxn, $sql) or die("Query died: username");
$num = mysqli_num_rows($result);
if ($num > 0)
{
$sql = "SELECT username, password FROM members WHERE username='$usernamefinal' AND password=md5('$password')";
$result = mysqli_query($cxn, $sql) or die("Query died: username and password");
$num = mysqli_num_rows($result);
if ($num > 0)
{
$sql = "SELECT userid FROM members WHERE username='$usernamefinal'";
$result = mysqli_query($cxn, $sql) or die("Query died: userid");
$row = mysqli_fetch_array($result);
$userid = $row['userid'];

                $_SESSION['auth'] = "yes";
                $_SESSION['username'] = $usernamefinal;
                $_SESSION['userid'] = $userid;
                $ipadd = $_SERVER['REMOTE_ADDR'];
                $sql2 = "INSERT INTO login (userid, username, logintime, ipadd) VALUES ('$userid', '$usernamefinal', NOW(), inet_aton('$ipadd'))";
                mysqli_query($cxn, $sql2) or die("Query died: login session");
                header("Location: news.php");
            }
            else
            {
                $error = "The username, $usernamefinal, and password do not match!";
            }
        }
        else
        {
            $error = "That username doesn't exist!";
        }
    }
    else
    {
        $error = "You must enter ...

...
I said I am using INT(10) UNSIGNED and I have the coding right.
I have exactly what they have.

I MUST still being doing something wrong though because it's not working. It fails to insert it into the table..

I dont know peoples IP address so I can't do INET_ATON('numbers here'), but I pull their IP address with the REMOTE_ADDR function and make it into a variable and put that into the parantheses but it's STILL not working.
It's failing to insert so I must be doing something wrong with the actual IPadd field in the Mysql database..

[img]http://i370.photobucket.com/albums/oo149/TenaciousMug/MemberTable.png[/img]

Also random question, is it ok if I make a database called Asterock_memberdirectory and just use that database for everything like member, login, news, pet, items?

EDIT
NEVERMIND. Someone helped me on phpfreaks. All I had to do was switch the function and variable around. xD

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]

Nevermind it was a simple variable mistake. I had $sql and instead I was trying to result the $query and $cxn. xD And there was no $query variable.