hielo 65 Veteran Poster

...and dhe data will be automaticly inserted into the column info.author_id

NO - No "automatic" insertion will take place. YOU have to insert it in BOTH tables explicitly. With the design I gave you (if you enforce referential integrity), you may at any time provide an entry in Author and NOT enter it Info, BUT you may NEVER enter a value in Info UNLESS it first exists in Author. Thus, you must FIRST enter the value in Author and THEN you may enter it in Info.

question two:how can I get two or three reports

Considering that you asked a very vague question, here's the best answer I can furnish:
First You get report One
Then report Two
THEN report Three :)

Seriously, you need to be very explicit. You should be able to retrieve whatever data you need from the design above in a single query, BUT if you need to populate three different sections of a web page, you just need to do so from the result set. Meaning, you don't have to forcibly execute three separate queries.

To Select ALL the data:

SELECT a.firstName,a.lastName,p.name,p.country,b.title,b.year,b.quantity,b.type,i.*
FROM (((Author a 
	INNER JOIN Info i ON a.id=i.Author_id)
	INNER JOIN Book b ON b.id=i.Book_id)
	INNER JOIN Publisher p ON p.id=i.Publisher_id)

To select info about a specific Author (based on his/her id):

SELECT a.firstName,a.lastName,p.name,p.country,b.title,b.year,b.quantity,b.type,i.*
FROM (((Author a 
	INNER JOIN Info i ON a.id=i.Author_id)
	INNER JOIN Book b ON b.id=i.Book_id)
	INNER JOIN Publisher p ON p.id=i.Publisher_id)
WHERE a.id=3

Or …

hielo 65 Veteran Poster

look at the HTML of the link above. You will notice that the information you want is in a <TABLE> .

So, from the tool I referred you to, you need to use: $html->find('table', SOME_INDEX) Now, I ask you, starting from the top, is THAT table (the one that contains the information you want) the FIRST table in the document? The SECOND? etc.

Whatever your answer is you need to subtract one and replace SOME_INDEX with the number you get (after subtracting one).

The reason for that is that find() will return an array, so the first table will be at index 0, the second table at index 1, etc.

Once you have the right table print it's innertext:

echo $html->find('table', YOU_FIGURE_OUT_THE_NUMBER_THAT_GOES_HERE)->innertext;

From the markup, it seems that all the info you want is within <B> tags, so you can refine your search further:

$data = $html->find('table', YOU_FIGURE_OUT_THE_NUMBER_THAT_GOES_HERE)->find('b')->innertext;

//now use a foreach to see what is in $data
hielo 65 Veteran Poster

If I understand you correctly, this is what you currently have:

--------
   |Author|  1---------------+
   --------                  |
   id                        |
   name                      *
   second name            --------             --------
   year                   | Book | 1---------1 | Info |
                          --------             --------  
                             * id               id
                             | bookname         type
-----------                  | Author_id        year
|Publisher|  1---------------+ Publisher_id     author
-----------
id
publisher name
quantity
country

Now consider a book that has multiple authors!

Try this instead:

--------
   |Author|  1---------------+
   --------                  |
   id                        |
   firstName                 *
   lastName               --------              --------
                          | Info | *----------1 | Book |
                          --------              --------  
                             * Author_id         id
                             | Publisher_id      title
-----------                  | Book_id           year
|Publisher|  1---------------+                   quantity
-----------                                      type
id
name
country
hielo 65 Veteran Poster

Line 8 of your FIRST block of code should be: $password = [B]md5([/B] mysql_real_escape_string($password) [B])[/B];

hielo 65 Veteran Poster

On line 18 of your FIRST block of code you have: $_SESSION['sername'] = $username; I suspect you meant: $_SESSION['username'] = $username; On line 9 of your FIRST block of code You need to use the values stored in the VARIABLES $email and $password. You incorrectly have a literal string: $sql = mysql_query("SELECT * FROM usersystem WHERE username = '[B]username[/B]' AND password = '[B]password[/B]' LIMIT 1"); You need to prefix those with a dollar sign: $sql = mysql_query("SELECT * FROM usersystem WHERE username = '[B]$username[/B]' AND password = '[B]$password[/B]' LIMIT 1"); The sample problem exists on line 15 of your SECOND block of code.

