kekkaishi 18 Junior Poster

Try not to use the reserved keywords. So try changing the name. It just might be it.

kekkaishi 18 Junior Poster

"database" is a reserved word in mysql. Which die statement is it printing? Cannot connect or the Cannot Find Database?

kekkaishi 18 Junior Poster

Your error could be because your code is missing single quotes around =".$_REQUEST['company'].""; . Try changing it to ='".$_REQUEST['company']."'"; . If this is not the error, please post the error message here for it would be easier to identify what is exactly the problem.

Hope this was of help.

kekkaishi 18 Junior Poster

Maybe the file (xxs.php) failed to include in comment.php. (Warnings might not be displayed if you have disabled warnings) Could you perhaps check by adding an 'echo' at the top of the xxs.php file, before you start your function.

kekkaishi 18 Junior Poster

cnlengr,
I think it's best if you take peter's advice. However, since I suggested assigning user specified size to array, I will try to explain the logic.
First, declare the array just the way you did. Next, ask user for the size of the array. For example, you would ask the user 'How many numbers would you like to enter?'. Now the user would give in a number, say 3. Now you'd know that the array would hold 3 numbers and hence the size of the array would be 3. Now you allocate the size to the earlier declared array as demonstrated in the following example.

int[] array;
output: how many numbers would you like to enter. //print to console. you know what to use :)
int size = input.nextInt(); //input is your scanner. 
//Now allocate array with the size
array = new int[size];

Now that you have allocated size to the array, you could start filling it up with values. Use a for loop like below

for(int i=0; i<size; i++){
//ask from user for a number and store it in the array. I am assuming you know this. 
}

I think I will also demonstrate one way to use ArrayList to achieve the same.

ArrayList<Integer> numbers = new ArrayList<Integer>(); //<Integer> because you are trying to store integer values. 
//Now you can use a while loop to ask for the numbers. And of course  there must be a number to use to indicate when the …
kekkaishi 18 Junior Poster

Maybe this would help.

Declare array

int[] someArray;
//Ask user for a size
int size = size_you_got_from_user;
//Allocate array size
someArray = new int[size];

Size could be the number of elements user wants to enter.

Having done that you could loop 'size' times, every time getting the value to be entered into the array.

Alternatively you could use ArrayList. You do not need to give it a size. You could just keep on adding to it.

Cheers.

kekkaishi 18 Junior Poster

Inside Bookshelf you could have a method that returns the 'shelf' array. If you merely want to print the elements of 'shelf' then you could override toString method in Bookshelf. That way when you need to print the elements, you would only need to call toString method after creating an object of Bookshelf.

Hope this helps.

kekkaishi 18 Junior Poster

It is best if you ask a networking question on the networking forum. But as per my limited networking knowledge I'd say it is possible. You'll need to connect the two using the CO cable and give them both IP addresses of the same subnet. Eg: 192.168.2.x (x different in either computers). After that you should be able to communicate between the two computers. To access webservice running on the Laptop you'd need to enter the IP address of the laptop on the browser address bar (that is desktop browser)

Again, its best to ask networking questions in the networking forum

kekkaishi 18 Junior Poster

Refer to this to get an idea.

Join workflow and content on workflow.content_id = content.id

Perform a normal 'select all' statement on the resulting table.

kekkaishi 18 Junior Poster

I am no expert and this might not be the answer you are looking for. But, I thought I'd share this knowledge.

To my knowledge, line ending convention may be different in different OS platforms. auto_detect_line_endings allows you to check which convention the data in the file is using when you use fgets function to read the lines. It might help you to check out these functions.

Cheers.

kekkaishi 18 Junior Poster

you have to specify the full file name inside include. If header.php is in the same directory as your other files then include 'header.php' . Otherwise, include 'your file path/header.php'

diafol commented: Just readdressing the neg rep. Bit harsh I thought. +9
kekkaishi 18 Junior Poster

a '#' would do. cheers.

kekkaishi 18 Junior Poster

Your program runs just like Vernon described. You are using Netbeans IDE and probably you think that it is not doing anything because the output window does not show anything. That is because your output is infinitely long. Try pressing the 'stop building' button on the left of the output window. You'll probably see the output (as much as the window could display). Your actual problem is as Vernon described.

