nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb Rinje!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Okay! notice is not an error. You can disable the notice by changing few lines in your php.ini file. Search for error_reporting and replace it with this. error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT line from your php.ini file to disable notices. Anyway, try using if(isset($errors)){ instead of if($errors){ .

nav33n 472 Purple hazed! Team Colleague Featured Poster

What happens is, the query ends when it encounters ' in hilgard's. Escape it with \.
Eg.

'SELECT *
FROM `table3`
WHERE name LIKE '%hilgard\'s%'

To escape the single quote, you can use addslashes (or mysql_real_escape_string if your database is mysql). Or
You can use double quotes.

"SELECT *
FROM `table3`
WHERE name LIKE '%hilgard's%"

:) Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

Enter Xray Emitted Room To Enjoy Disappointment.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Look for onchange event in the select tag ? Well, we could help if you post your code.

nav33n 472 Purple hazed! Team Colleague Featured Poster

nap
profession
fear

Headline

nav33n 472 Purple hazed! Team Colleague Featured Poster

-645

nav33n 472 Purple hazed! Team Colleague Featured Poster

There is nothing on line 51. Can you post your latest code (with CODE tags) ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

nap
profession
fear

Archive

nav33n 472 Purple hazed! Team Colleague Featured Poster

-642

nav33n 472 Purple hazed! Team Colleague Featured Poster

Exit here!

nav33n 472 Purple hazed! Team Colleague Featured Poster

As ShawnCplus has suggested, learn the basics of php programming. The basic working of Login and logout script is simple. A login script takes username and password as input, check the table if the username with that password exists. If yes, then add the username to the session and redirect him to another page. This whole operation is 'login' operation. Logout script is very simple. Just destroy the set session variable and redirect the user back to login page.
Best of luck!

nav33n 472 Purple hazed! Team Colleague Featured Poster
$i=0;
while($row=mysql_fetch_array($result)){
$photo=$row['photo'];
if($i==0) { //initially, i is 0, so it inserts a new tr. 
   echo "<tr>";
}
$i++;
echo "<td>$photo</td>"; //add the photo
if($i==4){ //adds 4 photos, once its done, make i as 0 to insert a new <tr>, end the existing <tr>.
  $i=0; 
  echo "</tr>"; 
}
}

Cheers,
Naveen

Morty222 commented: Awesome!!! +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

Well, You mean, based on one dropdown's value, the other dropdown should be populated ? You can use ajax to do this. If you don't have enough time to learn ajax, then the simplest solution would be to submit the page when 'onchange' event occurs in the first dropdown.

<select name="dropdown1" onchange="javascript: dropdown();">
<option value=1>value1</option>
<option value=2>value2</option>
....
</select>

In function dropdown(), get the selected value, assign it to a hidden variable in the form and submit the page.

function dropdown(){
 var value=document.formname.dropdown1.value;
document.formname.hidden.value=value;
document.formname.submit();
}

When the form is submitted, get the hidden value, query the table based on the hidden value condition and list it in dropdown box 2.

$selectedvalue=$_POST['hidden'];
$query="select * from models where car_category='$selectedvalue'";

get the records and populate 2nd dropdown.

Hope it helps..

nav33n 472 Purple hazed! Team Colleague Featured Poster

Yes, Everybody Loves Life.

nav33n 472 Purple hazed! Team Colleague Featured Poster

dent
stunt
tent

Programming

nav33n 472 Purple hazed! Team Colleague Featured Poster

Fourth house on the right side of the road is the place where great Nepolean lived.

nav33n 472 Purple hazed! Team Colleague Featured Poster

HP

Windows or Linux ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are welcome :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

-640

nav33n 472 Purple hazed! Team Colleague Featured Poster

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Model No='AP22', Product Price='39.0000', Serial No='220801', Ref='TLS00700', S' at line 1

That's what the error said. It said there is an extra ' near Model No. But anyway, I dont see anything wrong with your query. Execute it in phpmyadmin/mysql and see if it returns any value. What is the error you are getting now ?

nav33n 472 Purple hazed! Team Colleague Featured Poster
$query = "UPDATE $table SET '$io='$io2', $pp='$pp2', $sn='$sn2', $re='$re2', $sd='$sd2', $ed='$ed2', $dp='$dp2', $rn='$rn2' WHERE ID='$id'";

Look near SET '$io. An extra ' . :) Remove it!

nav33n 472 Purple hazed! Team Colleague Featured Poster

-635

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 Jen !

nav33n 472 Purple hazed! Team Colleague Featured Poster

The second script lists all the teams in the table. Select the ones which you want to delete and click on submit! It ll delete all those teams from the table. I don't know how you can edit and what you mean by edit !

nav33n 472 Purple hazed! Team Colleague Featured Poster

-631

nav33n 472 Purple hazed! Team Colleague Featured Poster

pat
put
pet

Psychologist

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are welcome! :) Its easy. Just keep trying.. You ll get it. Best of luck!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Anyway, here is a simple example to insert teams to the table, list selected teams and delete the teams from the table.