Also, on line 17 of your SECOND block of code you have to apply the condition check AFTER you have called the function - WRONG: If (mysql_num_rows($sql>0[B])[/B]) CORRECT: If (mysql_num_rows($sql[B])[/B] >0 )

hielo 65 Veteran Poster

Dumping data for table `sec_tblusers`

Is the data shown on that dump already encrypted? If yes, what code did you use to encode it? It would help to see the definition of DataLayer and Password Classes to see what methods they have available and what they are actually doing.

hielo 65 Veteran Poster

I have an upload form where the uploaded picture is displayed.

Once you upload the picture, what code are you exactly executing? Are you:
a. emitting an <IMG> tag with the path to the newly uploaded image
b. redirecting to the newly uploaded image
c. Other???

If you are doing a or b, instead of pointing to image.gif, try pointing to image.gif?cb=XXX where X is some random number - You can use the time() function to guarantee that it will be different every time:

header( 'Location: http://www.example.com/image.gif?cb=' . time() );
hielo 65 Veteran Poster

Read the manual:
http://us.php.net/manual/en/mysqli.real-connect.php

The second example clearly shows you: parent::init()

hielo 65 Veteran Poster

my apologies. There's an error in the if clause. It should be: if( isset($_GET['action']) && $_GET['action']=='d' && isset($_GET['id']) && isset($_SESSION[B]['varukorg'][/B][ $_GET['id'] ]) )

hielo 65 Veteran Poster

Line 4 of my FIRST post above has: $rows=$html->find('div[id=yfi_quote_summary_data] table tr'); which states: "within <div id='yfi_quote_summary_data'> locate all TABLE elements and within that every TR".

So you need to look at the markup you are working with and decide/determine what portions of HTML you are interested in. Look at the examples posted at the simplehtmldom page.

hielo 65 Veteran Poster

newweb, whenever you post code, please use the CODE "button" on the editor.
The following should work. Be sure to COPY AND PASTE:

<?php
session_start();

$_SESSION["varukorg"][] = array(

	"artikel" => $_SESSION['art'],
	"produkt" => $_SESSION['product'],
	"antal" => $_SESSION['qte'],
	"pris" => $_SESSION['price'],
	"image_cart" => $_SESSION['image']
); 

if( isset($_GET['action']) && $_GET['action']=='d' && isset($_GET['id']) && isset($_SESSION[ $_GET['id'] ]) ) 
{
  unset($_SESSION['varukorg'][ $_GET['id'] ]);
}

foreach($_SESSION['varukorg'] as $index=>$cart)
{
	echo "<p>" . $cart['artikel'] . "</p>";
	echo "<p>" . $cart['produkt'] . "</p>";
	echo "<p>" . $cart['antal'] . "</p>";
	echo "<p>" . $cart['pris'] . "</p>";
	echo "<p><a href='#'><img src='/images/produkter/{$cart['image_cart']}' width='100' height='100'/></a></p>";
	echo sprintf("<p><a href='%s?id=%s&action=d'>delete</a></p>",$_SERVER['PHP_SELF'],$index);
}

?>
hielo 65 Veteran Poster

There correct syntax for the foreach that you posted originally should be:

foreach($_SESSION['varukorg'] as $index=>$cart)
{
echo "<p>" . $cart['artikel'] . "</p>";
echo "<p>" . $cart['produkt'] . "</p>";
echo "<p>" . $cart['antal'] . "</p>";
echo "<p>" . $cart['pris'] . "</p>";
echo "<p><a href='#'><img src='/images/produkter/{$cart['image_cart']}' width='100' height='100'/></a></p>";
echo sprintf("<p><a href='%s?id=%s&action=d'>delete</a></p>",$_SERVER['PHP_SELF'],$index);
}
hielo 65 Veteran Poster

I may still not unset the data from the Session arrays...

What does that mean? Have your resolved the problem? If not, on the page where you are setting/initializing the $_SESSION, you MUST call session_start() first (preferable at the very start or your file).

hielo 65 Veteran Poster

BTW: on my Nov 12th, 2010, 15:03 post I thought I got rid of siteList everywhere but I missed one: location.href = siteList.options[sIndex].value; should be: location.href = [B]this[/B].options[sIndex].value;

