13 Replies - 1094 Views - Last Post: 09 November 2011 - 04:40 AM Rate Topic: -----

#1 Syfer  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 190
  • Joined: 08-October 10

it doesn't work on different computer...

Posted 08 November 2011 - 09:34 PM

I'm just wandering if what is the problem of this page which the computer doesn't run >_>
but it doesn't show any error.. so i can troubleshoot it.
<?php

$query = mysql_query("SELECT * from users_info where usergroup !='admin' ORDER BY userid ASC") or die (mysql_error());
$query1 = mysql_query("SELECT * from users_treatment_record ORDER BY user_id ASC") or die (mysql_error());
$row = mysql_fetch_array($query);
$row2 = mysql_fetch_array($query1);
$store='';

		for($x=1;$x<=mysql_num_rows($query1);$x++){
				if($x!=1){
						$store.="&&";
					}
				for($x1=1;$x1<=mysql_num_rows($query);$x1++){
					if(mysql_result($query1,$x-1,'user_id')==mysql_result($query,$x1-1,'userid')){				
					$store.= "rows['userid']==".mysql_result($query,$x1-1,'userid');
					$x1=mysql_num_rows($query);
					}					
				}	
		}
	$query3 = $store;
	while($rows=mysql_fetch_array($query)){
		if($query){
			$a=$rows["userid"];
					$b=$rows["first_name"];
					$c=$rows["last_name"];
		echo $rows["last_name"].", ".$rows["first_name"]." <a href=\"make_record.php?action=add&id=$a&firstname=$b&lastname=$c\">add</a><br/>";
		}else
		 echo "No results found";
		 
	}
		
if(isset($_POST["action"]) && $_POST["action"] == "add" && $_POST["id"] && $_POST["firstname"] && $_POST["lastname"]){
				$id=$_POST["id"];
				$f=$_POST["firstname"];
				$l=$_POST["lastname"];
			
				
			    echo "<div style=\"position:absolute;top:0;right:180;z-index:1;background-color:FFFFFF;border:1px solid black;\">";
				echo "Add<br/><br/>";		
				echo "<form method='post' action='make_record.php'>";
				echo "user id: <input type='text' disabled='disabled' name='aa' value='$id'><br/>";
				echo "<input type='hidden'  name='a' value='$id'><br/>";
				echo "firstname <input type=\"text\" disabled=\"disabled\" name=\"aa\" value=\"$f\"><br/>";
				echo "<input type=\"hidden\" name=\"a1\" value=\"$f\"><br/>";
				echo "lastname: <input type=\"text\" disabled=\"disabled\" name=\"aa\" value=\"$l\"><br/>";
				echo "<input type=\"hidden\"  name=\"a2\" value='$l'><br/>";
				echo "Date:<input type='text' onclick='scwShow(this,event);' name='b'><br/>";
				echo "tooth number: <input type='text'  name='c' onkeypress='return blockNonNumbers(this, event, false, false);'><br/>";
				echo "procedure: <input type='text'  name='d' ><br/>";
				echo "dentist: <input type='text'  name='e' ><br/>";
				echo "amount charged: <input type='text'  name='f' onkeypress='return blockNonNumbers(this, event, false, false);' ><br/>";
				echo "amount paid: <input type='text'  name='g' onkeypress='return blockNonNumbers(this, event, false, false);'><br/>";
				echo "balance: <input type='text'  name='h' onkeypress='return blockNonNumbers(this, event, false, false);'><br/>";			
				echo "<input type='submit' value='add' name='adder' />";
				echo "<a href='make_record.php'>back</a>";
				echo "</form>";
				echo "</div>";
				
				
				 
				}


	if(isset($_POST['adder'])){
		
		$id=mysql_real_escape_string($_POST['a']);
		$fname=mysql_real_escape_string($_POST['a1']);
		$lname=mysql_real_escape_string($_POST['a2']);
		$b=mysql_real_escape_string($_POST['b']);
		$c=mysql_real_escape_string($_POST['c']);
		$d=mysql_real_escape_string($_POST['d']);
		$e = mysql_real_escape_string($_POST['e']);
		$f=mysql_real_escape_string($_POST['f']);
		$g=mysql_real_escape_string($_POST['g']);
		$h=mysql_real_escape_string($_POST['h']);
		
		mysql_query("INSERT INTO users_treatment_record SET last_name='$lname',first_name='$fname',user_id='$id',`procedure` =  '$d',date='$b',dentist= '$e' , amount_charged= '$f' , tooth_num = '$c',amount_paid= '$g' , balance= '$h'")or die(mysql_error());
	    echo '<meta http-equiv="refresh" content="0;url=make_record.php">';
		exit;
		}		
	