kekkaishi 18 Junior Poster

Use a preg_split to split the string from '-' character. preg_split returns an array and at the first index would be 'id' and the second index would hold the 'quantity'

kekkaishi 18 Junior Poster

From your explanations I understood that you have 3 ArrayLists (let's say l1, l2 and l3) inside an ArrayList (al). If this is the case, one way you could do is to use an enhanced for loop to loop through al. Now, you will get l1 during the first loop, l2 and then l3. Manipulate l1, l2 and l3 like you would a normal ArrayList. Here is an example:

ArrayList<Double> l1 = new ArrayList<Double>();
ArrayList<Double> l2 = new ArrayList<Double>();
ArrayList<ArrayList> al = new ArrayList<ArrayList>();
//add elements to l1 and l2. //add l1 and l2 to al. 
 
for(ArrayList d: al){//enhanced for loop.
//d = l1 the first time. d=l2 the second time
 for(int i=0; i<d.size(); i++){ //loop through l1 and l2 
  System.out.println(d.get(i)); //d.get(i) gives you the double values stored in l1,l2
 }
}

Hope this helps and good luck.

kekkaishi 18 Junior Poster

You would need to do it for each element. So, yes you need iterate through the list and keep on casting them.

Edit: Also you would need to be adding the current value to the previous value. I hope this makes sense.

kekkaishi 18 Junior Poster

Escape forward slash.

.. *)\[\/\]/s', '<div>\\1</div>', $string); Hope this would help you to carry on.

RoyalElite96 commented: Thnak you, that worked! +1
kekkaishi 18 Junior Poster

The string that you are trying to cast into an integer must be an integer.
Eg:

String value = "2";
int intFromValue = Integer.parseInt(value);

Hope this helps.

kekkaishi 18 Junior Poster

Have you tried date function? Some information on the functions you've tried with: getdate function returns an array and I do not think sql's date format would accept it. strftime function, to my knowledge, has compatibility issues and it requires you to set the locales. strtotime gives you a timestamp.

kekkaishi 18 Junior Poster

@RisTar: md5 is one way encryption (hashing). Decrypting it is close to impossible.

@Joel: How about storing the information in a session variable? In #3 you could check if the variable is set, and if it is, execute db query and reset it.

kekkaishi 18 Junior Poster

I am no expert in jQuery but I can suggest some changes that would enable you to achieve what you are trying.
1. change all your IDs into classes (although it would work with IDs, if you are following W3C standard you are not allowed to have more than one element with the same ID.)
2. move the a tags into the div so that it'd be structured

<div>
    <a  ..>show/hide</a>
    <div class="summary">..</div>
    <div class="enclosure">..</div>
   </div>

