Jump to content

Page just refreshes


inilz
Go to solution Solved by inilz,

Recommended Posts

Hey guys,

I'm trying to use the script to update a row based on what username is entered into a field.

So far the page just keeps refreshing. I'm not sure what I'm doing wrong.

Can anyone help me?

Thanks

<?
//Connection Info
$database = 'account_zf';
$database2 = 'cq';
$location = '192.168.1.500';
$username = 'Host';
$password = 'Pass';

$conn = mysql_connect("$location","$username","$password");
$conn1 = mysql_connect("$location","$username","$password");

//Start Code
mysql_select_db($database,$conn) or die ("Could not open database");

//Select username ID from Account Table & Get Value
if(isset($_POST['edit']))
  {
    $sid = addslashes($_POST['id']);
    $maccid = mysql_query("SELECT `id` FROM `account` WHERE `name` = '$sid' LIMIT 1", $conn);
    $dmaccid = mysql_fetch_row($maccid);
//Change DB to cq
    mysql_select_db($database2,$conn1) or die ("Could not open database");
    
    $query = mysql_query("SELECT `recordmap_id` FROM `cq_user` WHERE `account_id` = '$maccid' LIMIT 1", $conn1);
    echo $dmaccid['id'] ;
    if(mysql_num_rows($query) > 0)
    {
        $row = mysql_fetch_assoc($query);
        
        if(in_array($row['recordmap_id'], $unallowed_maps))
        {
            echo '<font color=black>You are on an unallowed map.</font><br>';
        }
        else
        {
            mysql_query("UPDATE cq_user SET recordmap_id='1002', recordx='400',  recordy='400' WHERE name='$maccid'", $conn1);

            echo '<font color=black>Your character has been successfully moved.</font><br>';
        }
    }
  }
?>
Link to comment
Share on other sites

On a page you enter your username,

Query finds the primary key/id for your username in database account_zf Example: 50

Then on database cq, it looks for the recordmap_id for 50.

If the the value for recordmap_id is any of the following.

<?php
$unallowed_maps = array(1038, 1845, 6000);

?>

It will give you an error.

else it will update the recordmap_id field to 1002.

 

I never heard of a join.

How does that work?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.