vibhaJ 126 Master Poster

I am still confused what is your exact requirement?
Why don't you directly write loop on index.php.
What is the use of all.php?

vibhaJ 126 Master Poster

attached image....

How you know it will take 10 sec?
it is depending on what code is there in while loop.
If its simple, it may execute faster.

vibhaJ 126 Master Poster

While loop is also working in my browser.
Check this link for my output.
click here

vibhaJ 126 Master Poster

There is no big difference between Mysql and Mysqli.
Mysqli is nothing but an improved extension of Mysql which supports OOPS.
In some blogs and benchmark says that Mysql is slightly faster than the Mysqli Extension.

vibhaJ 126 Master Poster

Yes i get 1.something seconds to execute my code..

Wait so did the script give you a time on how fast it executed and did your code execute completely?

vibhaJ 126 Master Poster
SELECT City ,count(*) FROM `Persons` group by City
vibhaJ 126 Master Poster

I think you are talking about HTML table.
You can fix the width of table.
You need to post your code for review.
PLEASE USE CODE TAGS.

vibhaJ 126 Master Poster

Try this code.
It will print all php configuration.
So that you can check existing dlls.

<?php

// Show all information, defaults to INFO_ALL
phpinfo();

// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);

?>
vibhaJ 126 Master Poster

Did it worked or not????

vibhaJ 126 Master Poster

THE complete code

<?php

include 'connect.php';

$arrQueryParts = array();
$arrQueryParts['Age'] = $_POST['AgeF']; 
$arrQueryParts['Sex'] = $_POST['SexF']; 
$arrQueryParts['Hair'] = $_POST['HairF']; 
$arrQueryParts['Dress'] = $_POST['DressF']; 

foreach($arrQueryParts as $key=>$value)
{ 
    $strVarName = $key . "F";
    if($value != 'No Preference')
    {   
       $arrQueryParts[$key] = " AND ".ucwords($key)."='".$value."'";
    }   
}

//your query
$strAddQuery = $arrQueryParts['Age'] . $arrQueryParts['Sex'] . $arrQueryParts['Hair'] . $arrQueryParts['Dress'];
$strQuery = "select * from people " . (trim($strAddQuery) != ""?" where 1=1 ":"") . $strAddQuery . " order by Name";
$rs = mysql_query($strQuery);
while($row = mysql_fetch_assoc($rs))
{

$ID = $row['ID'];

$Name = $row['Name'];

$Phone_Number = $row['Phone_Number'];

$Age = $row['Age'];

$Sex = $row['Sex'];

$Hair = $row['Hair'];



echo "<table>"; 



echo "<tr><td>";

echo "<a href='www.example.com'>".$Name."</a></td>";

echo "<td>";
echo "<a href='www.example.com'>".$Phone_Number."</a></td>";

echo "<td>";
echo "<a href='www.example.com'>".$Age."</a></td>";

echo "<td align='center'>";

echo "<a href='www.example.com'>".$Sex."</a></td>";

echo "<td align='center'>";

echo "<a href='www.example.com'>".$Hair."</a></td></tr>";

echo "</table>"; }
?>
vibhaJ 126 Master Poster

Either do
1)

if($value != 'No Preference')

OR 2)
In dropdown in option value

<option value="">No Preference</option>

and in coding use,

if($value != '')

This is the query that is returned:

select * from people where 1=1 AND Age='19' AND Sex='No Preference' AND Hair='No Preference' AND Dress='No Preference' order by Name

Now the problem is that No Preference is supposed to be like a select all in that category because that doesn't narrow the search field down at all.

How do I make it so that when it is No Preference is selected it doesn't restrict the query?

vibhaJ 126 Master Poster

Replace this much code. and then check it.

foreach($arrQueryParts as $key=>$value)
{ 
    $strVarName = $key . "F";
    if(strtolower($strVarName) != 'no preference')
    {   
       $arrQueryParts[$key] = " AND ".ucwords($key)."='".$value."'";
    }   
}