<?php //insert to the table
if(isset($_POST['submit'])){
	mysql_connect("localhost","root");
	mysql_select_db("test");
	foreach($_POST['country'] as $value){
		$query="insert into country (team) values ('$value')";
		mysql_query($query);
	}
}
?>
<html>
<body>
<form method="post" action="checkbox.php">
<input type="checkbox" name="country[]" value="AG">Argentina <br />
<input type="checkbox" name="country[]" value="GE">Germany <br />
<input type="checkbox" name="country[]" value="BR">Brazil <br />
<input type="checkbox" name="country[]" value="SW">Sweden <br />
<input type="checkbox" name="country[]" value="EN">England <br />
<input type="checkbox" name="country[]" value="SC">Some country <br />
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
<?php //list inserted teams select teams you want to delete and click submit and it will delete. 
	mysql_connect("localhost","root");
	mysql_select_db("test");
	
	if(isset($_POST['submit'])) {
		foreach($_POST['country'] as $value) {
			$query="delete from country where team='$value'";
			mysql_query($query);
		}
	}
	
	$query="select * from country";
	$result=mysql_query($query);
	echo "<form method=\"post\" action=\"editcheckbox.php\">";
	while($row=mysql_fetch_array($result)) {
		$country=$row['team'];
		echo "<input type=\"checkbox\" name=\"country[]\" value='$country'>$country<br />";
	}
	echo "<input type='submit' name='submit' value='submit'>";
	echo "</form>";
?>

I hope that helps :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

hmm.. okay ! Try this.

echo '<META HTTP-EQUIV="Refresh"
      CONTENT="5; URL=redirect.php">';

This will redirect to redirect.php after 5 seconds.

nav33n 472 Purple hazed! Team Colleague Featured Poster

broad
rod
bar

Signature

nav33n 472 Purple hazed! Team Colleague Featured Poster

lol.. PS3..

Age of Empires II or Rise of nations ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

umm.. The code that I have given you is just an example how you can do it. Change it as per your needs. List all the questions with a textbox(with different names).You may also need to save the question_ids to store it in the answer table. When the submit button is pressed, get all the answers and the question_id's (for that particular user) and save it in the table.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Create a table with all the questions. You need another table to store the answers. question_id would be the foreign key in answers table. If you are doing this question-answer script for multiple users, you need another table users, whose 'user_id' would be a foreign key for table answers.
So, questions table will have
1. question_id, primary key
2. question
Answer table will have
1. answer_id, primary key
2. question_id, foreign key from questions table
3. user_id, foreign key from users table
Users table
1. user_id , primary key
and the user details

nav33n 472 Purple hazed! Team Colleague Featured Poster

Error 1.

for(int $i = 0; $i < $countries.sizeof.; i++){

My apologies. I said there is no sizeof. But there is sizeof. But this isn't the way to use it. Its sizeof($variable);
Error 2.

$sql = mysql_query("INSERT INTO countries (id, countries,)
VALUES('$id', '$countries', )") or die (mysql_error());

Wrong query. What's the "," doing ?
Error 3. You are using method=POST in the form . But you are searching in $_GET ?

if(array_key_exists('edit', $_GET)){
nav33n 472 Purple hazed! Team Colleague Featured Poster

Simple. Fetch all the questions from the table and print it as follows.

$query="Select question from question_table";
$result=mysql_query($query);
$i=1;
echo "<form method=\"post\" action=\"questionpaper.php\">";
while($row=mysql_fetch_array($result)){
  $question=$row['question'];
  echo $i."." $question."<br />"; // to print 1. What is your name ?
  echo "<input type=\"text\" name=\"answer$i\" /><br />"; \\ to have unique textboxes for different questions
$i++;
}
echo "<input type=\"hidden\" name=\"count\" value=\"$i\">"; \\ to count the number of questions
echo "<input type=\"submit\" name=\"submit\" value=\"submit\">";
?>

When the user clicks on submit, get the value of i, loop through the answers.

$i=$_REQUEST['count'];
for($j=1;$j<$i;$j++){
   $answertextbox="answer".$j;
  $answer=$_POST[$answertextbox];
//insert $answer to the table
} //by the end of for loop, all the answers will be in the table.
?>

cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

Difference in what ? hours ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Yep. There is tinymce editor which has all the options you are looking for ! Have a look. Its easy to use.

nav33n 472 Purple hazed! Team Colleague Featured Poster

onload wouldn't work. Print what's in $loginFoundUser. Is location.href=MM_redirectLoginSuccess working ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Simple. Pass the id of the news. For eg.

$query="select id from news";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
$id=$row['id'];
echo <a href=\"news.php?id=$id\">Part of the news</a>";
}
//this will print all the ids from the table.
//when the user clicks on the hyperlink, in news.php, 
$id=$_GET['id'];
$query="select news from news where id='$id'";
$result=msql_query($query);
$row=mysql_fetch_array($result); //id returns only 1 row with the news
$news=$row['news'];
print $news;
?>

That should give you a basic idea.

nav33n 472 Purple hazed! Team Colleague Featured Poster

-629

nav33n 472 Purple hazed! Team Colleague Featured Poster

My dog is very ferocious !

nav33n 472 Purple hazed! Team Colleague Featured Poster

rabbit


Angelina jolie or Jessica Alba ;)

nav33n 472 Purple hazed! Team Colleague Featured Poster

-627

nav33n 472 Purple hazed! Team Colleague Featured Poster

mailer

nav33n 472 Purple hazed! Team Colleague Featured Poster

L for Lion!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Gel

Vegetarian or non-vegetarian ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

walk
man
lan

Profession