nav33n 472 Purple hazed! Team Colleague Featured Poster

Yep. You can do it that way. But the user can change eid to whatever value he wants ! My code will check if the eid is valid or not.

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php
$reg = '/<div class=\"value\">(.*)<\/div>/s';
$data='<td width="55%"><div class="value">
                                            &pound;6.99 <font size="3"> </font></div>
										    
                                        </td>';
preg_match($reg,$data,$matches);
print $matches[1];
                                        
?>

That works.
Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

Okay !

<?php //page1.php
//connection
//select db
session_start();
$valid_eid=array();
$query="select eid,description from table";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
	$eid=$row['eid'];
	$description=$row['description'];
	$valid_eid[]=$eid;
	echo "<a href=\"template.php?eid=$eid\">".$description."</a>"; //will display all the links
}
$_SESSION['eid_array']=$valid_eid;
?>
<?php //template.php
session_start();
//connection
//select db
$eid=mysql_real_escape_string($_REQUEST['eid']);
$valid_eid=$_SESSION['eid_array'];
if(in_array($eid,$valid_eid)){
	$query="select * from table where eid='$eid'";
	//fetch details and print
} else {
	echo "Eid is not valid !";
	exit; //or redirect the user to an error page. 
}
?>

Hope that helps !

nav33n 472 Purple hazed! Team Colleague Featured Poster

No. you dont need a form if you are passing the eid in the url. While displaying the links, just concat eid at the end of the links and in template.php, check if that eid is in the session array of eids. If eid is in the array, fetch relevant details for that eid from the table and display it !

nav33n 472 Purple hazed! Team Colleague Featured Poster

You can have an array of all the eids and put it in a session. Then, everytime a user clicks on a link, check whether the eid is in the array of eids. If its present, then display respective page. Else, send the user to "you know where" ! Also, use mysql_real_escape_string or addslashes.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Daniweb should be bookmarked by one and all :)
Welcome Auch.

:P I thought he was going to bookmark the user!

nav33n 472 Purple hazed! Team Colleague Featured Poster

I dont think so. hmmm.. There is a weird way of doing it (which I wouldn't prefer). I hope you are looping to print the urls. What you can do is, use onclick event, set $_SESSION[$row[0]] value to a hidden variable and submit the form. :S

<html>
<body>
<?php
//connection
//select db
$query="select eid from table";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
echo "<form method=\"post\">";
echo "<input type=\"hidden\" name=\"eid\">";

echo "<a href=\"#\" onclick=\"javascript: document.form.eid.value='$_SESSION[$row[0]]'; document.form.action=\"template.php\"; document.form.submit();\">";
}
?>

As I said, this is the 'worst' way of doing it :P . But if you dont want to attach the info to the url, then you can do it this way ! I haven't tested the code(maybe the code wont even work!). Just giving you an idea on how it might work.
Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

And how will you know which $_SESSION[$row[0]] value has to be passed ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

How are you differentiating between different links ? Say you have 4 links ? Arent you passing some id for different links ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Why dont you assign the value to a variable and then use that variable ?
Eg.

<?php  //page1.php
session_start();
$_SESSION['eid']="1234";
// rest of your code... 
?>
<?php //page2.php
session_start();
$eid=$_SESSION['eid'];
$query = "SELECT eid, title, content, image, image2 FROM diary WHERE eid ='$eid'";
// rest of your code
?>
nav33n 472 Purple hazed! Team Colleague Featured Poster

hmm.. I dont see any infinite loop ! You can debug this script by putting your custom message after few lines followed by an exit. Repeat this step until you find an infinite loop! Also check the files you are including for an infinite loop.

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

-553

nav33n 472 Purple hazed! Team Colleague Featured Poster

lol.. sweet !

nav33n 472 Purple hazed! Team Colleague Featured Poster

best

nav33n 472 Purple hazed! Team Colleague Featured Poster

Me, Mo and Mu are 3 chinese brothers.

nav33n 472 Purple hazed! Team Colleague Featured Poster

What automatic message ? :S

nav33n 472 Purple hazed! Team Colleague Featured Poster

:P heh! yw !

nav33n 472 Purple hazed! Team Colleague Featured Poster

LOL, I'm actually supriced he replayed as the original post is 2 years old now

:P Prolly he came back today after a long break !

nav33n 472 Purple hazed! Team Colleague Featured Poster

As far as I know, you can't have insert and update in the same query. The only case where you can have insert and update in the same query is when you use on duplicate clause . If you are using php to insert values to the table, you can do it without any problem.

$insert_query="insert into puppybasket (number_of_puppies,color) values ('val1','val2')"; //val1 has the number and val2 has the color
mysql_query($insert_query);
$update_query="update basket set total=total+'val1' where condition"; // total will be updated to total+number of new puppies added.
mysql_query($update_query);

Cheers,
Naveen

Venom Rush commented: Exactly what I needed to know ;) +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

-551

nav33n 472 Purple hazed! Team Colleague Featured Poster

sent

nav33n 472 Purple hazed! Team Colleague Featured Poster

-549

nav33n 472 Purple hazed! Team Colleague Featured Poster

race
rat
car

Truncate