?>



any help or advice/suggestion will be appreciated :)

Is This A Good Question/Topic? 0
  • +

Replies To: it doesn't work on different computer...

#2 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 926
  • View blog
  • Posts: 3,205
  • Joined: 19-January 10

Re: it doesn't work on different computer...

Posted 08 November 2011 - 09:39 PM

What do you mean it doesn't work on another computer? Like, the user is on a different computer or you moved the file to another server?
Was This Post Helpful? 1
  • +
  • -

#3 Syfer  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 190
  • Joined: 08-October 10

Re: it doesn't work on different computer...

Posted 08 November 2011 - 09:44 PM

View Postcreativecoding, on 08 November 2011 - 09:39 PM, said:

What do you mean it doesn't work on another computer? Like, the user is on a different computer or you moved the file to another server?



i copied my files to our school computer in its htdocs since im using xampp
and when i run that certain page it wont run or work but it doesn't show any errors so i can debug/troubleshoot it.
well the other pages of my site works well but that page that i posted doesn't work.
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is online

  • Admiral Fancy Pants
  • member icon

Reputation: 5345
  • View blog
  • Posts: 27,296
  • Joined: 10-May 07

Re: it doesn't work on different computer...

Posted 08 November 2011 - 09:44 PM

Assuming you mean that it just displays a white page, try validating your variables :

$row = mysql_fetch_array($query);
if(!$row) {
  die("<p>The following SQL failed : </p><p>$query</p>");
}
$row2 = mysql_fetch_array($query1);
if(!$row2) {
  die("<p>The following SQL failed : </p><p>$query1</p>");
}


Was This Post Helpful? 0
  • +
  • -

#5 Syfer  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 190
  • Joined: 08-October 10

Re: it doesn't work on different computer...

Posted 08 November 2011 - 09:48 PM

View Postno2pencil, on 08 November 2011 - 09:44 PM, said:

Assuming you mean that it just displays a white page, try validating your variables :

$row = mysql_fetch_array($query);
if(!$row) {
  die("<p>The following SQL failed : </p><p>$query</p>");
}
$row2 = mysql_fetch_array($query1);
if(!$row2) {
  die("<p>The following SQL failed : </p><p>$query1</p>");
}



tried this still a "whitepage.php"
Was This Post Helpful? 0
  • +
  • -

#6 no2pencil  Icon User is online

  • Admiral Fancy Pants
  • member icon

Reputation: 5345
  • View blog
  • Posts: 27,296
  • Joined: 10-May 07

Re: it doesn't work on different computer...

Posted 08 November 2011 - 09:54 PM

Try removing the die statements & adding some default output :

<?php
echo "<P>START HERE!</p>";

$query = mysql_query("SELECT * from users_info where usergroup !='admin' ORDER BY userid ASC");
$query1 = mysql_query("SELECT * from users_treatment_record ORDER BY user_id ASC");
$row = mysql_fetch_array($query);
if(!$row) {
  die("<p>The following SQL failed : </p><p>$query</p>");
}
$row2 = mysql_fetch_array($query1);
if(!$row2) {
  die("<p>The following SQL failed : </p><p>$query1</p>");
}

$store='';


Was This Post Helpful? 2
  • +
  • -

#7 Syfer  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 190
  • Joined: 08-October 10

Re: it doesn't work on different computer...