//your query
$strAddQuery = $arrQueryParts['Age'] . $arrQueryParts['Sex'] . $arrQueryParts['Hair'] . $arrQueryParts['Dress'];
echo $strQuery = "select * from people " . (trim($strAddQuery) != ""?"where 1=1 ":"") . $strAddQuery . " order by Name";
 exit;
vibhaJ 126 Master Poster

eval executes java script code.
Your code works for me.
For that you have to directly enter js code in textarea as shown in below code.
no 'script' tag.
You only want JS code to execute?

<script>
function speedgo()
{

var code = document.getElementById('code').value;

var d1 = new Date();

//Code to be timed will go below.

eval(code);

//Code to be timed will go above

var d2 = new Date();

m1 = d1.getMilliseconds();
m2 = d2.getMilliseconds();
s1 = d1.getSeconds();
s2 = d2.getSeconds();

if(s1 > s2)
{
var minitotal=s1-s2;
var total=60-minitotal;
var s2 = s2+total;
}


militotal1=s1*1000+m1;
militotal2=s2*1000+m2;

var total=militotal2-militotal1;

var final22= total/1000;

alert("Total Seconds: "+final22);

}
</script>
<b>HTML</b>, <b>Javascript</b>, and <b>CSS</b>. Surround HTML with . Surround Javascript with &lt;script&gt;. Surround CSS with &lt;style&gt; tags. Happy coding for Speed.

<input onclick="speedgo()" type="button" value="Code Speed Go!" />

<textarea cols="50" id="code" rows="20" style="height: 409px; width: 675px;">
var a = 10;
var b = 20;
alert('a:'+a+' ,b:'+b);
alert('summation is a+b :'+ (parseInt(a) + parseInt(b)));
</textarea>
vibhaJ 126 Master Poster

APC is a PECL Extension

Try Getting the package and install
for more info on apc Extension
http://pecl.php.net/package/APC

vibhaJ 126 Master Poster

Not sure, but try this using eval function.

var code = document.getElementById('code').value;
eval(code);
vibhaJ 126 Master Poster

Core javascript ajax is headache.
Why don't you try jquery ajax.
check here
Its too easy to operate.

vibhaJ 126 Master Poster

On onclick event of button you can call one js function.
In js function call ajax to increment click counter.

vibhaJ 126 Master Poster

I use below logic.
In login form place a new hidden field which will have user's current location with query parameter.

<input type='hidden' name='page' value='<?=basename($_SERVER["PHP_SELF"]).'?'.$_SERVER["QUERY_STRING"]?>' />

In php side coding use below redirection.

header('location:'$_POST['page']);
vibhaJ 126 Master Poster