hielo 65 Veteran Poster

You can use:

echo $item["label"] . ": " . $item["value"] . "<br />" ;

OR:

echo "{$item['label']} :  {$item['value']} <br />" ;

(the {} forces the engine to evaluate a variable that is wrapped/embedded in a string.)

ko ko commented: Nice answered hielo. thz guy +2
hielo 65 Veteran Poster

In the future, please put you wrap your code in CODE tags (look for the word CODE wrapped in square brackets at the top of the editor).

My code looks like I am putting it on the allSelect

Exactly! It IS the SELECT list/element that ACTUALLY changes so it will trigger the onchange event.

... instead of each of the URL's within the lists

You probably meant "instead of each of the OPTION's", but the onchange does NOT go on the OPTION tags. Think about it. When you change from Google to Yahoo, the VALUE of the Google option REMAINS http://www.google.com. You simply selected a new item - Yahoo. So the SELECT now has a value that equals the value of the new selected/chosen item (namely http://yahoo.com).

hielo 65 Veteran Poster

That is the problem. Your index page already sent <body>.... by the time you call header() . So you cannot include your login in the middle of your index.php page. You need to do so right at the beginning:

try:

<?php
include'database_conn.php';//connect to the database
$form='';
if(isset($_COOKIE['ID_my_site']))//checks if there is a login cookie
{
		$username = $_COOKIE['ID_my_site'];//if there is a cookie it logs you in and directs you to the  page
		$pass = $_COOKIE['Key_my_site'];
		$check = mysql_query("SELECT * FROM users WHERE email = '$email'")or die(mysql_error());
		while($info = mysql_fetch_assoc( $check ))
		{
			if ($pass == $info['password'])
			{
				header("Location: account.php");
				exit;
			}
		}
}