and remove the showHide() function from within a tag. (from the script because I am suggesting you to listen to .click function inside $(document).ready() function

3. check this. include it inside head after including jquery file.

<script type="text/javascript">
            $(document).ready(function(){
                $('a').click(function(){
                    $(this).parent().children(".enclosure").animate({"height": "toggle"}, { duration: 500 });
                     $(this).parent().children(".summary").toggle({"opacity":"0%"}, { duration: 200 });

            });
       });
</script>

Hope this helps.

kekkaishi 18 Junior Poster

Have a look at this. PHP network functions

kekkaishi 18 Junior Poster

The pages seem to be navigating to the right pages however the page does not appear i get
:Oops! This link appears to be broken.

without the above script active the page seems to load fine

Is this the entire code? If not, you need to define $uid.

header("location: goldaccount.php?id=$uid"); //$uid is uid stored in session I suppose...

Also, I wonder if the other pages are in the same directory as this page. If so, do you get an oopsy for 'myacount.php'?

kekkaishi 18 Junior Poster

line 11 and line 13: you are doing comparison so there should be double equal operators.

else if ($_SESSION['type']== 1){ //single = means you are assigning

Apart from that the code looks ok.

Hope this helps.

kekkaishi 18 Junior Poster

Maybe this will help you.
A long/long is long. long/int is long. double/int is double. double/long is double. long/double is double ... and so on.

Apply this to line 16 of your code.

Hope this helps.

kekkaishi 18 Junior Poster

I suggest you read this thoroughly. Search Engine Optimization (SEO)

kekkaishi 18 Junior Poster

Hey, I am no expert in regexp but quite recently I had the same problem with escaping a $ sign. Just like you I used a single backslash to escape it and when it did not work I experimented with double backslashes and it did work then. I do not know exactly why. I did try to find out why but I'm afraid I was unable to get a satisfactory answer. I did however got introduced to preg_quote function that adds a backslash to every special character. There seems to be some issues in the function but for me it has worked without an issue. Even the $ sign issue after being passed through the function seems to be working. I hope this answer is of some help to you. :Dhttp://my2.php.net/preg_quote

kekkaishi 18 Junior Poster

You should probably ask this in the JavaScript/DHTML/AJAX forum.

kekkaishi 18 Junior Poster

line 11, closing bracket is missing.

//mysqli_select_db($this->link, $this->db_database 
mysqli_select_db($this->link, $this->db_database);

line 19:
try changing it from

//$sql = "select * from '$table'";
//TO
$sql = "select * from $table"; //without single quotes. table name do not need to be enclosed with single quotes. 
//OR
$sql = "select * from {$table}";

hope this helps.

kekkaishi 18 Junior Poster

Knowing about JMenus might help you. Here is Sun's/Oracle's tutorial on how to use menus. http://download.oracle.com/javase/tutorial/uiswing/components/menu.html

Hope this helps.

kekkaishi 18 Junior Poster

cant u just use the default date class? or Calendar class? (or both together?)

kekkaishi 18 Junior Poster

could u post the error message?

kekkaishi 18 Junior Poster

btw, is $id a numeric value. if yes, then

$check_id = mysql_query("SELECT * FROM `members` WHERE `id` =".$id) or die(mysql_error()); //remove single quote

//OR
$check_id = mysql_query("SELECT * FROM `members` WHERE `id` ={$id}") or die(mysql_error());

could solve ur problem

kekkaishi 18 Junior Poster

also, here is a little something for ur reference. this script is working and use this as ur reference.

//activatePage.php
<?php

//mysql connections and all...

if(array_key_exists('id', $_GET)){
    $id = $_GET['id'];
    $acCode = $_GET['actCode'];
    
    $sql = mysql_query("SELECT * FROM members WHERE userId={$id}");
    
    if(mysql_num_rows($sql)==0){
        echo "user does not exist";
    }else{
        $row = mysql_fetch_array($sql);
        if($row['activated']==1){
            echo "already activated";
        }else{
            if($row['actCode']!= $acCode){
                echo "act code mismatch";
            }else{
                mysql_query("UPDATE members SET activated=1 WHERE userId={$id}");
                echo "activated";
            }
        }
    }

}else{
    ?>
<a href="?actCode=aabbccdd&id=1">Activate user1</a>
<a href="?actCode=bbcceefd&id=2">Activate user2</a>
<?php
}

?>

//here is the db table to go with the above
CREATE TABLE IF NOT EXISTS `members` (
  `id` int(1) NOT NULL AUTO_INCREMENT,
  `activated` int(1) NOT NULL DEFAULT '0',
  `actCode` varchar(250) NOT NULL,
  `userId` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

INSERT INTO `members` (`id`, `activated`, `actCode`, `userId`) VALUES
(1, 1, 'aabbccdd', 1),
(2, 1, 'bbcceefd', 2);
Tehim commented: Really helpful thanks :) +1
kekkaishi 18 Junior Poster

ok since uve echoed the gets, althoughit should work, just check ur database to see if there is data (an activation code) for that id. the id in the link that is. if there is, try changing ur line 25 to the suggested.

//$check_id = mysql_query("SELECT * FROM `members` WHERE `id` = '$id'") or die(mysql_error()); 
$check_id = mysql_query("SELECT * FROM `members` WHERE `id` = '".$id."'") or die(mysql_error());
kekkaishi 18 Junior Poster

u needa return the sorted array from the rotateRight function

public static int[] rotateRight(int[] array){

and at the end of the function

return array;

and in the main

list = rotateRight(list);

hope this helps

kekkaishi 18 Junior Poster

if i may add in, can't u just do this?

public static void main(String[] args){
        int sum=0;
        for(String s: args){
            sum += Integer.parseInt(s);
        }
        System.out.println("Sum: "+sum);
    }
kekkaishi 18 Junior Poster

first change the string to integer. that is

Scanner sc = new Scanner(System.in);
String st = sc.nextLine(); 
int x = Integer.parseInt(st);

//then goin to find the total of the sum of the individual digits. 
int total=0;

while(x>0){
  total += x%10;
  x = x/10;
}

its just simple maths. what happens here is, say x=123 and when x is divided by 10 the answer is gonna be 12 and 3 the reminder. so x%10 gives u the reminder. and then u r adding the reminder digits to the total and u r repeating it until the last digit.

hope this helps.

kekkaishi 18 Junior Poster

u know what im trying to say here right.
say

$x = "123asd";
$y = "123asd";
if($x == $y){
echo 1; //it should echo one right
}

due to the fact that ur code does not do so, we could conclude that they are not equal, couldnt we? so i'm sorry to ask again, but do compare the two actvtn codes side by side. (maybe the lengths are not the same. i had an issue like this once and it turned out that i had allowed 200 characters to be stored in the db and i was comparing a 250 character string with a 200 one. the longer string was exactly the same up until the 200th character. u see what i mean?)

kekkaishi 18 Junior Poster

ok.... do something for me (sorry im also tryin to figure out the prob)

do this

if($get_user_data['activationcode'] == $activationcode){
echo 1;
}

if it does not echo 1 could u paste the two codes.
echo $get_user_data;
and
echo $activationcode;

kekkaishi 18 Junior Poster

and yet the message is "Sorry that activation code seems to be invaid."?

kekkaishi 18 Junior Poster

echo the actvtn code within the block to check.. u know just in case.

//THIS SEEMS TO BE WHERE THE ERROR IS
$get_user_data = mysql_fetch_array($check_id);

echo $get_user_data['activationcode'];
echo $activationcode;

if($get_user_data['activationcode'] != $activationcode){
$final_report.="Sorry that activation code seems to be invaid.";
}else{
//THIS SEEMS TO BE WHERE THE ERROR IS^
kekkaishi 18 Junior Poster

if u want to convert string to int

String s = "2";

int x = Integer.parseInt(s);

but u could directly get the int value using nextInt

Scanner sc = new Scanner(System.in);
int x = sc.nextInt(); //edited to assign sc.nextInt() to int x

hope this helps.

kekkaishi 18 Junior Poster

Sorry but that does not work at all. I tried to do this before and all I got was empty space. The output was empty spaces.

karim.naggar is right. and the solution i provided does work. ive compiled and checked.

and try this. it'd be easier this way to check i suppose.

System.out.println("value at " +i+ "," + j + " is: " + a[i][j]);

//value at 2,3 is: F
kekkaishi 18 Junior Poster
System.out.print(a[i][j] + ' ');

change to

System.out.print(a[i][j] + " ");

and see.

kekkaishi 18 Junior Poster

select id from your table, order by id in descending order and give it a limit of 1.

kekkaishi 18 Junior Poster

I dont think the Db connection is the issue as other pages used the same connection and the have to issues. just this new page

so y dont u give the necessary tables a check out :)

kekkaishi 18 Junior Poster

I have tested the query in phpmyadmin and it pulls back the expected results. so it not working in the code is beyond me

If the connection is OK then try this.
u said its workin on the test server, so can u recheck the database in ur server and confirm if the tables and column names are exactly the same as ur db in the test server. remember, mysql is case sensitive.

kekkaishi 18 Junior Poster

just thought id also add in a bit.
remember that mysql fetch array returns only one row each time the query runs, first run returns first row of the mysql resource, the second run second row and so on and returns a false if there is no more... so the cleanest way to go about is to use a while loop as u did IF u r fetching from DB. As network18 said, the best way is to practice and 'explore' be it foreach loop or anything else :)

rouse commented: Kekkaishi as good energy and insight +2
kekkaishi 18 Junior Poster

jomanlk is correct. Sorry i couldnt focus on ur full qstn and I dunno any open source forum that allows user migration.