Yes urtrivedi is right.
you can always use `(escape) character around table name to avoid it.

.....
INSERT INTO `join`
vibhaJ 126 Master Poster

post your code.
I use below searching logic:
1. Create join query which will have all five parameters as a result.
2. now create where condition by concatenation.
e.g.

if(isset($_POST['color']))
  $where.= " AND table1.color=".$_POST['color'];
if()
  ....

3. So your final query will be.
$sql = " select... WHERE 1=1 ".$where;

vibhaJ 126 Master Poster

Try 'U' in small case.

echo $sql = "SELECT [B]u[/B]sername FROM login_tbl WHERE username='".$username."' and password='".$password."'";
$result = mysql_query($sql, $connectID);

If it still not works then run echoed query in phpmyadmin.

vibhaJ 126 Master Poster

Code is looking w/o error.
can you check $tbl_name variable in both page.

vibhaJ 126 Master Poster

1. count distance between x and y point.
2. check wheather it is less than radious (y is inside)
it is greater than radious (y is outside)

karthik_ppts commented: its really helpful to me. +1
vibhaJ 126 Master Poster

try without single quote.

in_array($user_em,$pieces)
vibhaJ 126 Master Poster

I have checked with test name.txt and it works fine in my browser.
and if i give only google.com in my href it won't work.

You don't have to have http:// in the href.

The space shouldn't be there. Filenames should not have spaces in them. I'd go at it to change them - change them from space to underscore or similar.

vibhaJ 126 Master Poster

You have to use absolute path.
You can define one php variable and use it in js, image, css path.

$siteurl = 'http://www.site.com';

<img src="<?=$siteurl?>/images/test.jpg">

vibhaJ 126 Master Poster

I think its not because of space.
Your href link must start with http:// to work in browser.
When you click on link what is url shown in browser?

vibhaJ 126 Master Poster

1. session_start(); must be on the first line of coding.
2. where is $_SESSION defined?
3. you have to check user's entered code with session captcha code on add_enquiry.php page.
Because your form action is 'add_enquiry.php' which will directly executed code without checking captcha.

vibhaJ 126 Master Poster

Yup.. you are absolutely correct.

I am not sure if you are aware of jquery.
with the help of jquey java script code is so much simplified.

e.g.lets you want to show or hide a div id 'myDivd'.
In jquery it is a simple one line coding.

$('#myDivd').show();
$('#myDivd').hide();

Here is a link:
http://api.jquery.com/show/

There are plenty of functionality available in jquery.
This is just a knowledge sharing as you are newbie.

vibhaJ 126 Master Poster

Okay.. as a beginner always try to explore as many way as you can for any development.And use the best one.So if you stuck anywhere you have another choice. e.g. form submission can be done more than one way.

I have seen your solution.Its 100% right but here's a just suggestion.

Lets say if you have changed your html code in field id :'to_change_into_image'.
In your way you have to change it twice. once in html and once in javascript.
You also have to take care of back slash '\'.(I hate concatenation of strings in javascript as it breaks sometime :) ) And if a little quote or slash is missing whole JS will not work.So i prefer not to use it.

vibhaJ 126 Master Poster
<?php
// the HTML source of a URL.
$lines = file('http://www.google.com/');

// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines as $line_num => $line) {
    echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
}
?>
vibhaJ 126 Master Poster

Check this code.
And implement as per your need.

<script language="javascript">
function valid(form)
{
	if(form.name.value=="")
	{
		alert('Please enter name');
		return false;
	}
	else if(form.subject.value=="")
	{
		alert('Please enter subject');
		return false;
	}
	else
	{
		return true;
	}	
}
</script>
<form name="frm" id="frm" method="post" onsubmit="return valid(this);">
<br />Name : <input name="name" type="text" />
<br />Subject : <input name="subject" type="text" />
<br /><input name="send" value="Send" type="submit" />
monta2020 commented: THIS HELLLLLPED ME !!! +0
vibhaJ 126 Master Poster

You can design your database this manner:

commentId| parentCommentId |user |comment
1		 |	0			   |XYZ  |hsdahfkasydf astdfsa dftasdf astdfasdf
2		 |	1			   |TYU  |why you writing wirdo?
3		 |	1			   |IOP  |wtf!
4		 |	0			   |VBN  |I love daniweb.
5		 |	4			   |DFG  |me too.
vibhaJ 126 Master Poster

- you can not define function in another function.
- always keep practice to return value from any function.

<script language="javascript">
function check()
{
	if(confirm("Are you sure you want to place your order?"))
	{
		var a= document.myForm.name.value;
		var b= document.myForm.phoneNumber.value;
		var c= document.myForm.unitNumber.value;
		var d= document.myForm.streetName.value;
		var e= document.myForm.city.value;
		var f= document.myForm.zip.value;
		var g= document.myForm.province.value;
		if( a =="" || b=="" || c=="" || d=="" || e=="" || f=="" || g=="")
		{
			alert("Input fields can not be empty");
			return false;
		}
		else
			return true;
	}
	else
	{
		return false;
	}
} 
</script>
vibhaJ 126 Master Poster
<?php
$subject = "<a href='google.com'>Google link</a>";
$pattern = "/url|link|href/";

preg_match($pattern, substr($subject,3), $matches, PREG_OFFSET_CAPTURE);
print_r($matches);
?>
vibhaJ 126 Master Poster

Here is a query.

SELECT name, count( * )
FROM `student`
WHERE 1
GROUP BY name
vibhaJ 126 Master Poster

Why don't you toggle both layout.
Here is code for that.

<script language="javascript">
function changeText()
{
	document.getElementById('layout1').style.display = 'none';
	document.getElementById('layout2').style.display = 'block';
}
function resetText()
{
	document.getElementById('layout2').style.display = 'none';
	document.getElementById('layout1').style.display = 'block';
}
</script>
<div id="to_change_into_image" class="box">
<div id="layout1">
<h1>Table for layout</h1>
<table class="table_for_layout"><!--OUTER TABLE-->
<tbody><tr>
<td></td><td colspan="2"><p><br></p><h2>Web editing - Tables</h2></td>
</tr>
<tr><td>
<table class="inner_table"><!--INNER TABLE SITS IN THE COLUMN OF THE OUTER TABLE-->

<tbody><tr>
<td><a href="styles.htm">Styles</a></td>
</tr>
<tr>
<td><a href="documents.htm">Documents</a></td>
</tr>
<tr>
<td><a href="content.htm">Content</a></td>
</tr>
<tr>
<td><a href="links.htm">Links</a></td>
</tr>
<tr>
<td><a href="Images">Images</a></td>
</tr>
<tr>
<td>Pages</td>
</tr>
<tr>
<td><strong>Tables</strong></td>
</tr>
</tbody></table><!--INNER TABLE--></td>
<!--SECOND COLUMN OF INNER TABLE TAKES THE TEXT -->
<td colspan="2"><h3>Tables in the page</h3>
<p>Nowadays tables are used only for tabular data and not for layout purposes. To arrage text and elements in a page we use a CSS like this - that's the CSS for this website.</p></td>

</tr></tbody></table>
</div>
<div id="layout2" style="display:none;">
<img src="table_for_layout_2.jpg">
</div>
</div>
vibhaJ 126 Master Poster
function check()
{
  var a = document.getElementById('name').value;
  var b = document.getElementById('address').value;
  if( a =="" || b==""){
     alert("Input fields can not be empty");
     return false;
  }
return true;
}

Where name and address is id of the fields.

vibhaJ 126 Master Poster

Also use value in option tag.
Because it may cause issue in IE.

<?php

// your database connection here

echo "<select name='dropdown1'>";
$query = mysql_query("SELECT * from employeedetails");
while($result=mysql_fetch_array($query));
{
echo "<option value='".$result['EmployeeID']."' name='id_list'>".$result['EmployeeID']."</option>";
}

echo "</select>";

?>
vibhaJ 126 Master Poster

Okay...
$_SERVER was not working on live server in some of my past projects.
So i used below function.
Just sharing...

function getCurrPageUrl($unset=array())
{
	$currPageName = basename($_SERVER['PHP_SELF']);
	$arr = $_GET;
	foreach($unset as $one)
	{
		unset($arr[$one]);
	}		
	return $url = $currPageName.'?'.http_build_query($arr);
}
vibhaJ 126 Master Poster

You can get query string parameter using $_GET.

echo '<pre>';
print_r($_GET);
vibhaJ 126 Master Poster

Have you checked database value?
Database contain more than 40 char?

vibhaJ 126 Master Poster

Have you checked database value?
Database contain more than 40 char?

vibhaJ 126 Master Poster

check this
This is exactly what you want !

vibhaJ 126 Master Poster

check here it might help you

vibhaJ 126 Master Poster

If you have object for database then that function can be used.
otherwise,

<?
	 function deleteEntry() {
        return mysql_query("delete from manage where entryId='".$this->entryId."'") or die(mysql_error());//delete $this->entryId from database
    }
?>
vibhaJ 126 Master Poster

Post code..w/o code it can't be judged.

vibhaJ 126 Master Poster
<?
	echo '<strong>Data is below:</strong>';
	echo $str = 'This is first line.<br>
	   <span id="our_price_display"> Rs 2,990.00</span>
	   This is second line.<br> 
	   <span id="our_price_display"> Rs 17.00</span> ';	
	$pattern = '/span/';
	$pattern = '/<span id="our_price_display">([^"]*)<\/span>/';
	preg_match_all($pattern, $str, $matches);	
	
	echo '<br>This is filtered:<pre>';
	print_r($matches[0]);
?>
vibhaJ 126 Master Poster

Because your code is completely wrong.
Make sure whenever you write any code which will be executed after form submission then put in if condition.
e.g. in below code 'submitBtn' is your form submit button name.
You have placed insert code twice.correct it.

Here it is:

<?php
$con = mysql_connect("localhost","qserves1_ukadmin","lexington2009");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

if(isset($_POST['submitBtn']))
{
//============ db 1 ===========
$db=mysql_select_db("qserves1_uksurvey", $con);
$sql =  "SELECT * FROM forms WHERE Number='".$_POST['Number']."'";
$res = mysql_query($sql, $con) or die (mysql_error());
if(mysql_num_rows($res)>0)
{
	echo 'forms already exist with number:'.$_POST['Number'];
	exit;
}
else
{
	$sql="INSERT INTO forms (date, Receivingsky, Title, Firstname, Lastname, House, Street, Town, County, Postcode, Number, WarrantyCoverForSky, Tvmake, Warrantycover, Payingmonthly, Agentnotes, Agentname)
	VALUES
	(NOW(),'$_POST[Receivingsky]','$_POST[Title]','$_POST[Firstname]','$_POST[Lastname]','$_POST[House]','$_POST[Street]','$_POST[Town]','$_POST[County]','$_POST[Postcode]','$_POST[Number]','$_POST[WarrantyCoverForSky]','$_POST[Tvmake]','$_POST[Warrantycover]','$_POST[Payingmonthly]','$_POST[Agentnotes]','$_POST[Agentname]')";
	$sql_result = mysql_query($sql, $con) or die (mysql_error());

}
//============ db 2 ===========
$db2=mysql_select_db("qserves1_uksurvey", $con);
$sql2 =  "SELECT * FROM dupphones WHERE Number='".$_POST['Number']."'";
$res = mysql_query($sql2, $con2) or die (mysql_error());
if(mysql_num_rows($res)>0)
{
	echo 'forms already exist with number:'.$_POST['Number'];
	exit;
}
else
{
	$sql2="INSERT INTO dupphones (date, Number)
	Values
(NOW(),'$_POST[Number]')";
	$sql_result = mysql_query($sql2, $con2) or die (mysql_error());

}
}

if ($_POST['Receivingsky']=="") {
Print("Please fill in Receivingsky!<br>");
}
elseif ($_POST['Title']=="")
{
Print("Please fill in Title!!<br>");
}
elseif ($_POST['Firstname']=="")
{
Print("Please fill in Firstname!!!<br>");
}
elseif ($_POST['Lastname']=="")
{
Print("Please fill in Lastname!!!<br>");
}
elseif ($_POST['Number']=="")
{
Print("Please fill in Number!!!<br>");
}
elseif ($_POST['WarrantyCoverForSky']=="")
{
Print("Please fill in WarrantyCoverForSky!!!<br>");
}
elseif ($_POST['Tvmake']=="")
{
Print("Please fill in Tvmake!!!<br>");
}
elseif ($_POST['Warrantycover']=="")
{
Print("Please fill in Warrantycover!!!<br>");
}
elseif ($_POST['Payingmonthly']=="")
{
Print("Please fill in Payingmonthly!!!<br>");
} …
vibhaJ 126 Master Poster

You mean it is not fix what you want to read from line?
You can use preg_match function to fetch data using regular expression.