nav33n 472 Purple hazed! Team Colleague Featured Poster

dent

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are welcome!

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) yeah.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Well, You can do it this way. Have a dropdown box with these options. Have a textbox to take the input from the user. Instead of passing the value as location, software, IC number, etc. you can pass the value as 1,2,3, etc depending upon the choice made by the user. Then when the page is submitted, you can simply check the selected value of the dropdown and do respective search. Eg.

<?php
if(isset($_POST['submit'])){
	$conn=mysql_connect("localhost","root");
	mysql_select_db("test");
	$selectedvalue=$_REQUEST['select'];
	$searchstring=$_REQUEST['search'];
	if($selectedvalue=="1") { // location was selected
		$query="select * from table where location like '%$searchstring%'";
		$result=mysql_query($query);
		// do whatever you want
	}
	if($selectedvalue=="2"){ //IC number was selected
		$query="select * from table where IC_number like '%$searchstring%'";
		$result=mysql_query($query);
		//do whatever you want
	}
	if($selectedvalue=="3"){
	/////////// same like you did for other 2 options
	}
	
}
?>
<html>
<body>
<form method="post" action="test.php">
Select an option: <select name="select">
<option value="1">location </option>
<option value="2">IC number</option>
<option value="3">some other option </option>
</select><br />
<input type="text" name="search"><br />
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

So, this way, you can avoid having so many scripts with only a change in 1 line.

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

If you know the filename and the directory where it is stored, you can do it by giving a hyperlink.
Eg. <a href="directory/resume.doc">Resume</a> . But if you don't know the filename, you have to open the directory using opendir , read the opened directory using readdir , give a hyperlink to all the files in the folder. Since its a doc file, When you click on the link, a file save dialog will popup.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Do you want to download an uploaded word document ? or upload and download a word document ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

send

nav33n 472 Purple hazed! Team Colleague Featured Poster

city
fit
tie

International

nav33n 472 Purple hazed! Team Colleague Featured Poster

tent

nav33n 472 Purple hazed! Team Colleague Featured Poster

When you submit viewsearchbylocsoft.php, do, $select=$_REQUEST; :S where do you want to use it and why do you have the same copy of 3 scripts ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

I dont get it. Where is your dropdown box ? And could you please highlight your code by putting it within [/ code] tags.[code=php ] [/ code] tags.

nav33n 472 Purple hazed! Team Colleague Featured Poster

sat
say
set

Subscribe

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php
$conn=mysql_connect("localhost","root");
mysql_select_db("test");
echo "Select a name: <select name='name'>";
$query="select name from users";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
$name=$row['name'];
echo "<option value='$name'>$name</option>":
}
echo "</select>";
?>

This will show all the names of table users in a dropdown box.
If this isnt what you were looking for, can you be more specific and show us your code ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Have a select box with all the options! When the user clicks on submit, you REQUEST the value of the select box. $selectedvalue=$_REQUEST['select_box_name'];

nav33n 472 Purple hazed! Team Colleague Featured Poster

I just asked if you have experiences about it, nothing concern about the date.

You could have started a new thread. And you are bumping many "dead" threads and thats a concern.

nav33n 472 Purple hazed! Team Colleague Featured Poster

and why should I waste my time explaining how I fixed it when NO-ONE on this forum gave me even the slightest help?

- Courtesy works both ways... not just one!

Well, people might not be knowing the answer for your question. You can't expect them to know the answer for everything. Can you ? And If you had posted your 'fix', it would have helped others who might have encountered the same problem. If your attitude is, 'why should I waste my time explaining blah blah blah', why do you expect help from others ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Phew...was about to post and then realized the date of the thread.

:P you have already posted in some threads without reading the post !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb !

nav33n 472 Purple hazed! Team Colleague Featured Poster

huh! bookmark toolbar ? :S why ! Hi btw !

nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php
if(isset($_POST['submit'])){
      $selectedoption=$_REQUEST['select1'];
      //use $selectedoption in your query. 
}
?>
<html>
<body>
<form method="post" action="test.php">
<select name="select1">
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
</select><br />
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

:) retrieving the option value and using it in a query.

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) look at the date before bumping a thread. Thanks.

nav33n 472 Purple hazed! Team Colleague Featured Poster

land

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are welcome! :)
Btw, If your problem is solved, you can mark this thread as solved.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Since you are including so many files and most of them contains classes and we don't know what those classes do, I suggest you to echo your own message to check the flow of the code. For example, when calling a method in a class, check if it returns a value. Understand the flow of your script. Turn on display errors and set error reporting to 8191 or uncomment > error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT < in php.ini .

nav33n 472 Purple hazed! Team Colleague Featured Poster

howdy want to be your student am a bigginner

:confused: Why did you bump a 2 yr old thread ? :|

nav33n 472 Purple hazed! Team Colleague Featured Poster

Could you please edit your post and put your code within [ /code] (without space) tags ? And, If you have access to php.ini file, change display_errors to On (if its off).[code=php ] [ /code] (without space) tags ?
And, If you have access to php.ini file, change display_errors to On (if its off).

nav33n 472 Purple hazed! Team Colleague Featured Poster

i need your help please help someone

:S Please post your question in related forum !