We've got some kind of groups at our site where group members could put messages. I want to notice the members of each group when there's new entries.
What's the best way to do this?
I try to request an array of IDs, to return each row with that ID, and push each into an Array $finalArray
But only the first result from the Query will output, and at the second foreach, it skips the while loop.
I have this working in another script, so I don't understand where it's going wrong.
The $arrayItems is an array containing: "home, info"
$finalArray = array();
foreach ($arrayItems as $UID_get)
{
$Query = "SELECT *
FROM items
WHERE (uid = '" . cleanQuery($UID_get) . "' )
ORDER BY uid";
if($Result = $mysqli->query($Query))
{
print_r($UID_get);
echo "<BR><-><BR>";
while ($Row = $Result->fetch_assoc())
{
array_push($finalArray , $Row);
print_r($finalArray );
echo "<BR><><BR>";
}
}
else
{
echo '{ "returned" : "FAIL" }'; //. mysqli_connect_errno() . ' ' . mysqli_connect_error() . "<BR>";
}
}
(the cleanQuery is to escape and stripslashes)
What I'm trying to get is an array of multiple rows (after i json_encoded it, like:
{"finalArray" : { "home": {"id":"1","created":"0000-00-00 00:00:00","css":"{ \"background-color\" : \"red\" }"} }, { "info": {"id":"2","created":"0000-00-00 00:00:00","css":"{ \"background-color\" : \"blue\" }"} } }
But that's after I get both, or more results from the db.
the print_r($UID_get); does print info, but then nothing..
So, why am I not getting the second row from info? I am essentially re-querying foreach $arrayItem right?
I am trying something like this:
result = db.GqlQuery("SELECT * FROM myDataMode COUNT(Employee) GROUP BY(Department) WHERE Salary > :1"10000)
And I am getting error :
BadQueryError: Parse Error: Expected no additional symbols at symbol count
Can any one please help me.
I have tried to connect my index.php file in 000webhost.com using jQuery.
From the site menu I have connected with 000webhost using FTP details available in 000webhost.com.
When I tried to read data from jQuery it doesn’t working.
Anyone please tell me what should I need to change? Should I need to connect my Dreamweaver database to webhost? If yes please explain?
This is what I have done.
index.php
$mysql_host = "mysql0.000webhost.com";
$mysql_database = "a000000_mydb";
$mysql_user = "a000000_root";
$mysql_password = "******";
$conn=@mysql_connect ( $mysql_host,$mysql_user,$mysql_password )or die('aa');
mysql_select_db($mysql_database,$conn) or die('eoor on db');
$quer=mysql_query("SELECT * FROM sam");
$res=array();
while($row=mysql_fetch_row($quer)) {
$res[]=$row;
}
print(json_encode($res));
return json_encode($res);
mysql_close();
index.html
$.get('public_html/index.php', function( data ) {
alert( 'Successful' +data);
});
I'm a beginner in jQuery area and I have simple question like this :
I want to load (AJAX) MySQL result in array, let's say :
$row[0] = first name
$row[1] = last name
$row[2] = phone number
I have no problem with PHP part, but I have difficulties to display each of that array content on different id. because syntax I found loads everything processed by PHP :
<script type="text/javascript">
$(document).ready(function(){
$('#mysql-result').load('ajax.php');
});
</script>
how to get 'First Name', 'Last Name' and 'Phone Number' from PHP with only one time load and still I can put the result in different . thank you.
Hi all,
I've a scenario where my java program has to continuously communicate with the database table, example my java program has to get the data of my table when new rows are added to it at runtime. There should be continuous communication between my program and database.
if the table has 10 rows initially and 2 rows are added by the user, it must detect this and return the rows.
My program shouldn't use AJAX and timers.
Please Help.
I realize that it's generally not a good idea to do this but the reason why I want to is because it's a really heavy page and I want to show the user progress of the download and when it's done load the page. I can either do this with some kind of spinner but is it possible for me to show the actual progress? Can I see how much and what data has been downloaded? Let's say I use jQuery for the AJAX-request how do I do this? If you have other suggestions please feel free to suggest.
here is my code
$sql="SELECT * FROM $tbl_name WHERE ownerId='$UserId'";
$result=mysql_query($sql,$link)or die(mysql_error());
$row = mysql_fetch_array($result, MYSQL_ASSOC);
<?php
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "<tr>";
echo "<td>".$row['pinId']."</td>";
echo "<td>".$row['usedby']."</td>";
echo "<td>".$row['status']."</td>";
echo "</tr>";
}
?>
it is ignoring the first record means if 4 rows are in $row its ignoring the 1st one rest three are coming on page. ownerId is not primary key.
Hello,
*EDIT*Thanks to the comments below it has been figured out that the problem lies with the md5, without everything works as it should.
But how do i implent the md5 then?
I am having some troubles with the following code below to login.
The database and register system are already working.
The problem lies that it does not find any result at all in the query.
IF the count is 0 it should redirect the user to a secured page.
But this only works if i write count = 0, but this should be 0 , only if the user name and password is found he should be directed to the secure (startpage) of the site after login.
For example root (username) root (password) already exists but i cannot seem to properly login with it.
<?php
session_start();
if (!empty($_POST["send"]))
{
$username = ($_POST["username"]);
$password = (md5($_POST["password"]));
$count = 0;
$con = mysql_connect("localhost" , "root", "");
mysql_select_db("testdb", $con);
$result = mysql_query("SELECT name, password FROM user WHERE name = '".$username."' AND password = '".$password."' ")
or die("Error select statement");
$count = mysql_num_rows($result);
if($count > 0) // always goes the to else, only works with >=0 but then the data is not found in the database, hence incorrect
{
$row = mysql_fetch_array($result);
$_SESSION["username"] = $row["name"];
header("Location: StartPage.php");
}
else
{
echo "Wrong login data, please try again";
}
mysql_close($con);
}
?>
I use a stateless session and the follow HQL.
CreateQuery("select a from Address a")
My Address Class has many BankDetails but i can't access. If i use a normal session it works. What can I do?
<?
$res = $database->userLatestStatus($u);
while($row=mysql_fetch_assoc($res)){
$status=$row['status'];
echo "$status";
}
?>
This is the code on my page, which is throwing up the following error:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource....
The database function:
function userLatestStatus($u)
{
$q = "SELECT status FROM ".TBL_STATUS." WHERE userid = '$u' DESC LIMIT 1";
return mysql_query($q, $this->connection);
}
Any ideas what the problem is?
Symfony 1.4 + Doctrine 1.2.
What is the best way to minimize the number of queries to retrieve products, subcategories of current category, product counts by subcategory and brand for the result set of the query below? Categories are a nested set.
Here is my query:
$q = Doctrine_Query::create()
->select('c.*, p.product,p.price, b.brand')
->from('Category c')
->leftJoin('c.Product p')
->leftJoin('p.Brand b')
->where ('c.root_id = ?', $this->category->getRootId())
->andWhere('c.lft >= ?', $this->category->getLft())
->andWhere('c.rgt <= ?', $this->category->getRgt())
->setHydrationMode(Doctrine_Core::HYDRATE_ARRAY);
$treeObject = Doctrine::getTable('Category')->getTree();
$treeObject->setBaseQuery($q);
$this->treeObject = $treeObject;
$treeObject->resetBaseQuery();
$this->products = $q->execute();
hi,
currently i have 2 table in mysql
structure:
messages
id | content | user_id | time
submessages
id | subcontent | msg_id | user_id | time
submessages msg_id is FK for messages id.
Now i need to query from php
$cur_user = $user->current; // current user id.
SELECT * FROM messages WHERE id > '{$_GET['id']}' // problem here
how do i query submessages that posted by others not include current user?
thank you.
Can any one please help me by giving a query or an idea which helps me?
I am looking for a query which returns the users and logins in a sql server 2008 r2 instance.
If some one has added/updated a user/permissions in next day- if we run a script it should revert all the changes to the previous day status.
Let me give you an example
On Wednesday the database security is fine
On Thursday someone goes into the SQL instance and changes several database user security settings. This creates lots of problems.
On Wednesday if we run a script on the SQL instance and it should reset the database user security back to what it was on Wednesday.
Someone please help me in this regard, Its very urgent..............Please..........
hi, i'm new to this so bear with me plz.
im attempting to set up git on my mac and need to be using my dev folder. however, there seems to be nothing in my folder ("zero KB on disk") with no sub directories listed. other hidden directories are intact. i've never really gone this deep into things before so i'm not sure how/why anything would previously have been deleted.
any help greatly appreciated.
I use the following entry in ~/.bashrc file to colorize the prompt and display current branch of git repository:
PS1='\[\e[1;32m\]\[\u@\h\]\[\e[m\] \[\w\]\[\e[1;1m\]\[$(__git_ps1 " (%s)")\] \[\e[1;1m\]\[$\] \[\e[m\]'
This works almost fine, except when I use bash history (up arrow key few times), the command line becomes 'outdented' (just the first characters of the prompt remains untouched), and the visible is:
usemmand
when my username is user and the command is command.
I am trying to install gitosis on my server but keep getting the error "Username contains not allowed characters"
sudo -H -u git gitosis-init < /tmp/id_rsa.pub
with the username "[email protected]".
Any fix for this?
I'm not sure if everyone experiences this - when I edit a BitBucket wiki locally (through a git repository) I have to enter my BitBucket password for every pull and push.
Is there any way around this?
I have ssh correctly configured to use a key that is unlocked by gnome-keyring. Pushing to the code repository for my project in BitBucket works fine - I do not need to enter either by BitBucket or ssh key password.
Does anyone know which of the big players (if any) support LDAP/AD users and groups for authentication AND database permissions? Specifically, I'm wondering if SVN, GIT, Mercurial etc. will allow users to login/connect based on AD permissions and also allow granular permissions to be applied to folders within the VC database based on groups within AD. So far my research has not shown this to be possible....
Say I wanted to setup a server, where I could create GIT repositories for users.
I would only give them access via SSH.
I would need to restrict them to say 100megs or 1 gig etc.
Is this a complicated setup or one of the more straight forward setups?
The terms DVCS and Git seem to be thrown around a lot. Are there any applications for this technology if I'm not a programmer, but just a regular "superuser"?
I installed msysgit on other Windows machines with no problems. On this Vista 64 bit Ultimate box, I installed the 3 most recent versions of msysgit. On all three installs, when I do a "git bash here", I get exactly this on the command window:
sh.exe": fork: Permission denied
sh.exe"-3.1$
NThe git command doesn't work. I get the same permission denied message. Any clues as to how to fix this?
I'm having a hard time enabling git colored output on windows when using console2.
To trick git I've already SET TERM = 'cygwin'. This enabled the colors from a standard cmd.exe prompt but not in console2. I've verified that console2 can see the env var as well.
Anyone know how to get this working?
I am newbie with git. It tried this tutorial, but after the command, i get this error:
[root@WL-0022150E7BD4 alma]$ git diff --cached
fatal: No HEAD commit to compare with (yet)
I created two file in the current directory. I dont undersitand, it is the first step in the tutorial.
This isn't the best programming question but lets face it, the server fault guys aren't well versed in git, so I think its more towards this audience.
Do I have to write a script to uninstall them?
How do I get them to go away, I want to switch to tortoise git, or portablegit in my shell, but I'm left with these annoying menu options.