hielo 65 Veteran Poster

What is your PHP INSERT query? Are you by any chance casting the value of type to an integer? Also, where is the javscript code that is actually sending the data to the server? The updateNewsFeed(...) doesn't seem to be doing anything with the encodedata and url variables.

hielo 65 Veteran Poster

And in terms of Finder menu options ... Not sure why they're missing for you

FYI - They are not missing for me. However the list of items under my "Favorite Forums" is not the same as what I had prior to the "upgrade." I wonder if I am seeing someone else's "Favorite Forums" list. I used to have four items -- Databases, Web Development, Software Development, and UI/UX Design, but after the migration I now see only three: Hardware and Software, Software Development, and Community Center. On another note, it would be nice if there was a way to customize that list.

hielo 65 Veteran Poster

You need ... LIMIT offset, rowCount -- ex:

SELECT blabla
FROM a INNER JOIN b ON a.a = b.b
ORDER BY a.id DESC LIMIT 50, 10

will give you at most 10 rows, starting with row 50.

hielo 65 Veteran Poster

The second parameter of function createChatBox(chatboxtitle,minimizeChatBox) should be chatName (not minimizeChatBox) since you are using chatName on line 19.

hielo 65 Veteran Poster

try:
SELECT * FROM forums AS F INNER JOIN users AS U ON F.lastAuthorID = U.id

To help you understand ... forums AS F simply makes F an alias for forums. Similarly, ... users as U makes U an alias for users. The AS keyword is optional, so it could have been written as
SELECT * FROM forums F INNER JOIN users U ON F.lastAuthorID = U.id and it still would have worked. You are not required to "alias" the table names, so you could have also written it as SELECT * FROM forums INNER JOIN users ON forums.lastAuthorID = users.id. Notice that the ON clause uses the actual table names since there are no prefixes.

hielo 65 Veteran Poster

However, i would also like to get the roleid returned

That implies that you don't know the initial roleid. So your function should not be accepting $roleid and shouldn't be part of the WHERE clause since you don't know what it is. Try:

function getUserRole($username)
{
    $roleid = false;
    $con=dbConnect();
    $query="select userrole.roleid from user 
                    inner join userrole on user.id = userrole.userid 
                    inner join role on role.id = userrole.roleid 
            where username = :username";
    $sql=$con->prepare($query);
    $sql->bindValue(':username',$username);
    $sql->execute();
    $sql->store_result();
    if($sql->num_rows>0)
    {
        $sql->bind_result($roleid);
        $sql->fetch();
    }
    $sql->free_result();
    $sql->close();
    $con->close();
return $roleid;
}
hielo 65 Veteran Poster

Is it possible to be able to have those printed out results turn into a textbox where you, as the user, can edit them?

That is what you need to on the server when you first generate the page. Intead of

echo "<td>". $row["FirstName"] . "</td>";

you need

echo "<td><input type='text' name='firstname' value='". htmlentities($row["FirstName"],ENT_QUOTES) . "'/></td>";

The same goes for the other fields that you wish to edit. Refer to http://php.net/manual/en/function.htmlentities.php if you are not familar with htmlentities().

hielo 65 Veteran Poster

I want to know if I can use the event listener to help trigger a php code that will make a query to update that specific user

