nav33n 472 Purple hazed! Team Colleague Featured Poster

oh..hmm ! If the user has uploaded the images, there will be an entry for every uploaded images in the database. (ie., the path of the 5 images.) Get all the records for that particular user and then delete them. for example, if the user with userid 3 has uploaded 5 images. There will be 5 entries in the table image_upload(which contains the path of the images).

$q="select * from image_upload where userid='5'";
$result=mysql_query($q); //the query returns 5 records 
while($row=mysql_fetch_array($result)){
  $imagepath=$row['path']; //$imagepath will have the path of the uploaded image. 
unlink($imagepath);//delete the file
//then delete the directory. I hope you are saving the images into the directory which is named after userid.
}
rmdir(5); //remove the directory with userid 5. 
?>
Sulley's Boo commented: *grabs nav33n by the ear* i (((DONNOT))) wear glasses anymore! +4
nav33n 472 Purple hazed! Team Colleague Featured Poster

huh ? When you execute your query, send the header back to the same page. It will work.

<?php
if(isset($_POST['submit'])) {//if delete button is pressed
$id=$_POST['id'];
$q="delete from table where id = '$id'";
mysql_query($q);
header("location: samepage.php");
}
<html>
<body>
<form method="post" action="samepage.php">
<!-- list the images and have a delete button in this form -->
</form>
</body>
</html>

Thats how I do and it always work for me. What do you mean by we cant use 2 headers in one input button ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

What is the problem ? When the user uploads an image, I m sure you will be saving the path of the image. When the user clicks on delete, get the id of that image and unlink the file. What exactly is your problem ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb Jeff! Thats an interesting intro ! Umm.. Installing Borland C ? Read the first readme of this forum.
Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

Someone got bored and 'drilled' holes (small, medium and big) on a piece of paper using a pen ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome !

nav33n 472 Purple hazed! Team Colleague Featured Poster

If memory serves me, that would not be a correct variable for mysql_num_rows.

Nope. $result=mysql_query($query) or die(mysql_error()); will assign the resultset to $result if the query executes without any error. If it encounters any error, the script print the die statement and exit.
When you call the function, instead of echoing everything inside the function, assign it to a variable and return that variable. for example,

function print($res){
 $output.="<table>";
$output.="<tr><td>Radiobutton</td></tr>";
......
return $output;
}

Then you can print it in the form. Also, test if the function is serving its purpose. Have a print statement to check the flow of the function.
}

nav33n 472 Purple hazed! Team Colleague Featured Poster

what' s respective form?

I think your's is a hardware problem. Check this forum.

nav33n 472 Purple hazed! Team Colleague Featured Poster

uhmm..welcome to Daniweb djcolej.. But you have to post your question in respective forum !

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

to loop ? Which loop ? Put the whole thing in whatever loop you want.

<?php
for($i=0;$i<10;$i++){
if ($daybooked == 1){
print sprintf('<td align="center"
bgcolor="%s">&nbsp;%d&nbsp;</td>',$opts['today_color'],$day);
}
else{
print sprintf('<td align="center"><font color="#999999">&nbsp;%d&nbsp;</font></td>',$day);
}
} //this will loop 10 times.
....
?>

If thats not what you looking for, then please explain in detail.

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

Very simple. While redirecting, redirect with a value in the query string. And if that variable is set, display the error message.
eg.

<?php
//incorrect login
header("location: login.php?err=1");
?>

And in login.php,

<?php
if(isset($_GET['err'])){
$errormsg="Incorrect login..";
}
//display $errormsg whereever you want, to indicate an invalid login. 
// rest of the code
?>

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

I think though it is bad programming practice to pass an integer this way, but if it were ment to be parsed as a string, it's better to type cast the data type to clear up any confusion for other programmers

Exactly ! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Instead of

$f = fopen($main_url,"r");
$inputStream = fread($f,65535);
fclose($f);

use, $inputStream = implode("",file($main_url)); The problem with your code was, it was reading only a part of the file.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb bihartourism ! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Try taking the single quotes away from the zero in this line:

if($english_level!='0') change to if($english_level!= 0)

:)

No. That ain't the reason for this error. !='0' works just the same like !=0, as in the following example.

<?php
$english_level=0;
if($english_level=='0'){
$query_array[]= "reg_english_level.english_level1 = '". $english_level . "' OR reg_english_level.english_level2 = '". $english_level . "' OR reg_english_level.english_level3 = '". $english_level . "'";
}
print_r($query_array);
?>

