nav33n 472 Purple hazed! Team Colleague Featured Poster

You can use array_multisort. More on array_multisort here .

nav33n 472 Purple hazed! Team Colleague Featured Poster

How do you want to split it ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

When the form is submitted, get the value of the select box. $selectboxvalue = $_POST;
Then update the table depending upon the value of $selectboxvalue !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Explode the value on +. Then add the required fields.
Eg.

$value1 = $_POST['field1'];
//consider $value1 has 100+xyz
$value2 = $_POST['field2'];
//$value2 = 300+abc
$newval1 = explode("+",$value1);
$newval2 = explode("+",$value2);
//$newval1 and $newval2 will be an array where $newval1[0] will have 100, $newval1[1] will have xyz and $newval2[0] will have 300, $newval2[1] will have the value abc. 
$total = $newval1[0] + $newval2[0];
echo $total; // 100+300 = 400
?>

Hope that helps :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome Babs!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb xa2009 !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Use <?php instead of <? (very bad habit).

Matti Ressler
Suomedia

I don't think thats the problem. Because, If short tags are disabled on his computer, it will just print the 'code' as text.

nav33n 472 Purple hazed! Team Colleague Featured Poster

-854

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb Johnny :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hi Sodium1! Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

-848

nav33n 472 Purple hazed! Team Colleague Featured Poster

Thanks nav33n.. I think it's working now.. I change the the function query not to return anything since it's a delete query. did that caused the error? "Warning:mysql_num_rows(): supplied argument is not a valid mysql result resource in .... line 42

Ah! You are right ! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

-846

nav33n 472 Purple hazed! Team Colleague Featured Poster

When the user clicks apply for the first time, get his username (and password ?) from the table. Add it to the session variable. Then check if the session variable exists. If it does, then don't ask him for username and password. If session variable doesn't exist, ask him for username and password and add it to the session.

jino commented: Simple and comprehend +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hmm.. Well, how bout this. When you click on a button, call a javascript function, which opens a new window, window.reload the parent window ?
Maybe someone has an answer for this.

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

Dude, you have to be specific on the errors you get. What do you mean by 'error on mysql_num_row' ? What is the error ?

Try this.

unction exequery($query){
if (!$this->conn) {
die('Could not connect: ' . mysql_error());
}
echo $query;
exit;
$results = mysql_query($query) or die(mysql_error());
//mysql_close($this->conn);
return $results;
}

Check if its printing the query. Also in the class, check if database connection is established.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Well, AFAIK, If you want the parent window to be refreshed, you can't do it using php. That can only be done using javascript.
You can declare a php variable in javascript. But you can't use it in javascript. But this works.

<script type='text/javascript'>
function test() {
<?php 
$x=1000;
?>
....
}
</script>
nav33n 472 Purple hazed! Team Colleague Featured Poster

Return some value on execution of the delete query. Check if its returning the right value.

nav33n 472 Purple hazed! Team Colleague Featured Poster

I dont see an "action" in the html form ! When is your php script getting called ? And why do you have different forms for different form variables ?!?

nav33n 472 Purple hazed! Team Colleague Featured Poster

but its not doing it

Which part of the script isn't working ? Executing the delete query or establishing the connection ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

-844

nav33n 472 Purple hazed! Team Colleague Featured Poster

Yep. Javascript is the only way where you can have a popup. Well, check this thread. http://www.daniweb.com/forums/thread114307.html The OP wanted something same.

nav33n 472 Purple hazed! Team Colleague Featured Poster

textbox inside <?php tags ? Yep, you have to echo it. But this way. echo "<input type=\"text\" name=\"name\" value=\"$firstname\">";

nav33n 472 Purple hazed! Team Colleague Featured Poster

-838

nav33n 472 Purple hazed! Team Colleague Featured Poster

int
aqua
ant


Discussion

nav33n 472 Purple hazed! Team Colleague Featured Poster

http://www.w3schools.com/php/php_mysql_select.asp Check this. Instead of echoing $row and $row in the example, assign it to a variable and use it as the 'value' of the textbox. <input type="text" name="firstname" value="<?php echo $firstname; ?>">

karthik_ppts commented: helpful post +5
nav33n 472 Purple hazed! Team Colleague Featured Poster

In the php script, where is $username coming from ? Have a hidden variable in the upload form and pass the username. Check if that user already have a folder. If yes, copy the image, else, create a folder and copy it. What error are you getting ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

General idea is... I click a button, goes through php code, opens a new page and then refresh orginal page.

You mean the 'new page' is a popup and 'original page' is the parent window ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

count is not a reserved word AFAIK. hmmm..

nav33n 472 Purple hazed! Team Colleague Featured Poster

What do you mean 'is not working' ? What error are you getting ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

-834

nav33n 472 Purple hazed! Team Colleague Featured Poster

Umm.. Update or insert ? Print out your query to see if all the required values are passed. Print_r($checkbox_name) will print the values of those checkbox which were selected.

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) You are welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Can you post your code ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Use a variable with another name.. not $weekday ! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Huh! thats strange. Before foreach loop, assign null to $weekday and then try again !

Edit: Or, use another variablename $weekday1. Check this example.

<?php
echo $id;
?>
<html>
<body>
<form method="post" action='test.php'>
<input type=text name=id[]><br>
<input type=submit name=submit value=submit>
</form>
</body>
</html>

Form variables are global by default. (I think).

nav33n 472 Purple hazed! Team Colleague Featured Poster

Thats because, while inserting, you insert this way. insert into table (col1) values ('value'); But since your value already has a ', its considered as the end of value, throwing an error. If you are using php, you can escape ' or " by using mysql_real_escape_string or addslashes.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Basically, its like this. You have for example 3 pages. homepage.php, courses.php and students.php.
homepage.php is a login script, where the user can login. You should check if the user is a valid user. You shouldn't let the user to go to page2 or page3 (ie., courses.php and students.php) if the user hasn't logged in. For this, you can use sessions. Once the user has logged in, add his username to the session. ($_SESSION=$username; ). Then on page2 and page3, check if $_SESSION is not null. If its null, then he isn't a valid user, so redirect him back to homepage.php. If he's a valid user, show him page2. That can be done as shown by petr.pavel in post2.

nav33n 472 Purple hazed! Team Colleague Featured Poster

-830