ShawnCplus 456 Code Monkey Team Colleague

Your query might be failing

$result = mysql_query($sql);

Try

$result = mysql_query($sql);
if (!$result)
{
  echo mysql_error();
}
ShawnCplus 456 Code Monkey Team Colleague

Line 49

if ($_POST["$submit"])
// should be
if (isset($_POST['submit']))
ShawnCplus 456 Code Monkey Team Colleague

Well an HTML page is laid out like a tree.

/*
        HEAD
         |
        BODY
          \
           DIV  <-- SPAN's parent node
            \
            SPAN
            /  \
          A   IMG <-- SPAN's child nodes

Each point in the tree is called a Node. The Node directly above another in the tree is its parent (just like a family tree). Any node directly below another is a child

ShawnCplus 456 Code Monkey Team Colleague

You should still make your checks for length before this but this will check for numbers like 1111111 and 999999

var phone_number = "9999999";
if (!/^(\d)\1{6}$/.test(phone_number)) {
  alert('Good phone number');
} else {
  alert('Bad phone number');
}
ShawnCplus 456 Code Monkey Team Colleague

What language are you using the for backend? (PHP, ASP, whatever)

ShawnCplus 456 Code Monkey Team Colleague

A) Why is your ID field TEXT?
B)

SELECT MAX(CAST(id AS DECIMAL)) as id FROM object
iamthwee commented: sounds good to me. +24
ShawnCplus 456 Code Monkey Team Colleague

Nice
I'm puzzled though, why is that code using same id on multiple elements?

And I have another puzzle somebody could answer to me: whose responsibility is to mark threads as solved, :: the thread starter or admins? (!please, I really don't know the answer to this, just curious!)

The poster marks the thread solved though admins probably have the ability it's not really their job to do so.

ShawnCplus 456 Code Monkey Team Colleague

The server it is working on probably has notices turned off. You should have an if (isset($_POST['username'])) block around that anyway.

ShawnCplus 456 Code Monkey Team Colleague

You would setup a server-side script (using PHP or ASP or whatever your language is) that uses cURL or whatever your language uses to make and output the response. Then your AJAX call just points to your script.

RemoteServer
-------------------
somefile.php

MyServer
-----------------
myapifile.php
`- Make request to RemoteServer.com/somefile.php
`- Output response from the request

myawesomeajax.js
`- Make request to myapifile.php
ShawnCplus 456 Code Monkey Team Colleague

They do look good; however, I need one that's going to offer unlimited space and bandwidth.

I have found two I do like, is there anyway to do a test (maybe through ping) or something to check out the reliability of the server and make sure they have good load balancing?

heh, you can't exactly test load balancing with a ping and I can say without a doubt that if you DoS a hosting company to "test their load balancing" they'll be very quick to send a nicely formatted letterhead containing their lawyer's phone number.

ShawnCplus 456 Code Monkey Team Colleague

Show us your current code, we don't know you database schema or what to change if you don't

ShawnCplus 456 Code Monkey Team Colleague

It's syntactically correct and there's really no harm in it except for the fact that its a complete waste since the reason you have a function returning a value is because you want to use it. If you don't want to return a value then a function returns void.

#include <stdio.h>

int add(int x, int y)
{
  return x + y;
}

void print_add (int x, int y)
{
  printf("%d\n", add(x, y));
}

int main()
{
  add(5, 10); // does nothing
  print_add(5, 10); // outputs 15
  return 0;
}
ShawnCplus 456 Code Monkey Team Colleague

It isn't a Netbeans project but it is a JSP AJAX primer (found by searching AJAX JSP on google...) http://www.ics.uci.edu/~cs122b/projects/project5/AJAX-JSPExample.html

It should also be noted that while it is very important that you are familiar with your IDE it's just as important to not become absolutely dependent upon it.

ShawnCplus 456 Code Monkey Team Colleague

Don't be silly... you know very well that it could be done with Ajax.

Sure, it COULD be done with AJAX but there is absolutely no reason to. The term/acronym AJAX describes making a request to the server then receiving and parsing XML. There is absolutely, positively no reason to do something so complex for validation.

ShawnCplus 456 Code Monkey Team Colleague

The example you described isn't AJAX, that's just standard Javascript validation. AJAX would be, for example, as the user types display a list of possible selections underneath the box.

http://w3schools.com/ajax/ajax_intro.asp

ShawnCplus 456 Code Monkey Team Colleague

Explode on spaces and use ORs for the extra terms. http://php.net/explode

ShawnCplus 456 Code Monkey Team Colleague
<?php
// create short variable names
$searchtype=$_POST['searchtype'];
$searchterm=trim($_POST['searchterm']);
if (!$searchtype || !$searchterm) {
	echo 'You have not entered search details.';
	exit;
}
if (!get_magic_quotes_gpc()){
	$searchtype = addslashes($searchtype);
	$searchterm = addslashes($searchterm);
}
$db = new mysqli('localhost', 'username', 'password', 'database');
if (mysqli_connect_errno()) {
	echo 'Error: Could not connect to database. Please try again later.';
	exit;
}
$query = "select * from books where ".$searchtype." like '%".$searchterm."%'";
$result = $db->query($query);
$num_results = $result->num_rows;
if ($num_results) { // add this
	for ($i=0; $i <$num_results; $i++) {
		$row = $result->fetch_assoc();
		echo "<div class='mess'><strong>";
		echo htmlspecialchars(stripslashes($row['title']));
		echo "</br></strong><br /><strong>Found:</strong> </br></div>";
		echo stripslashes($row['author']);
	}
} else { // and this
	echo 'There were no results found.'; // stuff
} // here
$db->close();
?>
ShawnCplus 456 Code Monkey Team Colleague

You would use the function just like you would inside another function. With the example code afunction isn't defined (there is no prototype.) You could do something like this

void afunction(); // function prototype

class example {
    public:
    example();
    ~example();
    
    void doSomthing() {
        afunction();
    }

};

void afunction() {
    //do more things
}
ShawnCplus 456 Code Monkey Team Colleague

Then just get the absolute positions of both then subtract the item you want's position from the item that it's relative from.

Box1 : x 100, y 200
Box2 : x 234, y 123
Box2 Relative Box1: x 134, y -77
ShawnCplus 456 Code Monkey Team Colleague

Well you have an unclosed/broken tag here on line 62 that may be causing issues

<div <!--Div class added by Damion -->

Aside from that grab firebug(http://getfirebug.com) for firefox and toy around with the CSS until you get it where you want it then just copy into your file.

ShawnCplus 456 Code Monkey Team Colleague
require "dbconn.php";
$id=$_POST['id'];
$checkquery = "SELECT * FROM table WHERE id = '$id'";
$checkresults = mysql_query($checkquery);
var_dump($checkresults);
die();
$row = mysql_fetch_row ($checkresults);

Do that and post the output

ShawnCplus 456 Code Monkey Team Colleague

Take a look at the FAQ that is stickied, follow those instructions and then if it still doesn't work repost your code along with the new errors

ShawnCplus 456 Code Monkey Team Colleague

Is there some absolutely halting reason that the joomla stuff can't be hosted on the same server? It's not like its that hard to port a database and rsync code

ShawnCplus 456 Code Monkey Team Colleague

Don't try to mix creating your own json strings

$objJSON = array('sample' => null);
// whatever
$objJSON['sample'] = $arr;
$objJSON = json_encode($objJSON);
echo '<script type="text/javascript">var myJSON = ' . $objJSON . ';</script>
ShawnCplus 456 Code Monkey Team Colleague
'"string with"'

is invalid, '' are used for chars, "" are for strings.

"\"string with\""

is that string

ShawnCplus 456 Code Monkey Team Colleague
somestring = "this is a \"string with \" quotes";
ShawnCplus 456 Code Monkey Team Colleague

The problem is that get_browser returns an array, not an object. use $b['parent'] , not $b->parent

ShawnCplus 456 Code Monkey Team Colleague

I'm new to this technology. I'd be glad if somebody help me in starting this and guiding me where to start? and how to start? to learn this new technology.

A) Wrong forum, B) Google is your friend, along with php.net and pretty much any of the first million results from searching PHP in any search engine

ShawnCplus 456 Code Monkey Team Colleague

Your example should work the way you want it. There is no dimensioning of arrays in PHP, space is allocated as necessary.

ShawnCplus 456 Code Monkey Team Colleague

You use . to concatenate so echo ucwords($_SESSION['fname'] . ' ' . $_SESSION['lname']);

ShawnCplus 456 Code Monkey Team Colleague

You can't, the form fields must have separate names. If you have a bunch of Select1=blah in the URL only the last one will actually assign the value.

ShawnCplus 456 Code Monkey Team Colleague

well there's your answer:

document.getElementById("divCheckBoxList");

Isn't returning anything, it can't find that element. My first tip is to use Firefox and Firebug so you can actually see the error since Internet Explorer has pretty much every JS error as Object Expected because everything in JS is an object

ShawnCplus 456 Code Monkey Team Colleague

divRef probably doesn't exist, show the whole code not just one line.

ShawnCplus 456 Code Monkey Team Colleague

http://php.net/print_r]print_r[/url][/icode] will print an array and its contents like you see in

Array (
 [0] => this
 [1] => sentence
)

http://php.net/echo]echo[/url][/icode] simply echoes a string. It says "Array" because when an array is converted to a string that is the output.

ShawnCplus 456 Code Monkey Team Colleague

well i have indeed chosen the aliendb (database) . But the whole point is , by doing so its inserting the values by default in the first table (alien).
But i want to insert the data in the second table of the same DB , which is store. So how do i select the other table inside the DB ?

You aren't locked into tables, only the database. So once you select the database you can use SELECT/INSERT/UPDATE/etc. on any table in that database. You might want to read up on a few MySQL tutorials (take a look at w3schools) to see how to work on different tables.

ShawnCplus 456 Code Monkey Team Colleague

You can use mysql_select_db to change the database. And neither PHP or MySQL automatically select a table or a DB. As you can see in the query it's inserting into alien and in the mysql_connect function it's using the aliendb database

ShawnCplus 456 Code Monkey Team Colleague

Might want to show the code so we can point out what to change

ShawnCplus 456 Code Monkey Team Colleague

You're missing a bunch so you either have broken javascript or you didn't copy/paste directly. It should look like:

$('#css-style-def').click(function () {
    var newText = $('console-msgs').html();
});

$ is (in most cases) a jQuery function that finds an element based on the CSS selector passed so that particular code says: Find the element with the id css-style-definition, and when someone clicks on it set the variable newText equal to whatever the element with the id console-msgs contains.

ShawnCplus 456 Code Monkey Team Colleague

Hi..friend.. anybody help me, how to display motherboard serial with php script ? thanks... :)

You can't. PHP is a server-side language, it is not allowed to get anywhere near the end-user's hardware. Hell, it doesn't even touch the user's browser outside of knowing which browser it is.

ShawnCplus 456 Code Monkey Team Colleague

php is not a programming language it is a scripting language.

Scripting languages are programming languages.

ShawnCplus 456 Code Monkey Team Colleague

Doesn't quite work that way. There are hacks you can do but in general you'll want something along these lines

$var1 = 'yes';
$var2 = 'yes';
$var3 = 'no';
if ($var1 == 'yes' && $var2 == 'yes' && $var3 == 'yes') {
  // do something
} else {
  // do something else
}

The hacky way being

$var1 = 'yes';
$var2 = 'yes';
$var3 = 'no';
$vars = array($var1, $var2, $var3);
if ($vars === array_fill(0, count($vars), 'yes')) {
  // do something
} else {
  // do something else
}
ShawnCplus 456 Code Monkey Team Colleague

You do realize that the error says ze1 as in z - e - one, and yours says zel as in z - e - L

ShawnCplus 456 Code Monkey Team Colleague

D) There is any way to accomplish that? Any standard?

Can you give me a suggestion to improve search (line 67), I feel it is not powerful is just a simple query.

Optimally you want absolutely ZERO HTML in your PHP unless absolutely necessary (simple loops, conditions, etc.), having application logic (handling GET/POST, executing queries, working with files) in your "view" which is in your case HTML is bad practice whether you're using an MVC or not (I'll let you Google that).

There is a lot you could do to make it more accurate like implementing wildcards, using more than just %string% , etc. Look at the MySQL documentation for WHERE clauses and you'll get some ideas.

ShawnCplus 456 Code Monkey Team Colleague

As for B, no, it's not good to suppress error messages. If you don't want to display errors in a live environment then use the error_reporting 0 ini setting.

As for C, exactly, you got it from somewhere else, do you understand how it works and why it works?

And finally, for D: You just randomly have PHP and HTML mixed together in no particularly organized way. It makes it hard to follow, hard to maintain and just plain ugly.

ShawnCplus 456 Code Monkey Team Colleague

Use parenthesis for grouping just like math

SELECT * FROM sometable WHERE somefield = 1 AND (anotherfield = 1 OR anotherfield = 12)
ShawnCplus 456 Code Monkey Team Colleague

A) Stop using PHP4 or if you're using PHP5 STOP USING ereg
B) Stop using @, it's slow and its sole purpose is to hide errors (BAD)
C) Don't use/abuse regular expression before you understand them (Case in point "^[A-z0-9+. -]*[']?[A-z0-9+. -]*$" D) DON'T MIX LOGIC WITH HTML

ShawnCplus 456 Code Monkey Team Colleague

Try just returning false from the function. Also, in your onkeypress attribute you don't need "javascript:" it knows what you're trying to do if you just put typed(event);

ShawnCplus 456 Code Monkey Team Colleague

No, that means you're using PHP4 which is quite unfortunate.

if (!function_exists('scandir')) {
  function scandir($path, $sort = 0)
  {
    if (!$dir = opendir($path)) {
      return array();
    }
    $files = array();
    while (false !== ($file = readdir($dir))) {
      if ($file != '.' && $file != '..') {
        $files[] = $file;
      }
    }
    closedir($dir);
    return $files;
  }
}
ShawnCplus 456 Code Monkey Team Colleague
function count_dir($dirname)
{
  return count(array_slice(scandir($dir), 2));
}

$seasons = array('spring', 'summer', 'winter', 'fall');
$springcount = $summercount = $fallcount = $wintercount = 0;
foreach ($seasons as $season) {
  $seasoncnt = $season . 'count';
  $$seasoncnt = count_dir("images/" . $season);
}
// done

Whoops: For Reference Variable Variables, http://php.net/scandir, http://php.net/array_slice

ShawnCplus 456 Code Monkey Team Colleague

I already gave you an example for that: OPTIONALLY ENCLOSED BY "\"" LINES TERMINATED BY "\n" I would point you to the documentation but evidently there is a major power outage in Sweden right now and MySQL's servers are down (not joking)