Your Questions About Can I Have Your Number Script 2

Daniel asks…

how to do all this ???????????

MATA JAI KAUR PUBLIC SCHOOL
CLASS: IX (2009-10)
HOLIDAYS HOMEWORK

ENGLISH
1.Read the following books and write a review of any one in 200 words

a)The Rupa Book of Travellers’ Tales edited by Ruskin Bond
b)How I Met Myself by David A. Hill
c)Windows of the mind by Frank Brennan
d)Any other latest book of your choice
2.Choose an announcement of a `wanted’ person from your newspaper and draw a poster. Write some sentences to describe him/her.
3.Prepare a Radio Show as instructed in MCB Unit 4, for a 10-15 minutes duration.

COMPUTER SCIENCE
1.Read Chapter 1 and 2 of your Computer Science Book and do the questions given in the exercises at the back.

2.Open Source is frequently cited as one of the most important movements in modern software creation. It is supported by all higher education institutions. Visit the website http://www.opensource.org and find answers for the following questions. Write the answers in your notebook.

a.What is Open Source Software?
b.Why is open-source software important?
c.Why should open source software be used in schools?
d.What is the difference between open source and free software?
e.Name any two Open Source Softwares.
f.Can usage of open source software help us get rid of software piracy? How?
NOTE: DO ALL THE QUESTIONS IN COMPUTER SCIENCE NOTEBOOK.

MATH
Note: The projects should contain:
a.Contents
b.Preface
c.Acknowledgement
d.Pre-requisite knowledge
e.Project related information
f.Conclusion

NOTE: 1. Each student will be doing only one of the following projects as per allotted as a part of their final assessment.
2. The Project will be evaluated for 5 marks.
3. The project should either be hand-written or typed neatly.
4. Total length of project should be about 10-12 pages.
1. Study of various aspects of Pythagoras theorem:
a. A brief history of Pythagoras theorem
b. Statement
c. Proofs of Pythagoras theorem
d. Pythagorean triplets
e. Representation of irrational numbers.
f. Use of theorem in real life.
g. Biography of Pythagoras.

2. Represent the following information in the form of bar graphs, histograms, line or linear graphs, pie-chart. Also find the mean, median and mode the data.

a.Record the hemoglobin of 40 patients in nearby clinical laboratory.
b.Conduct a survey to find the type of music liked by a group of 30 young people from the given category : semi classical, classical, folk and western.
c.Collect the data related to the pocket money of 40 students.
d.Record the daily income of 30 workers in a factory.
e.Record the maximum and minimum temperature in your city in the month of April 2009.

3. Story of digits 0-9:
a.Historical origin and its variations in different cultures.
b.The international form of 10 digits 0-9
c.How are they written in ancient Indian-scripts, Brahmis script etc.?
d.How are they written in other cultures – Chinese, Arabic, Roman etc.?
e.Ten digits are most commonly used. Is it because we have 10 fingers?
f.Did any old civilization use a different number system?

4. Investigations of various historical aspects of number π
(i) Knowledge of π in various ancient civilizations.
(ii) Approximations of number π
(iii) Circle and π
(iv) Famous mathematical problems featuring π
(v) To find the value of π
(1) Draw 3 circles of any radius and cut them.
(2) By using the measuring tape or thread find the circumference and complete the table.

CircleCircumference (c)Diameter (d)Ratio c/d

(3) Take the average of 3 values obtained from c/d
(4) Find the value of π in two decimal places.
(5) Define π

5. Make a project on Vedic Mathematics consisting of techniques of Class VIII and IX level.

PUNJABI
Write essay on the given topic in Grammar copy
1.Mobile Phone
2.Same Da Mahatav
3.Desh de Natikita Da Pattan
4.So Kyun Manda Akihyea
5.Komi Ekta
6.Anparta Ik Lahnat

For Assignment 5 learn 50 Muhavaras and 50 Akhans (Idioms and Proverbs)

SCIENCE
PHYSICS
1. Make 10 MCQ from Expt 1 and solve back Exercise questions of NCERT Ch. 1 – for all students
Roll No. 1 -10
Make a chart on Uniform circular motion and model of Spring balance (L.C = 2g, range 100g) using cardboard.

Roll No. 11-20
Make a chart on distance and displacement and model of spring balance (L.C = 1g and Range 50g) using cardboard.

Roll No. 21-30
Make a chart on Uniform Motion and Non-uniform motion, and model of measuring cylinder L.C. = 10ml., Range 1000 ml.) using cardboard

Roll No. 31-40
Make a chart on Uniform Acceleration and Retardation, and model of measuring cylinder (L.C = 2ml, Range 200 ml) using cardboard

Roll No. 41
Make a chart on Zero displacement and model of measuring cylinder (L.C. 1 ml. and Range 50 ml)

CHEMISTRY

1. Prepare a model to demonstrate movement of particles in solids, liquids and gases with an empty bottle and a stretched rubb

Hcg Diet answers:

I don’t understand — why schools in India have turned in to like this.
Students are given summer holidays to enjoy …. What is the point in giving so many assignments.

Sorry for you. May be I can help with the Computer Science section but other than that I’m sorry … Nothing much I can do.

Nancy asks…

Using a SPAN Tag as an Text input area?

Hi guys I hope you guys can help me. I have an assignment that I have to hand in on Tuesday 11 May which is a sudoku game in javascript. I am given the startboard solution and the final solution of 3 difficulty levels (easy, medium, hard). I need to be able to load both the startboard and final solution at the same time and then be able to input numbers in the sudoku cells, and when a 0 is typed the cell content is emptied. Also i need to be able to check the cell that is selected and check it against the solution and display a message if it is correct or not. I am not using a conventional table as most would be using but im using a sudoku grid that is manipulated by css. I have managed to be able to output the initial startboard but cannot find a way of inputing a number because my table is made out of divs that have 2spans, and i have been wondering how to be able to manipulate the span tags in order to use them as input area. The following is my code.

<script type=”text/javascript” src=”sudoku.js”>
// JavaScript Document
window.onload = loadEasy;
// define the global variables used to represent the board state, size etc.
var startboard; //initial board
var solution;//Sudoku solution board
var boardsize = 9; //number of cells

// Output the numbers of the selected Level to the cells and hide the 0′s
function displayvalues ()
{
for (var rowloop = 0; rowloop < boardsize; rowloop++) {
for (var columnloop = 0; columnloop < boardsize; columnloop++){
var cell = document.getElementById('square_' + rowloop + '_' + columnloop);
cell.value = startboard[rowloop][columnloop];
cell.innerHTML= cell.value;
if (cell.value == 0) {

cell.innerHTML = "";
}
}
}
}

// define the starting and solution board values for the "easy" level
function loadEasy()
{

startboard = [[0, 4, 6, 2, 8, 0, 0, 0, 0],
[5, 0, 0, 6, 0, 0, 7, 4, 0],
[2, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 5, 0, 3, 2, 0, 7, 0],
[0, 2, 1, 0, 0, 0, 4, 8, 0],
[0, 3, 0, 1, 7, 0, 5, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 5],
[0, 9, 4, 0, 0, 1, 0, 0, 7],
[0, 0, 0, 0, 9, 6, 8, 3, 0]]

solution = [[9, 4, 6, 2, 8, 7, 3, 5, 1],
[5, 8, 3, 6, 1, 9, 7, 4, 2],
[2, 1, 7, 5, 4, 3, 6, 9, 8],
[8, 6, 5, 4, 3, 2, 1, 7, 9],
[7, 2, 1, 9, 6, 5, 4, 8, 3],
[4, 3, 9, 1, 7, 8, 5, 2, 6],
[6, 7, 8, 3, 2, 4, 9, 1, 5],
[3, 9, 4, 8, 5, 1, 2, 6, 7],
[1, 5, 2, 7, 9, 6, 8, 3, 4]]

displayvalues();

}

// define the starting and solution board values for the “normal” level
function loadNormal()
{

startboard = [[0, 0, 0, 8, 0, 0, 0, 1, 7],
[4, 3, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 2, 0, 0, 0, 9, 0, 0],
[2, 0, 0, 0, 0, 8, 0, 0, 0],
[0, 9, 7, 6, 0, 3, 4, 8, 0],
[0, 0, 0, 7, 0, 0, 0, 0, 5],
[0, 0, 6, 0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 4, 8],
[5, 8, 0, 0, 0, 1, 0, 0, 0]]

solution = [[6, 5, 9, 8, 2, 4, 3, 1, 7],
[4, 3, 1, 5, 9, 7, 8, 2, 6],
[8, 7, 2, 1, 3, 6, 9, 5, 4],
[2, 6, 5, 9, 4, 8, 7, 3, 1],
[1, 9, 7, 6, 5, 3, 4, 8, 2],
[3, 4, 8, 7, 1, 2, 6, 9, 5],
[9, 2, 6, 4, 8, 5, 1, 7, 3],
[7, 1, 3, 2, 6, 9, 5, 4, 8],
[5, 8, 4, 3, 7, 1, 2, 6, 9]]

displayvalues();
}

// define the starting and solution board values for the “hard” level
function loadHard()
{

startboard = [[9, 0, 0, 0, 0, 1, 0, 5, 0],
[7, 6, 5, 0, 0, 0, 0, 0, 0],
[1, 0, 0, 3, 0, 0, 0, 0, 8],
[0, 0, 0, 0, 0, 6, 0, 4, 0],
[0, 0, 0, 2, 1 ,8 ,0 ,0 ,0],
[0, 9, 0, 4, 0, 0, 0, 0, 0],
[6, 0, 0, 0, 0, 4, 0, 0, 2],
[0, 0, 0, 0, 0, 0, 8, 3, 7],
[0, 3, 0, 1, 0, 0, 0, 0, 5]]

solution = [[9, 8, 3, 7, 2, 1, 6, 5, 4],
[7, 6, 5, 8, 4, 9, 3, 2, 1],
[1, 2, 4, 3, 6, 5, 7, 9, 8],
[8, 1, 7, 9, 5, 6, 2, 4, 3],
[3, 4, 6, 2, 1, 8, 5, 7, 9],
[5, 9, 2, 4, 7, 3, 1, 8, 6],
[6, 7, 8, 5, 3, 4, 9, 1, 2],
[4, 5, 1, 6, 9, 2, 8, 3, 7],
[2, 3, 9, 1, 8, 7
* {
padding:0px;
margin:0px;
}

body{
font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
width:100%;
height:100%;
margin:0px;
padding:0px;
}

#header {
clear:both;
background-color: #CCC;
height: 40px;
}

#content {
position:relative;
background-color: #0FF;
}

#leftnav {
float:left;
background-color: #F30;
}

#rightnav {
float:right;
background-color: #6F3;
}

#footer {
clear:both;
background-color: #F9F;
}

/* */

#sudoku{
position:relative;
margin: 0 auto;
}
.sudoku{
width:456px;
height:456px;
border:2px solid #000;

}
.sudokuSquare,.sudokuSquareHighlighted{
width:46px;
height:46px;
float:left;
border:1px solid #000000;
padding:1px;
line-height:46px;
font-size:30px;
text-align:center;
background-color:#FFF;
cursor:default;
}
.sudokuSquareHighlighted{
border:2px solid #317082;
width:46px;
height:46px;
padding:0px;
background-color:#E2EBED;
}
.sudokuSection{
width:150px;
height:150px;
border:1px solid #000000;
float:left;
}

The above is my style.css file in case it may help you guys see how i have made it all look as i currently have it.
Sorry I forgot to mention a few things. One of the requirements of the assignment that I have is to be able to show a table even if the JavaScript is turned off. Have a button that when clicked will check the current Cell against the solution rather than using the onChange.
Sorry I may have explained myself badly. What I mean is that if someone has JavaScript turned off they can still see the Sudoku Grid which means the only thing I need to do is that rather than using the displayCell() function to create the Sudoku Grid I will have to put it into the HTML which I did. I copied your exact grid but put it into HTML. I am only missing 2 things that I have not managed to find how I do it. That is that when I click on a cell and or input a number that Cell is selected and then there should be a button that I click to check the selected cells input against the solution (at the moment Michael's script is doing the checking but through onchange function). So I need to find a way to select cell when clicked or anything is inputed and then a function activated by a button that checks that selected cell against the solution. Please Help me, I have tried but cannot figure it out. I am VERY NEW TO JavaScript. Thanks for your help

Hcg Diet answers:

Why not use the tag for your cells as in the following:

* {
padding:0px;
margin:0px;
}

body{
font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
width:100%;
height:100%;
margin:0px;
padding:0px;
}

/* */

#sudoku{
position:relative;
margin: 0 auto;
}

.sudoku{
width:456px;
height:456px;
border:2px solid #000;
margin: 0 auto;
}

.sudokuSquare {
width:46px;
height:46px;
float:left;
border:1px solid #000000;
padding:1px;
line-height:46px;
font-size:30px;
text-align:center;
background-color:#FFF;
cursor:default;
}

.sudokuSection{
width:150px;
height:150px;
border:1px solid #000000;
float:left;
}

.sudoku br {
clear:left;
}

.sudoku input { width: 1.55em; text-align: center; }

// define the global variables used to represent the board state, size etc.
Var startboard; //initial board
var solution;//Sudoku solution board
var boardsize = 9; //number of cells

// Output the cells
function displayCells ()
{
  var cells = "

";
  for (var row = 0; row < boardsize ; row += 3) {
    for (var column = 0; column < boardsize ; column += 3){
      cells += "
";
      for (var rowloop = row; rowloop < row + 3 ; rowloop++) {
        for (var columnloop = column; columnloop < column + 3 ; columnloop++){
          var id = 'square_' + rowloop + '_' + columnloop;
          cells += "";
        }
        cells += "
";
      }
      cells += "

";
    }
    cells += "
";
  }
  cells += "

";
  document.write ( cells );
}

// Output the numbers of the selected Level to the cells and hide the 0's
function displayvalues ()
{
  for (var rowloop = 0; rowloop < boardsize  ; rowloop++) {
    for (var columnloop = 0; columnloop < boardsize  ; columnloop++){
      var id = 'square_' + rowloop + '_' + columnloop;
      var cell = document.getElementById( id );
      cell.value = startboard[ rowloop ][ columnloop ];
      if (cell.value == 0) {
        cell.value = "";
      }
    }
  }
}

var currentRow = '';
var currentColumn = '';

// save the current Id
function save( row, column )
{
  currentRow = row;
  currentColumn = column;
}

// Check changes made
function check ()
{
  var row = currentRow;
  var column = currentColumn;
  var id = 'square_' + row + '_' + column;
  var cell = document.getElementById( id );
  row = parseInt( row );
  column = parseInt( column );
  var correctValue = solution[ row ][ column ];
  var value = cell.value;
 
  if (value == correctValue) {
    alert("Correct");
  } else {
    alert("Try again");
  }
}

// define the starting and solution board values for the "easy" level
function loadEasy()
{

startboard = [[0, 4, 6, 2, 8, 0, 0, 0, 0],
[5, 0, 0, 6, 0, 0, 7, 4, 0],
[2, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 5, 0, 3, 2, 0, 7, 0],
[0, 2, 1, 0, 0, 0, 4, 8, 0],
[0, 3, 0, 1, 7, 0, 5, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 5],
[0, 9, 4, 0, 0, 1, 0, 0, 7],
[0, 0, 0, 0, 9, 6, 8, 3, 0]];

solution = [[9, 4, 6, 2, 8, 7, 3, 5, 1],
[5, 8, 3, 6, 1, 9, 7, 4, 2],
[2, 1, 7, 5, 4, 3, 6, 9, 8],
[8, 6, 5, 4, 3, 2, 1, 7, 9],
[7, 2, 1, 9, 6, 5, 4, 8, 3],
[4, 3, 9, 1, 7, 8, 5, 2, 6],
[6, 7, 8, 3, 2, 4, 9, 1, 5],
[3, 9, 4, 8, 5, 1, 2, 6, 7],
[1, 5, 2, 7, 9, 6, 8, 3, 4]];

displayvalues();

}

Sudoku

displayCells();
loadEasy();
document.write(“”);

On each change to a cell the users input is saved. If they click the “check current” button then the check() function is called which checks their latest change.

For more on the input tag see: http://www.html-tags-guide.com/html-input-tag.html

I know of no way checking the solution without using Javascript, or a server side script.

A non Javascript solution would require that the displayCells() function be written as a server side script, such as in PHP, or the cells be written into the html file.

For server side checking the grid of tags would need to be placed in a form which would need to be processed by the server side script.

A server side script could also be used to rewrite the page with the standard and difficult puzzles, if the user selected them.

Lizzie asks…

PLEASE HTML help, so upset so upset?

ok, I dont mean to be so dramatic,
but I am upset.

I have worked so hard, and I have run into a roadblock. I found a html off html goodies, when I copy it into photobucket, or my website it doesnt work, when I copy it into a practice html board, off internet it works. what the heck is going on- some htmls are not public?
I am going to paste the html in HUGE HOPES someone knows what I can do to get it to work on my site, if I just have to change something on it?

Here it is:

<meta name="description" content="Title: Diagonal Fly In – Created for Internet Explorer 5.5+. Dsiplays well in Gecko-Based Browsers like Netscape 7 and Mozilla 1.2+. Works Best in IE 5.5+ and Opera 7+.JavaScript/DHTML Text Effects – www.DynamicScripts.net”>

<script language=”JavaScript” type=”text/javascript”>
<!–
var message="JavaScript, LiveScript, JScript, and DHTML";
var MAXIMUM=5;
var MOVEPOS=150;
var INTERVALSTEPS=5;
var FONTSIZE=30;
var EndingFontSize=40;
var COLOR=new Array("#00ff00","darkblue","gray","lightyellow","white"); // -Make sure the number of colors match the MAXIMUM variable
var GlobalT=buffer=10, GlobalT2=300;

/* Counters */

var IDNo=colorCount=HUCKO=0;
var cntrTop=cntrDisp=1;
var bool=booleanVar=booleanVal=endBool=true;
/* End Counters */

window.onload=DynamicScripts_Main;

function DynamicScripts_Main()
{
Dynamic_Write_Spans();
RHUCKO1_Anim_Spans();
}
document.title=”Dynamic Scripts”+” by”+”"+” DynamicScripts.net”+”"+” DHTML”+” & “+”JavaScript “+”Effects”;
function Dynamic_Write_Spans()
{
for(var Scripts=0; Scripts<MAXIMUM; Scripts++)
document.getElementById('JAVASCRIPTS'+Scripts).innerHTML=message;
}
function RHUCKO1_Anim_Spans()
{
if(HUCKO<MOVEPOS)
{// – Created By Richard Hucko, Kaneohe Hawaii (HI) 96744 – Free DHTML Effects for your Website…
document.getElementById(‘JAVASCRIPTS’+0).style.zIndex=1;
with(document.getElementById(‘JAVASCRIPTS’+IDNo).style)
{
left=HUCKO;
top=HUCKO;
visibility=”visible”;
}
HUCKO+=INTERVALSTEPS;
}
else if(IDNo<MAXIMUM-1)
{
IDNo++;HUCKO=0;
}
else if(bool)
{
bool=false;
}
else if(colorCount<COLOR.length)
{
GlobalT=GlobalT2;

for(var DynX=1;DynX<MAXIMUM;DynX++)
document.getElementById('JAVASCRIPTS'+DynX).style.visibility="hidden";

for(var DynID=0;DynID<MAXIMUM;DynID++)
{
with(document.getElementById('JAVASCRIPTS'+DynID).style)
{
left=0;
width=100+"%";
textAlign="center";
}
document.getElementById('JAVASCRIPTS'+DynID).style.position=(navigator.appName=="Netscape")?"absolute":"relative";
document.getElementById('SecondPhrase').style.top=(navigator.appName=="Netscape")?50:0;
}
document.getElementById('JAVASCRIPTS'+0).style.color=COLOR[colorCount];
colorCount++;
}
else if(booleanVar)
{
for(var DynY=0;DynY<MAXIMUM;DynY++)
document.getElementById('JAVASCRIPTS'+DynY).style.top=0;
booleanVar=false;
}
else if(cntrTop<MAXIMUM)
{
document.getElementById('JAVASCRIPTS'+cntrTop).style.visibility='visible';
cntrTop++;
}
else if(cntrDisp
</script>

<script language=”JavaScript” type=”text/javascript”>
<!–
for(var RHucko1=0;RHucko1<MAXIMUM;RHucko1++)
document.write("“);
//–>
</script>
<span style="color:white;background-color:#000;font-size:15;display:none;text-decoration:none;z-index:2;”>Diagonal Fly-In Effect By Richard Hucko. Works best in Internet Explorer 5.5+ and Opera 7+. Displays well in Gecko-Based Browsers such as Netscape 7+ and Mozilla 1.2+. Check Out DynamicScripts.net for more JavaScript and DHTML Effects.

In a land of static content, Dynamic Scripts Rule!!!

HUGS
TIA:)

Hcg Diet answers:

Note to previous answerer: Yahoo! Answers truncates long lines of text with ellipses (…) to prevent scrolling and to resolve layout issues. It’s not her fault.

That said, you seem pretty confused. Photobucket isn’t used to create HTML. Photobucket stores the images you want to display on a Web page; it doesn’t store HTML.

In re: why this might not work on your Web page, it would make more sense for you to provide a link to the page on your Web site so we could see the code in full and tell you what is wrong.

Joseph asks…

PHP search help please?

OK, trying to make a search for my site using drop downs, here is what I got so far…

**********************************************************************html



Bedrooms:

1
2
3
4
5

Area:

Calderdale
Kirklees

********************************************************************php
<?php

// Get the search variable from URL
$var1 = @$_GET['beds'] ;
$var2 = @$_GET['area'] ;
$trimmed = trim($var1); //trim whitespace from the stored variables

// rows to return
$limit=10;

// check for an empty string and display a message.
if ($var1 == "")
{
echo "

Please enter a search…

“;
exit;
}

// check for a search parameter
if (!isset($var1))
{
echo “

We dont seem to have a search parameter!

“;
exit;
}

//connect to your database ** EDIT REQUIRED HERE **
mysql_connect(“localhost”,”root”,”"); //(host, username, password)

//specify database ** EDIT REQUIRED HERE **
mysql_select_db(“property_db”) or die(“Unable to connect”); //select which database we’re using

// Build SQL Query
$query = “SELECT * FROM property_db”; // EDIT HERE and specify your table and field names for the SQL query

$numresults=mysql_query($query);

// next determine if s has been passed to script, if not use 0
if (empty($s)) {
$s=0;
}

// get results
$query .= ” limit $s,$limit”;
$result = mysql_query($query) or die(“Couldn’t execute query”);

// display what the person searched for
echo “

You searched for: “” . $var1 . “, ” . $var2 . “”

“;

// begin to show results set
echo “Results”;
$count = 1 + $s ;

// now you can display the results returned
while ($row= mysql_fetch_array($result)) {
$title = $row["1st_field"];

echo “$count.) $title” ;
$count++ ;
}

$currPage = (($s/$limit) + 1);

//break before paging
echo “
“;

// next we need to do the links to other results
if ($s>=1) { // bypass PREV link if s is 0
$prevs=($s-$limit);
print “ <<
Prev 10
&nbsp ”;
}

// calculate number of pages needing links
$pages=intval($numrows/$limit);

// $pages now contains int of pages needed unless there is a remainder from division

if ($numrows%$limit) {
// has remainder so add one page
$pages++;
}

// check to see if last page
if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {

// not last page so give NEXT link
$news=$s+$limit;

echo “ Next 10 >>“;
}

$a = $s + ($limit) ;
if ($a > $numrows) { $a = $numrows ; }
$b = $s + 1 ;
echo “

Showing results $b to $a of $numrows

“;

?>

********************************************************
I run this and it says could not execute query, can someone modify/correct pls, would be very greatful! :) Thanks
Yeah, this is just a test on my apache localhost not online, sorry hackers!
This is the line that is causing trouble…

$numresults = mysql_num_rows($results);

it says: “Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:search222.php on line 39

Hcg Diet answers:

Try the following (not tested):

$host = “localhost”;
$username = “root”;
$password = “”;
//connect to your database ** EDIT REQUIRED HERE **
mysql_connect($host, $username, $password) or die(“Unable to connect to SQL Server”); //(host, username, password)

$db = “property_db”;
//specify database ** EDIT REQUIRED HERE **
mysql_select_db($db) or die(“Unable to select database”); //select which database we’re using

// Build SQL Query
$query = “SELECT * FROM property_db”; // EDIT HERE and specify your table and field names for the SQL query

$results = mysql_query($query);
$numresults = mysql_num_rows($results);

// next determine if s has been passed to script, if not use 0
if ($numresults == 0) {
$s=0;
} else {
while($result = mysql_fetch_array($results)) {
echo $result["columnname"];
}
}

//Obviously modify the above for whatever you are trying to achieve. Leave the connection stuff alone apart from the variables used in the connection and alike. For example only change $host, $username, $password, $db, $query and what is being output. I dont know what $s is but you had some line about if(empty($s)) {$s = 0;}. I changed this to if ($numresults == 0) {$s = 0} else {…}

Hope this helps.

Edit: I take it you are not specifying the database name (property_db) as the table name in $query..? Basically a database can contain many tables – typically things like Users, Customers, Products etc. You need to select all records from a specified table, not from the database. If you have many tables and you want to print all rows from each table you will need to execute lots of different queries and loop through each result set one at a time.

PS I have checked in one of my projects and the only difference I can see is that I have specified the connection in the mysql_query function.

For example use:
//Store the connection in an object called $conn.
$conn = mysql_connect($host, $username, $password) or die(“Unable to connect to SQL Server”); //(host, username, password)

//Now modify the query to specify the connection:
$results = mysql_query($query, $conn);

Hope this helps.

Edit: Just found someone else with the same problem – they were told the same thing about specifying the connection in mysql_query(). Http://www.phpfreaks.com/forums/index.php?topic=272971.0

Powered by Yahoo! Answers

Leave a Comment