Hi All,
I have a small excel program.
I would like to be able to use this program to update a SQL table.
What would be the function to say update line 2 in SQL table Test in Database ABC
Thanks
I have "tasks" table with 3 fields:
date
priority (0,1,2)
done (0,1)
What I am trying to achieve is with the whole table sorted by done flag, tasks that are not done should be sorted by priority, while tasks that are done should be sorted by date:
Select * from tasks order by done asc
If done=0 additionally order by priority desc
If done=1 additionally order by date desc
Is it possible to do this in MySQL without unions?
Thanks.
I have a table of values, with one of the columns being of type SET.
If it currently has the members ('a', 'b', 'c', 'd'), how do I add 'e' to the possible values?
I realize that using a SET type is a little strange, and I'm unclear why one would use it instead of a foreign key to another table with the values of the set, but I didn't design the database in question, and can't change it that much.
Thanks for your help!
Somewhat new to SQL queries and I need a little help with my join.
I am supplied with gid
For each of these I need to grab name from table wp_ngg_gallery
then join in table wp_ngg_pictures and grab field filename limit 1 order DESC by field imagedate
Anyone able to help?
I have a table with an 'expires' datetime column. I want to find all the items that have an 'expires' date earlier than now.
I've tried
session.query(Item).filter(Item.expires < now())
but it doesn't return anything regardless of the dates in the table.
I'm using PostgreSQL 8.4.
How do I do this comparison?
Hi everyone,i created an application that takes the excell output of a table.There are long numbers in table cell.When i took the output the cells that have long numbers are seen like that 1234+E34.how can i fix that?Thanks for advance...
hi in my database i am store more than 50 field with primarykey (Auto increment) i am not sure about the fields name but i wants to select the entire data in that table , i am using
SELECT * FROM tablename
i want to select all the fields except that ID but this query populate the entire table so is there is possible to unselect the particular field in the select query. Can anyone have an idea please guide me. Thanks in Advance
I have Two forms in my index.php and am trying to get them to submit and POST their data seperatly
Form 1
echo '<form action="process.php?type=news" method="post">';
echo '<table cellspacing="0"><tr><th>';
echo 'Add News to News Feed';
echo '</th></tr><tr><td>';
echo 'Title:<br /><input name="newstitle" type="text" id="add" style="height:16px;width:525px;" size="80" maxlength="186" /><br />';
echo 'Main Body Text:<br /><textarea name="newsfeed" id="add" style="width:525px;height:78px;" maxlength="2000" ></textarea>';
echo '<input style="float:right;margin-top:5px;" id="button" type="submit" value="Submit" />';
echo '</td></tr></table></from>';
And Form 2
echo '<form action="process.php?type=suggest" method="post">';
echo '<table cellspacing="0"><tr><th>';
echo 'Suggest Additions to the Intranet';
echo '</th></tr><tr><td>';
echo '<textarea name="suggest" id="add" style="width:330px;height:60px;" maxlength="800" ></textarea>';
echo '<input style="float:right;margin-top:5px;" id="button" type="submit" value="Submit" />';
echo '</td></tr></table></from>';
I want these both to post and do the action after pressing the submit button, but currently the second form submit to the first forms action
How can i fix this???
EDIT: Also i am using .PHP for both the index and process page then using it to echo the forms onto the page
Also here is the process.php data
$type=$_REQUEST['type'];
$suggest=$_POST['suggest'];
$newstitle=$_POST['newstitle'];
$news=mysql_real_escape_string($_POST['newsfeed']);
if ($type == "news")
{
$sql=mysql_query("SELECT * FROM newsfeed WHERE title = ('$newstitle')");
$number_of_rows = mysql_num_rows($sql);
if ($number_of_rows > 0)
{
echo 'This Title is Already Taken';
}
else
{
$sql="INSERT INTO newsfeed (title, news) VALUES ('$newstitle','$news')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
header('Location: index.php');
exit;
}
}
elseif ($type == "suggest")
{
$sql="INSERT INTO suggestions VALUES ('$suggest')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
header('Location: index.php');
exit;
}
I'm a beginner in php, and I am trying to create a login and logout. But I am having problems in logging out. My logout just calls for the login form which is this:
<?
session_start();
session_destroy();
?>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="checklogin.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>Member Login </strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="mypassword" type="text" id="mypassword"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
My problem is, when I try to press the back button in the browser. Whoever user is using it can still access what is not supposed to be accessed when a user hasn't logged in.
Do I need to add a code on the user page?
I have this code on the user page:
<?
session_start();
if(!session_is_registered(myusername)){
header("location:main_login.php");
}
?>
What can you recommend that I would do so that a script will prompt to enter the username and password again when a user clicks on the back button.
Is it possible to link one MDB to another in a standalone manner?
Ie. If I have the accounts table in db1.mdb and the products table in db2.mdb, can both these MDBs be coded so that they can link to each of the tables in a seamless manner?
Hello All,
I know its possible to create a table that has an index on the side and a search bar at the top that a user can type in to find an item, but is it possible to say to the table if array isEqual to "item1" push view1? I would like to push a different view with each cell. Anyone have any advice?
i am doing a jquery back end search of data from a DB table..until i fetch the data from the table...how do i show am image like every where its shown like searching or something like tht
Hey guys i'm using phpmyadmin (php & mysql) and i'm having alot of trouble linking the tables using foreign keys.
I'm getting negative values for the field countyId (which is the foriegn key). However it is linking to my other table fine and it's cascading fine.
So when I go to add data there will be a drop box for the CountyId and the vlaues will look something like this,
"
-1
1-
"
Here is my alter statement,
ALTER TABLE Baronies
ADD FOREIGN KEY (CountyId)
REFERENCES Counties (CountyId)
ON DELETE CASCADE
I'm working on a mock exam paper at the moment, however I have no set of correct answers and I'm not sure what the correct answer of this SQL query is.
Given a table:
foo, bar
a , 1
b , 3
a , 2
c , 1
and the query:
SELECT foo, sum(bar)
FROM table
GROUP BY foo
The two ways I can see this going are either:
a 3
a 3
b 3
c 1
or
a 3
b 3
c 1
Thanks.
Hello,
I've a system, that have two types of users (Companies and individuals).all types have a shared set of properties but they differ in another. What is the best design merge all in one table that allows null for unmatched properties, or separate them in two tables related to a basic table with a one to one relationship.
Thanks.
target: whenever the table in the database changes, the treeview will reload the new contents of the table.
Is there any good methods to solve this problem? thank u
I have the following query
SELECT *
FROM attend
RIGHT OUTER JOIN noattend ON attend.date = noattend.date2
WHERE attend.date
BETWEEN '2010-02-01'
AND '2010-04-01'
AND attend.customerid =1
ORDER BY date DESC
LIMIT 0 , 30
Attend is the table with customerid
noattend is the table with a row for each date (date2) I followed the advice in other questions to right outer join it to create values where there is no record in attend but it still isn't filling in the empties
any help much appreciated
When I do \footnote{} for a value in a table, the footnote doesn't show up. How do I get it to show up? Also, is it possible to get it to show up at the bottom of the table rather than the bottom of the page?
Basically i want to keep the transaction very simple but i should be able to rollback if any error in the later part.
Something like mentioned below,
BEGIN TRANSACTION
DELETE SET 1(this will delete first set of table)
COMMIT
DELETE SET 2 (will delete second set of table)
If any error occurs while deleting set 2 i should be able to rollback set 1 transaction as well.Let me know if we have any options to do like this. Appreciate for your help.
for a table valued function in sql why cant we write sql statements inside begin and end tags like-
create function dbo.emptable()
returns Table
as
BEGIN --it throws an error
return (select id, name, salary from employee)
END
go
while in scalar valued function we can use these tags like
create function dbo.countemp()
returns int
as
begin
return (select count(*) from employee)
end
go
is there any specific rule where we should use BEGIN & END tags
I have a table on my web page that is populated with data like this:
<tr data-ng-repeat="row in grid.data | filter:isQuestionInRange">
<td>{{ row.problemId }}</td>
</tr>
Is there a way that I can put a count of the rows displayed in the table footer. Note that I want to be able to show the rows after that have been filtered not just the row count from the grid.data array.
Hi folks,
In Oracle 10g, is there a way to do the following in PL/SQL?
for each table in database
for each row in table
for each column in row
if column is of type 'varchar2'
column = trim(column)
Thanks!
I've been looking into JOIN, subqueries and other ways of doing this, but I can't work out the best way to do this is...
I have a table (ps_category_product):
id_product, id_category
I want to perform a query on it like:
SELECT id_product FROM ps_category_product WHERE id_category='$this_cat'
BUT, I only want to perform this query where the ID's are returned by a query on another table (ps_product):
id_product, active
SELECT id_product FROM ps_product WHERE active='1'
Can anyone help me with getting these two queries working together?
I've a model called broadcastinfo, It has fields viz.. info,userid...userid is excluded. when i add an new info, my broadcastinfo table should get the records of all userid from user table and the given message. Im trying this via signal.Any idea is highly appreciated.
Thanks
Hi,
If I have a column, set as primary index, and set as INT.
If I don't set it as auto increment and just insert random integers which are unique into it, does that slow down future queries compared to autincrementing?
Does it speed things up if I run OPTIMIZE on a table with its primary and only index as INT? (assuming only 2 columns, and second column is just some INT value)
(the main worry is the upper limit on the autoincrement as theres lots of adds and deletes in my table)