if (isset($_POST['submit'])) {//runs if form has been submitted
	if(!isset($_POST['email']) || !isset($_POST['pass']) || empty($_POST['email']) || empty($_POST['pass']) ) {//makes sure the user has filled the form in
		die('You did not fill in a required field.');
	}
	if (!get_magic_quotes_gpc()) {
		$_POST['email'] = addslashes($_POST['email']);//checks the form against the database
	}
	$check = mysql_query("SELECT * FROM users WHERE email = '".$_POST['email']."'") or die(mysql_error());//gives error is user doesnt exsist
	$check2 = mysql_num_rows($check);
	if ($check2 == 0) {
		die('That user does not exist in our database. <a href="register.php">Click Here to Register</a>');
	}
	while($info = mysql_fetch_assoc( $check ))
	{
		$_POST['pass'] = stripslashes($_POST['pass']);
		$info['password'] = stripslashes($info['password']);
		$_POST['pass'] = md5($_POST['pass']);

		if ($_POST['pass'] != $info['password']) {//gives error if the password is wrong
			die('Incorrect password, please try again.');
		}
		else {
			$_POST['email'] = stripslashes($_POST['email']);//if login is ok we add a cookie
			$hour = time() + 3600;
			setcookie(ID_my_site, $_POST['email'], $hour);
			setcookie(Key_my_site, $_POST['pass'], $hour);
			header("Location: account.php");//else redirect them to  account area …
hielo 65 Veteran Poster

do you have a link to your page? IF not, paste your page's HTML source code.

hielo 65 Veteran Poster

The problem is that you were processing the images separately. One foreach for the thumbnails and one for the large images. You need to do both at once since you need two per record/row.

Based on your post, my guess is that in your HTML markup you have something SIMILAR to:

<div>Image 1:
Thumbnail:<input type="file" name="small_tn_[]">
Large Image:<input type="file" name="large_image_[]">
</div>
<div>Image 2:
Thumbnail:<input type="file" name="small_tn_[]">
Large Image:<input type="file" name="large_image_[]">
</div>

OR:

<div>Image 1:
Thumbnail:<input type="file" name="small_tn_[0]">
Large Image:<input type="file" name="large_image_[0]">
</div>
<div>Image 2:
Thumbnail:<input type="file" name="small_tn_[1]">
Large Image:<input type="file" name="large_image_[1]">
</div>

When you upload the images, then: $_FILES['small_tn_']['name'][0] will have the name of the first Thumbnail $_FILES['small_tn_']['name'][1] will have the name of the second Thumbnail $_FILES['large_image_']['name'][0] will have the name of the first Large Image $_FILES['large_image_']['name'][1] will have the name of the second Large Image

If you look closer, the thumbnails are "connected/related" to the large image via the index. The zero in the thumbnail corresponds to the zero in the large image.

Likewise, the one in the thumbnail corresponds with the one in the large image.

That's why you need to use the $key in the foreach. On every iteration it will increment (starting from zero).

Thus, using $key , on lines 8 and 9 of my post I can get the "related" images.

hielo 65 Veteran Poster

try:

<td><textarea name="text" id="text" rows="26" cols="61" ><?php echo preg_replace('#<br\s*/?>#i', "\n", html_entity_decode($edit_servicedesc2));?></textarea>&nbsp;</td>
hielo 65 Veteran Poster

try:

if( isset($_POST['btnSubmit']) )
{

	//.........

	foreach ( $_FILES['small_tn_']['name'] as $key=>$value1 )
	{
		$smallImage=$_FILES['small_tn_']['name'][$key];
		$largeImage=$_FILES['large_image_']['name'][$key];
		$sql_small_tn = sprintf("INSERT INTO `overlay`(`small_tn`,`large_img`) VALUES ('%s','%s')",$smallImage, $largeImage );  
		$db->query($sql_small_tn);
	}
}
hielo 65 Veteran Poster

try:

foreach($_SESSION['varukorg'] as $index=>$cart)
{
echo "<p>" . $cart['art'] . "</p>";
echo "<p>" . $cart['product'] . "</p>";
echo "<p>" . $cart['qte'] . "</p>";
echo "<p>" . $cart['price'] . "</p>";
echo "<p><a href=#><img src=\"/images/produkter/ $cart['image_cart'] \" width=100 height=100/></a></p>";
echo sprintf("<p><a href='%s?id=%s&action=d'>delete</a></p>",$_SERVER['PHP_SELF'],$index);
}

so when you click on the Delete button, it will send the id of the item to be deleted. So start your page with:

<?php
session_start();

if( isset($_GET['action']) && $_GET['action']=='d' && isset($_GET['id']) && isset($_SESSION[ $_GET['id'] ]) ) 
{
  unset($_SESSION[ $_GET['id'] ]);
}
hielo 65 Veteran Poster

In your init() function I don't see the need for allSelect.push(allSelect[i]); . If you have 10 select lists and only three have list of links all these three have class="optionLinks" then yes, I can see/understand why you have the if check/clause. However, the body of the if clause should simply attach the onchange event to the "current" (depending on the iteration) SELECT right away.

if (allselect[i].className == "optionLinks")
{
   allSelect[i].onchange = loadLink;
}

Having said that, here's what's wrong with what you have in init() :


a. the body of your if clause is NOT enclosed in braces. So only the first if statement if executed when the if condition is true. But the statement that follows allSelect[i].onchange = loadLink; will execute for ALL selects. If I am not mistaken, the purpose of the if (allselect[i].className == "optionLinks") statement was to pick and choose specific SELECT list to attach the onchange event to, but that is NOT what you are doing. You are attaching it to EVERY select list in your page. I suspect you had the intention of executing both statements within the if, but forgot to enclose them in braces. This type of mistake is easily avoided if you always put braces around the statements you intend to execute within an if - even it is a single statement.

b. Assuming allSelects currently has:

allSelects[0] ==> <SELECT class="optionLinks" id="Select1">...</SELECT>
allSelects[1] ==> <SELECT class="optionLinks" id="Select5">...</SELECT>
allSelects[2] ==> <SELECT class="optionLinks" id="Select12">...</SELECT>

(where "==>" means …

hielo 65 Veteran Poster

(my apologies for the double post - I'm having connectivity issues and didn't realize it posted the first time)

hielo 65 Veteran Poster

javascript is case sensitive. To clarify, var greeting="..."; is different from: var Greeting="..."; In your case you declared and initialized a variable named allSelect (with uppercase "S"), but in the for you are using ... < all[b]s[/b]elect.length (notice the lowercase "s"). The same problem exists in if (all[B]s[/B]elect[i].className

hielo 65 Veteran Poster

javascript is case sensitive. To clarify, var greeting="..."; is different from: var Greeting="..."; In your case you declared and initialized a variable named allSelect (with uppercase "S"), but in the for you are using ... < all[b]s[/b]elect.length (notice the lowercase "s"). The same problem exists in if (all[B]s[/B]elect[i].className

hielo 65 Veteran Poster

On line 20 you are using a single "|" to mean "or". You need TWO since you are not doing bitwise OR-ing. Furthermore, that line should be: if(!isset($_POST['email']) || empty($_POST['email']) || !isset($_POST['pass']) || empty($_POST['pass']) ) Also, change mysql_fetch_array() to mysql_fetch_assoc() Lastly, IMMEDIATELY after the header("Location: account.php"); put exit();

hielo 65 Veteran Poster

Apologies Airshow. Your post was not yet there when I opened the page.

Regards,
Hielo

hielo 65 Veteran Poster

You are currently have the following (on line 164):

<input type='hidden' name='unit_price_". $row['pid'] ."' />

The js function needs to compute: unit_price_X * qty_X (where X is whatever value is in $row['pid'] )
but you have NOT assigned a value! Since it is a hidden field, the user cannot enter anything either. You MUST assign it a value.

try:

<?php
session_start();
require_once ('../mysql_connect.php'); // Connect to the db.

$cid = mysql_real_escape_string($_POST['cid']);
$surname = mysql_real_escape_string($_POST['surname']);
$order = mysql_real_escape_string($_POST['order']);


/* Retrieve the cid and surname for that combination. */
$query = "SELECT * FROM customer WHERE cid='$cid' AND surname='$surname'";	

// Run the query.
$result = @mysql_query ($query); 

// Return a record, if applicable.
$row = mysql_fetch_array ($result, MYSQL_NUM); 



/* ============ ALL OK WITH LOGON ================ */
// A record was pulled from the database.
if ($row)
{ 

	// Set the session data & redirect.
	session_name ('YourVisitID');
	session_start();
	$_SESSION['cid'] = $row[0];
	$_SESSION['surname'] = $row[3];
	$_SESSION['agent'] = md5($_SERVER['HTTP_USER_AGENT']);

	/* ============= LOG DETAILS ============= */
	$title = $row[2];
	$surname = $row[3];
	$add1 = $row[4];
	$add2 = $row[5];
	$add3 = $row[6];
	$add4 = $row[7];
	$pc = $row[8];
	$round = $row[19];
	$email = $row[9];

	/* =============== CREATE JS =============== */
	$query  = "SELECT * FROM product";
	$result = mysql_query($query);

	$jsvar = "var ";
	$jsunit = "";
	$jsqty = "";
	$jstot = "";
	$jscalc = "document.box.tot.value = ";

	while($row = mysql_fetch_array($result, MYSQL_ASSOC))
	{
	   if ($row['sts'] ==1){

		$jsvar .= " unit_price_". $row['pid'] .", " . "qty_" . $row['pid'] . ",";
		$jsunit .= "unit_price_". $row['pid'] ."=document.box.unit_price_". …
hielo 65 Veteran Poster

Instead of: $(this).closest('form').submit() try: $('#login_form').submit() AND make sure that there is NO html element with name="submit" (nor id="submit" )

hielo 65 Veteran Poster

try:

$str=<<<STR
multipart/alternative; boundary="001636284f500b21f90494114b4d"
multipart/alternative; boundary='f01636284f500b;21f90494114b4f'
multipart/alternative; boundary="001636284f;500b21f90494114b4d"
foo; fa="001636284f5"\; fy="00b21f90494114b4d"
STR;
$str=preg_replace('#(\x22|\x27)([^;]*)(?<!\x5C)(;)(.*?)\1#','$1$2'.chr(7).chr(92).';$4$1',$str);
$m=preg_split('#(?<![\x5C]);#',$str);
foreach($m as $i=>$v)
{
	$m[$i]=str_replace(chr(7).chr(92).';',';',$v);
}
//this shows the result
print_r($m);
hielo 65 Veteran Poster

you may want to use preg_replace_callback() for this. For the sake of clarity, let's say you have the following TWO (separate/independent) input strings

a;b\";\"c;d';'ef\;g

a;b\";'\"c;d';'ef\;g

what results do you expect? Do you have a sample of an actual/realistic input string?

hielo 65 Veteran Poster

. It messed up my formatting

I forgot the closing table tag.

Do you think you can help with my other post I posted just before this one?

I really don't feel like deciphering someone else's code. I don't know what is in the js file but it should be difficult to achieve what you want if you make ajax requests.

hielo 65 Veteran Poster

assuming you have:

<form id="theForm"...>

on your SECOND block of code you posted, in line 6 - instead of: data: ...monstrosity of statements your currently have here... simply use: data: $('#theForm').serialize() The serialize() method should be able to determine accurately which of your radio buttons is actually checked. The problem you are having is that you are NOT limiting your selection to the checked item:

$("input[name='rbGender']:checked").val()
hielo 65 Veteran Poster

Problem now would be that without the ID field queried I can't call a single-record for edit by ID, right?

correct. If all you want is the field->name (as opposed to other field metadata), then the easiest approach would be to get a row of data and get name from that row. This is probably what you are after:

<?php
//This section gathers the field names
// and puts them in the first row of the table
$sql = "SELECT `ID`, `Code`, `Account Info`, `Ph#`, `User`, `PW`, `Web`, `Active` FROM `vendors` ORDER BY `Company/Name` ASC";
$query = mysql_query($sql) or die(mysql_error());

/*
lookup these functions in the PHP manual if you are not familiar with them:
	mysql_num_rows()
	mysql_fetch_assoc()
	implode()
	array_keys()
	array_slice()
*/
if( mysql_num_rows($query) > 0)
{
	$row=mysql_fetch_assoc($query);
	
	echo '<table>';
	echo '<tr><th>'.array_keys( array_slice($row,1) ).'</th></tr>';
	do{
		//save the value of id
		$id=$row['ID'];
		
		//"erase" ID from $row
		unset($row['ID']);
		
		//implode will "join" all the $row elements using '</td><td>' as the 'glue'
		echo '<tr><td>'.implode('</td><td>',$row).'</td><td><a href="?id='.$id.'">[Edit]</a></td></tr>';
	}while($row=mysql_fetch_assoc($query));
} 
else
{
	echo 'No Records found';
}
?>
Xtremefaith commented: Great help, patient enough to help me figure out a complicated issue +1
hielo 65 Veteran Poster

What if ID wasn't the first field in the table?

The order in which the field is defined in the TABLE does NOT matter. What matters is the order in which you list them when execute your query.

If you execute: SELECT `Code`, `Account Info`,`ID`... then ID will be the THIRD column in the result set (index=2), not the first column (index=0).

Why can't I say i=1 now (skipping 0)? I thought by calling the way I was it was doing in short what you did by calling all of them.

You can do that BUT that relies on the ID ALWAYS being defined first in your table. There's no way for me to know for a fact that ID is the first field in your table when all you have shown is SELECT * . However, if you had shown that you were executing SELECT ID,.... then I would have suggested $i=1

hielo 65 Veteran Poster

It looks like you are creating a RADIO AND a TEXT field with the SAME name every time. Give them different names. For example, try using this for line 15:

document.getElementById('segment_form').innerHTML += "<input type='text' name='txt_segment_type_"+j+"' size='10' onFocus='check_other()' />";
hielo 65 Veteran Poster

the easiest approach would be NOT to use SELECT * ... . Instead, mention explicitly which fields you want AND make sure the ones you want to hide appear first: SELECT ID, Code, Account Info, Ph#, User, PW, Web, Active That way if you wanted to "hide" bod ID and Code, then instead of for($i=0;...) you would use for($i=[B]2[/B];...) NOTE: if you do not want/need ID at all, then don't SELECT it. Simply list the columns/fields that you DO need/want.

hielo 65 Veteran Poster

OK, now I see the problem. The issue is that you are executing SELECT * but both tables have an id column. What you need to do is specify precisely which columns you want by prefixing the columns with the table (notice that I used "u" as the alias for the "users" table and "c" for the contacts table):

Assuming you are interested in users.id, try:

$sql='
SELECT c.fname, c.lname, u.id
FROM contacts c INNER JOIN users u ON u.id=c.user_id
 WHERE 
        u.username = "' . mysql_real_escape_string($_SESSION['username']) . '"';
hielo 65 Veteran Poster

and its being displayed from the user_id of the table rather than getting the result from the id of the table.

I don't understand what you mean. Post a sample of BOTH tables

hielo 65 Veteran Poster

what is NOT working on the code you posted? Are you NOT getting any results? Are you getting the ENTIRE table? Are you getting the WRONG id?

Have you tried to echo your sql statement to verify what sql command is actually being executed?

hielo 65 Veteran Poster

does this consider as correct output?

Yes, of course! It clearly shows you that $result IS an array with all the information you want. For example: echo $result[0]['label'] . ': '. $result[0]['value']; will give you the Last Trade information. If you want to see all the information, use a foreach:

foreach($result as $item)
{
  echo $item['label'] . ': '. $item['value'];
}
hielo 65 Veteran Poster

You are welcome!

Regards,
Hielo

PS: Don't forget to mark the thread as solved.

hielo 65 Veteran Poster

It should be:
http://finance.yahoo.com/q/ta?s=4707.KL+Basic+Tech.+Analysis&t=3m

Are you sure it is including the file? Change:

include("simple_html_dom.php");

to:

require_once("simple_html_dom.php");

If it throws an error then you may have the wrong path to the file.

hielo 65 Veteran Poster

download simple_html_dom.php:
http://simplehtmldom.sourceforge.net/

then try:

<?php
include("simple_html_dom.php");
$html=file_get_html("http://http://finance.yahoo.com/q/ta?s=4707.KL+Basic+Tech.+Analysis&t=3m");
$rows=$html->find('div[id=yfi_quote_summary_data] table tr');
$result=array();
foreach($rows as $row){
	preg_match('#([^:]+):(.+)#',strip_tags($row),$m);
	$result[]=array("label"=>$m[1],"value"=>$m[2]);
}
print_r($result);
?>
hielo 65 Veteran Poster

The problem is that when you provide an email, then the following IS executed:

else if ($_POST[email])
{
	$email = $_POST[email]; 
	if(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email))
	{ 
		$err = 'Email invalid because wrong number of characters!<br />';
	}
}

In other words, it goes INTO the email else if clause and thus skips all the remaining else if clauses. Try using this instead:

else if( !ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['email']) )
{
	$err = 'Email invalid because wrong number of characters!<br />';
}
hielo 65 Veteran Poster

I tried with a textarea and it worked fine for me:

<script type="text/javascript">
function setValue(field)
{
	if(''!=field.defaultValue)
	{
		if(field.value==field.defaultValue)
		{
			field.value='';
		}
		else if(''==field.value)
		{
			field.value=field.defaultValue;
		}
	}
}
</script>
<input type="text" value="Enter Title" onfocus="setValue(this)" onblur="setValue(this)"/>
<textarea  onfocus="setValue(this)" onblur="setValue(this)">hi</textarea>

Not sure if you have some other event handler attached to your textarea.

hielo 65 Veteran Poster

try:

$sql="select * from users where twitter_id IN (" . implode(',',$friends) . ") AND status=1";
$result=mysql_query($sql) or die( mysql_error() );

$total=mysql_num_rows( $result );
hielo 65 Veteran Poster

You can change the CSS of image opacity and border style, but you cannot change the image's background color using CSS

You can if you have the right type of image. What you need is to use images with TRASPARENT backgrounds.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>hielo</title>
		<style type="text/css">
		<!--
			img.editor{background-color:white;border:1px solid white;}
			img.editor:hover{background-color:yellow;border:1px solid blue;}
		-->
		</style>
	</head>
	<body>
		<img id="code" class="editor" src="http://www.daniweb.com/rxrvbimages/editor/bold.gif" alt="Bold">
		<img id="code" class="editor" src="http://www.daniweb.com/rxrvbimages/editor/createlink.gif" alt="">
	</body>
</html>
hielo 65 Veteran Poster

if you really want just the border and width try:

str.replace(/\[table((\s+(border|width)=(\d+)){0,2})\]/ig,'<table$1>')