Yes. Give all your update buttons a common class, and your delete buttons a common class (see sample code below). Then you bind an event listener for the update buttons, and one for the delete buttons. If you give your <tr> an id that references the EmployeeID (assuming that EmployeeID is unique on that query result), then you can determine which record to UPDATE/DELETE.

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"> </script>
<script>
$(document).ready(function()
{

        $('.update-button').on('click', function(){
                        // go to jquery's site and read about the closest() method
                        var tr = $(this).closest("tr");

                        // you will need to "collect" the data in the text fields
                        // since this is what the user has changed
                        var fields={};
                        $("input",tr).each(function(){
                            //here I am dynamically creating:
                            //  fields.firstname and assigning it its corresponding text field value
                            //  fields.lastname and assigning it its corresponding text field value
                            fields[$(this).attr("name")] = $(this).val();
                        });

                        fields.action_requested="update";

                        // if you open your page in chrome and do right-click > inspect > console
                        // you should see the contents of fields
                        if( typeof(console)!='undefined')
                        {
                            console.log( 'fields=',fields );
                        }

                        //send the data to process.php
                        $.ajax({ method: "POST",
                                  url: "process.php",
                                  data: fields
                                })
                               .done(function( msg ) {
                                    alert( "Data Saved: " + msg );
                                });
                });

        $('.delete-button').on('click', function(){
                        // go to jquery's site and read about the closest() method
                        var tr = $(this).closest("tr");
                        var fields={'action_requested':'delete'};
                        // …
hielo 65 Veteran Poster

If you noticed carefully, I used $(this).hide();. Within that function this refers to the element that triggered the action. So it only applies to the clicked button.

hielo 65 Veteran Poster

In HTML, an elements id attribute must be unique. Since you have <button id='button'>Update</button> within the while construct, all the buttons are getting the same id value. By contrast, your $('#button') works only on the first button because it was expecting to find only one to begin with! What you need to do is change id to class, and the # to .

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"> </script>
<script>
$(document).ready(function()
{
        $('.button').on('click', function()
                {
                        $(this).hide();
                });
});
</script>
</head>
<body>
<?php
        include_once("sqlConnect.php");
        $sql = "SELECT * FROM engineers ORDER BY LastName";
        $result = mysqli_query($conn, $sql);
        echo "<table style='width:85%'>";
        echo "<tr>";
        echo "<td>FirstName</td>";
        echo "<td>LastName</td>";
        echo "<td>Extension</td>";
        echo "<td>Office</td>";
        echo "<td>Mobile</td>";
        echo "<td>Email</td>";
        echo "<td>PersonalPhone</td>";
        echo "<td>TelephoneAgent</td>";
        echo "<td>UserID</td>";
        echo "<td>EmployeeID</td>";
        while($row = mysqli_fetch_assoc($result))
        {
                echo "<tr>";
                echo "<td>". $row["FirstName"]          . "</td>";
                echo "<td>". $row["LastName"]           . "</td>";
                echo "<td>". $row["Extension"]          . "</td>";
                echo "<td>". $row["Telephone"]          . "</td>";
                echo "<td>". $row["Mobile"]             . "</td>";
                echo "<td>". $row["Email"]              . "</td>";
                echo "<td>". $row["PersonalPhone"]      . "</td>";
                echo "<td>". $row["TelephoneAgent"]     . "</td>";
                echo "<td>". $row["UserID"]             . "</td>";
                echo "<td>". $row["EmployeeID"]         . "</td>";
                echo "<td><button type='button' class='button'>Update</button></td>";
                echo "</tr>";
        }
        echo "</table>";
?>
</body>
</html>
hielo 65 Veteran Poster

On line 20 of Page 2, you are expecting a "field/parameter" named "engineers" as a POST request, but on line 13 of Page 1, you are not passing an object -- you need to extract the value of #engineers and pass it onto to Page 2. The load() method will emit a POST request if you pass an object as a second argument OR a GET request if you pass a string. Since Page 2 uses $_POST, then on line 13 of Page 1 you need:

$('#display_info').load('sqlPage2.php', {'engineers': $('#engineers').val()}  );

For the sake of completeness, if you wanted to use $_GET on Page 2 instead, then you would need:

$('#display_info').load('sqlPage2.php', 'engineers='+ encodeURIComponent( $('#engineers').val() )  );

Lastly, on Page 2 you should be generating just the <table> markup, not the <html>,<head>,<body> tags. As a matter of fact,
Page 2 is sending code to "re-include" the jquery library. Your Page 1 already included jquery, and since you are using ajax, the browser does not refresh the page -- which means that you don't "loose" the jquery library when you send the request.

As for the <table> on Page 2, the first <form> tag should "hug" the <table>. The second <form> seems unnecessary. Since you are using ajax, the page actually loaded is Page 1, but your second form is targetting Page 2. The net effect is that the browser will navigate to Page 2. You should be really refreshing Page 1.

<?php
//Page 2
    $servername = 'localhost';
    $username = 'root'; …
hielo 65 Veteran Poster

The issue I'm facing now is that the update button won't work

I don't know what button you are referring to. You need to show your code.

hielo 65 Veteran Poster

With the new code you have, you just need this.value:

$(document).ready(function(){
    $('#engineers').on('change', function()
    {
        $('#display_info').load('sqlPage2.php?' + this.value );
    });

For the sake of completeness, with the old code, you needed to pass the value to loaddata() by adding this.data as a parameter:

echo "<select name='engineers' id='engineers' onchange='loaddata(this.value);'>";
hielo 65 Veteran Poster

Get rid of the $(document).ready(function(){...}); "wrapper". You need that only when you need to execute something as soon as the page has loaded. In your case, by the time the user selects something, the page is already loaded, so you just need to make the load() method call immediately.

function loaddata()
{
    $('#display_info').load('sqlPage2.php?engineers');
}
hielo 65 Veteran Poster

I find some of the OO aspects a bit confusing: It seems that an image is turned into an object simply to be able to process it from within an array, programatically.

If I am not mistaken, you are referring to lines 17- 23 on your original post. If so, all that it is doing is is pre-loading the images to ensure that the browser caches the images. That way when the rollover effect is triggered, instead of fetching the images from the server, the browser will use the cached images. If you don't cache the images, every time you swap the images, the browser will fetch the image from the server. If you are on a slow internet connection, you will experience a "flicker" effect while the image loads directly from the server.

On your original post I see:

<img src="/images/black_menu1.jpg" name="button1" width="185" height="30" border="0">

which indicates that black_menu1.jpg is the "initial" image that appears where the <img> tag is located. The question is, does it render properly upon initial page load? If so, then that implies that your site has a top-most folder named images, and hopefully all the images you are trying to preload are in that folder.

var path = '/images/';

should be:

var path = '/';
hielo 65 Veteran Poster

is_int(1) should return true since 1 is an int primitive. However, is_int("1") should return false because you are checking a string (that happens to have a numeric character, but is a string nevertheless).

A form's input (as in $_POST['id']) or url parameter (as in $_GET['id']) is always a string, even if it has a numeric value. What you need is is_numeric().

if ( array_key_exists('id',$_GET) && is_numeric($_GET['id']) ) {
    $id = intval( $_GET['id'] );
    echo is_int( $id );
}
hielo 65 Veteran Poster

Try changing include('../../../datalogin.php'); to require_once('../../../datalogin.php'); to make sure that the file is actually being included.

hielo 65 Veteran Poster

You are aware that this is the Java forum... ?

I am now. However, the regex I provided earlier still applies. Here's the java equivalent:

String EXAMPLE_TEST = "In our tests...1234 and another number 4568...done!";
Pattern pattern = Pattern.compile("^In our tests\\D+(\\d+)\\D+(\\d+)");
Matcher matches = pattern.matcher(EXAMPLE_TEST);
if( matches.find() )
{
    //matches.group(1) has the first number
    //matches.group(2) has the second number
    System.out.println( matches.group(1) + " " + matches.group(2) );
}
else
{
    System.out.println("No Match!");
}
hielo 65 Veteran Poster

Try:

$lines = file(getcwd().'/data.txt');
foreach( $lines as $line)
{
    if( preg_match('/^In our tests\D+(\d+)\D+(\d+)/',$line,$matches) )
    {
        print_r($matches);
    }
}

If there are any matches, then the variable $matches will contain the data you are after.

hielo 65 Veteran Poster

You can easily troubleshoot your problems provided you have the right tools:
A. Colorzilla extension for Firefox
Once this extension is installed, you can click on it to "activate" it for the page currently loaded on your browser. Then hover on the menu you are interested and once you are on the red sub menu, clicking it will cause colorzilla to "capture" that color. You can then retrieve the color name from the plugin and search for it in you source code (which could be inline css or a linked css file).

B. Web Developer Toolbar
Once installed you can click on CSS > View Style Information. After doing this, you can then mouse over the submenu of that you are interested in. You will then see a changing DOM "path" to the element that you are after (including IDs and CLASS names). If you know the ID and/or CLASS name of the elements you are interested in, then you can search for that ID and/or CLASS in your css.

C. Firebug Extension for Firefox
You can just right click on the sub-menu item that you are interested in and then choose "Inspect with Firebug". You should see some "sub-window" with a left and a right "pane" On the left pane you can click on the exact item you are after (ex: a span, div, etc) and on the left you will see the css for that item.

In case you are curious, …

hielo 65 Veteran Poster

Load the page in your browser. Then view the source code. Within the source code look for:
#D50512

That is the "red" color that you are seeing.

Q8iEnG commented: Thanks for the help! +3
hielo 65 Veteran Poster

try:

$result = mysql_query("SELECT * FROM comments") or die(mysql_error());
while( $row = mysql_fetch_assoc($result) )
{
  echo $row['alias'], ': ', $row['comment'], '<br />', PHP_EOL;
}
hielo 65 Veteran Poster

IF your /Style/ folder is directly under your DOCUMENT_ROOT - ex:
http://yoursite.com/Styles/ then instead of using ../Styles/ start the path reference with a slash - meaning, drop the dots. That way the search path will begin from DOCUMENT_ROOT: ... href="/Styles/styles.css"...

hielo 65 Veteran Poster

Check your file case. In other words, if your folder/file is named Style (uppercase "S"), make sure you are not using
< (...) href="../style/style.css"> (lowercase "S")

hielo 65 Veteran Poster

I re-coded the files for you. The version of login.php you have above is NOT the one I gave you. Use the three files I gave you (which have absolutely no use for check_user.php. Read the comments in my version of login.php to find out why you don't need check_user.php).

Additionally, the error on line 21 of my version of login.php is the foreach. It should be:
foreach($row as $k=>$v)

hielo 65 Veteran Poster

backup your files and then create new files with the code below (make sure you copy and paste). Also, in login.php, be sure to edit the db credentials as well as line 61 (provide email address for $webmaster );

<?php
//login.php
session_start();
$err='';
$file=strip_tags($_SERVER['PHP_SELF']);

if(isset($_POST['Submit']))
{
	mysql_connect('127.0.0.1','root','') or die(mysql_error());
	mysql_select_db('member') or die(mysql_error());

	$user = mysql_real_escape_string(stripslashes($_POST['user']));
	$pass = mysql_real_escape_string(stripslashes($_POST['pass']));

	$select = "SELECT * FROM `USERS` where `username`='".$_POST['user']."' AND `password`='".$_POST['password']."'";
	$msq = mysql_query($select) or die(mysql_error());
	$total=mysql_num_rows($msq);
	if(1==$total)
	{
		$row = mysql_fetch_assoc($msq);
		foreach($row as $k=$v)
		{
			$_SESSION[$k] = $v;
		}
		//there is no need to go to checkuser.php just to figure out the user level.
		//If you look at your query in checkuser, it is also doing 
		//	SELECT * FROM users WHERE username='XXX'
		//That means that if the correct username/password were entered, the query
		//above already got the user-level and is currently stored in $_SESSION['user_level']
		//Thus, instead of redirecting to:
		//	header("location: checkuser.php");
		//and re-querying the db on that other file, attemp to redirect the user
		//on this file (which is what the elseif-else is doing below
		if(isset($_SESSION['returnTo']) && !empty($_SESSION['returnTo']))
		{
			$temp=$_SESSION['returnTo'];
			$_SESSION['returnTo']=NULL;
			header('Location: '.$temp);
		}
		elseif(1==(int)$_SESSION['user_level'])
		{
			header('Location: Blog-admin-area.php');
		}
		else
		{
			header('Location: index.php');		
		}
		exit;
	}
	elseif(0==$total)
	{
		$err='<p>Incorrect username/password</p>';
	}
	else
	{
		$err='<p>We are currently experiencing technical difficulties.  Please try again later.</p>';

		$msg='Error encountered at '.$file.'.  Expected the query to yield zero or one row, but instead the query generated '.$total.' rows.'.PHP_EOL;
		$msg.='The submitted data is as follows:'.PHP_EOL.print_r($_POST,true);

		$webmaster='webmaster@yourdomain.com';
		$to=$webmaster;

		$subject='Error at Login Page';

		$headers='To: '.$to.PHP_EOL;
		$headers.='From: '.$webmaster.PHP_EOL;
		$headers.='Return-Path: …
hielo 65 Veteran Poster

but it outputs the message saying "You must be logged in. Click here to login!"..

change:
if(!isset($_SESSION['username']) || empty($_SESSION['username']))

to:
if(!isset($_POST['Submit']) && (!isset($_SESSION['username']) || empty($_SESSION['username'])))

hielo 65 Veteran Poster

On all three files you have:

...
$user = $_POST['username'];
$pass = $_POST['password'];
// validate the data
$user = stripslashes($user);
$pass = stripslashes($pass);

//WRONG: You cannot call mysql_real_escape_string() until AFTER you have connected to the DB
$user = mysql_real_escape_string($user);
$pass = mysql_real_escape_string($pass);
 
mysql_connect("127.0.0.1","root","");
mysql_select_db("member");

//WRONG: you cannot use $_SESSION on the query string. You need to use the values submitted
//which you have stored in $user and $password variables
$select = "SELECT * FROM USERS where username='".$_SESSION['$user']."' && password='".$_SESSION['$pass']."'";
$msq = mysql_query($select);
...

change those lines (on all three files) to:

...
$user = $_POST['username'];
$pass = $_POST['password'];

// validate the data
$user = stripslashes($user);
$pass = stripslashes($pass);
 
mysql_connect("127.0.0.1","root","") or die(mysql_error());
mysql_select_db("member") or die(mysql_error());

$user = mysql_real_escape_string($user);
$pass = mysql_real_escape_string($pass);

$select = "SELECT * FROM USERS where username='". $user ."' AND password='". $pass . "'";
$msq = mysql_query($select) or die(mysql_error());
...
hielo 65 Veteran Poster

try:

<?php
session_start();
error_reporting (E_ALL );


//connect to db
$connect = mysql_connect("*******","*****","*******") or die( mysql_error() );
mysql_select_db("******") or die( mysql_error() );



$get = mysql_query("SELECT * FROM `users` WHERE `username`='".$_SESSION['username']."'") or die(mysql_error());
while($row = mysql_fetch_array($get)) 
{
   $admin = $row['user_level'];
         if ($admin == 0)
         {
            header("Location: index.php");
            exit;
         }
        elseif ($admin == 1) 
        {
           header("Location: Blog-admin-area.php");
           exit;
        }
      else
      {
         echo "this is an invalid status";
         }
}
?>

On another note, are you using a <FORM> to post the username? If yes, then maybe you meant $_POST['username'] instead of $_SESSION['username']

hielo 65 Veteran Poster

There is no specification that formally states how to behave when forms are nested. Thus, different browser developers handle it differently. Some of them ignore the nested elements. Others use the inner-most form. The only way to achieve consistency is to get rid of the nested forms.

hielo 65 Veteran Poster

You are not allowed to nest HTML forms. To clarify, this is NOT allowed:

<form action="test1.php">
  ...
  <form action="test2.php">
    ...<input type="submit" value="Inner Submit" />
  </form>
  ...<input type="submit" value="Outer Submit" />
</form>

You have to get rid of the inner form(s). You can nest the entire table within a "master" form:

<form name="EditHome" method="post" enctype="multipart/form-data" action="SaveHome.php">
<input type="hidden" name="id" value="<?= $id ?>">

<table align="center" width="100%" border="0" bgcolor="f59422" cellspacing="0" cellpadding="0">


<tr>
<td valign="top" height="50">
    <table width="100%">
    <tr>
<td valign="top" height="50">
    <table width="100%" bgcolor="f8ab60">
    <tr>
    <td valign="top">
	    <table width="100%">
	    <tr>
		<td valign="top">
		<!-- <FORM> -->
<INPUT TYPE="button" VALUE="Return to Property Admin" onClick="parent.location='property_admin.php'">
<!-- </FORM> -->
</td>
<td valign="top">
		<!-- <FORM> -->
<INPUT TYPE="button" VALUE="Add a Picture" onClick="parent.location='AddPicture.php?home_id=<?= $id ?>'">
<!-- </FORM>  -->
</td>
<td valign="top">		
		<input type="submit" value="SAVE"  />
		
		</td>
		</tr>
		</table>
    </td>
    </tr>
    </table>
</td>
</tr>
</tr>

    </table>
</form>
manc1976 commented: Well Explained, Thanks +1
hielo 65 Veteran Poster

try changing:

<input type="button" value="SAVE" onclick="submit();" />

to:

<input type="submit" value="SAVE"  />
hielo 65 Veteran Poster

That error typically indicates that your query did NOT succeed. To find out what was any error, change $sql = mysql_query ("SELECT * FROM 'Product'"); to $sql = mysql_query ("SELECT * FROM 'Product'") or die(mysql_error());

On the code you posted, the query is wrong. It should be Product (using backticks NOT apostrophes). On a US keyboard, the backtick is on the same key as the tilde(~) character. Thus, the correct statement is:

$sql = mysql_query ("SELECT * FROM `Product`") or die(mysql_error());

Also, echo ($rows['Product']); should be echo ($row['Product']);, with no "s"

hielo 65 Veteran Poster

OK, then if you don't understand my post, change your code as follows:

print '<select name="day">';
for ($day = 1; $day <= 31; $day++) 
{
  if($datearray[2]!=$day)
    print "\n<option value=\"$day\">$day</option>";
  else
    print "\n<option value=\"$day\" selected=\"selected\">$day</option>";

}
print '</select>';
hielo 65 Veteran Poster

try:

<?php
$datearray=explode('-','1980-09-28');

$days=str_replace('>'.$datearray[2],' selected="selected">'.$datearray[2],preg_replace('#option>(\d+)#','option value="$1">$1','<option>'.implode('</option><option>',range(1,31)).'</option>'));
echo '<select name="day">'.$days.'</select>';
?>
hielo 65 Veteran Poster

Read comments in code:

Dim strSQL
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS   = Server.CreateObject("ADODB.Recordset")
objConn.ConnectionString = "Provider={SQL Server};Server=server;Database=db;User ID=id;Pwd=pw"

strSQL = "SELECT * FROM table"

'open connection first
objConn.open

'execute the sql on the Recordset object
objRS.Open strSQL, objConn, 1,3

If Not objRS.EOF Then
 'iterate through records here
Else
 'no records found
End If
objRS.close
Set objRS=Nothing
objConn.close
Set objConn=Nothing
hielo 65 Veteran Poster
...
<a href="http://{target}"><xsl:value-of select="name" /></a><br />
...
hielo 65 Veteran Poster

That is not working dude

You need to be more descriptive. Imagine calling your doctor and saying "I am not feeling well. Please write me a prescription"

The only thing that stands out from your original post is: text.innerHTML = "hide"; I don't see where you defined "text". Did you perhaps mean ele.innerHTML="hide";

hielo 65 Veteran Poster

toggle(this)

this IS the <a> tag so you do NOT need:
var ele = document.getElementById(int);

all you need is:

<script language="javascript">
//function toggle(int) {
//var ele = document.getElementById(int);
function toggle(ele){
  if(ele.style.display == "block") {
  ele.style.display = "inline";
}
else {
ele.style.display = "block";
text.innerHTML = "hide";
}
} 
</script>
hielo 65 Veteran Poster

Point the link to the XML file (not the XSL).
The top of the XML should look SIMILAR to the following (you need to provide the correct path to your file): <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="Catalog.xsl"?> Also, at the top of the XSL file make sure you declare the xsl namespace: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

hielo 65 Veteran Poster

<div style="padding-bottom:20px; font-size:small; padding-right:28px; ">Description:<?php echo '<div style="white-space:pre; width:200px;">' . htmlentities($row['description'],ENT_QUOTES) . '</div>';?></div>

hielo 65 Veteran Poster

since you seem to be passing very minimal data, try setting some cookies instead of passing the data via url. Then on the server retrieve the data from the cookies.

In "The Scripts" section of http://www.quirksmode.org/js/cookies.html you will find three very useful functions. Save them as cookies.js and import them into your page. Then use them to create a cookie for each of the data you want to "pass" to the server.

The drawback is of course that the user will require to have cookies enabled.

hielo 65 Veteran Poster

this will display me all the amount field from 26th date till 29th and if i want to add that all amount display how would i perform that..i would use sum function instead the while loop

if you want every record AND the sum, then initialize a $total=0; variable outside the while. Then within the while put $total+=$r['amount']; . After the while, $total should have the sum.

If all you want/need is the sum, then do a SUM query.

hielo 65 Veteran Poster

try:

content.value = content.value.substring(0,content.selectionStart) + url + content.value.substring(content.selectionEnd);
hielo 65 Veteran Poster

the table markup you are emitting is not correct. Also, there's no need to save it onto $new .
Try:

$sql=mysql_query("SELECT * FROM `expense` WHERE `date` BETWEEN '2011-04-26' AND '2011-04-29'");


echo '<center><table bordercolor="#000000" border="3" >';

while( $r=mysql_fetch_assoc($sql) )
{
	
  echo '<tr><td>' . implode(' ',$r) . '</td></tr>';

}

echo '</table></center>';
hielo 65 Veteran Poster

you need to iterate over the entire result set:

...
$sql=mysql_query("SELECT * FROM `expense` WHERE `date` BETWEEN '2011-04-26' AND '2011-04-28'")
 
 or die(mysql_error());

while( $r=mysql_fetch_assoc($sql) )
 echo implode(' ',$r).'<br/>';
}
hielo 65 Veteran Poster

why i am getting this array

Because that's what print_r() does.

can't i get it without array

echo/print them individually - ex: echo $r['rec_no'] . ' ' . $r['date'].'<br>'; Or for all of them (without Array): echo implode(' ', $r).'<br>';

hielo 65 Veteran Poster

assuming the field you inserted the data into is named info, then instead of something like: echo $row['info']; try: echo '<div style="white-space:pre">' . htmlentities($row['info'],ENT_QUOTES) . '</div>'; OR: echo '<pre>' . htmlentities($row['info'],ENT_QUOTES) . '</pre>';

hielo 65 Veteran Poster
$sql=mysql_query("SELECT * FROM `expense` WHERE `date` BETWEEN '2011-04-26' AND '2011-04-28'") or die(mysql_error());

$r=mysql_fetch_assoc($sql);

//SELECT * ... assuming that the * includes some field named `id`, then the following
//will print it's contents:
echo $r['id'];


//if you want to see everything at once, use:
print_r($r);
hielo 65 Veteran Poster

But if the item contains more than one word, or special characters, like a single quote, the delete does not work...

Most likely you have: <input type=checkbox value=White Bread > instead of: <input type=[B]"[/B]checkbox[B]"[/B] value=[B]"[/B]White Bread[B]"[/B] > You need to quote the values of the attributes - particularly, the VALUE attribute.