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

I don't think your code is wrong. It works here and it should work. Try these alternatives, just in case.

echo "<div style='background-image: url(boxshadow2small.jpg);text-align:center; height: {$someVariable}px; width: 225px; '></div>"; 
//OR
echo "<div style='background-image: url(boxshadow2small.jpg);border:1px solid #333; text-align:center; height: ".$someVariable."px; width: 225px; '></div>";
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

Check curl. You could use it to check if the url is online.

Edit: @ardav: didn't see your reply. sorry :)

kekkaishi 18 Junior Poster

Please do not hijack old threads. But as as answer to your problem, do not use + use '.' (dot). For example,

echo "<script>alert('text".$varName."')</script>" 
//OR
echo "<script>alert('text {$varName} ')</script>"

If you have further doubts please start a new thread.

kekkaishi 18 Junior Poster

Well if that was the only problem I guess you do not need to share your table :) What you need to know is that the associative name should be the name of a field in the table and a field that you are selecting in the select query. ($row). If you still want to share the table then yes, export the table. That is, browse to the table and go to the export link at the top menu.

kekkaishi 18 Junior Poster

Could you share your database table with us for reference. From the look of it I think the problem is that you are using $row when there is no such field in the database table. Perhaps you should change $row after checking your table carefully. But, it would be very easy if you could share your table with us.

PS: One advice on database naming convention: You should avoid having names like 'serial no' where you are required to use quotes. Instead of the space use underscore.

kekkaishi 18 Junior Poster

From what I understand from your description, you are displaying all the information in a form in input fields or of such. Why don't you add a submit button (to save the data) to the bottom of the form (above the "next" link). Now what you need to understand is that this would act as a normal form, just like the one you use to insert data into database. I will include an example below.

//your navigation (pagination) code with necessary mysql queries
<form method="post" action="update.php">
<input type='text' name='name' value='{$row['name']}' />
//all other fields
<input type="submit" value="Save" />
</form>
//navigation (prev, next and all)

This form is posting information to update.php. It would look similar to the add.php page. Only difference would be that, as I said earlier, instead of the insert query, use an update query. When the query is completed you would need to redirect the browser to the previous page you were in.
One way to achieve this would be to use a hidden field in the form to send the current page to update.php and use this link to redirect the page. (Skimming through your code, I see that the your next page link is like this. <a href="$s?page=$p"> where $p is $page+1. So your current page would be $page...)

Another approach to achieve your goal is to use Ajax to post information to update.php. This is to eliminate the redirecting process. (I recommend using Ajax if you are familiar with it).

Hope …

kekkaishi 18 Junior Poster

"Okay, I've build the script to display all of the entries (one per page) in textboxes. "
If you already have done it then you need to have a separate file called, maybe, update.php. This file would be similar to your add.php, but instead of the insert query, you will need an update query. Post information to update.php file when you click the submit button (that is your next button). Your update query would be similar to the following line of code.

mysql_query("update addresses SET id={$id}, name='{$name}'");

Upon successfully updating, you could redirect the browser to the "next" records page (Referring to your remark (quoted above), I am assuming you are already able to view the separate records by pressing a "next" button)

Hope this made sense. :)

kekkaishi 18 Junior Poster

Hi,

There is an extra parenthesis in the following line.

$row = mysql_fetch_array($result)); //the last parenthesis is not required
//it should be
$row = mysql_fetch_array($result);

Also, wrap your code in CODE tags to make your codes easily readable.

Hope this helps.

kekkaishi 18 Junior Poster

Hi, .click() is for mouse click in jQuery. When you are binding it it's called like this. .bind('click') You might also like to check jQuery's toggle() function.

Hope this was of help.

kekkaishi 18 Junior Poster

Hi,

Your problem maybe because there is no space between function and the function name in the following line.