The problem is usually caused when you have already declared $query_array as a string by assigning some value and then use it as an array. For example,

<?php
$x="Test !";
$x[]="is this an array?";
print_r($x); //this will generate the same error as above!
?>

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Great! Congrats..

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hi Nurul ! 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 Aikell :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb Darryl

nav33n 472 Purple hazed! Team Colleague Featured Poster

I have no idea what that is.

nav33n 472 Purple hazed! Team Colleague Featured Poster

If you have any <?php ?> tags in your script, you have to save it with the extension .php . If you want to save it with .html extension, then you need to modify your htaccess file. You can make use of only 1 page/script to do everything.
-- list the comments here --
...
....
Have the fields for name, comments etc, with a submit button. When the form is submitted, get the values and insert it to the table ! A small example.

<?php
if(isset($_POST['submit'])){
  $comment=$_POST['comment'];
  $q="insert into comments_table (comment) values ('$comment')";
mysql_query($q);
} 
$q="select comments from comments_table";
 $result=mysql_query($q);
while($row=mysql_fetch_array($result)){
 //list the comments
 echo $row['comments']."<br />";
}
?>
<html>
<body>
<form method="Post" action="comments.php">
<textarea name="comments" rows=30 cols=10></textarea>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

This is just an example. And comments should be above the 'comment box'..

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

print the values of team before foreach.
print_r($_POST); If its an array, it ll print the whole array. else it ll print only 1 value.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hmm.. I don't see any missing ; in the above scripts. The only thing thats wrong is,

"Welcome $msg;"

It should have been <?php echo "Welcome $msg"; ?> . But that has nothing to do with process.php. Check for missing ; in process.php . (cuz I dont see any!)

nav33n 472 Purple hazed! Team Colleague Featured Poster

As I said, foreach will give this error if you aren't giving an array as input. And there are so many queries. Check out what's on line 25. That query isn't working.

nav33n 472 Purple hazed! Team Colleague Featured Poster

1st error means, the value passed to foreach is not an array. Check if you are passing array to foreach loop.
2nd error means, the query is returning empty result.

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Hi conklin ! Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome Rockpebblar!

nav33n 472 Purple hazed! Team Colleague Featured Poster

What error exactly ?
Dude, list all the teams. Let the user select the checkboxes and then click on delete. Go back to page 1 and check the example I have given. Do the same, but use delete query. And instead of passing the team name as value, pass the id.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Isnt there an easir way to delete a checkbox??

Deleting the checkbox which is checked or deleting the checkbox which isn't checked ? I am not sure about the second case, but deleting records when checked works just like how you do while inserting.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Are you sure it doesn't work ? Its works on my computer though. What is the error you are getting this time ?
Edit: Btw, in voting page, you need to request msg.
ie., $msg=$_GET;

nav33n 472 Purple hazed! Team Colleague Featured Poster

username is root by default.

mysql_connect("localhost","root","")

Grr! I got beaten by a few seconds again ! :P

Sulley's Boo commented: mote, LOL, jaldi bhaaga karr :P +4
nav33n 472 Purple hazed! Team Colleague Featured Poster

The default user for the database is root. Try giving ("localhost","root",""). That should work.

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Good !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Do you want alternate colors for columns ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

instead, initialise $nr0 to 0 outside while loop. initialise $nr0 at the end of while loop.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Can you post your code ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hi ! missing semicolon in these lines.

$msg=$user << here
         header ("Location:vote_page.php?$msg=$msg");
		break;
	case "Jim":
         $msg=$user  << here

Cheers,
Naveen

Edit: Btw, this header ("Location:vote_page.php?$msg=$msg") should be header ("Location:vote_page.php?msg=$msg") , if you want to use $msg value in vote_page.php !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hi Sid Prasad ! Welcome to Daniweb :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

hmm! okay !

scorpionz commented: Naveen is a Great Guy ... With Great Knowledge +2
nav33n 472 Purple hazed! Team Colleague Featured Poster

car
van
larva

Archives

nav33n 472 Purple hazed! Team Colleague Featured Poster

bullet

nav33n 472 Purple hazed! Team Colleague Featured Poster

-700

nav33n 472 Purple hazed! Team Colleague Featured Poster

If your problem is fixed, why not mark this thread as solved ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Great ! congrats !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hey Ryan! Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb Jerry :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

hmm.. this looks totally messed up !