Posted 08 November 2011 - 10:01 PM

View Postno2pencil, on 08 November 2011 - 09:54 PM, said:

Try removing the die statements & adding some default output :

<?php
echo "<P>START HERE!</p>";

$query = mysql_query("SELECT * from users_info where usergroup !='admin' ORDER BY userid ASC");
$query1 = mysql_query("SELECT * from users_treatment_record ORDER BY user_id ASC");
$row = mysql_fetch_array($query);
if(!$row) {
  die("<p>The following SQL failed : </p><p>$query</p>");
}
$row2 = mysql_fetch_array($query1);
if(!$row2) {
  die("<p>The following SQL failed : </p><p>$query1</p>");
}

$store='';



still the same but the echo above pops up.
Was This Post Helpful? 0
  • +
  • -

#8 no2pencil  Icon User is online

  • Admiral Fancy Pants
  • member icon

Reputation: 5345
  • View blog
  • Posts: 27,296
  • Joined: 10-May 07

Re: it doesn't work on different computer...

Posted 08 November 2011 - 10:04 PM

Then it sounds like you need to connect to the database & select the table to use. Have you done that anywhere in your code previously?
Was This Post Helpful? 0
  • +
  • -

#9 Syfer  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 190
  • Joined: 08-October 10

Re: it doesn't work on different computer...

Posted 08 November 2011 - 10:07 PM

View Postno2pencil, on 08 November 2011 - 10:04 PM, said:

Then it sounds like you need to connect to the database & select the table to use. Have you done that anywhere in your code previously?


well , they all have the same connection type/style
include("connect.php");
Was This Post Helpful? 0
  • +
  • -

#10 no2pencil  Icon User is online

  • Admiral Fancy Pants
  • member icon

Reputation: 5345
  • View blog
  • Posts: 27,296
  • Joined: 10-May 07

Re: it doesn't work on different computer...

Posted 08 November 2011 - 10:15 PM

In connect.php do you set a connection id? Validate the id before proceeding.

Can you do manually what the code is doing? From the command prompt or from a phpmyadmin page?
Was This Post Helpful? 0
  • +
  • -

#11 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,250
  • Joined: 08-June 10

Re: it doesn't work on different computer...

Posted 08 November 2011 - 11:19 PM

View PostSyfer, on 09 November 2011 - 05:44 AM, said:

i copied my files to our school computer in its htdocs since im using xampp

does that school computer also have a copy of the database installed? (there is no use connecting to a non-existent database)
Was This Post Helpful? 1
  • +
  • -

#12 Syfer  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 190
  • Joined: 08-October 10

Re: it doesn't work on different computer...

Posted 09 November 2011 - 04:28 AM

View PostDormilich, on 08 November 2011 - 11:19 PM, said:

View PostSyfer, on 09 November 2011 - 05:44 AM, said:

i copied my files to our school computer in its htdocs since im using xampp

does that school computer also have a copy of the database installed? (there is no use connecting to a non-existent database)


i also imported the db in our school
and now i am at home its not working at all and it doesn't show any error just a white page.. o.O
well last time it works so smooth..
Was This Post Helpful? 0
  • +
  • -

#13 no2pencil  Icon User is online

  • Admiral Fancy Pants
  • member icon

Reputation: 5345
  • View blog
  • Posts: 27,296
  • Joined: 10-May 07

Re: it doesn't work on different computer...

Posted 09 November 2011 - 04:35 AM

How likely is it you got a garbage value in your database?

As I asked previously, are you able to duplicate the sql statements manually, either from the command line or from phpmyadmin?
Was This Post Helpful? 1
  • +
  • -

#14 Syfer  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 190
  • Joined: 08-October 10

Re: it doesn't work on different computer...

Posted 09 November 2011 - 04:40 AM

I already figured it out Thanks guys! XD its logically error on the user which is me , i totally forgot.. what it is for and i just remembered it >_< im really sorry for wasting your time guys thanks~!

This post has been edited by Syfer: 09 November 2011 - 05:12 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1