functionvalidateWord(.. //this must be
function validateWord(...

Also, do use CODE tags to wrap your code. :)

Hope this solved the issue.

kekkaishi 18 Junior Poster

Yunie,
You might benefit from following a tutorial on how to update database records. This one here is a good tutorial. I believe that going through this tutorial would give you the basic idea on how to achieve your goal. If you got stuck en route, you could always ask for the forum's help by sharing your issue (and code).

Regards.

kekkaishi 18 Junior Poster

Hi,
Check KeyListener interface. A tutorial could be found here

Hope this helps.

kekkaishi 18 Junior Poster

eduardc,
Your code looks to be OK. As Karthik suggested, try executing the line (select * from Products) in phpmyadmin (or your sql dbms).

Also, I suggest using mysql_error() in your codes to identify the exact error the database is returning. That is,

mysql_select_db("eduardli_company", $con) or die(mysql_error());


mysql_query ("INSERT INTO Products (Description, Price, Quantity) 
VALUES ('$description', '$price', '$quantity')") or die(mysql_error());

$q="select * from Products";
$result = mysql_query($q,$con) or die(mysql_error());

Regards.

karthik_ppts commented: useful post +3
kekkaishi 18 Junior Poster

Hi,
"Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given"
This could mean that $result (the first parameter passed) is boolean. Just to check this, could you echo $result right before you start the while loop?

Also, I suppose you have made changes to your original code in insert.php. If you could perhaps post your current code...

kekkaishi 18 Junior Poster

You could look for any number of characters ( [a-z0-9]* ) between '' in a preg_match_all. If the string within the brackets are always 'str' and then a number, you could also search for str[1-9] in a preg_match_all.

You could also use explode if you first replace one of the square brackets with nothing and then use the other bracket to explode the resulting string.

Hope you understood.

kekkaishi 18 Junior Poster

You might benefit from checking JavaScript Date object.

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

If you want 8 numbers, your loop must continue while count is less than 8. In your code it is greater than 8. If you want to print UP TO 8, then you do not necessarily need a count. You could just program it to loop until value of b != 8 . In other worde, while b is not equal to 8.

Hope this helps.

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

Check array of objects.

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

Oh I mistakenly disregarded <ArrayList> part. If that is the case, do you want to get the maximum in terms of the size of the ArrayList?

kekkaishi 18 Junior Poster

Check Collections.max Sample usage:

ArrayList<Integer> al = new ArrayList<Integer>();
//add values
Object o = Collections.max(al);
System.out.print("Max: " + o );

Hope this helps

kekkaishi 18 Junior Poster

echo it inside the while loop. Now that it is outside, the $name variable will hold the last name.

Hope you understood and hope this was of help.

kekkaishi 18 Junior Poster

I just realised a terrible mistake in my explanation. To concatenate use '.' (dot without quotes) not '+'. I hope the earlier explanation did not confuse you since you already have concatenated a few strings. Cheers.

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

Make sure you properly mark the closing of a statement using semi-colons. In your code, for instance, the following statement needs closing.

$msgText="TISSUE CULTURE PARAMETER EXCEED!!!"; //add semi colon if this is the end of the statement.

If the following lines are a part of this statement, then concatenate the strings using '+' (with out single quotes). While doing so, make sure you enclose the string parts with double quotes.

It is difficult to read your code so please wrap your codes in CODE tags.

Hope this helps.

kekkaishi 18 Junior Poster
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

Check array_count_values function.

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

I maybe wrong but the problem sounds like as if the questioner wants to shuffle the array. If that is the case, Collections.shuffle(Arrays.asList(s)) , I reckon, could be easier. Not that the above code won't work. Just thought I'd add this in in case this may be of any help. Cheers.

kekkaishi 18 Junior Poster

Check MouseListener interface. Counting the number of clicks is one way to go about it.

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

Its preferable for you to try on your own first and share your difficulties. However, i will give you an example, a different one, but I hope it is of help to you.

$s = "this is a string and this a currency - $34";
$qs = preg_quote($s); //to avoid special chars like - and $
$ptn = "/".$qs."$(?=([0-9]*))/"; //pattern to find number followed by "this is a string and this a currency - $"
preg_match($ptn, $s, $r); //$r is results array
echo $r[0]; //echos "this is a string and this a currency - $" without "
echo $r[1]; //echos 34

Good luck.

kekkaishi 18 Junior Poster

wow :D Assuming that html would remain unchanged, these are the strings I'd focus on.

//to get you save
<h4>you save</h4>
    <span ><span class="currency">$</span>32

//discount
<h4>discount</h4>
    <span >52
//orig. price. 
<h4>original price</h4>
    <span ><span class="currency">$</span>62

Change these to patterns and remember that all the values (32, 52, 62) are groups of numerics.

Good luck.